diff options
Diffstat (limited to 'tests/auto/quickcontrols2')
14 files changed, 83 insertions, 11 deletions
diff --git a/tests/auto/quickcontrols2/controls/basic/BLACKLIST b/tests/auto/quickcontrols2/controls/basic/BLACKLIST index bdb2af0b46..b643dd1d9c 100644 --- a/tests/auto/quickcontrols2/controls/basic/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/basic/BLACKLIST @@ -8,3 +8,6 @@ [RangeSlider::test_overlappingHandles] b2qt qnx + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml index 0e896ddb2d..6de1c81595 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml @@ -1870,8 +1870,8 @@ TestCase { width: 200 height: 200 - Keys.onPressed: { ++pressedKeys; lastPressedKey = event.key } - Keys.onReleased: { ++releasedKeys; lastReleasedKey = event.key } + Keys.onPressed: (event) => { ++pressedKeys; lastPressedKey = event.key } + Keys.onReleased: (event) => { ++releasedKeys; lastReleasedKey = event.key } ComboBox { id: comboBox @@ -1918,11 +1918,6 @@ TestCase { compare(container.pressedKeys, pressedKeys) keyRelease(data.key) - // Popup receives the key release event if it has an exit transition, but - // not if it has been immediately closed on press, without a transition. - // ### TODO: Should Popup somehow always block the key release event? - if (!control.popup.exit) - ++releasedKeys compare(container.releasedKeys, releasedKeys) tryCompare(control.popup, "visible", false) diff --git a/tests/auto/quickcontrols2/controls/fusion/BLACKLIST b/tests/auto/quickcontrols2/controls/fusion/BLACKLIST index bdb2af0b46..b643dd1d9c 100644 --- a/tests/auto/quickcontrols2/controls/fusion/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/fusion/BLACKLIST @@ -8,3 +8,6 @@ [RangeSlider::test_overlappingHandles] b2qt qnx + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/imagine/BLACKLIST b/tests/auto/quickcontrols2/controls/imagine/BLACKLIST index 72eebcd21d..c3865e0006 100644 --- a/tests/auto/quickcontrols2/controls/imagine/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/imagine/BLACKLIST @@ -12,3 +12,6 @@ qnx # QTBUG-101704 [ToolTip::test_attachedSizeBug] * + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/ios/BLACKLIST b/tests/auto/quickcontrols2/controls/ios/BLACKLIST index 68b52a8ccc..e5d8e9bcab 100644 --- a/tests/auto/quickcontrols2/controls/ios/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/ios/BLACKLIST @@ -2,3 +2,6 @@ [ScrollView::test_textArea] * + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/macos/BLACKLIST b/tests/auto/quickcontrols2/controls/macos/BLACKLIST index 0e48b148d8..1e751af957 100644 --- a/tests/auto/quickcontrols2/controls/macos/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/macos/BLACKLIST @@ -1,2 +1,4 @@ # See qtbase/src/testlib/qtestblacklist.cpp for format +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/material/BLACKLIST b/tests/auto/quickcontrols2/controls/material/BLACKLIST index bdb2af0b46..b643dd1d9c 100644 --- a/tests/auto/quickcontrols2/controls/material/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/material/BLACKLIST @@ -8,3 +8,6 @@ [RangeSlider::test_overlappingHandles] b2qt qnx + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/universal/BLACKLIST b/tests/auto/quickcontrols2/controls/universal/BLACKLIST index bdb2af0b46..b643dd1d9c 100644 --- a/tests/auto/quickcontrols2/controls/universal/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/universal/BLACKLIST @@ -8,3 +8,6 @@ [RangeSlider::test_overlappingHandles] b2qt qnx + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/controls/windows/BLACKLIST b/tests/auto/quickcontrols2/controls/windows/BLACKLIST index 476340700a..8230d5eb4e 100644 --- a/tests/auto/quickcontrols2/controls/windows/BLACKLIST +++ b/tests/auto/quickcontrols2/controls/windows/BLACKLIST @@ -3,3 +3,6 @@ # QTBUG-70597 [Tumbler::test_itemsCorrectlyPositioned] * + +[ComboBox::test_keyClose] +macos arm ci # QTBUG-102817 diff --git a/tests/auto/quickcontrols2/qquickpopup/BLACKLIST b/tests/auto/quickcontrols2/qquickpopup/BLACKLIST index 4aa2bfeb6e..aa31440328 100644 --- a/tests/auto/quickcontrols2/qquickpopup/BLACKLIST +++ b/tests/auto/quickcontrols2/qquickpopup/BLACKLIST @@ -6,9 +6,6 @@ macos # QTBUG-89938 [zOrder] macos # QTBUG-89938 -[closePolicy] -macos # QTBUG-89938 - # QTBUG-94251 [closePolicy] opensuse-leap diff --git a/tests/auto/quickcontrols2/qquickpopup/data/activeFocusOnClose3.qml b/tests/auto/quickcontrols2/qquickpopup/data/activeFocusOnClose3.qml index 8a68246853..a6dcf637d9 100644 --- a/tests/auto/quickcontrols2/qquickpopup/data/activeFocusOnClose3.qml +++ b/tests/auto/quickcontrols2/qquickpopup/data/activeFocusOnClose3.qml @@ -64,15 +64,27 @@ ApplicationWindow { Popup { id: popup1 + objectName: "popup1" focus: true enter: Transition { PauseAnimation { duration: 200 } } exit: Transition { PauseAnimation { duration: 200 } } + + Label { + text: popup1.objectName + anchors.centerIn: parent + } } Popup { id: popup2 + objectName: "popup2" focus: true enter: Transition { PauseAnimation { duration: 100 } } exit: Transition { PauseAnimation { duration: 100 } } + + Label { + text: popup2.objectName + anchors.centerIn: parent + } } } diff --git a/tests/auto/quickcontrols2/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml b/tests/auto/quickcontrols2/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml index b65e4ec0c0..b1d7413e9b 100644 --- a/tests/auto/quickcontrols2/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml +++ b/tests/auto/quickcontrols2/qquickpopup/data/closeOnEscapeWithVisiblePopup.qml @@ -11,6 +11,7 @@ Window { width: 200 height: 200 anchors.centerIn: parent + focus: true closePolicy: Popup.CloseOnEscape } } diff --git a/tests/auto/quickcontrols2/qquickpopup/data/destroyDuringExitTransition.qml b/tests/auto/quickcontrols2/qquickpopup/data/destroyDuringExitTransition.qml index 67fca2e78e..084af64e16 100644 --- a/tests/auto/quickcontrols2/qquickpopup/data/destroyDuringExitTransition.qml +++ b/tests/auto/quickcontrols2/qquickpopup/data/destroyDuringExitTransition.qml @@ -89,6 +89,7 @@ ApplicationWindow { Dialog { dim: true modal: true + focus: true closePolicy: Popup.CloseOnEscape visible: true diff --git a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp index a1412d5ddd..e7e7acd4af 100644 --- a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp @@ -39,6 +39,7 @@ #include <QtQuickTemplates2/private/qquickcombobox_p.h> #include <QtQuickTemplates2/private/qquickdialog_p.h> #include <QtQuickTemplates2/private/qquickoverlay_p.h> +#include <QtQuickTemplates2/private/qquickoverlay_p_p.h> #include <QtQuickTemplates2/private/qquickpopup_p.h> #include <QtQuickTemplates2/private/qquickpopupitem_p_p.h> #include <QtQuickTemplates2/private/qquickbutton_p.h> @@ -79,6 +80,7 @@ private slots: void activeFocusOnClosingSeveralPopups(); void activeFocusAfterExit(); void activeFocusOnDelayedEnter(); + void activeFocusDespiteLowerStackingOrder(); void hover_data(); void hover(); void wheel_data(); @@ -861,6 +863,47 @@ void tst_QQuickPopup::activeFocusOnDelayedEnter() QTRY_VERIFY(popup2->hasActiveFocus()); } +// Test that a popup (popup1) with a lower stacking order than another popup (popup2) gets +// key events due to having active focus. +void tst_QQuickPopup::activeFocusDespiteLowerStackingOrder() +{ + QQuickControlsApplicationHelper helper(this, QStringLiteral("activeFocusOnClose3.qml")); + QVERIFY2(helper.ready, helper.failureMessage()); + QQuickApplicationWindow *window = helper.appWindow; + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + QQuickPopup *popup1 = window->property("popup1").value<QQuickPopup *>(); + QVERIFY(popup1); + popup1->open(); + QTRY_VERIFY(popup1->isOpened()); + + QQuickPopup *popup2 = window->property("popup2").value<QQuickPopup *>(); + QVERIFY(popup2); + popup2->open(); + QTRY_VERIFY(popup2->isOpened()); + popup2->setX(popup1->width() / 2); + popup2->setY(popup1->height() / 2); + + // Both popups have no explicitly assigned Z value, so they should be the same. + // Items (QQuickPopupItem in this case) with identical Z values are rendered according + // to their order in the childItems container in the parent QQuickItem (see + // paintOrderChildItems(), which is what stackingOrderPopups() uses). + QCOMPARE(popup1->z(), popup2->z()); + + // Give popup1 active focus. Even though it's stacked under popup2, + // it should still receive key events. + popup1->forceActiveFocus(); + + // Press Escape to close popup1. + QTest::keyClick(window, Qt::Key_Escape); + QVERIFY(!popup1->isOpened()); + QVERIFY(popup2->isOpened()); + QTRY_VERIFY(!popup1->isVisible()); + QVERIFY(!popup1->hasActiveFocus()); +} + void tst_QQuickPopup::hover_data() { QTest::addColumn<QString>("source"); @@ -1283,7 +1326,7 @@ void tst_QQuickPopup::closeOnEscapeWithVisiblePopup() QVERIFY(popup); QTRY_VERIFY(popup->isOpened()); - QTRY_VERIFY(window->activeFocusItem()); + QTRY_VERIFY(popup->hasActiveFocus()); QTest::keyClick(window, Qt::Key_Escape); QTRY_VERIFY(!popup->isVisible()); } |