summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp')
-rw-r--r--tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
index 31a5391..0760ce8 100644
--- a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
+++ b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp
@@ -59,6 +59,7 @@ public:
private slots:
void getSetCheck();
+ void capabilitiesPerType();
};
tst_QNetworkProxy::tst_QNetworkProxy()
@@ -79,6 +80,38 @@ void tst_QNetworkProxy::getSetCheck()
QCOMPARE(quint16(0), obj1.port());
obj1.setPort(quint16(0xffff));
QCOMPARE(quint16(0xffff), obj1.port());
+
+ obj1.setType(QNetworkProxy::DefaultProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy);
+ obj1.setType(QNetworkProxy::HttpProxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy);
+ obj1.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QNetworkProxy::capabilitiesPerType()
+{
+ QNetworkProxy proxy(QNetworkProxy::Socks5Proxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::NoProxy);
+ // verify that the capabilities changed
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability));
+ QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
+
+ proxy.setType(QNetworkProxy::HttpProxy);
+ QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
+ QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability));
+
+ // now set the capabilities on stone:
+ proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
+
+ // changing the type shouldn't change the capabilities any more
+ proxy.setType(QNetworkProxy::Socks5Proxy);
+ QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
}
QTEST_MAIN(tst_QNetworkProxy)