diff options
Diffstat (limited to 'tests/auto/gui/kernel/qwindow/tst_qwindow.cpp')
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index ff8ee3d168..fc9f50b15c 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -105,6 +105,7 @@ private slots: void stateChange(); void flags(); void cleanup(); + void testBlockingWindowShownAfterModalDialog(); private: QPoint m_availableTopLeft; @@ -2270,6 +2271,47 @@ void tst_QWindow::flags() QCOMPARE(window.flags(), baseFlags | Qt::WindowStaysOnTopHint); } +class EventWindow : public QWindow +{ +public: + EventWindow() : QWindow(), gotBlocked(false) {} + bool gotBlocked; +protected: + bool event(QEvent *e) + { + if (e->type() == QEvent::WindowBlocked) + gotBlocked = true; + return QWindow::event(e); + } +}; + +void tst_QWindow::testBlockingWindowShownAfterModalDialog() +{ + EventWindow normalWindow; + normalWindow.setFramePosition(m_availableTopLeft + QPoint(80, 80)); + normalWindow.resize(m_testWindowSize); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + QVERIFY(!normalWindow.gotBlocked); + + QWindow dialog; + dialog.setFramePosition(m_availableTopLeft + QPoint(200, 200)); + dialog.resize(m_testWindowSize); + dialog.setModality(Qt::ApplicationModal); + dialog.setFlags(Qt::Dialog); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QVERIFY(normalWindow.gotBlocked); + + EventWindow normalWindowAfter; + normalWindowAfter.setFramePosition(m_availableTopLeft + QPoint(80, 80)); + normalWindowAfter.resize(m_testWindowSize); + QVERIFY(!normalWindowAfter.gotBlocked); + normalWindowAfter.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindowAfter)); + QVERIFY(normalWindowAfter.gotBlocked); +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow) |