summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index e585835c3d..f61e585fda 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -70,6 +70,8 @@ private slots:
void showMinimized();
void showFullScreen();
void showAsTool();
+ void showWithoutActivating_data();
+ void showWithoutActivating();
void toolDialogPosition();
void deleteMainDefault();
void deleteInExec();
@@ -323,6 +325,33 @@ void tst_QDialog::showAsTool()
}
}
+void tst_QDialog::showWithoutActivating_data()
+{
+ QTest::addColumn<bool>("showWithoutActivating");
+ QTest::addColumn<int>("focusInCount");
+
+ QTest::addRow("showWithoutActivating") << true << 0;
+ QTest::addRow("showWithActivating") << false << 1;
+}
+
+void tst_QDialog::showWithoutActivating()
+{
+ QFETCH(bool, showWithoutActivating);
+ QFETCH(int, focusInCount);
+
+ struct Dialog : public QDialog
+ {
+ int focusInCount = 0;
+ protected:
+ void focusInEvent(QFocusEvent *) override { ++focusInCount; }
+ } dialog;
+ dialog.setAttribute(Qt::WA_ShowWithoutActivating, showWithoutActivating);
+
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ QCOMPARE(dialog.focusInCount, focusInCount);
+}
+
// Verify that pos() returns the same before and after show()
// for a dialog with the Tool window type.
void tst_QDialog::toolDialogPosition()