aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qquickpopup/tst_qquickpopup.cpp
diff options
context:
space:
mode:
authorWang Chuan <ouchuanm@outlook.com>2019-10-28 16:53:02 +0800
committerWang Chuan <ouchuanm@outlook.com>2019-10-29 20:22:03 +0800
commit21e3c3eff23c34f9e4b85794e336380d9f6815f6 (patch)
tree47409da1535d070b2926efeab3ccd6b131154eff /tests/auto/qquickpopup/tst_qquickpopup.cpp
parent6adad6d903cb38fbfed6573e3a9be589b469b716 (diff)
QQuickPopup: try to grab shortcut when component completed
If closePolicy of Popup is set to CloseOnEscape and the Popup is completed, shortcut will register to QGuiApplication to let Popup respond to Escape key. However if Popup is set to visible in creation, even if we set closePolicy to CloseOnEscape, the shortcut won't be registered. [ChangeLog][Controls][QQuickPopup] Fixed the issue that Popup doesn't respond to CloseOnEscape if the initial value of visible is true Fixes: QTBUG-79326 Change-Id: I90c6805e2b4d567a6e0d33d43a75fedcfc5416b3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/qquickpopup/tst_qquickpopup.cpp')
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index c36edd6d..7da20c37 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -82,6 +82,7 @@ private slots:
void cursorShape();
void componentComplete();
void closeOnEscapeWithNestedPopups();
+ void closeOnEscapeWithVisiblePopup();
void enabled();
void orientation_data();
void orientation();
@@ -1020,6 +1021,21 @@ void tst_QQuickPopup::closeOnEscapeWithNestedPopups()
QCOMPARE(stackView->depth(), 1);
}
+void tst_QQuickPopup::closeOnEscapeWithVisiblePopup()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("closeOnEscapeWithVisiblePopup.qml"));
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickPopup *popup = window->findChild<QQuickPopup *>("popup");
+ QVERIFY(popup);
+ QTRY_VERIFY(popup->isOpened());
+
+ QTest::keyClick(window, Qt::Key_Escape);
+ QTRY_VERIFY(!popup->isVisible());
+}
+
void tst_QQuickPopup::enabled()
{
QQuickPopup popup;