summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-06-24 14:32:33 +0200
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-06-25 10:40:27 +0200
commit00f77bdc5beb62e980216cfee906ab7aa1d1c4f7 (patch)
tree26367f36a9e708c8092f14a152575da35e4bc64a
parentb74e437051deb629a9ec3887678db76727fd0729 (diff)
downloadqtwebsockets-00f77bdc5beb62e980216cfee906ab7aa1d1c4f7.tar.gz
Fix a typo in proxy handling.
Change-Id: I25c9b9be2c780dae32e3f634f58e44be303a4b23 Task-number: QTBUG-39568 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
-rw-r--r--src/websockets/qwebsocket_p.cpp2
-rw-r--r--tests/auto/qwebsocket/tst_qwebsocket.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 18962ff..1932aeb 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -1227,7 +1227,7 @@ QNetworkProxy QWebSocketPrivate::proxy() const
*/
void QWebSocketPrivate::setProxy(const QNetworkProxy &networkProxy)
{
- if (networkProxy != networkProxy)
+ if (m_configuration.m_proxy != networkProxy)
m_configuration.m_proxy = networkProxy;
}
#endif //QT_NO_NETWORKPROXY
diff --git a/tests/auto/qwebsocket/tst_qwebsocket.cpp b/tests/auto/qwebsocket/tst_qwebsocket.cpp
index 9e5997e..529efa3 100644
--- a/tests/auto/qwebsocket/tst_qwebsocket.cpp
+++ b/tests/auto/qwebsocket/tst_qwebsocket.cpp
@@ -147,6 +147,7 @@ private Q_SLOTS:
void tst_sendTextMessage();
void tst_sendBinaryMessage();
void tst_errorString();
+ void tst_setProxy();
};
tst_QWebSocket::tst_QWebSocket()
@@ -575,6 +576,23 @@ void tst_QWebSocket::tst_errorString()
QCOMPARE(socket.errorString(), QStringLiteral("Host not found"));
}
+void tst_QWebSocket::tst_setProxy()
+{
+ // check if property assignment works as expected.
+ QWebSocket socket;
+ QCOMPARE(socket.proxy(), QNetworkProxy(QNetworkProxy::DefaultProxy));
+
+ QNetworkProxy proxy;
+ proxy.setPort(123);
+ socket.setProxy(proxy);
+ QCOMPARE(socket.proxy(), proxy);
+
+ proxy.setPort(321);
+ QCOMPARE(socket.proxy().port(), quint16(123));
+ socket.setProxy(proxy);
+ QCOMPARE(socket.proxy(), proxy);
+}
+
QTEST_MAIN(tst_QWebSocket)
#include "tst_qwebsocket.moc"