From b3ae87fe765fe6ad005760d6370f2674873fead7 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 29 Oct 2018 14:26:15 +0100 Subject: Add missing protocol enumerators, report TLS 1.3 if negotiated 1. Remove the conditional inclusion of DTLS versions, they made difficult and unnecessary ugly adding new protocols (something like TlsV1_2OrLater + 4). 2. OpenSSL 1.1.1 first introduced TLS 1.3 support. OpenSSL 1.1 back-end is compatible with OpenSSL 1.1.1, but would fail to extract/report protocol versions and set versions like 'TLS 1.3 only' or 'TLS 1.3 or better' on a new context. Given 1.1.1 is deployed/adapted fast by different distros, and 5.12 is LTS, we fix this issue by introducing QSsl::Tls1_3 and QSsl::Tls1_3OrLater. SecureTransport, WinRT and OpenSSL below 1.1.1 will report an error in case the application requests this protocol (SecureTransport in future will probably enable TLS 1.3). Saying all that, TLS 1.3 support is experimental in QSslSocket. Done-by: Albert Astals Cid Done-by: Timur Pocheptsov Change-Id: I4a97cc789b62763763cf41c44157ef0a9fd6cbec Reviewed-by: Lars Knoll --- .../auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 60 ++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index b759aed074..6158347f62 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1025,6 +1025,26 @@ void tst_QSslSocket::protocol() socket->abort(); } #endif +#ifdef TLS1_3_VERSION + { + // qt-test-server probably doesn't allow TLSV1.3 + socket->setProtocol(QSsl::TlsV1_3); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("TLS 1.3 is not supported by the test server or the test is flaky - see QTBUG-29941"); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->abort(); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->connectToHost(QtNetworkSettings::serverName(), 443); + QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); + socket->startClientEncryption(); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("TLS 1.3 is not supported by the test server or the test is flaky - see QTBUG-29941"); + QCOMPARE(socket->sessionProtocol(), QSsl::TlsV1_3); + socket->abort(); + } +#endif // TLS1_3_VERSION #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) { // qt-test-server allows SSLV2. @@ -1279,7 +1299,9 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.0orlater-tls1.0") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_0 << true; QTest::newRow("tls1.0orlater-tls1.1") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.0orlater-tls1.2") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_2 << true; - +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.0orlater-tls1.3") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_3 << true; +#endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) QTest::newRow("tls1.1orlater-ssl2") << QSsl::TlsV1_1OrLater << QSsl::SslV2 << false; #endif @@ -1290,7 +1312,9 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.1orlater-tls1.0") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.1orlater-tls1.1") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.1orlater-tls1.2") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_2 << true; - +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.1orlater-tls1.3") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_3 << true; +#endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) QTest::newRow("tls1.2orlater-ssl2") << QSsl::TlsV1_2OrLater << QSsl::SslV2 << false; #endif @@ -1300,6 +1324,21 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.2orlater-tls1.0") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.2orlater-tls1.1") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_1 << false; QTest::newRow("tls1.2orlater-tls1.2") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_2 << true; +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.2orlater-tls1.3") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_3 << true; +#endif +#ifdef TLS1_3_VERSION +#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) + QTest::newRow("tls1.3orlater-ssl2") << QSsl::TlsV1_3OrLater << QSsl::SslV2 << false; +#endif +#if !defined(OPENSSL_NO_SSL3) + QTest::newRow("tls1.3orlater-ssl3") << QSsl::TlsV1_3OrLater << QSsl::SslV3 << false; +#endif + QTest::newRow("tls1.3orlater-tls1.0") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_0 << false; + QTest::newRow("tls1.3orlater-tls1.1") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_1 << false; + QTest::newRow("tls1.3orlater-tls1.2") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_2 << false; + QTest::newRow("tls1.3orlater-tls1.3") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_3 << true; +#endif // TLS1_3_VERSION QTest::newRow("any-tls1.0") << QSsl::AnyProtocol << QSsl::TlsV1_0 << true; QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true; @@ -3505,7 +3544,12 @@ protected: socket = new QSslSocket(this); socket->setSslConfiguration(config); socket->setPeerVerifyMode(peerVerifyMode); - socket->setProtocol(protocol); + if (QSslSocket::sslLibraryVersionNumber() > 0x10101000L) { + // FIXME. With OpenSSL 1.1.1 and TLS 1.3 PSK auto-test is broken. + socket->setProtocol(QSsl::TlsV1_2); + } else { + socket->setProtocol(protocol); + } if (ignoreSslErrors) connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); @@ -3885,6 +3929,11 @@ void tst_QSslSocket::pskServer() return; QSslSocket socket; +#ifdef TLS1_3_VERSION + // FIXME: with OpenSSL 1.1.1 (thus TLS 1.3) test is known to fail + // due to the different PSK mechanism (?) - to be investigated ASAP. + socket.setProtocol(QSsl::TlsV1_2); +#endif this->socket = &socket; QSignalSpy connectedSpy(&socket, SIGNAL(connected())); @@ -3970,6 +4019,11 @@ void tst_QSslSocket::signatureAlgorithm_data() if (QSslSocket::sslLibraryVersionNumber() < 0x10002000L) QSKIP("Signature algorithms cannot be tested with OpenSSL < 1.0.2"); + if (QSslSocket::sslLibraryVersionNumber() >= 0x10101000L) { + // FIXME: investigate if this test makes any sense with TLS 1.3. + QSKIP("Test is not valid for TLS 1.3/OpenSSL 1.1.1"); + } + QTest::addColumn("serverSigAlgPairs"); QTest::addColumn("serverProtocol"); QTest::addColumn("clientSigAlgPairs"); -- cgit v1.2.3 From d0e66df1a561cfe3f43879f37a7a3b5a477bd3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 8 Nov 2018 15:22:00 +0100 Subject: macOS: Skip tst_QGLThreads::renderInThread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It crashes in the render thread: thread #7, name = 'SceneRenderingThread' frame #0: libsystem_kernel.dylib`__wait4_nocancel + 10 frame #1: libsystem_c.dylib`system + 452 frame #2: QtTest`stackTrace() + 325 frame #3: QtTest`QTest::FatalSignalHandler::signal(int) + 207 frame #4: libsystem_platform.dylib`_sigtramp + 26 frame #5: libsystem_platform.dylib`_platform_bzero$VARIANT$Base + 23 frame #6: GLRendererFloat`gldSetZero + 63 frame #7: GLRendererFloat`gldClearDrawBuffer + 3792 frame #8: GLRendererFloat`gldClearFramebufferData + 49 frame #9: GLEngine`glClear_Exec + 541 frame #10: tst_qglthreads`SceneRenderingThread::run() + 227 Task-number: QTBUG-68524 Change-Id: I6bc67cb342f77dc1a590a25af535f9bb7f0d325a Reviewed-by: Morten Johan Sørvig --- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 09bea20d26..b7b5b505a0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -355,6 +355,11 @@ void tst_QGLThreads::renderInThread() QFETCH(bool, resize); QFETCH(bool, update); +#if defined(Q_OS_MACOS) + if (resize) + QSKIP("gldSetZero crashes in render thread, QTBUG-68524"); +#endif + ThreadSafeGLWidget widget; widget.resize(200, 200); SceneRenderingThread thread(&widget); -- cgit v1.2.3 From 2393551665a6dc608aa495d032d7408bd4b38297 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 24 Oct 2018 18:05:42 +0200 Subject: Fix precision in parsing hex format QColors We document being able to parse more than 8-bit per color, but were ignoring everything after the first 8 bits. Change-Id: Ic85ab04b0836e6979a623e294eebd5084c1a9478 Fixes: QTBUG-71373 Reviewed-by: Eirik Aavitsland --- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index ece7a30830..72bad03a6a 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -318,6 +318,9 @@ void tst_QColor::namehex_data() QTest::newRow("global color darkCyan") << "#008080" << QColor(Qt::darkCyan); QTest::newRow("global color darkMagenta") << "#800080" << QColor(Qt::darkMagenta); QTest::newRow("global color darkYellow") << "#808000" << QColor(Qt::darkYellow); + QTest::newRow("#RGB") << "#888" << QColor(0x88, 0x88, 0x88); + QTest::newRow("#RRRGGGBBB") << "#80F80F80F" << QColor(qRgba64(0x80f8, 0x80f8, 0x80f8, 0xffff)); + QTest::newRow("#RRRRGGGGBBBB") << "#808180818081" << QColor(qRgba64(0x8081, 0x8081, 0x8081, 0xffff)); QTest::newRow("transparent red") << "#66ff0000" << QColor(255, 0, 0, 102); QTest::newRow("invalid red") << "#gg0000" << QColor(); QTest::newRow("invalid transparent") << "#gg00ff00" << QColor(); -- cgit v1.2.3 From 79af4ec056b6301752ee750f04192d170f9c1823 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Nov 2018 14:58:47 +0100 Subject: Manual dialogs test: Fix shortcut Fix: QAction::event: Ambiguous shortcut overload: Ctrl+Q when pressing CTRL+Q Amends b5eb850e0deb61ff71e26a5a2d0e070b91306aa2 . Change-Id: Ie31d5830ea357cd34cdd422e667ceca507c7b53f Reviewed-by: Shawn Rutledge --- tests/manual/dialogs/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp index fc4adebcc0..2676ceeb52 100644 --- a/tests/manual/dialogs/main.cpp +++ b/tests/manual/dialogs/main.cpp @@ -94,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QMenu *editMenu = menuBar()->addMenu(tr("&Edit")); QAction *action = editMenu->addAction(tr("Cut")); - action->setShortcut(QKeySequence(QKeySequence::Quit)); + action->setShortcut(QKeySequence(QKeySequence::Cut)); action = editMenu->addAction(tr("Copy")); action->setShortcut(QKeySequence(QKeySequence::Copy)); action = editMenu->addAction(tr("Paste")); -- cgit v1.2.3 From 6bdf1e337d9104081b6e3b335d8439b32fb8b020 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 13 Nov 2018 09:03:15 +0100 Subject: tst_qguieventdispatcher: Sync blacklist with tst_qeventdispatcher Windows and WinRT only have on event dispatcher class so that failing test cases in one test will most likely also happen in the other. Change-Id: Ib047c6870e6e02f3cf8deaaa6e438ed0ac7e2d5a Reviewed-by: Friedemann Kleint --- tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST (limited to 'tests') diff --git a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST new file mode 100644 index 0000000000..b1590a5ccf --- /dev/null +++ b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST @@ -0,0 +1,5 @@ +[sendPostedEvents] +windows +[registerTimer] +windows +winrt -- cgit v1.2.3 From 16830c827b075c274f2f208fcc57c9f6174e9fcc Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 14 Nov 2018 12:09:51 +0100 Subject: Make sure QEventDispatcher::registerTimer() cleans up after itself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test needs to also unregister its timers when it fails. Therefore, wrap the registering and unregistering in an RAII class. Task-number: QTBUG-71773 Change-Id: I6ef44e580880deecb32763b5b0cd71e1c26929be Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- .../qeventdispatcher/tst_qeventdispatcher.cpp | 178 +++++++++++++++------ 1 file changed, 126 insertions(+), 52 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp index 5784f0728c..ca183752a5 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp +++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp @@ -92,77 +92,151 @@ void tst_QEventDispatcher::initTestCase() } } +class TimerManager { + Q_DISABLE_COPY(TimerManager) + +public: + TimerManager(QAbstractEventDispatcher *eventDispatcher, QObject *parent) + : m_eventDispatcher(eventDispatcher), m_parent(parent) + { + } + + ~TimerManager() + { + if (!registeredTimers().isEmpty()) + m_eventDispatcher->unregisterTimers(m_parent); + } + + TimerManager(TimerManager &&) = delete; + TimerManager &operator=(TimerManager &&) = delete; + + int preciseTimerId() const { return m_preciseTimerId; } + int coarseTimerId() const { return m_coarseTimerId; } + int veryCoarseTimerId() const { return m_veryCoarseTimerId; } + + bool foundPrecise() const { return m_preciseTimerId > 0; } + bool foundCoarse() const { return m_coarseTimerId > 0; } + bool foundVeryCoarse() const { return m_veryCoarseTimerId > 0; } + + QList registeredTimers() const + { + return m_eventDispatcher->registeredTimers(m_parent); + } + + void registerAll() + { + // start 3 timers, each with the different timer types and different intervals + m_preciseTimerId = m_eventDispatcher->registerTimer( + PreciseTimerInterval, Qt::PreciseTimer, m_parent); + m_coarseTimerId = m_eventDispatcher->registerTimer( + CoarseTimerInterval, Qt::CoarseTimer, m_parent); + m_veryCoarseTimerId = m_eventDispatcher->registerTimer( + VeryCoarseTimerInterval, Qt::VeryCoarseTimer, m_parent); + QVERIFY(m_preciseTimerId > 0); + QVERIFY(m_coarseTimerId > 0); + QVERIFY(m_veryCoarseTimerId > 0); + findTimers(); + } + + void unregister(int timerId) + { + m_eventDispatcher->unregisterTimer(timerId); + findTimers(); + } + + void unregisterAll() + { + m_eventDispatcher->unregisterTimers(m_parent); + findTimers(); + } + +private: + void findTimers() + { + bool foundPrecise = false; + bool foundCoarse = false; + bool foundVeryCoarse = false; + const QList timers = registeredTimers(); + for (int i = 0; i < timers.count(); ++i) { + const QAbstractEventDispatcher::TimerInfo &timerInfo = timers.at(i); + if (timerInfo.timerId == m_preciseTimerId) { + QCOMPARE(timerInfo.interval, int(PreciseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::PreciseTimer); + foundPrecise = true; + } else if (timerInfo.timerId == m_coarseTimerId) { + QCOMPARE(timerInfo.interval, int(CoarseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::CoarseTimer); + foundCoarse = true; + } else if (timerInfo.timerId == m_veryCoarseTimerId) { + QCOMPARE(timerInfo.interval, int(VeryCoarseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::VeryCoarseTimer); + foundVeryCoarse = true; + } + } + if (!foundPrecise) + m_preciseTimerId = -1; + if (!foundCoarse) + m_coarseTimerId = -1; + if (!foundVeryCoarse) + m_veryCoarseTimerId = -1; + } + + QAbstractEventDispatcher *m_eventDispatcher = nullptr; + + int m_preciseTimerId = -1; + int m_coarseTimerId = -1; + int m_veryCoarseTimerId = -1; + + QObject *m_parent = nullptr; +}; + // test that the eventDispatcher's timer implementation is complete and working void tst_QEventDispatcher::registerTimer() { -#define FIND_TIMERS() \ - do { \ - foundPrecise = false; \ - foundCoarse = false; \ - foundVeryCoarse = false; \ - for (int i = 0; i < registeredTimers.count(); ++i) { \ - const QAbstractEventDispatcher::TimerInfo &timerInfo = registeredTimers.at(i); \ - if (timerInfo.timerId == preciseTimerId) { \ - QCOMPARE(timerInfo.interval, int(PreciseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::PreciseTimer); \ - foundPrecise = true; \ - } else if (timerInfo.timerId == coarseTimerId) { \ - QCOMPARE(timerInfo.interval, int(CoarseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::CoarseTimer); \ - foundCoarse = true; \ - } else if (timerInfo.timerId == veryCoarseTimerId) { \ - QCOMPARE(timerInfo.interval, int(VeryCoarseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::VeryCoarseTimer); \ - foundVeryCoarse = true; \ - } \ - } \ - } while (0) - - // start 3 timers, each with the different timer types and different intervals - int preciseTimerId = eventDispatcher->registerTimer(PreciseTimerInterval, Qt::PreciseTimer, this); - int coarseTimerId = eventDispatcher->registerTimer(CoarseTimerInterval, Qt::CoarseTimer, this); - int veryCoarseTimerId = eventDispatcher->registerTimer(VeryCoarseTimerInterval, Qt::VeryCoarseTimer, this); - QVERIFY(preciseTimerId > 0); - QVERIFY(coarseTimerId > 0); - QVERIFY(veryCoarseTimerId > 0); + TimerManager timers(eventDispatcher, this); + timers.registerAll(); + if (QTest::currentTestFailed()) + return; // check that all 3 are present in the eventDispatcher's registeredTimer() list - QList registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 3); - bool foundPrecise, foundCoarse, foundVeryCoarse; - FIND_TIMERS(); - QVERIFY(foundPrecise && foundCoarse && foundVeryCoarse); + QCOMPARE(timers.registeredTimers().count(), 3); + QVERIFY(timers.foundPrecise()); + QVERIFY(timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // process events, waiting for the next event... this should only fire the precise timer receivedEventType = -1; timerIdFromEvent = -1; QTRY_COMPARE_WITH_TIMEOUT(receivedEventType, int(QEvent::Timer), PreciseTimerInterval * 2); - QCOMPARE(timerIdFromEvent, preciseTimerId); + QCOMPARE(timerIdFromEvent, timers.preciseTimerId()); // now unregister it and make sure it's gone - eventDispatcher->unregisterTimer(preciseTimerId); - registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 2); - FIND_TIMERS(); - QVERIFY(!foundPrecise && foundCoarse && foundVeryCoarse); + timers.unregister(timers.preciseTimerId()); + if (QTest::currentTestFailed()) + return; + QCOMPARE(timers.registeredTimers().count(), 2); + QVERIFY(!timers.foundPrecise()); + QVERIFY(timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // do the same again for the coarse timer receivedEventType = -1; timerIdFromEvent = -1; QTRY_COMPARE_WITH_TIMEOUT(receivedEventType, int(QEvent::Timer), CoarseTimerInterval * 2); - QCOMPARE(timerIdFromEvent, coarseTimerId); + QCOMPARE(timerIdFromEvent, timers.coarseTimerId()); // now unregister it and make sure it's gone - eventDispatcher->unregisterTimer(coarseTimerId); - registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 1); - FIND_TIMERS(); - QVERIFY(!foundPrecise && !foundCoarse && foundVeryCoarse); + timers.unregister(timers.coarseTimerId()); + if (QTest::currentTestFailed()) + return; + QCOMPARE(timers.registeredTimers().count(), 1); + QVERIFY(!timers.foundPrecise()); + QVERIFY(!timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // not going to wait for the VeryCoarseTimer, would take too long, just unregister it - eventDispatcher->unregisterTimers(this); - registeredTimers = eventDispatcher->registeredTimers(this); - QVERIFY(registeredTimers.isEmpty()); - -#undef FIND_TIMERS + timers.unregisterAll(); + if (QTest::currentTestFailed()) + return; + QVERIFY(timers.registeredTimers().isEmpty()); } void tst_QEventDispatcher::sendPostedEvents_data() -- cgit v1.2.3 From 900b57ea90ebe60414a5188337bc85ee4faac220 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 13 Nov 2018 18:35:50 +0100 Subject: Re-blacklist tst_QEventDispatcher::registerTimer() on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test has been failing over and over since it was removed from the blacklist. Obviously it is not stable. This is a partial revert of commit b10ee45546e152e08b2494bd45eb22426e9d2dc9. Task-number: QTBUG-71773 Change-Id: Ie2588538ee704652c2f09ce6ad947da3011e7dad Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST index b1590a5ccf..06588188d4 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST +++ b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST @@ -3,3 +3,4 @@ windows [registerTimer] windows winrt +osx -- cgit v1.2.3 From 527406cbd99f44470ef87468b73c18df949e8ac7 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 12 Nov 2018 09:40:47 +0100 Subject: Modernize the "settings" feature Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/io.pro | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 3c93fd5e1f..eee2c0e30d 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -65,6 +65,9 @@ win32:!qtConfig(private_tests): SUBDIRS -= \ qprocess \ qprocess-noapplication +!qtConfig(settings): SUBDIRS -= \ + qsettings + winrt: SUBDIRS -= \ qstorageinfo -- cgit v1.2.3 From 7a4f41bad98da9953abcea05a71c2986406c7695 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 14 Nov 2018 09:47:21 +0100 Subject: tests: Distinguish tst_qeventdispatcher and tst_qguieventdispatcher Both use same source, but link without and with Qt Gui library. Task-number: QTBUG-71751 Change-Id: I5643a07a8067f5fc10fc66f717f19bc3e16a33ab Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp index ca183752a5..49c10c6a24 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp +++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp @@ -28,6 +28,7 @@ #ifdef QT_GUI_LIB # include +# define tst_QEventDispatcher tst_QGuiEventDispatcher #else # include #endif -- cgit v1.2.3 From 6125fce79936d3ce96e3faac9ad3a9bad3101796 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Nov 2018 15:57:35 -0700 Subject: tst_QResourceEngine: store the actual byte contents that we expect Instead of using a QString with only the prefix, let's do a full comparison to make sure there's no junk at the end of the file. Take the opportunity to remove the nonsense of a space at the end of most of these files (I didn't remove from all). Change-Id: I343f2beed55440a7ac0bfffd15632228c1bfe78f Reviewed-by: Lars Knoll --- .../auto/corelib/io/qresourceengine/.gitattributes | 1 + .../qresourceengine/testqrc/aliasdir/aliasdir.txt | 2 +- .../io/qresourceengine/testqrc/blahblah.txt | 2 +- .../io/qresourceengine/testqrc/currentdir.txt | 2 +- .../io/qresourceengine/testqrc/currentdir2.txt | 2 +- .../qresourceengine/testqrc/otherdir/otherdir.txt | 2 +- .../io/qresourceengine/testqrc/subdir/subdir.txt | 2 +- .../io/qresourceengine/testqrc/test/test/test1.txt | 2 +- .../io/qresourceengine/testqrc/test/test/test2.txt | 2 +- .../io/qresourceengine/testqrc/test/testdir.txt | 2 +- .../io/qresourceengine/testqrc/test/testdir2.txt | 2 +- .../io/qresourceengine/tst_qresourceengine.cpp | 59 +++++++++++----------- 12 files changed, 41 insertions(+), 39 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qresourceengine/.gitattributes b/tests/auto/corelib/io/qresourceengine/.gitattributes index add3716d81..88edd3681a 100644 --- a/tests/auto/corelib/io/qresourceengine/.gitattributes +++ b/tests/auto/corelib/io/qresourceengine/.gitattributes @@ -1 +1,2 @@ testqrc/test.qrc -crlf +*.txt -crlf diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt index 21a3dfa0b8..dcf7937f0a 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt @@ -1 +1 @@ -"This is a korean text file" +"This is a korean text file" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt b/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt index 436c4d11c3..19f0805d8d 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt @@ -1 +1 @@ -qwerty +qwerty diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt index 38e389979a..65f1f43def 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt @@ -1 +1 @@ -"This is the current dir" +"This is the current dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt index 6ac16a3306..7d89108011 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt @@ -1 +1 @@ -"This is also the current dir" +"This is also the current dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt index b0e4a124ee..e1b430f33b 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt @@ -1 +1 @@ -"This is the other dir" +"This is the other dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt index b6115207a2..4506acf413 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt @@ -1 +1 @@ -"This is in the sub directory" +"This is in the sub directory" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt index adc01d1354..8baef1b4ab 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt @@ -1 +1 @@ -abc +abc diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt index 3f48e3cdc3..24c5735c3e 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt @@ -1 +1 @@ -def +def diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt index 40ee68dccb..b8cb3a8c01 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt @@ -1 +1 @@ -"This is in the test directory" +"This is in the test directory" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt index 051430298a..dccfdc9bcf 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt @@ -1 +1 @@ -"This is another file in this directory" +"This is another file in this directory" diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index ab49dea6d8..2678bb0db3 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -104,7 +105,7 @@ void tst_QResourceEngine::cleanupTestCase() void tst_QResourceEngine::checkStructure_data() { QTest::addColumn("pathName"); - QTest::addColumn("contents"); + QTest::addColumn("contents"); QTest::addColumn("containedFiles"); QTest::addColumn("containedDirs"); QTest::addColumn("locale"); @@ -134,7 +135,7 @@ void tst_QResourceEngine::checkStructure_data() QTest::newRow("root dir") << QString(":/") - << QString() + << QByteArray() << (QStringList() #if defined(BUILTIN_TESTDATA) << "parentdir.txt" @@ -146,7 +147,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(0); QTest::newRow("secondary root") << QString(":/secondary_root/") - << QString() + << QByteArray() << QStringList() << (QStringList() << QLatin1String("runtime_resource")) << QLocale::c() @@ -158,56 +159,56 @@ void tst_QResourceEngine::checkStructure_data() const QString root = roots.at(i); QTest::newRow(QString(root + "prefix dir").toLatin1().constData()) << QString(root + "test/abc/123/+++") - << QString() + << QByteArray() << (QStringList() << QLatin1String("currentdir.txt") << QLatin1String("currentdir2.txt") << QLatin1String("parentdir.txt")) << (QStringList() << QLatin1String("subdir")) << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "parent to prefix").toLatin1().constData()) << QString(root + "test/abc/123") - << QString() + << QByteArray() << QStringList() << (QStringList() << QLatin1String("+++")) << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "two parents prefix").toLatin1().constData()) << QString(root + "test/abc") - << QString() + << QByteArray() << QStringList() << QStringList(QLatin1String("123")) << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "test dir ").toLatin1().constData()) << QString(root + "test") - << QString() + << QByteArray() << (QStringList() << QLatin1String("testdir.txt")) << (QStringList() << QLatin1String("abc") << QLatin1String("test")) << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "prefix no slashes").toLatin1().constData()) << QString(root + "withoutslashes") - << QString() + << QByteArray() << QStringList("blahblah.txt") << QStringList() << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "other dir").toLatin1().constData()) << QString(root + "otherdir") - << QString() + << QByteArray() << QStringList(QLatin1String("otherdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "alias dir").toLatin1().constData()) << QString(root + "aliasdir") - << QString() + << QByteArray() << QStringList(QLatin1String("aliasdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); QTest::newRow(QString(root + "second test dir").toLatin1().constData()) << QString(root + "test/test") - << QString() + << QByteArray() << (QStringList() << QLatin1String("test1.txt") << QLatin1String("test2.txt")) << QStringList() << QLocale::c() @@ -215,7 +216,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test1.txt")); QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test1.txt") - << QString("abc") + << QByteArray("abc\n") << QStringList() << QStringList() << QLocale::c() @@ -223,7 +224,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/blahblah.txt")); QTest::newRow(QString(root + "text no slashes").toLatin1().constData()) << QString(root + "withoutslashes/blahblah.txt") - << QString("qwerty") + << QByteArray("qwerty\n") << QStringList() << QStringList() << QLocale::c() @@ -232,7 +233,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test2.txt")); QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test2.txt") - << QString("def") + << QByteArray("def\n") << QStringList() << QStringList() << QLocale::c() @@ -240,7 +241,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt")); QTest::newRow(QString(root + "currentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir.txt") - << QString("\"This is the current dir\" ") + << QByteArray("\"This is the current dir\"\n") << QStringList() << QStringList() << QLocale::c() @@ -248,7 +249,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/currentdir2.txt")); QTest::newRow(QString(root + "currentdir text2").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir2.txt") - << QString("\"This is also the current dir\" ") + << QByteArray("\"This is also the current dir\"\n") << QStringList() << QStringList() << QLocale::c() @@ -256,7 +257,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("parentdir.txt")); QTest::newRow(QString(root + "parentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/parentdir.txt") - << QString("abcdefgihklmnopqrstuvwxyz ") + << QByteArray("abcdefgihklmnopqrstuvwxyz \n") << QStringList() << QStringList() << QLocale::c() @@ -264,7 +265,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/subdir/subdir.txt")); QTest::newRow(QString(root + "subdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/subdir/subdir.txt") - << QString("\"This is in the sub directory\" ") + << QByteArray("\"This is in the sub directory\"\n") << QStringList() << QStringList() << QLocale::c() @@ -272,7 +273,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir.txt")); QTest::newRow(QString(root + "testdir text").toLatin1().constData()) << QString(root + "test/testdir.txt") - << QString("\"This is in the test directory\" ") + << QByteArray("\"This is in the test directory\"\n") << QStringList() << QStringList() << QLocale::c() @@ -280,7 +281,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/otherdir/otherdir.txt")); QTest::newRow(QString(root + "otherdir text").toLatin1().constData()) << QString(root + "otherdir/otherdir.txt") - << QString("\"This is the other dir\" ") + << QByteArray("\"This is the other dir\"\n") << QStringList() << QStringList() << QLocale::c() @@ -288,7 +289,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir2.txt")); QTest::newRow(QString(root + "alias text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is another file in this directory\" ") + << QByteArray("\"This is another file in this directory\"\n") << QStringList() << QStringList() << QLocale::c() @@ -296,7 +297,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); QTest::newRow(QString(root + "korean text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is a korean text file\" ") + << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() << QLocale("ko") @@ -304,7 +305,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); QTest::newRow(QString(root + "korean text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is a korean text file\" ") + << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() << QLocale("ko_KR") @@ -312,7 +313,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); QTest::newRow(QString(root + "german text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("Deutsch") + << QByteArray("Deutsch\n") << QStringList() << QStringList() << QLocale("de") @@ -320,7 +321,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); QTest::newRow(QString(root + "german text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("Deutsch") + << QByteArray("Deutsch\n") << QStringList() << QStringList() << QLocale("de_DE") @@ -330,7 +331,7 @@ void tst_QResourceEngine::checkStructure_data() file.open(QFile::ReadOnly); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/compressme.txt")); QTest::newRow(QString(root + "compressed text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString(file.readAll()) + << file.readAll() << QStringList() << QStringList() << QLocale("de_CH") @@ -341,7 +342,7 @@ void tst_QResourceEngine::checkStructure_data() void tst_QResourceEngine::checkStructure() { QFETCH(QString, pathName); - QFETCH(QString, contents); + QFETCH(QByteArray, contents); QFETCH(QStringList, containedFiles); QFETCH(QStringList, containedDirs); QFETCH(QLocale, locale); @@ -401,8 +402,8 @@ void tst_QResourceEngine::checkStructure() QFile file(pathName); QVERIFY(file.open(QFile::ReadOnly)); - QByteArray ba = file.readAll(); - QVERIFY(QString(ba).startsWith(contents)); + // check contents + QCOMPARE(file.readAll(), contents); } QLocale::setDefault(QLocale::system()); } -- cgit v1.2.3 From 460866ee47c2a2ee98d7874a88bc3cc4b17b6f6a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Nov 2018 16:09:05 -0700 Subject: tst_QResourceEngine: use QTest::addRow instead of QString concatenation Change-Id: I343f2beed55440a7ac0bfffd156322c95aebb847 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk Reviewed-by: Kai Koehne --- .../io/qresourceengine/tst_qresourceengine.cpp | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 2678bb0db3..cf1d249f54 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -158,56 +158,56 @@ void tst_QResourceEngine::checkStructure_data() for(int i = 0; i < roots.size(); ++i) { const QString root = roots.at(i); - QTest::newRow(QString(root + "prefix dir").toLatin1().constData()) << QString(root + "test/abc/123/+++") + QTest::addRow("%s prefix dir", qPrintable(root)) << QString(root + "test/abc/123/+++") << QByteArray() << (QStringList() << QLatin1String("currentdir.txt") << QLatin1String("currentdir2.txt") << QLatin1String("parentdir.txt")) << (QStringList() << QLatin1String("subdir")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "parent to prefix").toLatin1().constData()) << QString(root + "test/abc/123") + QTest::addRow("%s parent to prefix", qPrintable(root)) << QString(root + "test/abc/123") << QByteArray() << QStringList() << (QStringList() << QLatin1String("+++")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "two parents prefix").toLatin1().constData()) << QString(root + "test/abc") + QTest::addRow("%s two parents prefix", qPrintable(root)) << QString(root + "test/abc") << QByteArray() << QStringList() << QStringList(QLatin1String("123")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "test dir ").toLatin1().constData()) << QString(root + "test") + QTest::addRow("%s test dir ", qPrintable(root)) << QString(root + "test") << QByteArray() << (QStringList() << QLatin1String("testdir.txt")) << (QStringList() << QLatin1String("abc") << QLatin1String("test")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "prefix no slashes").toLatin1().constData()) << QString(root + "withoutslashes") + QTest::addRow("%s prefix no slashes", qPrintable(root)) << QString(root + "withoutslashes") << QByteArray() << QStringList("blahblah.txt") << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "other dir").toLatin1().constData()) << QString(root + "otherdir") + QTest::addRow("%s other dir", qPrintable(root)) << QString(root + "otherdir") << QByteArray() << QStringList(QLatin1String("otherdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "alias dir").toLatin1().constData()) << QString(root + "aliasdir") + QTest::addRow("%s alias dir", qPrintable(root)) << QString(root + "aliasdir") << QByteArray() << QStringList(QLatin1String("aliasdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "second test dir").toLatin1().constData()) << QString(root + "test/test") + QTest::addRow("%s second test dir", qPrintable(root)) << QString(root + "test/test") << QByteArray() << (QStringList() << QLatin1String("test1.txt") << QLatin1String("test2.txt")) << QStringList() @@ -215,7 +215,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(0); info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test1.txt")); - QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test1.txt") + QTest::addRow("%s test1 text", qPrintable(root)) << QString(root + "test/test/test1.txt") << QByteArray("abc\n") << QStringList() << QStringList() @@ -223,7 +223,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/blahblah.txt")); - QTest::newRow(QString(root + "text no slashes").toLatin1().constData()) << QString(root + "withoutslashes/blahblah.txt") + QTest::addRow("%s text no slashes", qPrintable(root)) << QString(root + "withoutslashes/blahblah.txt") << QByteArray("qwerty\n") << QStringList() << QStringList() @@ -232,7 +232,7 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test2.txt")); - QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test2.txt") + QTest::addRow("%s test1 text", qPrintable(root)) << QString(root + "test/test/test2.txt") << QByteArray("def\n") << QStringList() << QStringList() @@ -240,7 +240,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt")); - QTest::newRow(QString(root + "currentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir.txt") + QTest::addRow("%s currentdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/currentdir.txt") << QByteArray("\"This is the current dir\"\n") << QStringList() << QStringList() @@ -248,7 +248,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/currentdir2.txt")); - QTest::newRow(QString(root + "currentdir text2").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir2.txt") + QTest::addRow("%s currentdir text2", qPrintable(root)) << QString(root + "test/abc/123/+++/currentdir2.txt") << QByteArray("\"This is also the current dir\"\n") << QStringList() << QStringList() @@ -256,7 +256,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("parentdir.txt")); - QTest::newRow(QString(root + "parentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/parentdir.txt") + QTest::addRow("%s parentdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/parentdir.txt") << QByteArray("abcdefgihklmnopqrstuvwxyz \n") << QStringList() << QStringList() @@ -264,7 +264,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/subdir/subdir.txt")); - QTest::newRow(QString(root + "subdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/subdir/subdir.txt") + QTest::addRow("%s subdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/subdir/subdir.txt") << QByteArray("\"This is in the sub directory\"\n") << QStringList() << QStringList() @@ -272,7 +272,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir.txt")); - QTest::newRow(QString(root + "testdir text").toLatin1().constData()) << QString(root + "test/testdir.txt") + QTest::addRow("%s testdir text", qPrintable(root)) << QString(root + "test/testdir.txt") << QByteArray("\"This is in the test directory\"\n") << QStringList() << QStringList() @@ -280,7 +280,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/otherdir/otherdir.txt")); - QTest::newRow(QString(root + "otherdir text").toLatin1().constData()) << QString(root + "otherdir/otherdir.txt") + QTest::addRow("%s otherdir text", qPrintable(root)) << QString(root + "otherdir/otherdir.txt") << QByteArray("\"This is the other dir\"\n") << QStringList() << QStringList() @@ -288,7 +288,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir2.txt")); - QTest::newRow(QString(root + "alias text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s alias text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << QByteArray("\"This is another file in this directory\"\n") << QStringList() << QStringList() @@ -296,7 +296,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); - QTest::newRow(QString(root + "korean text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s korean text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() @@ -304,7 +304,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); - QTest::newRow(QString(root + "korean text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s korean text 2", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() @@ -312,7 +312,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); - QTest::newRow(QString(root + "german text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s german text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << QByteArray("Deutsch\n") << QStringList() << QStringList() @@ -320,7 +320,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); - QTest::newRow(QString(root + "german text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s german text 2", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << QByteArray("Deutsch\n") << QStringList() << QStringList() @@ -330,7 +330,7 @@ void tst_QResourceEngine::checkStructure_data() QFile file(QFINDTESTDATA("testqrc/aliasdir/compressme.txt")); file.open(QFile::ReadOnly); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/compressme.txt")); - QTest::newRow(QString(root + "compressed text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") + QTest::addRow("%s compressed text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") << file.readAll() << QStringList() << QStringList() -- cgit v1.2.3 From 6a792d6f0b5a15ce09b7883bbbb06b2724596e40 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 13:54:26 -0700 Subject: QResourceFileEngine: fix map() for compressed files We were returning a pointer to the compressed data and comparing to the compressed data size. Change-Id: I343f2beed55440a7ac0bfffd1563232d557c9427 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index cf1d249f54..6461e6274f 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -404,6 +404,12 @@ void tst_QResourceEngine::checkStructure() // check contents QCOMPARE(file.readAll(), contents); + + // check memory map too + uchar *ptr = file.map(0, file.size(), QFile::MapPrivateOption); + QVERIFY2(ptr, qPrintable(file.errorString())); + QByteArray ba = QByteArray::fromRawData(reinterpret_cast(ptr), file.size()); + QCOMPARE(ba, contents); } QLocale::setDefault(QLocale::system()); } -- cgit v1.2.3 From 6b088b7a1da37511a8abb1503e4f2f95632dbdac Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Nov 2018 16:35:29 -0700 Subject: QResourceFileEngine: fix use of mapped files after close() QFile::map() is documented to continue working after the QFile is closed, so this should work for the resource file engine too. Change-Id: I343f2beed55440a7ac0bfffd1563243a3966441f Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 6461e6274f..0b50c391b8 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -410,6 +410,10 @@ void tst_QResourceEngine::checkStructure() QVERIFY2(ptr, qPrintable(file.errorString())); QByteArray ba = QByteArray::fromRawData(reinterpret_cast(ptr), file.size()); QCOMPARE(ba, contents); + + // check that it is still valid after closing the file + file.close(); + QCOMPARE(ba, contents); } QLocale::setDefault(QLocale::system()); } -- cgit v1.2.3 From e00c73911ae0127f986e056984eff02b099325f4 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 25 Oct 2018 15:08:13 +0200 Subject: Reduce run time of tst_QRegularExpression::threadSafety MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test was taking so much time that it regularly timed out on WinRT and when running in qemu. Reduce it from around 40 to 7 seconds on a powerful desktop. Now it either runs for two full seconds for each test function or until it has done 50 iterations. Fixes: QTBUG-71405 Change-Id: If752c1e65d3b19009b883f64edc96d020df479d1 Reviewed-by: Oliver Wolff Reviewed-by: Jędrzej Nowacki Reviewed-by: Timur Pocheptsov --- .../auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 18098f16bf..c23ee3b0ba 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -2135,11 +2135,12 @@ void tst_QRegularExpression::threadSafety() QFETCH(QString, pattern); QFETCH(QString, subject); + QElapsedTimer time; + time.start(); static const int THREAD_SAFETY_ITERATIONS = 50; - const int threadCount = qMax(QThread::idealThreadCount(), 4); - for (int threadSafetyIteration = 0; threadSafetyIteration < THREAD_SAFETY_ITERATIONS; ++threadSafetyIteration) { + for (int threadSafetyIteration = 0; threadSafetyIteration < THREAD_SAFETY_ITERATIONS && time.elapsed() < 2000; ++threadSafetyIteration) { QRegularExpression re(pattern); QVector threads; -- cgit v1.2.3 From 46076f73337d6b0fea9a006dab2af8864571ae2c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 21 Nov 2018 13:46:28 +0100 Subject: tst_QNetworkReply: Blacklist getFromHttp:success-external Task-number: QTBUG-71953 Change-Id: I449ee3be8fa748046895386c9cbff90b30ed80c4 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index fab8224431..4d29a830e9 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -8,6 +8,9 @@ windows * [getErrors:ftp-host] linux +# QTBUG-71953 +[getFromHttp:success-external] +* [getFromHttpIntoBuffer] windows [getFromHttpIntoBuffer2] -- cgit v1.2.3