aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-16 03:00:59 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-16 03:01:00 +0200
commit8b61881469901a793e9ac8eec7caefad547258a2 (patch)
treefc85f58a91776cfe1f57f2cdf7f1267833041eec /tests
parentd1fdbd128f6e95255c7d9fc20ef07f44677a649e (diff)
parentced7d5af9caeedd7b3a2278b052a0b0f7bf951b7 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_combobox.qml51
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml33
2 files changed, 84 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index e37eb03d..7f061a2b 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -85,6 +85,17 @@ TestCase {
MouseArea { }
}
+ Component {
+ id: customPopup
+ Popup {
+ width: 100
+ implicitHeight: contentItem.implicitHeight
+ contentItem: TextInput {
+ anchors.fill: parent
+ }
+ }
+ }
+
function init() {
// QTBUG-61225: Move the mouse away to avoid QQuickWindowPrivate::flushFrameSynchronousEvents()
// delivering interfering hover events based on the last mouse position from earlier tests. For
@@ -1686,4 +1697,44 @@ TestCase {
compare(container.releasedKeys, ++releasedKeys)
compare(container.lastReleasedKey, data.key)
}
+
+ function test_popupFocus_QTBUG_74661() {
+ var control = createTemporaryObject(comboBox, testCase)
+ verify(control)
+
+ var popup = createTemporaryObject(customPopup, testCase)
+ verify(popup)
+
+ control.popup = popup
+
+ var openedSpy = signalSpy.createObject(control, {target: popup, signalName: "opened"})
+ verify(openedSpy.valid)
+
+ var closedSpy = signalSpy.createObject(control, {target: popup, signalName: "closed"})
+ verify(closedSpy.valid)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+
+ // show popup
+ keyClick(Qt.Key_Space)
+ openedSpy.wait()
+ compare(openedSpy.count, 1)
+
+ popup.contentItem.forceActiveFocus()
+ verify(popup.contentItem.activeFocus)
+
+ // type something in the text field
+ keyClick(Qt.Key_Space)
+ keyClick(Qt.Key_H)
+ keyClick(Qt.Key_I)
+ compare(popup.contentItem.text, " hi")
+
+ compare(closedSpy.count, 0)
+
+ // hide popup
+ keyClick(Qt.Key_Escape)
+ closedSpy.wait()
+ compare(closedSpy.count, 1)
+ }
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 419478a2..d3a0d8bb 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -486,6 +486,39 @@ TestCase {
compare(button.hovered, false)
}
+ function test_hoverWhilePressed_data() {
+ return [
+ { tag: "up" },
+ { tag: "down" },
+ ]
+ }
+
+ // QTBUG-74688
+ function test_hoverWhilePressed(data) {
+ var control = createTemporaryObject(spinBox, testCase, { hoverEnabled: true, value: 50 })
+ verify(control)
+
+ var button = control[data.tag]
+ compare(control.hovered, false)
+ compare(button.hovered, false)
+
+ // Hover over the indicator. It should be hovered.
+ var buttonXCenter = button.indicator.x + button.indicator.width / 2
+ var buttonYCenter = button.indicator.y + button.indicator.height / 2
+ mouseMove(control, buttonXCenter, buttonYCenter)
+ compare(button.hovered, true)
+
+ // Press on the indicator and then move the mouse outside of it.
+ mousePress(control, buttonXCenter, buttonYCenter)
+ compare(button.hovered, true)
+ mouseMove(control, buttonXCenter - button.indicator.width, buttonYCenter - button.indicator.height)
+ // It should not be pressed or hovered.
+ compare(button.pressed, false)
+ compare(button.hovered, false)
+
+ mouseRelease(control)
+ }
+
function test_valueFromText_data() {
return [
{ tag: "editable", editable: true },