diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2013-06-18 14:42:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-19 12:16:03 +0200 |
commit | 249c5f0689bf1208a4f1d589de45c20c3ff16de9 (patch) | |
tree | ee75b8c09e5e568b08c4b5ba67a7601a0968396d /tests/auto/widgets/kernel | |
parent | 2a8efea1a90436556f1cd471dce27a0619c5618e (diff) |
If a QWidget is ignored for auto-quit, ignore its corresponding QWindow.
Unit test by Friedemann Kleint <Friedemann.Kleint@digia.com>
Task-number: QTBUG-31569
Change-Id: I526d33d4f88a41f6ac349098476bc45af6c841b0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r-- | tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index c6835f6076..c9079e222c 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -783,6 +783,31 @@ void tst_QApplication::quitOnLastWindowClosed() QVERIFY(timerSpy.count() > 15); // Should be around 20 if closing did not caused the quit } + { // QTBUG-31569: If the last widget with Qt::WA_QuitOnClose set is closed, other + // widgets that don't have the attribute set should be closed automatically. + int argc = 0; + QApplication app(argc, 0); + QVERIFY(app.quitOnLastWindowClosed()); + + QWidget w1; + w1.show(); + + QWidget w2; + w2.setAttribute(Qt::WA_QuitOnClose, false); + w2.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&w2)); + + QTimer timer; + timer.setInterval(100); + timer.start(); + QSignalSpy timerSpy(&timer, SIGNAL(timeout())); + + QTimer::singleShot(100, &w1, SLOT(close())); + app.exec(); + + QVERIFY(timerSpy.count() < 10); + } } class PromptOnCloseWidget : public QWidget |