From 38a0909d4ed39b49e0463bd780d20a82ea672d35 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Oct 2017 12:42:29 +0200 Subject: tst_qnetworkreply: Replace insignificant_test with blacklisting Neither the exit crash of QTBUG-21102 nor the Windows failure of QTBUG-24226 appear to be reproduceable. Add verbose error reporting to getErrors() and blacklist getErrors:ftp-host which has been found to fail with timeouts on Linux and ioHttpRedirectMultipartPost. Task-number: QTBUG-21102 Task-number: QTBUG-24226 Task-number: QTBUG-62860 Change-Id: I6b29f6184e83de8ffebf6ff0d80606512dca6419 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 20 ++++++++++++++++++++ .../auto/network/access/qnetworkreply/test/test.pro | 3 --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 13 ++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 1d56c78bbc..f2ccefb9d6 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -1,5 +1,7 @@ # See qtbase/src/testlib/qtestblacklist.cpp for format osx +[authenticationCacheAfterCancel] +windows [ioGetFromBuiltinHttp:http+limited] ubuntu-14.04 [ioGetFromBuiltinHttp:https+limited] @@ -8,3 +10,21 @@ ubuntu-14.04 * [backgroundRequestInterruption:ftp, bg, nobg] * +[getErrors:ftp-host] +linux +[getFromHttpIntoBuffer] +windows +[getFromHttpIntoBuffer2] +windows +[headFromHttp] +windows +[ioGetFromHttpWithSocksProxy] +windows +[ioPostToHttpFromSocket] +windows +[ioHttpRedirectMultipartPost] +linux +[putWithServerClosingConnectionImmediately] +windows +[qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] +windows diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro index 0dcf5a250c..1f45ac0c49 100644 --- a/tests/auto/network/access/qnetworkreply/test/test.pro +++ b/tests/auto/network/access/qnetworkreply/test/test.pro @@ -13,7 +13,4 @@ RESOURCES += ../qnetworkreply.qrc TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \ ../index.html ../smb-file.txt -qtConfig(xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102 -win32:CONFIG += insignificant_test # QTBUG-24226 - !winrt: TEST_HELPER_INSTALLS = ../echo/echo diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 93afca3d48..099ea8ff39 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1994,6 +1994,16 @@ void tst_QNetworkReply::getErrors_data() << int(QNetworkReply::AuthenticationRequiredError) << 401 << false; } +static QByteArray msgGetErrors(int waitResult, const QNetworkReplyPtr &reply) +{ + QByteArray result ="waitResult=" + QByteArray::number(waitResult); + if (reply->isFinished()) + result += ", finished"; + if (reply->error() != QNetworkReply::NoError) + result += ", error: " + QByteArray::number(int(reply->error())); + return result; +} + void tst_QNetworkReply::getErrors() { QFETCH(QString, url); @@ -2023,7 +2033,8 @@ void tst_QNetworkReply::getErrors() QCOMPARE(reply->error(), QNetworkReply::NoError); // now run the request: - QVERIFY(waitForFinish(reply) != Timeout); + const int waitResult = waitForFinish(reply); + QVERIFY2(waitResult != Timeout, msgGetErrors(waitResult, reply)); QFETCH(int, error); QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort); -- cgit v1.2.3 From 01c7b474f5ad2c9fcf4b90c71048624070811618 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 26 Oct 2017 11:01:11 +0200 Subject: tst_QMenuBar: Port to QWindow-based mouse test API Add some helpers to convert the coordinates and change the code to use the QWindow-based mouse test API. Remove mouse presses on the second and third menu from task256322_highlight() since moving the mouse is sufficient to switch menus. Remove blacklisting/skipping of macOS and offscreen. Task-number: QTBUG-63988 Change-Id: If3e94170d11df369aec199d13d54d39382a78723 Reviewed-by: Gatis Paeglis --- tests/auto/widgets/widgets/qmenubar/BLACKLIST | 2 - .../auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 71 +++++++++++----------- 2 files changed, 37 insertions(+), 36 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST index ee08086e83..e2194e69ca 100644 --- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST @@ -1,5 +1,3 @@ [check_menuPosition] ubuntu-14.04 ubuntu-16.04 -[task256322_highlight] -osx diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index bc50e4f1d8..12afb77281 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -48,6 +48,18 @@ QT_FORWARD_DECLARE_CLASS(QMainWindow) #include +// Helper to calculate the action position in window coordinates +static inline QPoint widgetToWindowPos(const QWidget *w, const QPoint &pos) +{ + const QWindow *window = w->window()->windowHandle(); + Q_ASSERT(window); + return window->mapFromGlobal(w->mapToGlobal(pos)); +} + +static QPoint menuBarActionWindowPos(const QMenuBar *mb, QAction *a) +{ + return widgetToWindowPos(mb, mb->actionGeometry(a).center()); +} class Menu : public QMenu { @@ -1194,21 +1206,19 @@ void tst_QMenuBar::check_menuPosition() menu.close(); } -# ifndef QT_NO_CURSOR // QTBUG-28031: Click at bottom-right corner. { w.move(400, 200); LayoutDirectionSaver directionSaver(Qt::RightToLeft); QMenuBar *mb = w.menuBar(); - const QPoint localPos = mb->actionGeometry(menu.menuAction()).bottomRight() - QPoint(1, 1); - const QPoint globalPos = mb->mapToGlobal(localPos); - QCursor::setPos(globalPos); - QTest::mouseClick(mb, Qt::LeftButton, 0, localPos); + const QPoint bottomRight = mb->actionGeometry(menu.menuAction()).bottomRight() - QPoint(1, 1); + const QPoint localPos = widgetToWindowPos(mb, bottomRight); + const QPoint globalPos = w.mapToGlobal(localPos); + QTest::mouseClick(w.windowHandle(), Qt::LeftButton, 0, localPos); QTRY_VERIFY(menu.isActiveWindow()); QCOMPARE(menu.geometry().right() - 1, globalPos.x()); menu.close(); } -# endif // QT_NO_CURSOR } #endif @@ -1246,10 +1256,8 @@ void tst_QMenuBar::task223138_triggered() void tst_QMenuBar::task256322_highlight() { - if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) - || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { - QSKIP("Highlighting does not work correctly for minimal/offscreen platforms"); - } + if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) + QSKIP("Highlighting does not work correctly for minimal platform"); QMainWindow win; win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars @@ -1266,31 +1274,26 @@ void tst_QMenuBar::task256322_highlight() QApplication::setActiveWindow(&win); QVERIFY(QTest::qWaitForWindowActive(&win)); - QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center()); - QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file).center()); - QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center()); + const QPoint filePos = menuBarActionWindowPos(win.menuBar(), file); + QWindow *window = win.windowHandle(); + QTest::mousePress(window, Qt::LeftButton, 0, filePos); + QTest::mouseMove(window, filePos); + QTest::mouseRelease(window, Qt::LeftButton, 0, filePos); QTRY_VERIFY(menu.isVisible()); QVERIFY(!menu2.isVisible()); QCOMPARE(win.menuBar()->activeAction(), file); - QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file2).center()); - QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center()); + const QPoint file2Pos = menuBarActionWindowPos(win.menuBar(), file2); + QTest::mouseMove(window, file2Pos); QTRY_VERIFY(!menu.isVisible()); - QVERIFY(menu2.isVisible()); + QTRY_VERIFY(menu2.isVisible()); QCOMPARE(win.menuBar()->activeAction(), file2); - QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file2).center()); - QPoint nothingCenter = win.menuBar()->actionGeometry(nothing).center(); - QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, nothingCenter); - QTest::mouseMove(win.menuBar(), nothingCenter); + QPoint nothingCenter = menuBarActionWindowPos(win.menuBar(), nothing); + QTest::mouseMove(window, nothingCenter); QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); -#ifdef Q_OS_MAC - if (win.menuBar()->activeAction() != nothing) - QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue); -#endif QTRY_COMPARE(win.menuBar()->activeAction(), nothing); - QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, nothingCenter); } void tst_QMenuBar::menubarSizeHint() @@ -1427,9 +1430,6 @@ void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu QMainWindow mainWindow; mainWindow.resize(300, 200); centerOnScreen(&mainWindow); -#ifndef QT_NO_CURSOR - QCursor::setPos(mainWindow.geometry().topLeft() - QPoint(100, 0)); -#endif QMenuBar *menuBar = mainWindow.menuBar(); menuBar->setNativeMenuBar(false); QMenu *fileMenu = menuBar->addMenu(QStringLiteral("OpenCloseOpen")); @@ -1437,14 +1437,17 @@ void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu mainWindow.show(); QApplication::setActiveWindow(&mainWindow); QVERIFY(QTest::qWaitForWindowActive(&mainWindow)); - const QPoint center = menuBar->actionGeometry(fileMenu->menuAction()).center(); - const QPoint globalPos = menuBar->mapToGlobal(center); - QTest::mouseMove(menuBar, center); - QTest::mouseClick(menuBar, Qt::LeftButton, 0, center); + + const QPoint center = menuBarActionWindowPos(mainWindow.menuBar(), fileMenu->menuAction()); + const QPoint globalPos = mainWindow.mapToGlobal(center); + + QWindow *window = mainWindow.windowHandle(); + QTest::mouseMove(window, center); + QTest::mouseClick(window, Qt::LeftButton, 0, center); QTRY_VERIFY(fileMenu->isVisible()); - QTest::mouseClick(fileMenu, Qt::LeftButton, 0, fileMenu->mapFromGlobal(globalPos)); + QTest::mouseClick(window, Qt::LeftButton, 0, fileMenu->mapFromGlobal(globalPos)); QTRY_VERIFY(!fileMenu->isVisible()); - QTest::mouseClick(menuBar, Qt::LeftButton, 0, center); + QTest::mouseClick(window, Qt::LeftButton, 0, center); QTRY_VERIFY(fileMenu->isVisible()); } -- cgit v1.2.3 From 1a647926528136850c8a0e4c2aa5ae23e22172ea Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 30 Oct 2017 09:58:15 +0100 Subject: tst_QTcpSocket::suddenRemoteDisconnect - fix flakyness This test starts two processes - server and client - and requires an external executable ('stressTest'). In .pro file we have SUBDIRS containing both 'test' (test itself) and 'stressTest' (client/server app), but there is no explicit dependency and as result we run the test before we build 'stressTest' thus failing to start those processes. This patch makes 'test' dependent on 'stressTest'. Task-number: QTBUG-36629 Change-Id: I286b08bcff86b9afc4bbee87a75e887527eaf5f2 Reviewed-by: Gatis Paeglis --- tests/auto/network/socket/qtcpsocket/qtcpsocket.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro index 1183b23556..1f13a396dd 100644 --- a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro @@ -1,6 +1,8 @@ TEMPLATE = subdirs SUBDIRS = test -!vxworks: SUBDIRS += stressTest - +!vxworks{ +SUBDIRS += stressTest +test.depends = stressTest +} requires(qtConfig(private_tests)) -- cgit v1.2.3 From b409cfa094c327cae0303c6fff39ae5dbb49ad80 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 30 Oct 2017 11:18:44 +0100 Subject: tst_QNetworkReply::ioHttpRedirectPolicy - blacklist for b2qt 64bit This test fails often and seems to be flaky. Task-number: QTBUG-62583 Change-Id: Id3af283c89e392634a7af6e11bd05775a4295798 Reviewed-by: Gatis Paeglis --- tests/auto/network/access/qnetworkreply/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index f2ccefb9d6..5edae13e34 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -24,6 +24,8 @@ windows windows [ioHttpRedirectMultipartPost] linux +[ioHttpRedirectPolicy] +b2qt 64bit [putWithServerClosingConnectionImmediately] windows [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] -- cgit v1.2.3 From a4f9cf23444dd76a11d4eb67c4ea65d5c3948894 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sat, 29 Jul 2017 11:28:13 +0200 Subject: Disable window shortcuts if there is a window modal dialog If a window is blocked by a WindowModal dialog, it should not be possible to trigger window shortcuts on that window if it receives a WindowActivate event. This currently happens if the blocked window gets clicked, because the window becomes the active_window and then QApplication sends it a WindowActivate event (this doesn't happen with application modal dialogs). The correctWidgetContext() function calls QApplicationPrivate::tryModalHelper() only if the shortcut context is ApplicationShortcut. This patch makes it call even if the shortcut context is WindowShortcut. Change-Id: Iff87d85bcae603a6a24128e0cedfa9d33b6485fd Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 52 ++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 3535e465b3..88ddb7c11d 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -26,7 +26,8 @@ ** ****************************************************************************/ - +#include +#include #include #include @@ -63,6 +64,8 @@ private slots: void task229128TriggeredSignalWhenInActiongroup(); void repeat(); void setData(); + void disableShortcutsWithBlockedWidgets_data(); + void disableShortcutsWithBlockedWidgets(); private: int m_lastEventType; @@ -424,5 +427,52 @@ void tst_QAction::setData() // QTBUG-62006 QCOMPARE(spy.count(), 1); } +void tst_QAction::disableShortcutsWithBlockedWidgets_data() +{ + QTest::addColumn("shortcutContext"); + QTest::addColumn("windowModality"); + + QTest::newRow("application modal dialog should block window shortcut.") + << Qt::WindowShortcut << Qt::ApplicationModal; + + QTest::newRow("application modal dialog should block application shortcut.") + << Qt::ApplicationShortcut << Qt::ApplicationModal; + + QTest::newRow("window modal dialog should block application shortcut.") + << Qt::ApplicationShortcut << Qt::WindowModal; + + QTest::newRow("window modal dialog should block window shortcut.") + << Qt::WindowShortcut << Qt::WindowModal; +} + + +void tst_QAction::disableShortcutsWithBlockedWidgets() +{ + QMainWindow window; + + QFETCH(Qt::ShortcutContext, shortcutContext); + QAction action(&window); + window.addAction(&action); + action.setShortcut(QKeySequence(Qt::Key_1)); + action.setShortcutContext(shortcutContext); + + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + QDialog dialog(&window); + QFETCH(Qt::WindowModality, windowModality); + dialog.setWindowModality(windowModality); + + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + + QApplication::setActiveWindow(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); + + QSignalSpy spy(&action, &QAction::triggered); + QTest::keyPress(&window, Qt::Key_1); + QCOMPARE(spy.count(), 0); +} + QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" -- cgit v1.2.3 From ca0f05ebe2a6a8e51e4c58b2994620cc51638a3f Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 3 Nov 2017 09:47:00 +0200 Subject: Skip d-bus tests also on armv7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both of the new toolchains (armv7 + arm64) have some problems with d-bus tests. Skip them until the toolchain has been fixed. Task-number: QTBUG-60263 Change-Id: Ic300f419635fb6b49b3ea7f48fa76c19088c88bd Reviewed-by: Tony Sarajärvi --- tests/auto/auto.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 3caa6a3b65..a1ffe5b3ce 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -46,5 +46,5 @@ else:!qtConfig(process): SUBDIRS -= tools # QTBUG-63915 boot2qt: { - contains(QT_ARCH, arm64): SUBDIRS -= dbus + SUBDIRS -= dbus } -- cgit v1.2.3 From 484a186f50de59279cf3c02088273ff114f4cfcf Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 4 Oct 2017 12:00:57 -0700 Subject: QNativeSocketEngine/Win: fix getting the datagram destination Looks like I never even tested this. There were two problems: 1) when we asked for the recvmsg and sendmsg functions, we used the wrong variable (socketDescriptor was still -1) 2) we extracted the destination addresses, but never set them in the QIpPacketHeader object The added tests confirm that this works on Windows, Linux, Darwin, FreeBSD. There also seems to be a problem, obtaining the destination address on an IPv4 socket with a dual-stack sender (I can reproduce that on FreeBSD, macOS and Windows, plus an old version of Linux). Task-number: QTBUG-63605 Change-Id: I638cf58bfa7b4e5fb386fffd14ea732bddbc0c42 Reviewed-by: Timur Pocheptsov --- tests/auto/network/socket/qudpsocket/test/test.pro | 1 + .../network/socket/qudpsocket/tst_qudpsocket.cpp | 171 +++++++++++++++------ 2 files changed, 126 insertions(+), 46 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro index 73486a2bc3..e856776ddc 100644 --- a/tests/auto/network/socket/qudpsocket/test/test.pro +++ b/tests/auto/network/socket/qudpsocket/test/test.pro @@ -1,6 +1,7 @@ CONFIG += testcase testcase.timeout = 800 # this test is slow SOURCES += ../tst_qudpsocket.cpp +INCLUDEPATH += ../../../../../shared/ QT = core network testlib MOC_DIR=tmp diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index aeb6e61cd2..0f46caa7c2 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -45,6 +45,7 @@ #include #include "../../../network-settings.h" +#include "emulationdetector.h" #ifndef QT_NO_BEARERMANAGEMENT #include @@ -227,6 +228,9 @@ void tst_QUdpSocket::initTestCase() QSKIP("No network test server available"); allAddresses = QNetworkInterface::allAddresses(); m_skipUnsupportedIPv6Tests = shouldSkipIpv6TestsForBrokenSetsockopt(); + + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("This test is unreliable due to QEMU emulation shortcomings."); } void tst_QUdpSocket::init() @@ -445,31 +449,58 @@ void tst_QUdpSocket::loop() paul.setProperty("_q_networksession", QVariant::fromValue(networkSession)); #endif - QVERIFY2(peter.bind(), peter.errorString().toLatin1().constData()); - QVERIFY2(paul.bind(), paul.errorString().toLatin1().constData()); + // make sure we bind to IPv4 + QHostAddress localhost = QHostAddress::LocalHost; + QVERIFY2(peter.bind(localhost), peter.errorString().toLatin1().constData()); + QVERIFY2(paul.bind(localhost), paul.errorString().toLatin1().constData()); QHostAddress peterAddress = makeNonAny(peter.localAddress()); - QHostAddress pualAddress = makeNonAny(paul.localAddress()); + QHostAddress paulAddress = makeNonAny(paul.localAddress()); QCOMPARE(peter.writeDatagram(peterMessage.data(), peterMessage.length(), - pualAddress, paul.localPort()), qint64(peterMessage.length())); + paulAddress, paul.localPort()), qint64(peterMessage.length())); QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(), peterAddress, peter.localPort()), qint64(paulMessage.length())); QVERIFY2(peter.waitForReadyRead(9000), QtNetworkSettings::msgSocketError(peter).constData()); QVERIFY2(paul.waitForReadyRead(9000), QtNetworkSettings::msgSocketError(paul).constData()); - char peterBuffer[16*1024]; - char paulBuffer[16*1024]; + + QNetworkDatagram peterDatagram = peter.receiveDatagram(paulMessage.length() * 2); + QNetworkDatagram paulDatagram = paul.receiveDatagram(peterMessage.length() * 2); if (success) { - QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length())); - QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length())); + QCOMPARE(peterDatagram.data().length(), qint64(paulMessage.length())); + QCOMPARE(paulDatagram.data().length(), qint64(peterMessage.length())); } else { - QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length()); - QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length()); + // this code path seems to never be executed + QVERIFY(peterDatagram.data().length() != paulMessage.length()); + QVERIFY(paulDatagram.data().length() != peterMessage.length()); } - QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage); - QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage); + QCOMPARE(peterDatagram.data().left(paulMessage.length()), paulMessage); + QCOMPARE(paulDatagram.data().left(peterMessage.length()), peterMessage); + + QCOMPARE(peterDatagram.senderAddress(), paulAddress); + QCOMPARE(paulDatagram.senderAddress(), peterAddress); + QCOMPARE(paulDatagram.senderPort(), int(peter.localPort())); + QCOMPARE(peterDatagram.senderPort(), int(paul.localPort())); + + // Unlike for IPv6 with IPV6_PKTINFO, IPv4 has no standardized way of + // obtaining the packet's destination addresses. The destinationAddress and + // destinationPort calls could fail, so whitelist the OSes for which we + // know we have an implementation. +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN) + QVERIFY(peterDatagram.destinationPort() != -1); + QVERIFY(paulDatagram.destinationPort() != -1); +#endif + if (peterDatagram.destinationPort() == -1) { + QCOMPARE(peterDatagram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol); + QCOMPARE(paulDatagram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol); + } else { + QCOMPARE(peterDatagram.destinationAddress(), makeNonAny(peter.localAddress())); + QCOMPARE(paulDatagram.destinationAddress(), makeNonAny(paul.localAddress())); + QVERIFY(peterDatagram.destinationAddress().isEqual(makeNonAny(peter.localAddress()))); + QVERIFY(paulDatagram.destinationAddress().isEqual(makeNonAny(paul.localAddress()))); + } } //---------------------------------------------------------------------------------- @@ -492,8 +523,8 @@ void tst_QUdpSocket::ipv6Loop() paul.setProperty("_q_networksession", QVariant::fromValue(networkSession)); #endif - quint16 peterPort; - quint16 paulPort; + int peterPort; + int paulPort; if (!peter.bind(QHostAddress(QHostAddress::LocalHostIPv6), 0)) { QCOMPARE(peter.error(), QUdpSocket::UnsupportedSocketOperationError); @@ -502,6 +533,8 @@ void tst_QUdpSocket::ipv6Loop() QVERIFY(paul.bind(QHostAddress(QHostAddress::LocalHostIPv6), 0)); + QHostAddress peterAddress = makeNonAny(peter.localAddress()); + QHostAddress paulAddress = makeNonAny(paul.localAddress()); peterPort = peter.localPort(); paulPort = paul.localPort(); @@ -510,20 +543,33 @@ void tst_QUdpSocket::ipv6Loop() QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(), QHostAddress("::1"), peterPort), qint64(paulMessage.length())); - char peterBuffer[16*1024]; - char paulBuffer[16*1024]; QVERIFY(peter.waitForReadyRead(5000)); QVERIFY(paul.waitForReadyRead(5000)); + QNetworkDatagram peterDatagram = peter.receiveDatagram(paulMessage.length() * 2); + QNetworkDatagram paulDatagram = paul.receiveDatagram(peterMessage.length() * 2); + if (success) { - QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length())); - QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length())); + QCOMPARE(peterDatagram.data().length(), qint64(paulMessage.length())); + QCOMPARE(paulDatagram.data().length(), qint64(peterMessage.length())); } else { - QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length()); - QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length()); + // this code path seems to never be executed + QVERIFY(peterDatagram.data().length() != paulMessage.length()); + QVERIFY(paulDatagram.data().length() != peterMessage.length()); } - QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage); - QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage); + QCOMPARE(peterDatagram.data().left(paulMessage.length()), paulMessage); + QCOMPARE(paulDatagram.data().left(peterMessage.length()), peterMessage); + + QCOMPARE(peterDatagram.senderAddress(), paulAddress); + QCOMPARE(paulDatagram.senderAddress(), peterAddress); + QCOMPARE(paulDatagram.senderPort(), peterPort); + QCOMPARE(peterDatagram.senderPort(), paulPort); + + // For IPv6, IPV6_PKTINFO is a mandatory feature (RFC 3542). + QCOMPARE(peterDatagram.destinationAddress(), makeNonAny(peter.localAddress())); + QCOMPARE(paulDatagram.destinationAddress(), makeNonAny(paul.localAddress())); + QCOMPARE(peterDatagram.destinationPort(), peterPort); + QCOMPARE(paulDatagram.destinationPort(), paulPort); } void tst_QUdpSocket::dualStack() @@ -539,17 +585,23 @@ void tst_QUdpSocket::dualStack() QByteArray v4Data("v4"); QVERIFY(v4Sock.bind(QHostAddress(QHostAddress::AnyIPv4), 0)); - QHostAddress from; - quint16 port; - QByteArray buffer; //test v4 -> dual QCOMPARE((int)v4Sock.writeDatagram(v4Data.constData(), v4Data.length(), QHostAddress(QHostAddress::LocalHost), dualSock.localPort()), v4Data.length()); QVERIFY2(dualSock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(dualSock).constData()); - buffer.reserve(100); - qint64 size = dualSock.readDatagram(buffer.data(), 100, &from, &port); - QCOMPARE((int)size, v4Data.length()); - buffer.resize(size); - QCOMPARE(buffer, v4Data); + QNetworkDatagram dgram = dualSock.receiveDatagram(100); + QVERIFY(dgram.isValid()); + QCOMPARE(dgram.data(), v4Data); + QCOMPARE(dgram.senderPort(), int(v4Sock.localPort())); + // receiving v4 on dual stack will receive as IPv6, so use isEqual() + QVERIFY(dgram.senderAddress().isEqual(makeNonAny(v4Sock.localAddress(), QHostAddress::Null))); + if (dualSock.localAddress().protocol() == QAbstractSocket::IPv4Protocol) + QCOMPARE(dgram.senderAddress(), makeNonAny(v4Sock.localAddress(), QHostAddress::Null)); + if (dgram.destinationPort() != -1) { + QCOMPARE(dgram.destinationPort(), int(dualSock.localPort())); + QVERIFY(dgram.destinationAddress().isEqual(dualSock.localAddress())); + } else { + qInfo("Getting IPv4 destination address failed."); + } if (QtNetworkSettings::hasIPv6()) { QUdpSocket v6Sock; @@ -559,30 +611,41 @@ void tst_QUdpSocket::dualStack() //test v6 -> dual QCOMPARE((int)v6Sock.writeDatagram(v6Data.constData(), v6Data.length(), QHostAddress(QHostAddress::LocalHostIPv6), dualSock.localPort()), v6Data.length()); QVERIFY2(dualSock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(dualSock).constData()); - buffer.reserve(100); - size = dualSock.readDatagram(buffer.data(), 100, &from, &port); - QCOMPARE((int)size, v6Data.length()); - buffer.resize(size); - QCOMPARE(buffer, v6Data); + dgram = dualSock.receiveDatagram(100); + QVERIFY(dgram.isValid()); + QCOMPARE(dgram.data(), v6Data); + QCOMPARE(dgram.senderPort(), int(v6Sock.localPort())); + QCOMPARE(dgram.senderAddress(), makeNonAny(v6Sock.localAddress(), QHostAddress::LocalHostIPv6)); + QCOMPARE(dgram.destinationPort(), int(dualSock.localPort())); + QCOMPARE(dgram.destinationAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHostIPv6)); //test dual -> v6 QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHostIPv6), v6Sock.localPort()), dualData.length()); QVERIFY2(v6Sock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(v6Sock).constData()); - buffer.reserve(100); - size = v6Sock.readDatagram(buffer.data(), 100, &from, &port); - QCOMPARE((int)size, dualData.length()); - buffer.resize(size); - QCOMPARE(buffer, dualData); + dgram = v6Sock.receiveDatagram(100); + QVERIFY(dgram.isValid()); + QCOMPARE(dgram.data(), dualData); + QCOMPARE(dgram.senderPort(), int(dualSock.localPort())); + QCOMPARE(dgram.senderAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHostIPv6)); + QCOMPARE(dgram.destinationPort(), int(v6Sock.localPort())); + QCOMPARE(dgram.destinationAddress(), makeNonAny(v6Sock.localAddress(), QHostAddress::LocalHostIPv6)); } //test dual -> v4 QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHost), v4Sock.localPort()), dualData.length()); QVERIFY2(v4Sock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(v4Sock).constData()); - buffer.reserve(100); - size = v4Sock.readDatagram(buffer.data(), 100, &from, &port); - QCOMPARE((int)size, dualData.length()); - buffer.resize(size); - QCOMPARE(buffer, dualData); + dgram = v4Sock.receiveDatagram(100); + QVERIFY(dgram.isValid()); + QCOMPARE(dgram.data(), dualData); + QCOMPARE(dgram.senderPort(), int(dualSock.localPort())); + QCOMPARE(dgram.senderAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHost)); +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN) + QVERIFY(dgram.destinationPort() != -1); +#endif + if (dgram.destinationPort() != -1) { + QCOMPARE(dgram.destinationPort(), int(v4Sock.localPort())); + QCOMPARE(dgram.destinationAddress(), makeNonAny(v4Sock.localAddress(), QHostAddress::LocalHost)); + } } void tst_QUdpSocket::dualStackAutoBinding() @@ -1603,6 +1666,8 @@ void tst_QUdpSocket::linkLocalIPv6() QVERIFY(dgram.isValid()); QCOMPARE(dgram.senderAddress(), s->localAddress()); QCOMPARE(dgram.senderPort(), int(s->localPort())); + QCOMPARE(dgram.destinationAddress(), s->localAddress()); + QCOMPARE(dgram.destinationPort(), int(neutral.localPort())); QCOMPARE(dgram.data().length(), testData.length()); QCOMPARE(dgram.data(), testData); @@ -1684,6 +1749,20 @@ void tst_QUdpSocket::linkLocalIPv4() QCOMPARE(dgram.data().length(), testData.length()); QCOMPARE(dgram.data(), testData); + // Unlike for IPv6 with IPV6_PKTINFO, IPv4 has no standardized way of + // obtaining the packet's destination addresses. The destinationAddress + // and destinationPort calls could fail, so whitelist the OSes we know + // we have an implementation. +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN) + QVERIFY(dgram.destinationPort() != -1); +#endif + if (dgram.destinationPort() == -1) { + QCOMPARE(dgram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol); + } else { + QCOMPARE(dgram.destinationAddress(), s->localAddress()); + QCOMPARE(dgram.destinationPort(), int(neutral.localPort())); + } + QVERIFY(neutral.writeDatagram(dgram.makeReply(testData))); dgram = s->receiveDatagram(testData.length() * 2); -- cgit v1.2.3 From 84396a3f938453b81e6ecc73bd54ff6b08960e8f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Nov 2017 13:55:50 +0100 Subject: tst_QNetworkReply: Blacklist ioHttpRedirectPostPut for Linux Change-Id: I7db143bbd2e178e944f4cfc6c184850238f3bc8c Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 5edae13e34..091ec28bea 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -26,6 +26,8 @@ windows linux [ioHttpRedirectPolicy] b2qt 64bit +[ioHttpRedirectPostPut] +linux [putWithServerClosingConnectionImmediately] windows [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] -- cgit v1.2.3 From 254849b62a4aa5a34f18bf8e47a9cb9293d3f8b9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Oct 2017 09:15:23 +0100 Subject: macOS: Blacklist tst_QSequentialAnimationGroup::groupWithZeroDurationAnimations() Task-number: QTBUG-64109 Change-Id: Iebe5a07d108ba647baa74ded71b730c867bd1c41 Reviewed-by: Jesus Fernandez --- tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST index 391e3f67af..2a31afd735 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST @@ -3,3 +3,5 @@ windows [finishWithUncontrolledAnimation] windows osx-10.12 +[groupWithZeroDurationAnimations] +osx -- cgit v1.2.3 From 01f5f77c66dd6e4c15e0e0d8445e3560543e1973 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 30 Oct 2017 13:44:03 +0100 Subject: tests: skip tst_QMenuBar::check_cursorKeys* on Unity This test is flaky on Unity due to regression introduced by QTBUG-39362. Skip the test functions until QTBUG-39362 is resolved. These test functions do not fail on Gnome and KDE, so the functionality tested by check_cursorKeys* will be covered by other linux distributions in CI. Change-Id: Ifd1a7779a9728142424f4956dd6466c822ccde91 Reviewed-by: Frederik Gladhorn --- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 12afb77281..65181a9516 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -633,6 +633,9 @@ void tst_QMenuBar::check_accelKeys() #if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys1() { + if (qgetenv("XDG_CURRENT_DESKTOP") == "Unity") + QSKIP("This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362"); + QMainWindow w; initWindowWithComplexMenuBar(w); w.show(); @@ -667,6 +670,9 @@ void tst_QMenuBar::check_cursorKeys1() #if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys2() { + if (qgetenv("XDG_CURRENT_DESKTOP") == "Unity") + QSKIP("This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362"); + QMainWindow w; initWindowWithComplexMenuBar(w); w.show(); @@ -700,6 +706,9 @@ void tst_QMenuBar::check_cursorKeys2() #if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys3() { + if (qgetenv("XDG_CURRENT_DESKTOP") == "Unity") + QSKIP("This test is flaky on Ubuntu/Unity due to regression introduced by QTBUG-39362"); + QMainWindow w; initWindowWithComplexMenuBar(w); w.show(); -- cgit v1.2.3 From ad36da8ff416501e249beb098e5b84eaa2fba43d Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 30 Oct 2017 13:45:18 +0100 Subject: testlib: start sharing common helper functions ... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This header file is a convenient staging area for helper APIs, eventually some could be moved to public QTest API. This header file utilizes the same pattern as other qtestlib header files - wrapping functions with QT_${LIBNAME}_LIB to automatically enable certain APIs based on what is in the projects dependencies, e.g. QT += widgets. Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro | 2 +- .../corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 13 ++----------- .../auto/corelib/io/qtemporaryfile/qtemporaryfile.pro | 2 +- .../corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 16 ++++------------ tests/auto/other/qaccessibility/qaccessibility.pro | 2 +- .../auto/other/qaccessibility/tst_qaccessibility.cpp | 12 +++--------- .../graphicsview/qgraphicsitem/qgraphicsitem.pro | 2 +- .../graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 14 ++------------ .../graphicsview/qgraphicsview/qgraphicsview.pro | 2 +- .../graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 12 ++++-------- .../itemviews/qabstractitemview/qabstractitemview.pro | 2 +- .../qabstractitemview/tst_qabstractitemview.cpp | 15 ++------------- .../widgets/itemviews/qcolumnview/qcolumnview.pro | 2 +- .../widgets/itemviews/qcolumnview/tst_qcolumnview.cpp | 11 +++-------- tests/auto/widgets/itemviews/qlistview/qlistview.pro | 2 +- .../widgets/itemviews/qlistview/tst_qlistview.cpp | 14 ++++---------- .../auto/widgets/itemviews/qtableview/qtableview.pro | 2 +- .../widgets/itemviews/qtableview/tst_qtableview.cpp | 14 ++++---------- tests/auto/widgets/itemviews/qtreeview/qtreeview.pro | 2 +- .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 ++++---------- tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro | 2 +- .../auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp | 10 +++------- tests/auto/widgets/kernel/qformlayout/qformlayout.pro | 2 +- .../widgets/kernel/qformlayout/tst_qformlayout.cpp | 12 ++++-------- tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro | 2 +- .../widgets/kernel/qgridlayout/tst_qgridlayout.cpp | 12 +++--------- tests/auto/widgets/kernel/qlayout/qlayout.pro | 2 +- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 10 +++------- tests/auto/widgets/kernel/qwidget/qwidget.pro | 2 +- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 19 +++---------------- .../widgets/kernel/qwidget_window/qwidget_window.pro | 2 +- .../kernel/qwidget_window/tst_qwidget_window.cpp | 10 +++------- .../widgets/kernel/qwidgetaction/qwidgetaction.pro | 2 +- .../kernel/qwidgetaction/tst_qwidgetaction.cpp | 10 +++------- tests/auto/widgets/styles/qstyle/qstyle.pro | 2 +- tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 12 +++--------- .../styles/qstylesheetstyle/qstylesheetstyle.pro | 2 +- .../styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 7 ++----- tests/auto/widgets/util/qcompleter/qcompleter.pro | 2 +- tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp | 10 +++------- .../widgets/qabstractslider/qabstractslider.pro | 2 +- .../widgets/qabstractslider/tst_qabstractslider.cpp | 12 ++++-------- .../widgets/qabstractspinbox/qabstractspinbox.pro | 2 +- .../widgets/qabstractspinbox/tst_qabstractspinbox.cpp | 13 ++----------- tests/auto/widgets/widgets/qcombobox/qcombobox.pro | 2 +- .../auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 10 +++------- tests/auto/widgets/widgets/qlineedit/qlineedit.pro | 2 +- .../auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 12 ++---------- tests/auto/widgets/widgets/qmenu/qmenu.pro | 2 +- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 14 +++----------- tests/auto/widgets/widgets/qmenubar/qmenubar.pro | 2 +- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 10 ++++------ tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro | 2 +- .../widgets/widgets/qscrollbar/tst_qscrollbar.cpp | 11 ++--------- 54 files changed, 109 insertions(+), 274 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro index 351e263093..5908648378 100644 --- a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro +++ b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro @@ -4,4 +4,4 @@ SOURCES += tst_qtemporarydir.cpp INCLUDEPATH += ../../../../shared/ HEADERS += ../../../../shared/emulationdetector.h -QT = core testlib +QT = core testlib testlib-private diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 4bed8d0fd6..4cb3bfe549 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef Q_OS_WIN # include #endif @@ -112,16 +113,6 @@ void tst_QTemporaryDir::getSetCheck() QCOMPARE(true, obj1.autoRemove()); } -static inline bool canHandleUnicodeFileNames() -{ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - return true; -#else - // Check for UTF-8 by converting the Euro symbol (see tst_utf8) - return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254"); -#endif -} - static QString hanTestText() { QString text; @@ -160,7 +151,7 @@ void tst_QTemporaryDir::fileTemplate_data() QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_"; QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_"; QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_"; - if (canHandleUnicodeFileNames()) { + if (QTestPrivate::canHandleUnicodeFileNames()) { // Test Umlauts (contained in Latin1) QString prefix = "qt_" + umlautTestText(); QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix; diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index a89e5c66ff..e17cb05cd8 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qtemporaryfile -QT = core testlib +QT = core testlib testlib-private SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp RESOURCES += qtemporaryfile.qrc diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index ab6b435125..64b61839c1 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -36,6 +36,8 @@ #include #include +#include + #if defined(Q_OS_WIN) # include #endif @@ -141,16 +143,6 @@ void tst_QTemporaryFile::getSetCheck() QCOMPARE(true, obj1.autoRemove()); } -static inline bool canHandleUnicodeFileNames() -{ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - return true; -#else - // Check for UTF-8 by converting the Euro symbol (see tst_utf8) - return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254"); -#endif -} - static QString hanTestText() { QString text; @@ -199,7 +191,7 @@ void tst_QTemporaryFile::fileTemplate_data() QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx"; QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx"; QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX"; - if (canHandleUnicodeFileNames()) { + if (QTestPrivate::canHandleUnicodeFileNames()) { // Test Umlauts (contained in Latin1) QString prefix = "qt_" + umlautTestText(); QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << QString() << QString(); @@ -761,7 +753,7 @@ void tst_QTemporaryFile::QTBUG_4796_data() QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true; QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false; - if (canHandleUnicodeFileNames()) { + if (QTestPrivate::canHandleUnicodeFileNames()) { QTest::newRow("XXXXXX") << QString() << unicode << true; QTest::newRow("XXXXXX") << unicode << QString() << true; QTest::newRow("XXXXXX") << unicode << unicode << true; diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 727d5fe0d7..bfe652d25a 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qaccessibility requires(qtConfig(accessibility)) -QT += testlib core-private gui-private widgets-private +QT += testlib core-private gui-private widgets-private testlib-private SOURCES += tst_qaccessibility.cpp HEADERS += accessiblewidgets.h diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index b857501e8f..d98bbe28b7 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -59,15 +59,9 @@ #include "accessiblewidgets.h" -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface, int index, const QRect &domain) diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 88526144fc..ae6de48195 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qgraphicsitem -QT += widgets widgets-private testlib +QT += widgets widgets-private testlib testlib-private QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 96827022a8..0fc1a643b4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -127,17 +128,6 @@ static void sendKeyClick(QGraphicsScene *scene, Qt::Key key) sendKeyRelease(scene, key); } -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} - class EventSpy : public QGraphicsWidget { Q_OBJECT @@ -4211,7 +4201,7 @@ void tst_QGraphicsItem::cursor() QWidget topLevel; topLevel.resize(250, 150); - centerOnScreen(&topLevel); + QTestPrivate::centerOnScreen(&topLevel); QGraphicsView view(&scene,&topLevel); view.setFixedSize(200, 100); topLevel.show(); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro index 258b5e0e14..8ed19697a4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro @@ -3,7 +3,7 @@ testcase.timeout = 500 # this test is slow TARGET = tst_qgraphicsview QT += widgets widgets-private testlib -QT += core-private gui-private +QT += core-private gui-private testlib-private SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp HEADERS += tst_qgraphicsview.h diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 5900c85627..5b557dba58 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -61,6 +61,10 @@ #include "tst_qgraphicsview.h" +#include + +using namespace QTestPrivate; + Q_DECLARE_METATYPE(ExpectedValueDescription) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) @@ -130,14 +134,6 @@ class FriendlyGraphicsScene : public QGraphicsScene }; #endif -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - class tst_QGraphicsView : public QObject { Q_OBJECT diff --git a/tests/auto/widgets/itemviews/qabstractitemview/qabstractitemview.pro b/tests/auto/widgets/itemviews/qabstractitemview/qabstractitemview.pro index 2f0ca73265..4ee7f28af6 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/qabstractitemview.pro +++ b/tests/auto/widgets/itemviews/qabstractitemview/qabstractitemview.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qabstractitemview -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qabstractitemview.cpp diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 2234b2b488..165c4b079e 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -57,19 +58,7 @@ Q_DECLARE_METATYPE(Qt::ItemFlags); -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} +using namespace QTestPrivate; // Move cursor out of widget area to avoid undesired interaction on Mac. static inline void moveCursorAway(const QWidget *topLevel) diff --git a/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro b/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro index 5096cc691a..0b3dcd9e80 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro +++ b/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro @@ -1,6 +1,6 @@ CONFIG += testcase QT += widgets widgets-private -QT += gui-private core-private testlib +QT += gui-private core-private testlib testlib-private SOURCES += tst_qcolumnview.cpp HEADERS += ../../../../shared/fakedirmodel.h diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 62acf49f4a..38e6d95ba4 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -28,6 +28,7 @@ #include "../../../../shared/fakedirmodel.h" #include +#include #include #include #include @@ -369,12 +370,6 @@ void tst_QColumnView::scrollTo_data() QTest::newRow("reverse") << true << false; } -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - void tst_QColumnView::scrollTo() { QFETCH(bool, reverse); @@ -386,7 +381,7 @@ void tst_QColumnView::scrollTo() view.resize(200, 200); topLevel.show(); topLevel.activateWindow(); - centerOnScreen(&topLevel); + QTestPrivate::centerOnScreen(&topLevel); QVERIFY(QTest::qWaitForWindowActive(&topLevel)); view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible); @@ -1004,7 +999,7 @@ void tst_QColumnView::dynamicModelChanges() ColumnView view; view.setModel(&model); view.setItemDelegate(&delegate); - centerOnScreen(&view); + QTestPrivate::centerOnScreen(&view); view.show(); QStandardItem *item = new QStandardItem(QLatin1String("item")); diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 44e25ded66..e49a0c5fbf 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qlistview -QT += widgets gui-private widgets-private core-private testlib +QT += widgets gui-private widgets-private core-private testlib testlib-private SOURCES += tst_qlistview.cpp win32:!winrt: LIBS += -luser32 linux*: CONFIG += insignificant_test # Crashes diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index b9785c35ac..d8b8546d86 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -46,6 +46,10 @@ #include #include +#include + +using namespace QTestPrivate; + #if defined(Q_OS_WIN) # include # include @@ -64,16 +68,6 @@ Q_DECLARE_METATYPE(QAbstractItemView::ScrollMode) Q_DECLARE_METATYPE(QMargins) Q_DECLARE_METATYPE(QSize) -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - static QStringList generateList(const QString &prefix, int size) { QStringList result; diff --git a/tests/auto/widgets/itemviews/qtableview/qtableview.pro b/tests/auto/widgets/itemviews/qtableview/qtableview.pro index e02da95ab9..a02f96eb99 100644 --- a/tests/auto/widgets/itemviews/qtableview/qtableview.pro +++ b/tests/auto/widgets/itemviews/qtableview/qtableview.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qtableview QT += widgets widgets-private testlib -QT += core-private gui-private +QT += core-private gui-private testlib-private SOURCES += tst_qtableview.cpp diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index a27e0b6048..4e401ddd86 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -35,6 +35,10 @@ #include +#include + +using namespace QTestPrivate; + #ifdef QT_BUILD_INTERNAL #define VERIFY_SPANS_CONSISTENCY(TEST_VIEW_) \ QVERIFY(static_cast(QObjectPrivate::get(TEST_VIEW_))->spans.checkConsistency()) @@ -46,16 +50,6 @@ typedef QList IntList; typedef QList BoolList; -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - class tst_QTableView : public QObject { Q_OBJECT diff --git a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro index 3abd58e73d..2530b44935 100644 --- a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro +++ b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qtreeview QT += widgets testlib -QT += widgets-private gui-private core-private +QT += widgets-private gui-private core-private testlib-private SOURCES += tst_qtreeview.cpp HEADERS += ../../../../shared/fakedirmodel.h diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index e2886cfcfe..6ee0e50cce 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -33,6 +33,10 @@ #include #include +#include + +using namespace QTestPrivate; + #ifndef QT_NO_DRAGANDDROP Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode) #endif @@ -57,16 +61,6 @@ static void initStandardTreeModel(QStandardItemModel *model) model->insertRow(2, item); } -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - class tst_QTreeView : public QObject { Q_OBJECT diff --git a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro index 90e83f5285..1a2c6d6f66 100644 --- a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro +++ b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qboxlayout -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qboxlayout.cpp diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 0b35db1b5f..1dac242114 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -31,13 +31,9 @@ #include #include -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QBoxLayout : public QObject { diff --git a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro index be944605a3..617183fee6 100644 --- a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro +++ b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qformlayout -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qformlayout.cpp diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index c324a4bd56..1ccda25339 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -41,20 +41,16 @@ #include #include +#include + +using namespace QTestPrivate; + #include // ItemRole has enumerators for numerical values 0..2, thus the only // valid numerical values for storing into an ItemRole variable are 0..3: Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3); -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - struct QFormLayoutTakeRowResultHolder { QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW : labelItem(result.labelItem), diff --git a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro index ee64f8538f..8947658e8c 100644 --- a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro +++ b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro @@ -2,7 +2,7 @@ CONFIG += testcase TARGET = tst_qgridlayout QT += widgets widgets-private testlib -QT += core-private gui-private +QT += core-private gui-private testlib-private SOURCES += tst_qgridlayout.cpp FORMS += sortdialog.ui diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index c1ab5f51be..37e2bdb069 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -41,15 +41,9 @@ #include #include -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QGridLayout : public QObject { diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index d460785158..8e0ea1bfdb 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qlayout -QT += widgets widgets-private testlib +QT += widgets widgets-private testlib testlib-private SOURCES += tst_qlayout.cpp TESTDATA += baseline/* diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index 829d0ea098..a55693bb6c 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -44,13 +44,9 @@ #include #include -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QLayout : public QObject { diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index 499ca65516..3e4e96760b 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -2,7 +2,7 @@ CONFIG += testcase testcase.timeout = 600 # this test is slow TARGET = tst_qwidget -QT += widgets core-private gui-private widgets-private testlib +QT += widgets core-private gui-private widgets-private testlib testlib-private SOURCES += tst_qwidget.cpp RESOURCES = qwidget.qrc diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index baecc43f2c..a7aa99d2a8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -72,6 +72,9 @@ #endif #include +#include + +using namespace QTestPrivate; #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include @@ -108,22 +111,6 @@ bool macHasAccessToWindowsServer() } #endif -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static inline void setWindowsAnimationsEnabled(bool enabled) { diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro index a6248dfd16..00bf763c35 100644 --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qwidget_window -QT += widgets testlib core-private gui-private +QT += widgets testlib core-private gui-private testlib-private SOURCES += tst_qwidget_window.cpp diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index f20978c295..e4564a8640 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -45,13 +45,9 @@ #include #include -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QWidget_window : public QObject { diff --git a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro index e4158559a9..f443758eea 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro +++ b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qwidgetaction -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qwidgetaction.cpp diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp index 1824285f05..28731223a9 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp @@ -38,13 +38,9 @@ #include #include -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QWidgetAction : public QObject { diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index a1e5a70a08..0fb7499946 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qstyle -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qstyle.cpp android { diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index fcb05f6b74..5369101dae 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -60,15 +60,9 @@ #include -// Make a widget frameless to prevent size constraints of title bars -// from interfering (Windows). -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QStyle : public QObject { diff --git a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro index 7d9a8576d3..3bf1b94050 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qstylesheetstyle -QT += widgets widgets-private gui-private testlib +QT += widgets widgets-private gui-private testlib testlib-private SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 693b0b8aee..7953077152 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -33,12 +33,9 @@ #include #include +#include -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} +using namespace QTestPrivate; class tst_QStyleSheetStyle : public QObject { diff --git a/tests/auto/widgets/util/qcompleter/qcompleter.pro b/tests/auto/widgets/util/qcompleter/qcompleter.pro index 19d8d500b8..fcdce93079 100644 --- a/tests/auto/widgets/util/qcompleter/qcompleter.pro +++ b/tests/auto/widgets/util/qcompleter/qcompleter.pro @@ -1,6 +1,6 @@ CONFIG += testcase TEMPLATE = app TARGET = tst_qcompleter -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qcompleter.cpp diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 3818b83584..92bcd5c350 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -34,15 +34,11 @@ #include #include +#include + #include "../../../../shared/filesystem.h" -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +using namespace QTestPrivate; class CsvCompleter : public QCompleter { diff --git a/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro index 6453999786..95385e2172 100644 --- a/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro +++ b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qabstractslider -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qabstractslider.cpp diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index f0d74e7797..70ae453896 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp @@ -36,17 +36,13 @@ #include #include +#include + +using namespace QTestPrivate; + // defined to be 120 by the wheel mouse vendors according to the docs #define WHEEL_DELTA 120 -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} - class Slider : public QAbstractSlider { public: diff --git a/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro index be758a8bdd..a4a6f84ee4 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro +++ b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro @@ -4,7 +4,7 @@ CONFIG += testcase TARGET = tst_qabstractspinbox -QT += widgets gui-private core-private testlib +QT += widgets gui-private core-private testlib testlib-private SOURCES += tst_qabstractspinbox.cpp diff --git a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp index 3fb4863b0e..0ce3b4cefe 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp +++ b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -38,16 +39,6 @@ #include "../../../shared/platforminputcontext.h" #include -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} class tst_QAbstractSpinBox : public QObject { @@ -182,7 +173,7 @@ void tst_QAbstractSpinBox::inputMethodUpdate() QSpinBox *testWidget = &box; testWidget->setRange(0, 1); - centerOnScreen(testWidget); + QTestPrivate::centerOnScreen(testWidget); testWidget->clear(); testWidget->show(); QVERIFY(QTest::qWaitForWindowExposed(testWidget)); diff --git a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro index 88b9d08557..939153dc88 100644 --- a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro +++ b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qcombobox -QT += widgets widgets-private gui-private core-private testlib +QT += widgets widgets-private gui-private core-private testlib testlib-private SOURCES += tst_qcombobox.cpp diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index bf190cf60a..2195f43ef1 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -67,13 +67,9 @@ #include "../../../shared/platforminputcontext.h" #include -static inline void setFrameless(QWidget *w) -{ - Qt::WindowFlags flags = w->windowFlags(); - flags |= Qt::FramelessWindowHint; - flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - w->setWindowFlags(flags); -} +#include + +using namespace QTestPrivate; class tst_QComboBox : public QObject { diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro index 636208d67a..cb24a80afd 100644 --- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro +++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qlineedit -QT += gui-private core-private widgets widgets-private testlib +QT += gui-private core-private widgets widgets-private testlib testlib-private SOURCES += tst_qlineedit.cpp osx: LIBS += -framework AppKit diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index cf1e19d598..2c6599631e 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -28,6 +28,7 @@ #include +#include #include "qlineedit.h" #include "qapplication.h" #include "qstringlist.h" @@ -74,16 +75,7 @@ QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} +using namespace QTestPrivate; class StyleOptionTestStyle : public QCommonStyle { diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro index 55fff01138..84b6530184 100644 --- a/tests/auto/widgets/widgets/qmenu/qmenu.pro +++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qmenu -QT += gui-private widgets testlib +QT += gui-private widgets testlib testlib-private SOURCES += tst_qmenu.cpp macx:{ OBJECTIVE_SOURCES += tst_qmenu_mac.mm diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index ad30db501a..99d29d487d 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include +#include #include #include #include @@ -48,15 +49,11 @@ #include +using namespace QTestPrivate; + Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - struct MenuMetrics { int fw; int hmargin; @@ -71,11 +68,6 @@ struct MenuMetrics { } }; -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} - class tst_QMenu : public QObject { Q_OBJECT diff --git a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro index e680cf4d7d..bde0026517 100644 --- a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro +++ b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qmenubar -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qmenubar.cpp macos: { diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 65181a9516..417fa9befa 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -48,6 +48,10 @@ QT_FORWARD_DECLARE_CLASS(QMainWindow) #include +#include + +using namespace QTestPrivate; + // Helper to calculate the action position in window coordinates static inline QPoint widgetToWindowPos(const QWidget *w, const QPoint &pos) { @@ -73,12 +77,6 @@ class Menu : public QMenu } }; -static inline void centerOnScreen(QWidget *w) -{ - const QPoint offset = QPoint(w->width() / 2, w->height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} - struct TestMenu { QList menus; diff --git a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro index 2863dd2034..51f955200b 100644 --- a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro +++ b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro @@ -1,4 +1,4 @@ CONFIG += testcase TARGET = tst_qscrollbar -QT += widgets testlib +QT += widgets testlib testlib-private SOURCES += tst_qscrollbar.cpp diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 5238eea592..f9a3e51977 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -33,16 +33,9 @@ #include #include -static inline void centerOnScreen(QWidget *w, const QSize &size) -{ - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); -} +#include -static inline void centerOnScreen(QWidget *w) -{ - centerOnScreen(w, w->geometry().size()); -} +using namespace QTestPrivate; class tst_QScrollBar : public QObject { -- cgit v1.2.3 From 385589ef458715fcaa533bbd01ca421dc1040eba Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Oct 2017 17:39:08 +0700 Subject: QCocoaMenu: Attach menu items when updating the menubar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of waiting for the menu delegate to update each item, we can attach an NSMenu to its NSMenuItem as soon as we update the current window's menubar. This is safe to do because we know that this is going to be the main menubar right after, so we're not orphaning any NSMenuItem from its NSMenu at the wrong moment. By doing this, we also ensure that all menus from the active menubar are reachable by the key-equivalent dispatching logic, even before we display the actual menu. This was shown in BigMenuCreator where, under the menubar's ASP and SAP menus, all A*S submenus would be disabled. Furthermore, on the same menus, SAP would show the same issue. Added test in Menurama as well. Change-Id: If6e7311072e6b53ad1cbced73623d1832aa0df8e Task-number: QTBUG-57076 Task-number: QTBUG-63712 Reviewed-by: Morten Johan Sørvig --- tests/manual/cocoa/menurama/mainwindow.cpp | 5 +++++ tests/manual/cocoa/menurama/mainwindow.ui | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/manual/cocoa/menurama/mainwindow.cpp b/tests/manual/cocoa/menurama/mainwindow.cpp index 06867bd7c9..086fc1e2fa 100644 --- a/tests/manual/cocoa/menurama/mainwindow.cpp +++ b/tests/manual/cocoa/menurama/mainwindow.cpp @@ -37,6 +37,11 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); + auto *a = ui->menuStuff->addAction("Enabled Submenu (QTBUG-63172)"); + auto *qtbug63172_Menu = new QMenu; + qtbug63172_Menu->addAction("We're Good!"); + a->setMenu(qtbug63172_Menu); + startTimer(1000); connect(ui->menuAfter_aboutToShow, &QMenu::aboutToShow, [=] { diff --git a/tests/manual/cocoa/menurama/mainwindow.ui b/tests/manual/cocoa/menurama/mainwindow.ui index 18cded70d2..4fb3e3420e 100644 --- a/tests/manual/cocoa/menurama/mainwindow.ui +++ b/tests/manual/cocoa/menurama/mainwindow.ui @@ -131,6 +131,7 @@ Click on "Dynamic Stuff" then move left and right to other menus. Disa + -- cgit v1.2.3 From b5b1e1036ff59b584719b8af7b3be8223a662233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Sun, 5 Nov 2017 14:08:56 +0200 Subject: Extend blacklisting in qnetworkreply While removing insignificant flag in commit 38a0909d4ed39b49e0463bd780d20a82ea672d35 and blacklisting autotests that still failed, qtbase builds didn't verify VS2017. That broke qt5 builds which do build VS2017. Task-number: QTBUG-64264 Change-Id: I5fdfa5dac6192f449a05146a9a422e428a710c84 Reviewed-by: Liang Qi --- tests/auto/network/access/qnetworkreply/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 091ec28bea..4785c5b650 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -32,3 +32,5 @@ linux windows [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] windows +[getFromUnreachableIp] +windows msvc-2017 -- cgit v1.2.3 From c8fa698e9928783ee7257134e72c3c5927fe5698 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 6 Nov 2017 13:45:23 +0100 Subject: tst_QNetworkReply: Blacklist ioHttpRedirectPolicy for Linux Task-number: QTBUG-62583 Change-Id: I9723a465f1d36aec823ce3459fd03b9492a3b778 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 4785c5b650..9ae424943d 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -25,7 +25,7 @@ windows [ioHttpRedirectMultipartPost] linux [ioHttpRedirectPolicy] -b2qt 64bit +b2qt linux 64bit [ioHttpRedirectPostPut] linux [putWithServerClosingConnectionImmediately] -- cgit v1.2.3 From eb5994df1307b2e17e729374e1f7ab1c8fe82750 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Nov 2017 13:40:17 +0100 Subject: tst_QWidget::multipleToplevelFocusCheck(): Avoid overlapping The test showed flakyness on Linux. It has been observed that its windows overlap. Position the windows beside each other. Change-Id: I4ff1b9cafaf753a6844b3dfabb576a07f74b396a Reviewed-by: Gatis Paeglis --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index a7aa99d2a8..c1bff5b00a 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5176,19 +5176,22 @@ void tst_QWidget::multipleToplevelFocusCheck() TopLevelFocusCheck w1; TopLevelFocusCheck w2; + const QString title = QLatin1String(QTest::currentTestFunction()); + w1.setWindowTitle(title + QLatin1String("_W1")); + w1.move(m_availableTopLeft + QPoint(20, 20)); w1.resize(200, 200); w1.show(); QVERIFY(QTest::qWaitForWindowExposed(&w1)); + w2.setWindowTitle(title + QLatin1String("_W2")); + w2.move(w1.frameGeometry().topRight() + QPoint(20, 0)); w2.resize(200,200); w2.show(); QVERIFY(QTest::qWaitForWindowExposed(&w2)); - QTest::qWait(50); QApplication::setActiveWindow(&w1); w1.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&w1)); QCOMPARE(QApplication::activeWindow(), static_cast(&w1)); - QTest::qWait(50); QTest::mouseDClick(&w1, Qt::LeftButton); QTRY_COMPARE(QApplication::focusWidget(), static_cast(w1.edit)); -- cgit v1.2.3 From 0445065645daab1dd9c328e52313646dcfcc80c2 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Sun, 5 Nov 2017 12:56:50 +0100 Subject: Run oraArrayBind() test only for Oracle DBMS This test contains Oracle specific queries and will fail for other DBMS. Currently it doesn't fail, because it is skipped for drivers that doesn't support BatchOperations and only QOCI supports batch operations. Change-Id: I8f1e7c7244726fa11c841023dec186553747a6b5 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 35f86772e2..dc304513e2 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -146,7 +146,7 @@ private slots: void batchExec(); void QTBUG_43874_data() { generic_data(); } void QTBUG_43874(); - void oraArrayBind_data() { generic_data(); } + void oraArrayBind_data() { generic_data("QOCI"); } void oraArrayBind(); void lastInsertId_data() { generic_data(); } void lastInsertId(); -- cgit v1.2.3 From b4f4c384d9ee7cf93cc3db289a7d4275ac10a618 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 28 Oct 2017 13:20:53 +0200 Subject: QHeaderView: Honor maximumSectionSize property during resizeSections() Resizing a QTreeeView section with double click or resizeColumnToContents() does not respect the maximumSectionSize when the resize mode is Interactive or Fixed. Since the documentation of maximumSectionSize states that it should honor this property for those cases either the documentation or implementation is incorrect. This patch fixes the latter. Task-number: QTBUG-64036 Change-Id: Ic14c8e444d50b9c50a117efed19d0bca7ec1cf82 Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index b13e7b2f33..fa543ae2c3 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -3006,6 +3006,7 @@ void tst_QHeaderView::stretchAndRestoreLastSection() tv.setModel(&m); tv.showMaximized(); + const int minimumSectionSize = 20; const int defaultSectionSize = 30; const int someOtherSectionSize = 40; const int biggerSizeThanAnySection = 50; @@ -3013,6 +3014,9 @@ void tst_QHeaderView::stretchAndRestoreLastSection() QVERIFY(QTest::qWaitForWindowExposed(&tv)); QHeaderView &header = *tv.horizontalHeader(); + // set minimum size before resizeSections() is called + // which is done inside setStretchLastSection + header.setMinimumSectionSize(minimumSectionSize); header.setDefaultSectionSize(defaultSectionSize); header.resizeSection(9, someOtherSectionSize); header.setStretchLastSection(true); -- cgit v1.2.3 From 28937559b1e03f959cd012c6b42ca988311893f5 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 3 Nov 2017 12:02:12 +0100 Subject: tst_qxmlsimplereader::inputFromSocket - fix race condition(s) This test was failing recently on Windows 7, mingw, x86. It's not failing now and attempts to reproduce the failure on CI's VM were unsuccessful. Anyway, just reading the code is enough to spot race-conditions: two threads are accessing two shared boolean variables without any protection. It's unclear if these races were the reason why the test was failing, but we fix them for good anyway. Also, a failure to start a thread or to start listening on a TCP socket is not treated as XML-related failure anymore and QSKIPped instead. Change-Id: I5115ce6c33cafc91485f8cf6e7e268d954976556 Reviewed-by: Timur Pocheptsov --- .../sax/qxmlsimplereader/tst_qxmlsimplereader.cpp | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index f77fd2ebab..8c4c6c7179 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -47,10 +49,11 @@ class XmlServer : public QThread { Q_OBJECT public: - XmlServer(QObject *parent = 0) : QThread(parent), quit_soon(false), listening(false) {} + XmlServer(QObject *parent = 0) : QThread(parent) {} - bool quit_soon; - bool listening; + QSemaphore threadStarted; + bool listening = false; + QAtomicInt quitSoon; protected: virtual void run(); @@ -63,6 +66,8 @@ void XmlServer::run() QTcpServer srv; listening = srv.listen(QHostAddress::Any, TEST_PORT); + threadStarted.release(); + if (!listening) { qWarning() << "Failed to listen on" << TEST_PORT << srv.errorString(); return; @@ -95,14 +100,13 @@ void XmlServer::run() QByteArray data = file.readAll(); for (int i = 0; i < data.size();) { -// sock->putChar(data.at(i)); int cnt = qMin(CHUNK_SIZE, data.size() - i); sock->write(data.constData() + i, cnt); i += cnt; sock->flush(); QTest::qSleep(1); - if (quit_soon) { + if (quitSoon.loadAcquire()) { sock->abort(); break; } @@ -112,7 +116,7 @@ void XmlServer::run() delete sock; } - if (quit_soon) + if (quitSoon.loadAcquire()) break; } @@ -162,7 +166,7 @@ tst_QXmlSimpleReader::tst_QXmlSimpleReader() : server(new XmlServer(this)) tst_QXmlSimpleReader::~tst_QXmlSimpleReader() { - server->quit_soon = true; + server->quitSoon.storeRelease(1); server->wait(); } @@ -562,7 +566,19 @@ void tst_QXmlSimpleReader::inputFromSocket() QSKIP("WinRT does not support connecting to localhost"); #endif - QTRY_VERIFY_WITH_TIMEOUT(server->listening, 15000); + if (!server->threadStarted.tryAcquire(1, 15000)) { + // If something is wrong with QThreads, it's not a reason to fail + // XML-test, we are not testing QThread here after all! + QSKIP("XmlServer/thread has not started yet"); + } + + // Subsequent runs should be able to acquire the semaphore. + server->threadStarted.release(1); + + if (!server->listening) { + // Again, QTcpServer is not the subject of this test! + QSKIP("QTcpServer::listen failed, bailing out"); + } QTcpSocket sock; sock.connectToHost(QHostAddress::LocalHost, TEST_PORT); -- cgit v1.2.3 From d4b3ce9a287b81eb9d7c6750ccca89e362343261 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 1 Nov 2017 15:38:31 +0100 Subject: qudpsocket.pro - fix dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the problem found in QTcpSocket auto-test recently. While the failure on CI looks differently (apparently, server process starts but does not print anything), fixing the dependency does not hurt and at least fixes the 'make check' scenario. Change-Id: I8f29f3e492d22410533407a527f5fc8f664e7f5c Reviewed-by: Gatis Paeglis Reviewed-by: Mårten Nordheim --- tests/auto/network/socket/qudpsocket/qudpsocket.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/socket/qudpsocket/qudpsocket.pro b/tests/auto/network/socket/qudpsocket/qudpsocket.pro index 4ddb7178a4..b267d5f249 100644 --- a/tests/auto/network/socket/qudpsocket/qudpsocket.pro +++ b/tests/auto/network/socket/qudpsocket/qudpsocket.pro @@ -1,4 +1,3 @@ TEMPLATE = subdirs SUBDIRS = test clientserver - - +test.depends = clientserver -- cgit v1.2.3 From fad8f340333f1c9ec7b6cebe521d53f4b1da4f8d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Nov 2017 09:47:56 +0100 Subject: Extend blacklisting in qnetworkreply - Blacklist ioHttpRedirectPostPut for Windows - Amend 84396a3f938453b81e6ecc73bd54ff6b08960e8f: Keys need to be on subsequent lines Task-number: QTBUG-62583 Change-Id: I6360ec7bd87de65a3294a0d22148f13579fcd292 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 9ae424943d..acea0a5aad 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -25,9 +25,11 @@ windows [ioHttpRedirectMultipartPost] linux [ioHttpRedirectPolicy] -b2qt linux 64bit +b2qt 64bit +linux [ioHttpRedirectPostPut] linux +windows [putWithServerClosingConnectionImmediately] windows [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] -- cgit v1.2.3 From 39355daa40438eef386ce55f02e7ba9ff824993f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 7 Nov 2017 11:51:57 +0100 Subject: tst_QNetworkReply::getFromUnreachableIp - fix a failing test This patch works around Windows X86 on QEMU antics. It appears on this platform the test behaves in some unpredictable manner: - WSAConnect with 255.255.255.255 does not always immediately fail with some error, so socket engine waits for a connection timeout (30 s.), but the test itself - only waits for 5 seconds and then tests that a request has finished with error, which is not true (we are still connecting). To make it work - whenever we have bearermanager feature enabled, set a connection timeout to something reasonable, not 30 s. Since we try to connect to each address twice, make timeout 1.5 s (so it's 3 s. in total and still is < 5 s.). Task-number: QTBUG-64264 Change-Id: I1d40c140667fca8402ec9344e66d313b6df54256 Reviewed-by: Timur Pocheptsov --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 099ea8ff39..b86750a900 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6766,6 +6766,48 @@ void tst_QNetworkReply::getFromUnreachableIp() { QNetworkAccessManager manager; +#ifdef Q_OS_WIN32 + // This test assumes that attempt to connect to 255.255.255.255 fails more + // or less fast/immediately. This is not what we observe on Windows x86: + // WSAConnect on non-blocking socket returns SOCKET_ERROR, WSAGetLastError + // returns WSAEWOULDBLOCK (expected) and getsockopt most of the time returns + // NOERROR; so socket engine starts a timer (30 s.) and waits for a timeout/ + // error/success. Unfortunately, the test itself is waiting only for 5 s. + // So we have to adjust the connection timeout or skip the test completely + // if the 'bearermanagement' feature is not available. +#if QT_CONFIG(bearermanagement) + class ConfigurationGuard + { + public: + explicit ConfigurationGuard(QNetworkAccessManager *m) + : manager(m) + { + Q_ASSERT(m); + auto conf = manager->configuration(); + previousTimeout = conf.connectTimeout(); + conf.setConnectTimeout(1500); + manager->setConfiguration(conf); + } + ~ConfigurationGuard() + { + Q_ASSERT(manager); + auto conf = manager->configuration(); + conf.setConnectTimeout(previousTimeout); + manager->setConfiguration(conf); + } + private: + QNetworkAccessManager *manager = nullptr; + int previousTimeout = 0; + + Q_DISABLE_COPY(ConfigurationGuard) + }; + + const ConfigurationGuard restorer(&manager); +#else // bearermanagement + QSKIP("This test is non-deterministic on Windows x86"); +#endif // !bearermanagement +#endif // Q_OS_WIN32 + QNetworkRequest request(QUrl("http://255.255.255.255/42/23/narf/narf/narf")); QNetworkReplyPtr reply(manager.get(request)); -- cgit v1.2.3 From 429d5f0c5edf776004a8a28c3a93f97e41f2ef85 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Mon, 23 Oct 2017 23:56:51 +0200 Subject: Set correct datatype for column 'more_data' in PostgreSQL Task-number: QTBUG-63861 Change-Id: Ice9e788841046482bf5c4653eb859d00bc6b1c59 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 8f8cfe009d..81206a5856 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -77,6 +77,8 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) doubleField = "more_data double"; else if (dbType == QSqlDriver::Oracle) doubleField = "more_data number(8,7)"; + else if (dbType == QSqlDriver::PostgreSQL) + doubleField = "more_data double precision"; else doubleField = "more_data double(8,7)"; QVERIFY_SQL( q, exec("create table " + relTEST1 + -- cgit v1.2.3 From e27bd981373cc3d22e54d8cbe030e5c329f9beda Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 8 Nov 2017 12:10:29 +0100 Subject: qfile tests: Make sure files are writable before deleting them On some platforms (like UWP) files that are copied during qfile auto tests are not writable by default. The cleanup will fail for these files if the permissions are not set accordingly. Change-Id: Id925dcadfc6b505c87f1f55d5ea05e286b60a5a5 Reviewed-by: Maurice Kalinowski Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 5f3ebeadd7..8db89b9f05 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -405,6 +405,8 @@ void tst_QFile::cleanup() QDir remainingDir(absoluteFilePath); QVERIFY2(remainingDir.removeRecursively(), qPrintable(absoluteFilePath)); } else { + if (!(QFile::permissions(absoluteFilePath) & QFile::WriteUser)) + QVERIFY2(QFile::setPermissions(absoluteFilePath, QFile::WriteUser), qPrintable(absoluteFilePath)); QVERIFY2(QFile::remove(absoluteFilePath), qPrintable(absoluteFilePath)); } } -- cgit v1.2.3 From bbc68dc815122e6be9ea44adadd93ffb715c7792 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 8 Nov 2017 12:12:06 +0100 Subject: Fix tst_QFile::useQFileInAFileHandler for systems using resources for test data Resource files are extracted to m_dataDir in tst_QFile::initTestCase. Instead of trying to access the file from the resource on systems that use qrc for bundling the test data, we have to use the files that were extracted at the beginning of the test. Change-Id: I35453fbdeb27e317d1342ff1cb7bbea9cebea14d Reviewed-by: Maurice Kalinowski Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 8db89b9f05..8a3d490925 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2190,12 +2190,20 @@ public: if (fileName.startsWith(":!")) { QDir dir; - QString realFile = QFINDTESTDATA(fileName.mid(2)); +#ifndef BUILTIN_TESTDATA + const QString realFile = QFINDTESTDATA(fileName.mid(2)); +#else + const QString realFile = m_dataDir->filePath(fileName.mid(2)); +#endif if (dir.exists(realFile)) return new QFSFileEngine(realFile); } return 0; } + +#ifdef BUILTIN_TESTDATA + QSharedPointer m_dataDir; +#endif }; #endif @@ -2204,6 +2212,9 @@ void tst_QFile::useQFileInAFileHandler() { // This test should not dead-lock MyRecursiveHandler handler; +#ifdef BUILTIN_TESTDATA + handler.m_dataDir = m_dataDir; +#endif QFile file(":!tst_qfile.cpp"); QVERIFY(file.exists()); } -- cgit v1.2.3 From 82c3c9d45d5fad0ed18e096f09729579a0902a71 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 8 Nov 2017 13:58:19 +0100 Subject: Fix tst_QFile::handle for systems using builtin test data To obtain the file's handle, we need to obtain it from the extracted test data instead of qrc. Change-Id: I89c5c3f3a7da7e36205a439581a6d83efffdc07c Reviewed-by: Maurice Kalinowski Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 8a3d490925..16a3cfd766 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -445,8 +445,6 @@ void tst_QFile::initTestCase() m_stdinProcessDir = QFINDTESTDATA("stdinprocess"); QVERIFY(!m_stdinProcessDir.isEmpty()); #endif - m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp"); - QVERIFY(!m_testSourceFile.isEmpty()); m_testLogFile = QFINDTESTDATA("testlog.txt"); QVERIFY(!m_testLogFile.isEmpty()); m_dosFile = QFINDTESTDATA("dosfile.txt"); @@ -459,12 +457,15 @@ void tst_QFile::initTestCase() QVERIFY(!m_twoDotsFile.isEmpty()); #ifndef BUILTIN_TESTDATA + m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp"); + QVERIFY(!m_testSourceFile.isEmpty()); m_testFile = QFINDTESTDATA("testfile.txt"); QVERIFY(!m_testFile.isEmpty()); #else m_dataDir = QEXTRACTTESTDATA("/"); QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data")); m_testFile = m_dataDir->path() + "/testfile.txt"; + m_testSourceFile = m_dataDir->path() + "/tst_qfile.cpp"; #endif m_resourcesDir = QFINDTESTDATA("resources"); QVERIFY(!m_resourcesDir.isEmpty()); -- cgit v1.2.3 From 579d0cb2bed193ccb1901b121a360f85d1c57a54 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 8 Nov 2017 14:09:11 +0100 Subject: Fix tst_QFile::openDirectory for systems using builtin test data To obtain "proper" directory behavior, we have to check against the extracted "resources" directory instead of its qrc counterpart. Change-Id: I4996ba74419945f78d356ad953a5b826ff663687 Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 16a3cfd766..5f0eae6fc3 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -461,14 +461,15 @@ void tst_QFile::initTestCase() QVERIFY(!m_testSourceFile.isEmpty()); m_testFile = QFINDTESTDATA("testfile.txt"); QVERIFY(!m_testFile.isEmpty()); + m_resourcesDir = QFINDTESTDATA("resources"); + QVERIFY(!m_resourcesDir.isEmpty()); #else m_dataDir = QEXTRACTTESTDATA("/"); QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data")); m_testFile = m_dataDir->path() + "/testfile.txt"; m_testSourceFile = m_dataDir->path() + "/tst_qfile.cpp"; + m_resourcesDir = m_dataDir->path() + "/resources"; #endif - m_resourcesDir = QFINDTESTDATA("resources"); - QVERIFY(!m_resourcesDir.isEmpty()); m_noEndOfLineFile = QFINDTESTDATA("noendofline.txt"); QVERIFY(!m_noEndOfLineFile.isEmpty()); -- cgit v1.2.3