diff options
-rw-r--r-- | examples/webkit/domtraversal/domtraversal.pro | 2 | ||||
-rw-r--r-- | src/gui/kernel/qmacgesturerecognizer_mac.mm | 2 | ||||
-rw-r--r-- | tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 43 |
3 files changed, 45 insertions, 2 deletions
diff --git a/examples/webkit/domtraversal/domtraversal.pro b/examples/webkit/domtraversal/domtraversal.pro index dda63ba..49400de 100644 --- a/examples/webkit/domtraversal/domtraversal.pro +++ b/examples/webkit/domtraversal/domtraversal.pro @@ -1,4 +1,4 @@ -QT += webkit +QT += webkit network FORMS = window.ui HEADERS = window.h SOURCES = main.cpp \ diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index f142d71..3e0ba23 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e case QNativeGestureEvent::Swipe: { QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture); g->setSwipeAngle(ev->angle); - return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; break; } default: break; diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 5577903..4ed9fca 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -192,6 +192,8 @@ private slots: void connectToMultiIP(); void moveToThread0(); void increaseReadBufferSize(); + void taskQtBug5799ConnectionErrorWaitForConnected(); + void taskQtBug5799ConnectionErrorEventLoop(); #ifdef TEST_QNETWORK_PROXY void invalidProxy_data(); void invalidProxy(); @@ -2214,6 +2216,47 @@ void tst_QTcpSocket::increaseReadBufferSize() delete active; } +void tst_QTcpSocket::taskQtBug5799ConnectionErrorWaitForConnected() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + // check that we get a proper error connecting to port 12346 + // use waitForConnected, e.g. this should use a synchronous select() on the OS level + + QTcpSocket socket; + socket.connectToHost(QtNetworkSettings::serverName(), 12346); + QTime timer; + timer.start(); + socket.waitForConnected(10000); + QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); + QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, + QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); +} + +void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + // check that we get a proper error connecting to port 12346 + // This testcase uses an event loop + QTcpSocket socket; + connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); + socket.connectToHost(QtNetworkSettings::serverName(), 12346); + + QTestEventLoop::instance().enterLoop(10); + QVERIFY2(!QTestEventLoop::instance().timeout(), "Connection to closed port timed out instead of refusing, something is wrong"); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); + QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, + QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); +} + + + #ifdef TEST_QNETWORK_PROXY void tst_QTcpSocket::invalidProxy_data() { |