diff options
Diffstat (limited to 'tests/auto/qquickpopup/tst_qquickpopup.cpp')
-rw-r--r-- | tests/auto/qquickpopup/tst_qquickpopup.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 4d238663..7da20c37 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -82,6 +82,7 @@ private slots: void cursorShape(); void componentComplete(); void closeOnEscapeWithNestedPopups(); + void closeOnEscapeWithVisiblePopup(); void enabled(); void orientation_data(); void orientation(); @@ -904,6 +905,8 @@ void tst_QQuickPopup::cursorShape() // which is itself over an item with a different shape. QQuickApplicationHelper helper(this, QStringLiteral("cursor.qml")); QQuickApplicationWindow *window = helper.appWindow; + centerOnScreen(window); + moveMouseAway(window); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); @@ -1018,6 +1021,21 @@ void tst_QQuickPopup::closeOnEscapeWithNestedPopups() QCOMPARE(stackView->depth(), 1); } +void tst_QQuickPopup::closeOnEscapeWithVisiblePopup() +{ + QQuickApplicationHelper helper(this, QStringLiteral("closeOnEscapeWithVisiblePopup.qml")); + QQuickWindow *window = helper.window; + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickPopup *popup = window->findChild<QQuickPopup *>("popup"); + QVERIFY(popup); + QTRY_VERIFY(popup->isOpened()); + + QTest::keyClick(window, Qt::Key_Escape); + QTRY_VERIFY(!popup->isVisible()); +} + void tst_QQuickPopup::enabled() { QQuickPopup popup; @@ -1197,9 +1215,11 @@ void tst_QQuickPopup::toolTipCrashOnClose() QQuickWindow *window = helper.window; window->show(); - // TODO: Using ignoreMessage() fails in CI with macOS for release builds, - // so for now we let the warning through. -// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively."); + // The warning only occurs with debug builds for some reason. + // In any case, the warning is irrelevant, but using ShaderEffectSource is important, so we ignore it. +#ifdef QT_DEBUG + QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively."); +#endif QVERIFY(QTest::qWaitForWindowActive(window)); QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2)); @@ -1215,9 +1235,9 @@ void tst_QQuickPopup::setOverlayParentToNull() QQuickWindow *window = helper.window; window->show(); - // TODO: Using ignoreMessage() fails in CI with macOS for release builds, - // so for now we let the warning through. -// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively."); +#ifdef QT_DEBUG + QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively."); +#endif QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(QMetaObject::invokeMethod(window, "nullifyOverlayParent")); |