diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-07-07 16:45:26 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-11 11:21:06 +0000 |
commit | 3a7d3a8aa90e2b26a98eff1df0b93965976a699d (patch) | |
tree | c863aa8be4a3cd9c7eba29606cd45571422cffcc /tests | |
parent | 46e0e527a50c9dc2bdc4f8eb21d1f4fec42ef6e8 (diff) |
QQuickTextArea & -Field: fix double-click to select a word
The delayed/intercepted mouse press event must be passed first,
before letting the base class handle the double-click event.
Change-Id: I029d06b0b619f34bb7be13ae12b8904f2efe6b5b
Task-number: QTBUG-54615
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_textarea.qml | 19 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_textfield.qml | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml index 3afa7193..c46aece8 100644 --- a/tests/auto/controls/data/tst_textarea.qml +++ b/tests/auto/controls/data/tst_textarea.qml @@ -176,4 +176,23 @@ TestCase { ignoreWarning(Qt.resolvedUrl("tst_textarea.qml") + ":45:1: QML TestCase: TextArea must be attached to a Flickable") testCase.TextArea.flickable = null } + + function test_multiClick() { + var control = textArea.createObject(testCase, {text: "Qt Quick Controls 2 TextArea", selectByMouse: true}) + verify(control) + + waitForRendering(control) + control.width = control.contentWidth + var rect = control.positionToRectangle(12) + + // double click -> select word + mouseDoubleClickSequence(control, rect.x + rect.width / 2, rect.y + rect.height / 2) + compare(control.selectedText, "Controls") + + // tripple click -> select whole line + mouseClick(control, rect.x + rect.width / 2, rect.y + rect.height / 2) + compare(control.selectedText, "Qt Quick Controls 2 TextArea") + + control.destroy() + } } diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml index 012dedba..f2907b36 100644 --- a/tests/auto/controls/data/tst_textfield.qml +++ b/tests/auto/controls/data/tst_textfield.qml @@ -144,4 +144,23 @@ TestCase { control.destroy() } + + function test_multiClick() { + var control = textField.createObject(testCase, {text: "Qt Quick Controls 2 TextArea", selectByMouse: true}) + verify(control) + + waitForRendering(control) + control.width = control.contentWidth + var rect = control.positionToRectangle(12) + + // double click -> select word + mouseDoubleClickSequence(control, rect.x + rect.width / 2, rect.y + rect.height / 2) + compare(control.selectedText, "Controls") + + // tripple click -> select whole line + mouseClick(control, rect.x + rect.width / 2, rect.y + rect.height / 2) + compare(control.selectedText, "Qt Quick Controls 2 TextArea") + + control.destroy() + } } |