mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core/tests: add loadFromCloud var to qPrefCloudStorage
Add special property loadFromCloud + mail to qPrefCloudStorage this variable is used by qmlmanager.cpp Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
5dd0981961
commit
b7a1bb670c
4 changed files with 28 additions and 1 deletions
|
@ -7,7 +7,6 @@ static const QString group = QStringLiteral("CloudStorage");
|
|||
qPrefCloudStorage::qPrefCloudStorage(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
qPrefCloudStorage *qPrefCloudStorage::instance()
|
||||
{
|
||||
static qPrefCloudStorage *self = new qPrefCloudStorage;
|
||||
|
@ -114,3 +113,12 @@ void qPrefCloudStorage::disk_userid(bool doSync)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool qPrefCloudStorage::loadFromCloud(const QString& email)
|
||||
{
|
||||
return qPrefPrivate::propValue(QString("loadFromCloud") + email, false).toBool();
|
||||
}
|
||||
void qPrefCloudStorage::set_loadFromCloud(const QString& email, bool done)
|
||||
{
|
||||
qPrefPrivate::propSetValue(QString("loadFromCloud") + email, done);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
static bool save_userid_local() { return prefs.save_userid_local; }
|
||||
static QString userid() { return prefs.userid; }
|
||||
|
||||
static bool loadFromCloud(const QString& email);
|
||||
|
||||
public slots:
|
||||
static void set_cloud_base_url(const QString &value);
|
||||
static void set_cloud_storage_email(const QString &value);
|
||||
|
@ -59,6 +61,8 @@ public slots:
|
|||
static void set_save_userid_local(bool value);
|
||||
static void set_userid(const QString &value);
|
||||
|
||||
static void set_loadFromCloud(const QString& email, bool done);
|
||||
|
||||
signals:
|
||||
void cloud_base_url_changed(const QString &value);
|
||||
void cloud_storage_email_changed(const QString &value);
|
||||
|
|
|
@ -266,4 +266,18 @@ void TestQPrefCloudStorage::test_oldPreferences()
|
|||
TEST(cloud->cloud_verification_status(), 1);
|
||||
}
|
||||
|
||||
void TestQPrefCloudStorage::test_loadFromCloud_var()
|
||||
{
|
||||
auto cloud = qPrefCloudStorage::instance();
|
||||
|
||||
cloud->set_loadFromCloud("mail1", true);
|
||||
cloud->set_loadFromCloud("mail2", false);
|
||||
cloud->set_loadFromCloud("mail3", true);
|
||||
|
||||
QCOMPARE(cloud->loadFromCloud("mail1"), true);
|
||||
QCOMPARE(cloud->loadFromCloud("mail2"), false);
|
||||
QCOMPARE(cloud->loadFromCloud("mail3"), true);
|
||||
QCOMPARE(cloud->loadFromCloud("mail_unknown"), false);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestQPrefCloudStorage)
|
||||
|
|
|
@ -15,6 +15,7 @@ private slots:
|
|||
void test_struct_disk();
|
||||
void test_multiple();
|
||||
void test_oldPreferences();
|
||||
void test_loadFromCloud_var();
|
||||
};
|
||||
|
||||
#endif // TESTQPREFCLOUDSTORAGE_H
|
||||
|
|
Loading…
Add table
Reference in a new issue