summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp')
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 2fd875b7f4..8d0836e7c3 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -53,6 +53,7 @@ private slots:
void focusObject();
void allWindows();
void topLevelWindows();
+ void abortQuitOnShow();
};
class DummyWindow : public QWindow
@@ -152,5 +153,44 @@ void tst_QGuiApplication::topLevelWindows()
QCOMPARE(app.topLevelWindows().count(), 0);
}
+class ShowCloseShowWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ ShowCloseShowWindow(bool showAgain, QWindow *parent = 0)
+ : QWindow(parent), showAgain(showAgain)
+ {
+ QTimer::singleShot(0, this, SLOT(doClose()));
+ QTimer::singleShot(500, this, SLOT(exitApp()));
+ }
+
+private slots:
+ void doClose() {
+ close();
+ if (showAgain)
+ show();
+ }
+
+ void exitApp() {
+ qApp->exit(1);
+ }
+
+private:
+ bool showAgain;
+};
+
+void tst_QGuiApplication::abortQuitOnShow()
+{
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+ QWindow *window1 = new ShowCloseShowWindow(false);
+ window1->show();
+ QCOMPARE(app.exec(), 0);
+
+ QWindow *window2 = new ShowCloseShowWindow(true);
+ window2->show();
+ QCOMPARE(app.exec(), 1);
+}
+
QTEST_APPLESS_MAIN(tst_QGuiApplication)
#include "tst_qguiapplication.moc"