diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-19 13:39:41 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-19 12:50:52 +0000 |
commit | a02a54622a4eef49807060f9735c4c0d09833267 (patch) | |
tree | 6abb7770f72a7415021503ad7fc2ff3f64fdc080 /tests | |
parent | 0846541cd97b0fb30d51796ab9bf31d7684eb15b (diff) |
QQuickComboBox: handle touch events
Task-number: QTBUG-58389
Change-Id: I7120d7bce827beb97a9ae3eaf4e99cf6b6e9f209
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 05eb2de1..7789f861 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -695,6 +695,50 @@ TestCase { tryCompare(control.popup, "visible", false) } + function test_touch() { + var control = createTemporaryObject(comboBox, testCase, {model: 3}) + verify(control) + + var touch = touchEvent(control) + + var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"}) + verify(activatedSpy.valid) + + var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"}) + verify(highlightedSpy.valid) + + touch.press(0, control).commit() + touch.release(0, control).commit() + compare(control.popup.visible, true) + + var content = control.popup.contentItem + waitForRendering(content) + + // press - move - release outside - not activated - not closed + touch.press(0, control).commit() + compare(activatedSpy.count, 0) + compare(highlightedSpy.count, 0) + touch.move(0, control, control.width * 2, control.height / 2).commit() + compare(activatedSpy.count, 0) + compare(highlightedSpy.count, 0) + touch.release(0, control, control.width * 2, control.height / 2).commit() + compare(activatedSpy.count, 0) + compare(highlightedSpy.count, 0) + compare(control.popup.visible, true) + + // press - move - release inside - activated - closed + touch.press(0, content).commit() + compare(activatedSpy.count, 0) + compare(highlightedSpy.count, 0) + touch.move(0, content, content.width / 2 + 1, content.height / 2 + 1).commit() + compare(activatedSpy.count, 0) + compare(highlightedSpy.count, 0) + touch.release(0, content).commit() + compare(activatedSpy.count, 1) + compare(highlightedSpy.count, 1) + tryCompare(control.popup, "visible", false) + } + function test_down() { var control = createTemporaryObject(comboBox, testCase, {model: 3}) verify(control) |