diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/tst_treeview.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/tst_treeview.cpp b/tests/auto/tst_treeview.cpp index 413b2b3..b8f1713 100644 --- a/tests/auto/tst_treeview.cpp +++ b/tests/auto/tst_treeview.cpp @@ -74,6 +74,7 @@ private slots: void showTreeView(); void expandAndCollapseRoot(); void expandAndCollapseChildren(); + void expandChildPendingToBeVisible(); void attachedPropertiesRoot(); void attachedPropertiesChildren(); void emptyModel(); @@ -167,6 +168,28 @@ void tst_treeview::expandAndCollapseChildren() QCOMPARE(treeView->rows(), 1); } +void tst_treeview::expandChildPendingToBeVisible() +{ + // Check that if we expand a row r1, and that row has a child r2 that can + // be expanded, we can continue to expand c2 immediately, even if r1 is + // still pending to be shown as expanded in the view. + LOAD_TREEVIEW("normaltreeview.qml"); + QMetaObject::invokeMethod(treeView, "expand", Q_ARG(int, 0)); + // The view has not yet been updated at this point to show + // the newly expanded children, so it still has only one row. + QCOMPARE(treeView->rows(), 1); + // ...but we still expand row 5, which is a child that has children + // in the proxy model + QMetaObject::invokeMethod(treeView, "expand", Q_ARG(int, 4)); + QCOMPARE(treeView->rows(), 1); + + WAIT_UNTIL_POLISHED; + + // Now the view have updated to show + // all the rows that has been expanded. + QCOMPARE(treeView->rows(), 9); +} + void tst_treeview::attachedPropertiesRoot() { LOAD_TREEVIEW("normaltreeview.qml"); |