diff options
Diffstat (limited to 'tests/testqPrefCloudStorage.cpp')
-rw-r--r-- | tests/testqPrefCloudStorage.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/testqPrefCloudStorage.cpp b/tests/testqPrefCloudStorage.cpp index 3a20babea..84beda8db 100644 --- a/tests/testqPrefCloudStorage.cpp +++ b/tests/testqPrefCloudStorage.cpp @@ -6,6 +6,7 @@ #include "core/settings/qPrefCloudStorage.h" #include <QTest> +#include <QSignalSpy> void TestQPrefCloudStorage::initTestCase() { @@ -199,4 +200,51 @@ void TestQPrefCloudStorage::test_oldPreferences() TEST(cloud->cloud_verification_status(), 1); } +void TestQPrefCloudStorage::test_signals() +{ + QSignalSpy spy1(qPrefCloudStorage::instance(), SIGNAL(cloud_base_urlChanged(QString))); + QSignalSpy spy2(qPrefCloudStorage::instance(), SIGNAL(cloud_storage_emailChanged(QString))); + QSignalSpy spy3(qPrefCloudStorage::instance(), SIGNAL(cloud_storage_email_encodedChanged(QString))); + QSignalSpy spy4(qPrefCloudStorage::instance(), SIGNAL(cloud_storage_passwordChanged(QString))); + QSignalSpy spy5(qPrefCloudStorage::instance(), SIGNAL(cloud_storage_pinChanged(QString))); + QSignalSpy spy6(qPrefCloudStorage::instance(), SIGNAL(cloud_timeoutChanged(int))); + QSignalSpy spy7(qPrefCloudStorage::instance(), SIGNAL(cloud_verification_statusChanged(int))); + QSignalSpy spy9(qPrefCloudStorage::instance(), SIGNAL(save_password_localChanged(bool))); + QSignalSpy spy10(qPrefCloudStorage::instance(), SIGNAL(save_userid_localChanged(bool))); + QSignalSpy spy11(qPrefCloudStorage::instance(), SIGNAL(useridChanged(QString))); + + qPrefCloudStorage::set_cloud_base_url("signal url"); + qPrefCloudStorage::set_cloud_storage_email("signal myEmail"); + qPrefCloudStorage::set_cloud_storage_email_encoded("signal encodedMyEMail"); + qPrefCloudStorage::set_cloud_storage_password("signal more secret"); + qPrefCloudStorage::set_cloud_storage_pin("signal a pin"); + qPrefCloudStorage::set_cloud_timeout(11); + qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED); + qPrefCloudStorage::set_save_password_local(true); + qPrefCloudStorage::set_save_userid_local(true); + qPrefCloudStorage::set_userid("signal my user"); + + QCOMPARE(spy1.count(), 1); + QCOMPARE(spy2.count(), 1); + QCOMPARE(spy3.count(), 1); + QCOMPARE(spy4.count(), 1); + QCOMPARE(spy5.count(), 1); + QCOMPARE(spy6.count(), 1); + QCOMPARE(spy7.count(), 1); + QCOMPARE(spy9.count(), 1); + QCOMPARE(spy10.count(), 1); + QCOMPARE(spy11.count(), 1); + + QVERIFY(spy1.takeFirst().at(0).toString() == "signal url"); + QVERIFY(spy2.takeFirst().at(0).toString() == "signal myEmail"); + QVERIFY(spy3.takeFirst().at(0).toString() == "signal encodedMyEMail"); + QVERIFY(spy4.takeFirst().at(0).toString() == "signal more secret"); + QVERIFY(spy5.takeFirst().at(0).toString() == "signal a pin"); + QVERIFY(spy6.takeFirst().at(0).toInt() == 11); + QVERIFY(spy7.takeFirst().at(0).toInt() == qPrefCloudStorage::CS_VERIFIED); + QVERIFY(spy9.takeFirst().at(0).toBool() == true); + QVERIFY(spy10.takeFirst().at(0).toBool() == true); + QVERIFY(spy11.takeFirst().at(0).toString() == "signal my user"); +} + QTEST_MAIN(TestQPrefCloudStorage) |