summaryrefslogtreecommitdiffstats
path: root/tests/testqPrefProxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testqPrefProxy.cpp')
-rw-r--r--tests/testqPrefProxy.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/testqPrefProxy.cpp b/tests/testqPrefProxy.cpp
index 4db48baf0..921565d2f 100644
--- a/tests/testqPrefProxy.cpp
+++ b/tests/testqPrefProxy.cpp
@@ -132,4 +132,43 @@ void TestQPrefProxy::test_multiple()
QCOMPARE(tst->proxy_type(), 25);
}
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ proxy->sync(); \
+ proxy->load(); \
+ QCOMPARE(METHOD, VALUE);
+
+void TestQPrefProxy::test_oldPreferences()
+{
+ auto proxy = qPrefProxy::instance();
+
+ proxy->set_proxy_type(2);
+ proxy->set_proxy_port(80);
+ proxy->set_proxy_auth(true);
+ proxy->set_proxy_host("localhost");
+ proxy->set_proxy_user("unknown");
+ proxy->set_proxy_pass("secret");
+
+ TEST(proxy->proxy_type(), 2);
+ TEST(proxy->proxy_port(), 80);
+ TEST(proxy->proxy_auth(), true);
+ TEST(proxy->proxy_host(), QStringLiteral("localhost"));
+ TEST(proxy->proxy_user(), QStringLiteral("unknown"));
+ TEST(proxy->proxy_pass(), QStringLiteral("secret"));
+
+ proxy->set_proxy_type(3);
+ proxy->set_proxy_port(8080);
+ proxy->set_proxy_auth(false);
+ proxy->set_proxy_host("127.0.0.1");
+ proxy->set_proxy_user("unknown_1");
+ proxy->set_proxy_pass("secret_1");
+
+ TEST(proxy->proxy_type(), 3);
+ TEST(proxy->proxy_port(), 8080);
+ TEST(proxy->proxy_auth(), false);
+ TEST(proxy->proxy_host(), QStringLiteral("127.0.0.1"));
+ TEST(proxy->proxy_user(), QStringLiteral("unknown_1"));
+ TEST(proxy->proxy_pass(), QStringLiteral("secret_1"));
+}
+
QTEST_MAIN(TestQPrefProxy)