summaryrefslogtreecommitdiffstats
path: root/tests/testqPrefFacebook.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-28 12:33:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-11 17:25:00 -0700
commitc01d9f60c14ec9ee58892504e9f5c346dbb24e7e (patch)
tree10edfbe1f86c3d9097ca8206b44b42f6ed60e060 /tests/testqPrefFacebook.cpp
parent93ba8c583a4b38d34811f5592160ece31ddd7ea8 (diff)
downloadsubsurface-c01d9f60c14ec9ee58892504e9f5c346dbb24e7e.tar.gz
tests: add signal test to call testqPref*cpp
Add signal testing of all variables this commit contains all qPref* that work directly followup commit will do changes to qPref* to make signals work Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests/testqPrefFacebook.cpp')
-rw-r--r--tests/testqPrefFacebook.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/testqPrefFacebook.cpp b/tests/testqPrefFacebook.cpp
index ebb2e4f02..59063b7a3 100644
--- a/tests/testqPrefFacebook.cpp
+++ b/tests/testqPrefFacebook.cpp
@@ -6,6 +6,7 @@
#include "core/qthelper.h"
#include <QTest>
+#include <QSignalSpy>
void TestQPrefFacebook::initTestCase()
{
@@ -86,4 +87,23 @@ void TestQPrefFacebook::test_oldPreferences()
TEST(fb->album_id(), QStringLiteral("album-id-2"));
}
+void TestQPrefFacebook::test_signals()
+{
+ QSignalSpy spy1(qPrefFacebook::instance(), SIGNAL(access_tokenChanged(QString)));
+ QSignalSpy spy2(qPrefFacebook::instance(), SIGNAL(album_idChanged(QString)));
+ QSignalSpy spy3(qPrefFacebook::instance(), SIGNAL(user_idChanged(QString)));
+
+ qPrefFacebook::set_access_token("t_signal token");
+ qPrefFacebook::set_album_id("t_signal album");
+ qPrefFacebook::set_user_id("t_signal user");
+
+ QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy3.count(), 1);
+ QVERIFY(spy1.takeFirst().at(0).toString() == "t_signal token");
+ QVERIFY(spy2.takeFirst().at(0).toString() == "t_signal album");
+ QVERIFY(spy3.takeFirst().at(0).toString() == "t_signal user");
+}
+
+
QTEST_MAIN(TestQPrefFacebook)