aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testqPrefProxy.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/testqPrefProxy.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/testqPrefProxy.cpp')
-rw-r--r--tests/testqPrefProxy.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/testqPrefProxy.cpp b/tests/testqPrefProxy.cpp
index 089fb5a41..ed8c3a0ed 100644
--- a/tests/testqPrefProxy.cpp
+++ b/tests/testqPrefProxy.cpp
@@ -6,6 +6,7 @@
#include "core/settings/qPrefProxy.h"
#include <QTest>
+#include <QSignalSpy>
void TestQPrefProxy::initTestCase()
{
@@ -171,4 +172,37 @@ void TestQPrefProxy::test_oldPreferences()
TEST(proxy->proxy_pass(), QStringLiteral("secret_1"));
}
+void TestQPrefProxy::test_signals()
+{
+ QSignalSpy spy1(qPrefProxy::instance(), SIGNAL(proxy_authChanged(bool)));
+ QSignalSpy spy2(qPrefProxy::instance(), SIGNAL(proxy_hostChanged(QString)));
+ QSignalSpy spy3(qPrefProxy::instance(), SIGNAL(proxy_passChanged(QString)));
+ QSignalSpy spy4(qPrefProxy::instance(), SIGNAL(proxy_portChanged(int)));
+ QSignalSpy spy5(qPrefProxy::instance(), SIGNAL(proxy_typeChanged(int)));
+ QSignalSpy spy6(qPrefProxy::instance(), SIGNAL(proxy_userChanged(QString)));
+
+ prefs.proxy_auth = true;
+ qPrefProxy::set_proxy_auth(false);
+ qPrefProxy::set_proxy_host("signal t2 host");
+ qPrefProxy::set_proxy_pass("signal t2 pass");
+ qPrefProxy::set_proxy_port(2524);
+ qPrefProxy::set_proxy_type(22);
+ qPrefProxy::set_proxy_user("signal 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);
+
+ QVERIFY(spy1.takeFirst().at(0).toBool() == false);
+ QVERIFY(spy2.takeFirst().at(0).toString() == "signal t2 host");
+ QVERIFY(spy3.takeFirst().at(0).toString() == "signal t2 pass");
+ QVERIFY(spy4.takeFirst().at(0).toInt() == 2524);
+ QVERIFY(spy5.takeFirst().at(0).toInt() == 22);
+ QVERIFY(spy6.takeFirst().at(0).toString() == "signal user");
+}
+
+
QTEST_MAIN(TestQPrefProxy)