Skip to content

Commit

Permalink
Chore: Write test suite for SettingsHolder generated functions (#8819)
Browse files Browse the repository at this point in the history
  • Loading branch information
brizental authored Dec 18, 2023
1 parent 378afe9 commit 77e59e2
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 81 deletions.
8 changes: 3 additions & 5 deletions src/settingsholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
#include <QSettings>
#include <QStandardPaths>

#include "constants.h"
#include "cryptosettings.h"
#include "env.h"
#include "feature.h"
#include "leakdetector.h"
#include "logger.h"
#include "loghandler.h"
Expand Down Expand Up @@ -80,7 +78,7 @@ void SettingsHolder::clear() {
logger.debug() << "Clean up the settings";

#define SETTING(type, toType, getter, setter, remover, has, key, defvalue, \
userSettings, removeWhenReset, ...) \
removeWhenReset, ...) \
if (removeWhenReset) { \
m_settings.remove(key); \
emit getter##Changed(); \
Expand Down Expand Up @@ -117,7 +115,7 @@ void SettingsHolder::setRawSetting(const QString& key, const QVariant& value) {
#endif

#define SETTING(type, toType, getter, setter, remover, has, key, defvalue, \
userSettings, ...) \
...) \
bool SettingsHolder::has() const { return m_settings.contains(key); } \
type SettingsHolder::getter() const { \
if (!has()) { \
Expand Down Expand Up @@ -188,7 +186,7 @@ void SettingsHolder::serializeLogs(
QString buff;
QTextStream out(&buff);
#define SETTING(type, toType, getter, setter, remover, has, key, defvalue, \
userSettings, removeWhenReset, sensitive) \
removeWhenReset, sensitive) \
if (has()) { \
if (sensitive) { \
out << key << " -> <Sensitive>" << Qt::endl; \
Expand Down
2 changes: 2 additions & 0 deletions src/settingsholder.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <QSettings>
#include <QStringList>

#include "constants.h"
#include "feature.h"
#include "loghandler.h"

class SettingsHolder final : public QObject, public LogSerializer {
Expand Down
Loading

0 comments on commit 77e59e2

Please sign in to comment.