diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-03-23 16:00:07 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-03-23 16:00:07 +0200 |
commit | 19ed7973a311a8d42d3a558bb551230e902ce9b9 (patch) | |
tree | 9832c0cc796722f85579e25fd50cc38b65e6ef6c /tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp | |
parent | f5701f0def37fcc0c2b38ae9552eb3a896a34687 (diff) | |
parent | a5635345175e667601c8b6a344508c4d4ebb0f9d (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Change-Id: I91d2b178e7111d0802ea973bccf230b264c30c96
Diffstat (limited to 'tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp')
-rw-r--r-- | tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp index 84e08c471a..d5587432de 100644 --- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp +++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp @@ -47,6 +47,7 @@ private slots: void createMultiple(); void stringModel(); void activeProperty(); + void activeModelChangeInteraction(); void intModelChange(); void createAndRemove(); @@ -153,6 +154,26 @@ void tst_qqmlinstantiator::activeProperty() QCOMPARE(object->property("idx").toInt(), 0); } +void tst_qqmlinstantiator::activeModelChangeInteraction() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("activeModelChangeInteraction.qml")); + QScopedPointer<QObject> root(component.create()); + QVERIFY(root); + + // If the instantiator is inactive, a model change does not lead to items being loaded + bool ok = false; + int count = root->property("instanceCount").toInt(&ok); + QVERIFY(ok); + QCOMPARE(count, 0); + + // When turning the instantiator active, it will however reflect the model + root->setProperty("active", true); + count = root->property("instanceCount").toInt(&ok); + QVERIFY(ok); + QCOMPARE(count, 3); +} + void tst_qqmlinstantiator::intModelChange() { QQmlEngine engine; |