diff options
Diffstat (limited to 'tests/auto/controls/data/tst_treeview.qml')
-rw-r--r-- | tests/auto/controls/data/tst_treeview.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_treeview.qml b/tests/auto/controls/data/tst_treeview.qml index 902d2178..324d9cff 100644 --- a/tests/auto/controls/data/tst_treeview.qml +++ b/tests/auto/controls/data/tst_treeview.qml @@ -848,5 +848,30 @@ Item { mouseClick(tree, semiIndent + 50, 20 + 50, Qt.LeftButton) verify(selectionModel.isSelected(parentItem)) } + + function test_QTBUG_53097_currentIndex_on_model_reset() + { + var component = Qt.createComponent("treeview/treeview_1.qml") + compare(component.status, Component.Ready) + var tree = component.createObject(container); + verify(tree !== null, "tree created is null") + tree.headerVisible = false + var model = tree.model + waitForRendering(tree) + + /* Select the first row */ + verify(!tree.currentIndex.valid) + mouseClick(tree, semiIndent + 50, 20, Qt.LeftButton) + compare(tree.currentIndex.row, 0) + + spy.clear() + spy.target = tree + spy.signalName = "currentIndexChanged" + compare(spy.count, 0) + + /* delete the row: the currentIndex must be updated */ + model.removeRows(0, 1) + compare(spy.count, 1) + } } } |