aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-02-13 14:24:36 +0100
committerMitch Curtis <mitch.curtis@qt.io>2020-02-20 15:47:48 +0100
commit09476c590ab13623130d5ac79045fa68e504be96 (patch)
tree72775754502f610299cb140815587140f3364161 /tests
parentc1420ee5423dfa104d5ff87bc529b4530dc998d6 (diff)
Fix clicked() being emitted after doubleClicked()
Do as MouseArea does, and keep track of double clicks ourselves, otherwise we think the second click is a regular click. This is for mouse events only; for touch we have bigger problems to solve first: QTBUG-82146 Change-Id: I46e816d0cfa1bab98a0a1685915842ebd176e762 Fixes: QTBUG-82032 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml23
-rw-r--r--tests/auto/controls/data/tst_button.qml3
-rw-r--r--tests/auto/controls/data/tst_delaybutton.qml3
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml3
4 files changed, 26 insertions, 6 deletions
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index ee26a6d6..da5642cc 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -887,4 +887,27 @@ TestCase {
mouseRelease(control)
compare(clickedSpy.count, 1)
}
+
+ function test_doubleClick() {
+ let control = createTemporaryObject(button, testCase, { text: "Hello" })
+ verify(control)
+
+ let pressedSpy = signalSpy.createObject(control, { target: control, signalName: "pressed" })
+ verify(pressedSpy.valid)
+
+ let releasedSpy = signalSpy.createObject(control, { target: control, signalName: "released" })
+ verify(releasedSpy.valid)
+
+ let clickedSpy = signalSpy.createObject(control, { target: control, signalName: "clicked" })
+ verify(clickedSpy.valid)
+
+ let doubleClickedSpy = signalSpy.createObject(control, { target: control, signalName: "doubleClicked" })
+ verify(doubleClickedSpy.valid)
+
+ mouseDoubleClickSequence(control)
+ compare(pressedSpy.count, 2)
+ compare(releasedSpy.count, 2)
+ compare(clickedSpy.count, 1)
+ compare(doubleClickedSpy.count, 1)
+ }
}
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index bd4fe80e..83a6ea61 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -152,8 +152,7 @@ TestCase {
"doubleClicked",
["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }],
- "released",
- "clicked"]
+ "released"]
mouseDoubleClickSequence(control, control.width / 2, control.height / 2, Qt.LeftButton)
verify(sequenceSpy.success)
}
diff --git a/tests/auto/controls/data/tst_delaybutton.qml b/tests/auto/controls/data/tst_delaybutton.qml
index 2560177d..e965b5ef 100644
--- a/tests/auto/controls/data/tst_delaybutton.qml
+++ b/tests/auto/controls/data/tst_delaybutton.qml
@@ -173,8 +173,7 @@ TestCase {
"doubleClicked",
["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }],
- "released",
- "clicked"]
+ "released"]
mouseDoubleClickSequence(control, control.width / 2, control.height / 2, Qt.LeftButton)
verify(sequenceSpy.success)
}
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 3e2ff460..71eb0b99 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -654,8 +654,7 @@ TestCase {
"pressed",
"doubleClicked",
["pressedChanged", { "pressed": false }],
- "released",
- "clicked"
+ "released"
];
mouseDoubleClickSequence(control, control.width / 2, control.height / 2, Qt.LeftButton);
verify(mouseSignalSequenceSpy.success);