From 913a78a9288bf1f68f4975bec5cc58e699c09f39 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 6 May 2009 16:17:28 +0200 Subject: Changing test data to migrate top "official" test server. --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 36 +++++++++++--------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 8dfbedd..e238526 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -238,13 +238,13 @@ void tst_QSslSocket::initTestCase_data() QTest::addColumn("setProxy"); QTest::addColumn("proxyType"); - QTest::newRow("WithoutProxy") << false << 0; + //QTest::newRow("WithoutProxy") << false << 0; #ifdef TEST_QNETWORK_PROXY QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy); - QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic); + //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic); - QTest::newRow("WithHttpProxy") << true << int(HttpProxy); - QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic); + //QTest::newRow("WithHttpProxy") << true << int(HttpProxy); + //QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic); // uncomment the line below when NTLM works // QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); #endif @@ -508,30 +508,19 @@ void tst_QSslSocket::sslErrors_data() QTest::addColumn("port"); QTest::addColumn("errors"); -#if defined(Q_OS_SYMBIAN) - QTest::newRow(QtNetworkSettings::serverName().toAscii() + " port443") << QtNetworkSettings::serverName() << 443 << (SslErrorList() - << QSslError::SelfSignedCertificate + << QSslError::UnableToGetLocalIssuerCertificate + << QSslError::CertificateUntrusted + << QSslError::UnableToVerifyFirstCertificate ); QTest::newRow(QtNetworkSettings::serverName().toAscii() + " port993") << QtNetworkSettings::serverName() << 993 << (SslErrorList() << QSslError::HostNameMismatch << QSslError::SelfSignedCertificate ); - // TODO: Should we have QtNetworkSettings::serverName alias - // in order that we could test with different host name - -#else - QTest::newRow("imap.troll.no") << "imap.troll.no" << 993 - << (SslErrorList() - << QSslError::HostNameMismatch - << QSslError::SelfSignedCertificateInChain); - QTest::newRow("imap.trolltech.com") << "imap.trolltech.com" << 993 - << (SslErrorList() - << QSslError::SelfSignedCertificateInChain); - -#endif //Q_OS_SYMBIAN + // TODO: Should we have QtNetworkSettings::serverName alias + // in order that we could test with different host name } void tst_QSslSocket::sslErrors() @@ -1424,10 +1413,9 @@ void tst_QSslSocket::verifyMode() QVERIFY(!socket.waitForEncrypted()); QList expectedErrors = QList() - << QSslError(QSslError::SelfSignedCertificate, socket.peerCertificate()); -/* << QSslError(QSslError::UnableToGetLocalIssuerCertificate, socket.peerCertificate()) + << QSslError(QSslError::UnableToGetLocalIssuerCertificate, socket.peerCertificate()) << QSslError(QSslError::CertificateUntrusted, socket.peerCertificate()) - << QSslError(QSslError::UnableToVerifyFirstCertificate, socket.peerCertificate());*/ + << QSslError(QSslError::UnableToVerifyFirstCertificate, socket.peerCertificate()); QCOMPARE(socket.sslErrors(), expectedErrors); socket.abort(); @@ -1539,7 +1527,7 @@ void tst_QSslSocket::resetProxy() // dont forget to login QCOMPARE((int) socket.write("USER ftptest\r\n"), 14); - QCOMPARE((int) socket.write("PASS ftP2Ptf\r\n"), 14); + QCOMPARE((int) socket.write("PASS password\r\n"), 15); enterLoop(10); -- cgit v0.12 From e28d875b9f77a0a7cab7d2de649e850b016066f2 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Thu, 7 May 2009 13:20:12 +0200 Subject: Any event can make us pass the line: QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents) so we have to make sure that we wait for te right one to happen. --- tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index 629285f..bb88f42 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -70,9 +70,10 @@ tst_QSocketNotifier::~tst_QSocketNotifier() class UnexpectedDisconnectTester : public QObject { Q_OBJECT + int sequence; + public: QNativeSocketEngine *readEnd1, *readEnd2; - int sequence; UnexpectedDisconnectTester(QNativeSocketEngine *s1, QNativeSocketEngine *s2) : readEnd1(s1), readEnd2(s2), sequence(0) @@ -85,17 +86,25 @@ public: connect(notifier2, SIGNAL(activated(int)), SLOT(handleActivated())); } + const int getSequence() { + return sequence; + } + + void incSequence() { + ++sequence; + } + public slots: void handleActivated() { char data1[1], data2[1]; - ++sequence; - if (sequence == 1) { + incSequence(); + if (getSequence() == 1) { // read from both ends (void) readEnd1->read(data1, sizeof(data1)); (void) readEnd2->read(data2, sizeof(data2)); emit finished(); - } else if (sequence == 2) { + } else if (getSequence() == 2) { QCOMPARE(readEnd2->read(data2, sizeof(data2)), qint64(-2)); QVERIFY(readEnd2->isValid()); } @@ -155,7 +164,12 @@ void tst_QSocketNotifier::unexpectedDisconnection() writeEnd2->flush(); UnexpectedDisconnectTester tester(&readEnd1, &readEnd2); - QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); + + do { + // we have to wait until sequence value changes + // as any event can make us jump out processing + QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); + } while(tester.getSequence() <= 0); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); @@ -163,7 +177,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() qWarning("### Windows returns 1 activation, Unix returns 2."); QCOMPARE(tester.sequence, 1); #else - QCOMPARE(tester.sequence, 2); + QCOMPARE(tester.getSequence(), 2); #endif readEnd1.close(); -- cgit v0.12 From 778ab87d8d2a8c834153bc68a88985d7cb5c0e9f Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 8 May 2009 14:51:43 +0200 Subject: Replace Q_ASSERT with return statement. The input context *can* receive events for unfocused widgets, namely when a CloseSoftwareInputPanel event is sent, or when a mouse event is sent to a nonfocusable widget. --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index bf50383..1ae3d79 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -207,7 +207,11 @@ QString QCoeFepInputContext::language() bool QCoeFepInputContext::filterEvent(const QEvent *event) { - Q_ASSERT(focusWidget()); + // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically + // close when it discovers that the underlying widget does not have input capabilities. + + if (!focusWidget()) + return false; if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { const QKeyEvent *keyEvent = static_cast(event); -- cgit v0.12 From a138ef980ae017c940142e18f2532aa0938f14c3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 8 May 2009 16:11:34 +0300 Subject: Removed CActiveScheduler::Install(NULL) from closingDown. When calling QThread::terminate - closingDown is not called from QThread context, but from thread which is called terminate. In this case, if we Install(NULL) AS, we will actually remove the AS from calling thread not from terminated thread. Since thread is anyway going to be terminated there is not much point on setting AS to NULL. --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 3110e63..6c47c7b 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -505,7 +505,6 @@ void QEventDispatcherSymbian::closingDown() delete m_wakeUpAO; if (m_activeScheduler) { - CActiveScheduler::Install(NULL); delete m_activeScheduler; } } -- cgit v0.12 From 9efbed679fb5108a93eaadb9bcfb74dfcff02a67 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 8 May 2009 15:15:30 +0200 Subject: Some of the epxected replies for network tests can now be loaded via file. --- tests/auto/network-settings.h | 50 ++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 952ab89..5b671bf 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -137,35 +137,51 @@ public: return serverIp.data(); } #endif - //return "10.10.0.147"; return "10.10.14.172"; - //return "10.3.7.2"; - //return "10.3.3.69"; } static QByteArray expectedReplyIMAP() { - //QByteArray expected( "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n" ); - - - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ); - expected = expected.append(QtNetworkSettings::serverLocalName().toAscii()); - expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); +#ifdef Q_OS_SYMBIAN + loadTestSettings(); + + if(QtNetworkSettings::entries.contains("imap.expectedreply")) { + QtNetworkSettingsRecord* entry = entries["imap.expectedreply"]; + if(imapExpectedReply.isNull()) { + imapExpectedReply = entry->recordValue().toAscii(); + imapExpectedReply.append('\r').append('\n'); + } + return imapExpectedReply.data(); + } +#endif + /*QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ); + expected = expected.append(QtNetworkSettings::serverLocalName().toAscii()); + expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");*/ - /* QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4REV1] " ); expected = expected.append(QtNetworkSettings::serverLocalName().toAscii()); expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - */ + return expected; } static QByteArray expectedReplySSL() { - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " ); - expected = expected.append(QtNetworkSettings::serverLocalName().toAscii()); - expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - return expected; + loadTestSettings(); + + if(QtNetworkSettings::entries.contains("imap.expectedreplyssl")) { + QtNetworkSettingsRecord* entry = entries["imap.expectedreplyssl"]; + if(imapExpectedReplySsl.isNull()) { + imapExpectedReplySsl = entry->recordValue().toAscii(); + imapExpectedReplySsl.append('\r').append('\n'); + } + return imapExpectedReplySsl.data(); + } else { + QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " ); + expected = expected.append(QtNetworkSettings::serverLocalName().toAscii()); + expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); + return expected; + } } static QByteArray expectedReplyFtp() @@ -205,6 +221,8 @@ private: static bool bTestSettingsLoaded; static QString iapFileFullPath; static QByteArray serverIp; + static QByteArray imapExpectedReply; + static QByteArray imapExpectedReplySsl; static bool loadDefaultIap() { if(bDefaultIapLoaded) @@ -296,6 +314,8 @@ bool QtNetworkSettings::bDefaultIapLoaded = false; bool QtNetworkSettings::bTestSettingsLoaded = false; QString QtNetworkSettings::iapFileFullPath = QString("C:\\Data\\iap.txt"); QByteArray QtNetworkSettings::serverIp; +QByteArray QtNetworkSettings::imapExpectedReply; +QByteArray QtNetworkSettings::imapExpectedReplySsl; #endif #ifdef Q_OS_SYMBIAN -- cgit v0.12