summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-08-20 09:12:40 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2014-12-23 14:12:25 +0100
commit32422885fcd10af567b25bdca521fe9e3e68f36f (patch)
tree732eb0c9768b72be0bd64b9646dabfdc16fd637e /tests/auto/gui/kernel
parent7aadf03fead587299e129cf77fc8322a24cc0591 (diff)
emit lastWindowClosed even if quitOnLastWindowClosed is false
Behavior will agree with the docs. [ChangeLog][QtGui][QWindow] lastWindowClosed will be emitted even if quitOnLastWindowClosed is not set Task-number: QTBUG-32956 Change-Id: I7bb269d53894859fee27e171eea7ad472ea86af0 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 310fd58b7f..b14d2cf288 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -812,6 +812,33 @@ void tst_QGuiApplication::quitOnLastWindowClosed()
QCOMPARE(spy.count(), 1);
QVERIFY(spy2.count() > 15); // Should be around 20 if closing did not cause the quit
}
+ {
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+ app.setQuitOnLastWindowClosed(false);
+
+ QTimer timer;
+ timer.setInterval(2000);
+ timer.setSingleShot(true);
+ QObject::connect(&timer, SIGNAL(timeout()), &app, SLOT(quit()));
+
+ QSignalSpy spy(&app, SIGNAL(lastWindowClosed()));
+ QSignalSpy spy2(&timer, SIGNAL(timeout()));
+
+ QPointer<QWindow> mainWindow = new QWindow;
+
+ mainWindow->show();
+
+ QTimer::singleShot(1000, mainWindow, SLOT(close())); // This should not quit the application
+ timer.start();
+
+ app.exec();
+
+ QCOMPARE(spy2.count(), 1); // quit timer fired
+ QCOMPARE(spy.count(), 1); // lastWindowClosed emitted
+
+ app.setQuitOnLastWindowClosed(true); // restore underlying static to default value
+ }
}
static Qt::ScreenOrientation testOrientationToSend = Qt::PrimaryOrientation;