summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem/tst_qquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickitem/tst_qquickitem.cpp')
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 6a49c4dd7e..a403b3e42b 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1774,56 +1774,56 @@ static void gc(QQmlEngine &engine)
void tst_qquickitem::visualParentOwnership()
{
- QQuickView view;
- view.setSource(testFileUrl("visualParentOwnership.qml"));
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("visualParentOwnership.qml"));
- QQuickItem *root = qobject_cast<QQuickItem*>(view.rootObject());
+ QScopedPointer<QQuickItem> root(qobject_cast<QQuickItem*>(component.create()));
QVERIFY(root);
QVariant newObject;
{
- QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QVERIFY(QMetaObject::invokeMethod(root.data(), "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
QPointer<QQuickItem> newItem = qvariant_cast<QQuickItem*>(newObject);
QVERIFY(!newItem.isNull());
QVERIFY(!newItem->parent());
QVERIFY(!newItem->parentItem());
- newItem->setParentItem(root);
+ newItem->setParentItem(root.data());
- gc(*view.engine());
+ gc(engine);
QVERIFY(!newItem.isNull());
newItem->setParentItem(0);
- gc(*view.engine());
+ gc(engine);
QVERIFY(newItem.isNull());
}
{
- QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QVERIFY(QMetaObject::invokeMethod(root.data(), "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
QPointer<QQuickItem> firstItem = qvariant_cast<QQuickItem*>(newObject);
QVERIFY(!firstItem.isNull());
- firstItem->setParentItem(root);
+ firstItem->setParentItem(root.data());
- QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QVERIFY(QMetaObject::invokeMethod(root.data(), "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
QPointer<QQuickItem> secondItem = qvariant_cast<QQuickItem*>(newObject);
QVERIFY(!firstItem.isNull());
secondItem->setParentItem(firstItem);
- gc(*view.engine());
+ gc(engine);
delete firstItem;
root->setProperty("keepAliveProperty", newObject);
- gc(*view.engine());
+ gc(engine);
QVERIFY(!secondItem.isNull());
root->setProperty("keepAliveProperty", QVariant());
- gc(*view.engine());
+ gc(engine);
QVERIFY(secondItem.isNull());
}
}