summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_tableview.qml
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-10-22 12:52:49 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-22 15:00:47 +0200
commitfc01a4b20d08020cab6f1264c3b85a985bedc1e8 (patch)
treec91ab24775f4223cfbe9b34a3223cc5f4a183d7b /tests/auto/controls/data/tst_tableview.qml
parent11873dd28fc8ee2c756b79116f58eadf9f81d106 (diff)
downloadqtquickcontrols-fc01a4b20d08020cab6f1264c3b85a985bedc1e8.tar.gz
Ignore shift modifier in single selection mode
When holding shift in single selection mode, you can incorrectly select multiple rows. This fixes that issue and adds an auto-test. Change-Id: If43846b631e5a3927cf68f69298f71786f664fd0 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tst_tableview.qml')
-rw-r--r--tests/auto/controls/data/tst_tableview.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 6ec9fa5f..7f1b48dc 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -120,6 +120,37 @@ TestCase {
return true;
}
+
+ function test_keyboardSelection() {
+ var component = Qt.createComponent("tableview/table6_countmodel.qml")
+ compare(component.status, Component.Ready)
+ var table = component.createObject(container);
+ verify(table !== null, "table created is null")
+ table.model = 30
+ table.width = container.width
+ table.height = container.height
+ table.selectionMode = SelectionMode.SingleSelection
+ table.forceActiveFocus();
+ keyClick(Qt.Key_Down);
+ verify(table.selection.contains(1))
+ verify(table.selection.count === 1)
+ keyClick(Qt.Key_Down, Qt.ShiftModifier);
+ verify(table.selection.contains(2))
+ verify(table.selection.count === 1)
+ table.selectionMode = SelectionMode.ExtendedSelection
+ keyClick(Qt.Key_Down, Qt.ShiftModifier);
+ verify(table.selection.contains(2))
+ verify(table.selection.contains(3))
+ verify(table.selection.count === 2)
+ table.selectionMode = SelectionMode.MultiSelection
+ keyClick(Qt.Key_Down);
+ keyClick(Qt.Key_Down, Qt.ShiftModifier);
+ verify(table.selection.contains(4))
+ verify(table.selection.contains(5))
+ verify(table.selection.count === 2)
+ table.destroy()
+ }
+
function test_selection() {
var component = Qt.createComponent("tableview/table2_qabstractitemmodel.qml")