summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_treeview.qml
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-02-19 16:50:26 +0100
committerCaroline Chao <caroline.chao@theqtcompany.com>2015-02-25 07:57:02 +0000
commit5df76111772749e8c1dc323e1300607e0e2c427b (patch)
tree6bf4e910aa36d5e975bbf697c5510abe0697186b /tests/auto/controls/data/tst_treeview.qml
parentcdd0c1d5ac5daf8010e8088ca80e059dbea66efc (diff)
downloadqtquickcontrols-5df76111772749e8c1dc323e1300607e0e2c427b.tar.gz
TreeView: Always update selection current index
This gets us closer to the classic item views behavior. Change-Id: I1f9ccdaa1c91e807a8726715a520dd0006c6e988 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/tst_treeview.qml')
-rw-r--r--tests/auto/controls/data/tst_treeview.qml23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/auto/controls/data/tst_treeview.qml b/tests/auto/controls/data/tst_treeview.qml
index 7ce5581b..14ce3169 100644
--- a/tests/auto/controls/data/tst_treeview.qml
+++ b/tests/auto/controls/data/tst_treeview.qml
@@ -369,12 +369,9 @@ Item {
compare(secondItem.internalId, tree.currentIndex.internalId)
compare(secondItem.internalId, tree.selection.currentIndex.internalId)
- expectFailContinue('', 'BUG isSelected is always false when SingleSelection')
compare(tree.selection.isSelected(secondItem), true)
- expectFailContinue('', 'BUG hasSelection is always false when SingleSelection')
compare(tree.selection.hasSelection, true)
var list = tree.selection.selectedIndexes()
- expectFailContinue('', 'BUG empty selectedIndex when SingleSelection')
compare(list.length, 1)
if (list.length === 1) {
compare(list.at(0).internalId, secondItem.internalId)
@@ -386,7 +383,6 @@ Item {
compare(thirdItem.internalId, tree.selection.currentIndex.internalId)
keyClick(Qt.Key_Down, Qt.ControlModifier)
-
compare(fourthItem.internalId, tree.currentIndex.internalId)
expectFailContinue('', 'BUG selected state not updated with Command/Control when SingleSelection')
compare(fourthItem.internalId, tree.selection.currentIndex.internalId)
@@ -446,8 +442,6 @@ Item {
keyClick(Qt.Key_Down, Qt.ControlModifier)
verify(!tree.selection.currentIndex.valid)
compare(tree.selection.hasSelection, false)
- expectFailContinue('', 'BUG selected state not updated with Command/Controls when SingleSelection')
- compare(tree.selection.isSelected(fourthItem), true)
tree.destroy()
}
@@ -495,7 +489,6 @@ Item {
var listIndexes = tree.selection.selectedIndexes()
compare(listIndexes.length, 1)
compare(listIndexes.at(0).internalId, secondItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when MultiSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, secondItem.internalId)
@@ -509,7 +502,6 @@ Item {
compare(listIndexes.length, 2)
compare(listIndexes.at(0).internalId, secondItem.internalId)
compare(listIndexes.at(1).internalId, fourthItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when MultiSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, fourthItem.internalId)
@@ -528,7 +520,6 @@ Item {
compare(listIndexes.at(0).internalId, secondItem.internalId)
compare(listIndexes.at(1).internalId, fourthItem.internalId)
compare(listIndexes.at(2).internalId, sixthItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when MultiSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, sixthItem.internalId)
@@ -544,10 +535,7 @@ Item {
compare(listIndexes.length, 2)
compare(listIndexes.at(0).internalId, secondItem.internalId)
compare(listIndexes.at(1).internalId, sixthItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when MultiSelection')
verify(tree.selection.currentIndex.valid)
- if (tree.selection.currentIndex.valid) // TO VERIFY
- verify(!tree.selection.currentIndex.valid)
mouseClick(tree, semiIndent + 50, 70+150, Qt.LeftButton)
compare(fourthItem.internalId, tree.currentIndex.internalId)
@@ -612,7 +600,6 @@ Item {
var listIndexes = tree.selection.selectedIndexes()
compare(listIndexes.length, 1)
compare(listIndexes.at(0).internalId, secondItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when ExtendedSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, secondItem.internalId)
@@ -701,7 +688,6 @@ Item {
var listIndexes = tree.selection.selectedIndexes()
compare(listIndexes.length, 1)
compare(listIndexes.at(0).internalId, secondItem.internalId)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when ContiguousSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, secondItem.internalId)
@@ -710,12 +696,12 @@ Item {
mouseClick(tree, semiIndent + 50, 70+50, Qt.LeftButton)
compare(tree.selection.hasSelection, true)
compare(tree.selection.isSelected(secondItem), true)
- // Ctrl/Cmd click deselect
+ // Ctrl/Cmd click deselect all, selects current
mouseClick(tree, semiIndent + 50, 70+52, Qt.LeftButton, Qt.ControlModifier)
- compare(tree.selection.hasSelection, false)
- compare(tree.selection.isSelected(secondItem), false)
+ compare(tree.selection.hasSelection, true)
+ compare(tree.selection.isSelected(secondItem), true)
listIndexes = tree.selection.selectedIndexes()
- compare(listIndexes.length, 0)
+ compare(listIndexes.length, 1)
mouseClick(tree, semiIndent + 50, 70+50, Qt.LeftButton)
keyPress(Qt.Key_Down, Qt.ShiftModifier)
@@ -729,7 +715,6 @@ Item {
compare(tree.selection.isSelected(thirdItem), true)
compare(tree.selection.isSelected(fourthItem), true)
compare(tree.selection.isSelected(fifthItem), true)
- expectFailContinue('', 'BUG selection.currentIndex is invalid when ContiguousSelection')
verify(tree.selection.currentIndex.valid)
if (tree.selection.currentIndex.valid)
compare(tree.selection.currentIndex.internalId, fifthItem.internalId)