diff options
Diffstat (limited to 'tests/auto/gui/kernel')
15 files changed, 88 insertions, 77 deletions
diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro index 7e98704aea..293a6a8581 100644 --- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro +++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro @@ -5,4 +5,4 @@ QT += core-private network gui-private testlib SOURCES += tst_noqteventloop.cpp -qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32 +qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp index 4fca9a07fc..3d1876f00f 100644 --- a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp +++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp @@ -36,6 +36,7 @@ #include <QtNetwork/qtcpserver.h> #include <QtNetwork/qtcpsocket.h> #include <QtCore/qelapsedtimer.h> +#include <QtCore/qtimer.h> #include <QtCore/qt_windows.h> @@ -49,7 +50,7 @@ class tst_NoQtEventLoop : public QObject private slots: void consumeMouseEvents(); void consumeSocketEvents(); - + void deliverEventsInLivelock(); }; class Window : public QRasterWindow @@ -258,8 +259,8 @@ void tst_NoQtEventLoop::consumeMouseEvents() ::SetWindowPos(mainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - Window *childWindow = new Window; - childWindow->setParent(QWindow::fromWinId((WId)mainWnd)); + QWindow *mainWindow = QWindow::fromWinId(reinterpret_cast<WId>(mainWnd)); + Window *childWindow = new Window(mainWindow); childWindow->setGeometry(margin, topVerticalMargin, width - 2 * margin, height - margin - topVerticalMargin); childWindow->show(); @@ -276,6 +277,7 @@ void tst_NoQtEventLoop::consumeMouseEvents() if (g_exit) break; } + delete mainWindow; QCOMPARE(testThread->passed(), true); @@ -311,6 +313,34 @@ void tst_NoQtEventLoop::consumeSocketEvents() QVERIFY(server.hasPendingConnections()); } +void tst_NoQtEventLoop::deliverEventsInLivelock() +{ + int argc = 1; + char *argv[] = { const_cast<char *>("test"), 0 }; + QGuiApplication app(argc, argv); + + QTimer livelockTimer; + livelockTimer.start(0); + QTimer::singleShot(100, Qt::CoarseTimer, &livelockTimer, &QTimer::stop); + + QElapsedTimer elapsedTimer; + elapsedTimer.start(); + + // Exec own message loop + MSG msg; + forever { + if (elapsedTimer.hasExpired(3000) || !livelockTimer.isActive()) + break; + + if (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + } + + QVERIFY(!livelockTimer.isActive()); +} + #include <tst_noqteventloop.moc> QTEST_APPLESS_MAIN(tst_NoQtEventLoop) diff --git a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp index 68852f5a3f..d67b17fd43 100644 --- a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp +++ b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp @@ -68,10 +68,17 @@ void tst_QDrag::getSetCheck() QCOMPARE((QMimeData *)0, obj1.mimeData()); // delete var1; // No delete, since QDrag takes ownership - Qt::DropAction result = obj1.start(); + Qt::DropAction result = obj1.exec(); + QCOMPARE(result, Qt::IgnoreAction); + result = obj1.exec(Qt::MoveAction | Qt::LinkAction); + QCOMPARE(result, Qt::IgnoreAction); + +#if QT_DEPRECATED_SINCE(5, 13) + result = obj1.start(); QCOMPARE(result, Qt::IgnoreAction); result = obj1.start(Qt::MoveAction | Qt::LinkAction); QCOMPARE(result, Qt::IgnoreAction); +#endif } QTEST_MAIN(tst_QDrag) diff --git a/tests/auto/gui/kernel/qguiapplication/BLACKLIST b/tests/auto/gui/kernel/qguiapplication/BLACKLIST index 9a670237b7..e6ffe78ae3 100644 --- a/tests/auto/gui/kernel/qguiapplication/BLACKLIST +++ b/tests/auto/gui/kernel/qguiapplication/BLACKLIST @@ -1,4 +1,3 @@ [focusObject] -opensuse -opensuse-leap -ubuntu +ubuntu-16.04 +opensuse-42.3 diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro index 895c2a0307..34b75a8397 100644 --- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro +++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro @@ -6,6 +6,7 @@ INCLUDEPATH += $$CORE_TEST_PATH TARGET = tst_qguiapplication QT += gui-private +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050E00 SOURCES += tst_qguiapplication.cpp RESOURCES = tst_qguiapplication.qrc diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index a304981cd1..5ee25677bf 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -184,7 +184,7 @@ void tst_QGuiApplication::windowIcon() class DummyWindow : public QWindow { public: - DummyWindow() : m_focusObject(0) {} + DummyWindow() : m_focusObject(nullptr) {} virtual QObject *focusObject() const { @@ -204,7 +204,7 @@ public: void tst_QGuiApplication::focusObject() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) QSKIP("QWindow::requestActivate() is not supported."); @@ -271,15 +271,15 @@ void tst_QGuiApplication::focusObject() void tst_QGuiApplication::allWindows() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); QWindow *window1 = new QWindow; QWindow *window2 = new QWindow(window1); QVERIFY(app.allWindows().contains(window1)); QVERIFY(app.allWindows().contains(window2)); QCOMPARE(app.allWindows().count(), 2); delete window1; - window1 = 0; - window2 = 0; + window1 = nullptr; + window2 = nullptr; QVERIFY(!app.allWindows().contains(window2)); QVERIFY(!app.allWindows().contains(window1)); QCOMPARE(app.allWindows().count(), 0); @@ -288,15 +288,15 @@ void tst_QGuiApplication::allWindows() void tst_QGuiApplication::topLevelWindows() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); QWindow *window1 = new QWindow; QWindow *window2 = new QWindow(window1); QVERIFY(app.topLevelWindows().contains(window1)); QVERIFY(!app.topLevelWindows().contains(window2)); QCOMPARE(app.topLevelWindows().count(), 1); delete window1; - window1 = 0; - window2 = 0; + window1 = nullptr; + window2 = nullptr; QVERIFY(!app.topLevelWindows().contains(window2)); QVERIFY(!app.topLevelWindows().contains(window1)); QCOMPARE(app.topLevelWindows().count(), 0); @@ -306,7 +306,7 @@ class ShowCloseShowWindow : public QWindow { Q_OBJECT public: - ShowCloseShowWindow(bool showAgain, QWindow *parent = 0) + ShowCloseShowWindow(bool showAgain, QWindow *parent = nullptr) : QWindow(parent), showAgain(showAgain) { QTimer::singleShot(0, this, SLOT(doClose())); @@ -331,7 +331,7 @@ private: void tst_QGuiApplication::abortQuitOnShow() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); QScopedPointer<QWindow> window1(new ShowCloseShowWindow(false)); @@ -366,7 +366,7 @@ protected: } public: - FocusChangeWindow() : QWindow(), windowDuringFocusAboutToChange(0), windowDuringFocusOut(0) {} + FocusChangeWindow() : QWindow(), windowDuringFocusAboutToChange(nullptr), windowDuringFocusOut(nullptr) {} QWindow *windowDuringFocusAboutToChange; QWindow *windowDuringFocusOut; @@ -378,7 +378,7 @@ void tst_QGuiApplication::changeFocusWindow() QSKIP("WinRt does not support multiple native windows."); #endif int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) QSKIP("QWindow::requestActivate() is not supported."); @@ -430,7 +430,7 @@ void tst_QGuiApplication::changeFocusWindow() void tst_QGuiApplication::keyboardModifiers() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); QScopedPointer<QWindow> window(new QWindow); @@ -564,7 +564,7 @@ public: int leaves; int enters; - inline explicit BlockableWindow(QWindow *parent = 0) + inline explicit BlockableWindow(QWindow *parent = nullptr) : QWindow(parent), blocked(false), leaves(0), enters(0) {} bool event(QEvent *e) @@ -601,7 +601,7 @@ void tst_QGuiApplication::modalWindow() QSKIP("WinRt does not support multiple native windows."); #endif int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); int x = screenGeometry.left() + spacing; @@ -654,7 +654,7 @@ void tst_QGuiApplication::modalWindow() window2->show(); QVERIFY(QTest::qWaitForWindowExposed(window1.data())); QVERIFY(QTest::qWaitForWindowExposed(window2.data())); - QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr)); QCOMPARE(window1->blocked, 0); QCOMPARE(childWindow1->blocked, 0); QCOMPARE(window2->blocked, 0); @@ -698,7 +698,7 @@ void tst_QGuiApplication::modalWindow() // everything is unblocked when applicationModalWindow1 is hidden applicationModalWindow1->hide(); - QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr)); QCOMPARE(window1->blocked, 0); QCOMPARE(childWindow1->blocked, 0); // QTBUG-32242, blocked status needs to be set on children as well. QCOMPARE(window2->blocked, 0); @@ -750,7 +750,7 @@ void tst_QGuiApplication::modalWindow() // hide windowModalWindow2, windowModalWindow1 and window1 are unblocked windowModalWindow2->hide(); - QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr)); QCOMPARE(window1->blocked, 0); QCOMPARE(window2->blocked, 0); QCOMPARE(windowModalWindow1->blocked, 0); @@ -815,7 +815,7 @@ void tst_QGuiApplication::modalWindow() // hide windowModalWindow1, everything is unblocked windowModalWindow1->hide(); - QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr)); QCOMPARE(window1->blocked, 0); QCOMPARE(window2->blocked, 0); QCOMPARE(windowModalWindow1->blocked, 0); @@ -829,7 +829,7 @@ void tst_QGuiApplication::modalWindow() void tst_QGuiApplication::quitOnLastWindowClosed() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); QTimer timer; @@ -869,7 +869,7 @@ void tst_QGuiApplication::quitOnLastWindowClosed() void tst_QGuiApplication::quitOnLastWindowClosedMulti() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); QTimer timer; @@ -909,7 +909,7 @@ void tst_QGuiApplication::quitOnLastWindowClosedMulti() void tst_QGuiApplication::dontQuitOnLastWindowClosed() { int argc = 0; - QGuiApplication app(argc, 0); + QGuiApplication app(argc, nullptr); app.setQuitOnLastWindowClosed(false); QTimer timer; @@ -959,7 +959,7 @@ public: { if (key == "testplugin") return new TestPlugin; - return 0; + return nullptr; } }; @@ -989,9 +989,13 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents() QCoreApplication::postEvent(&testReceiver, new QEvent(QEvent::User)); QCOMPARE(testReceiver.customEvents, 0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QStaticPlugin testPluginInfo(qt_plugin_instance, qt_plugin_query_metadata); +#else QStaticPlugin testPluginInfo; testPluginInfo.instance = qt_plugin_instance; testPluginInfo.rawMetaData = qt_plugin_query_metadata; +#endif qRegisterStaticPluginFunction(testPluginInfo); int argc = 3; char *argv[] = { const_cast<char*>(QTest::currentAppName()), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") }; @@ -1065,7 +1069,7 @@ void tst_QGuiApplication::testSetPaletteAttribute() QVERIFY(!QCoreApplication::testAttribute(Qt::AA_SetPalette)); QPalette palette; - palette.setColor(QPalette::Foreground, Qt::red); + palette.setColor(QPalette::WindowText, Qt::red); QGuiApplication::setPalette(palette); QVERIFY(QCoreApplication::testAttribute(Qt::AA_SetPalette)); @@ -1122,7 +1126,7 @@ void tst_QGuiApplication::settableStyleHints() int argc = 0; QScopedPointer<QGuiApplication> app; if (appInstance) - app.reset(new QGuiApplication(argc, 0)); + app.reset(new QGuiApplication(argc, nullptr)); const int keyboardInputInterval = 555; QGuiApplication::styleHints()->setKeyboardInputInterval(keyboardInputInterval); diff --git a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST index b1590a5ccf..d2c51922a8 100644 --- a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST @@ -1,5 +1,3 @@ -[sendPostedEvents] -windows [registerTimer] -windows winrt + diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST deleted file mode 100644 index 03acb2f5b0..0000000000 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[testQuitLock] -osx-10.12 diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index b2572188b9..3ce65a6785 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -191,7 +191,7 @@ template<> struct TestValueFactory<QMetaType::QTextLength> { static QTextLength *create() { return new QTextLength(QTextLength::PercentageLength, 50); } }; template<> struct TestValueFactory<QMetaType::QTextFormat> { - static QTextFormat *create() { return new QTextFormat(QTextFormat::TableFormat); } + static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); } }; template<> struct TestValueFactory<QMetaType::QMatrix> { static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); } diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp index bad021c3b0..87a47bd93b 100644 --- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp +++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp @@ -121,7 +121,7 @@ static QByteArray modifiersTestRowName(const QString &keySequence) if (uc > 32 && uc < 128) str << '"' << c << '"'; else - str << "U+" << hex << uc << dec; + str << "U+" << Qt::hex << uc << Qt::dec; if (i < size - 1) str << ','; } @@ -155,7 +155,7 @@ void tst_QKeyEvent::modifiers_data() modifierCombinations.append(modifierCombination); } - qSort(modifierCombinations.begin(), modifierCombinations.end(), orderByModifier); + std::sort(modifierCombinations.begin(), modifierCombinations.end(), orderByModifier); QTest::addColumn<Qt::KeyboardModifiers>("modifiers"); foreach (const QVector<int> combination, modifierCombinations) { diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index f8b6bf064a..874468c954 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -86,7 +86,7 @@ static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntrie static QChar macSymbolForQtKey(int key) { - const MacSpecialKey *i = qBinaryFind(entries, MacSpecialKeyEntriesEnd, key); + const MacSpecialKey *i = std::lower_bound(entries, MacSpecialKeyEntriesEnd, key); if (i == MacSpecialKeyEntriesEnd) return QChar(); return QChar(i->macSymbol); diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 7f29b1c24e..6ce6422f48 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -141,21 +141,20 @@ void tst_QPalette::copySemantics() void tst_QPalette::moveSemantics() { -#ifdef Q_COMPILER_RVALUE_REFS QPalette src(Qt::red), dst; const QPalette control = src; QVERIFY(src != dst); QCOMPARE(src, control); QVERIFY(!dst.isCopyOf(src)); QVERIFY(!dst.isCopyOf(control)); - dst = qMove(src); // move assignment + dst = std::move(src); // move assignment QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too QVERIFY(dst.isCopyOf(control)); QCOMPARE(dst, control); src = control; // check moved-from 'src' can still be assigned to (doesn't crash) QVERIFY(src.isCopyOf(dst)); QVERIFY(src.isCopyOf(control)); - QPalette dst2(qMove(src)); // move construction + QPalette dst2(std::move(src)); // move construction QVERIFY(!src.isCopyOf(dst)); QVERIFY(!src.isCopyOf(dst2)); QVERIFY(!src.isCopyOf(control)); @@ -163,9 +162,6 @@ void tst_QPalette::moveSemantics() QVERIFY(dst2.isCopyOf(dst)); QVERIFY(dst2.isCopyOf(control)); // check moved-from 'src' can still be destroyed (doesn't crash) -#else - QSKIP("Compiler doesn't support C++11 move semantics"); -#endif } void tst_QPalette::setBrush() diff --git a/tests/auto/gui/kernel/qtouchevent/BLACKLIST b/tests/auto/gui/kernel/qtouchevent/BLACKLIST index 8e78d7e41f..dcda77bce7 100644 --- a/tests/auto/gui/kernel/qtouchevent/BLACKLIST +++ b/tests/auto/gui/kernel/qtouchevent/BLACKLIST @@ -1,6 +1,2 @@ -[basicRawEventTranslation] -linux [multiPointRawEventTranslationOnTouchScreen] -linux -[multiPointRawEventTranslationOnTouchPad] -linux +ubuntu-16.04 diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 1820499a53..27463adf99 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,3 +1,5 @@ +[positioning] +opensuse-leap [positioning:default] linux osx-10.12 ci @@ -5,39 +7,19 @@ winrt [positioning:fake] osx-10.12 ci [modalWithChildWindow] -ubuntu-16.04 # QTBUG-66851 -opensuse -opensuse-leap # QTBUG-69160 -android +opensuse-leap [setVisible] # QTBUG-69154 android [modalWindowEnterEventOnHide_QTBUG35109] -ubuntu-16.04 -osx ci +osx [spuriousMouseMove] -windows ci # QTBUG-69162 -android -[modalDialogClosingOneOfTwoModal] -osx -[modalWindowModallity] -osx -# QTBUG-69163 -android -[visibility] -osx-10.12 ci - +windows-10 [testInputEvents] rhel-7.4 -[isActive] -# QTBUG-67768 -ubuntu -# QTBUG-69157 -android - [exposeEventOnShrink_QTBUG54040] # QTBUG-69155 android diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro index 844b3e8507..e7931ca773 100644 --- a/tests/auto/gui/kernel/qwindow/qwindow.pro +++ b/tests/auto/gui/kernel/qwindow/qwindow.pro @@ -5,4 +5,4 @@ QT += core-private gui-private testlib SOURCES += tst_qwindow.cpp -qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32 +qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 |