aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-12-11 16:38:14 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-12-12 16:04:48 +0100
commit0425562e14e41b62dc7631c7c02768b8294454d0 (patch)
tree733b22fb261624f99c9b8ab48888512b4793619d /tests/auto
parent9a9ae6be7d278cdcaf6ac99ea22b3d6cf1093313 (diff)
ComboBox: add selectTextByMouse property
Allows configuring the selectByMouse property of the underlying TextField for editable combo boxes. Named selectTextByMouse instead of selectByMouse to avoid confusion with selection of the items themselves. [ChangeLog][Controls][ComboBox] Added selectTextByMouse property. Change-Id: I852e4cd44ebe6b2a1ed2535513ea2fc35cbe0a32 Fixes: QTBUG-71406 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_combobox.qml16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 2cf71f73..0f1f0bdc 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -1853,4 +1853,20 @@ TestCase {
closedSpy.wait()
compare(closedSpy.count, 1)
}
+
+ function test_comboBoxSelectTextByMouse() {
+ let control = createTemporaryObject(comboBox, testCase,
+ { editable: true, selectTextByMouse: true, model: [ "Some text" ], width: parent.width })
+ verify(control)
+ waitForRendering(control)
+ control.forceActiveFocus()
+
+ // Position the text cursor at the beginning of the text.
+ mouseClick(control, control.leftPadding, control.height / 2)
+ // Select all of the text.
+ mousePress(control, control.leftPadding, control.height / 2)
+ mouseMove(control, control.leftPadding + control.contentItem.width, control.height / 2)
+ mouseRelease(control, control.leftPadding + control.contentItem.width, control.height / 2)
+ compare(control.contentItem.selectedText, "Some text")
+ }
}