diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-04 15:17:08 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-07 07:51:27 +0200 |
commit | 82dc70261eb701deff800c224a4ac7733a6feb49 (patch) | |
tree | 19b4dbd4a2853f0e982383ebc3e55fe1035ae459 /tests/auto/qml/qqmlproperty | |
parent | 036cd790878eef614b063c619ca148a325cb4e67 (diff) |
tst_qqmlproperty: avoid setContextProperty
Change-Id: Ie81443bc6d6e6251db276937973b5d10b0a501e3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlproperty')
-rw-r--r-- | tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml index a9e51c1255..440f07ac87 100644 --- a/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml +++ b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 Item { + required property QtObject o Component.onCompleted: { o.variantMap = {}; } } diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index f6e3dc0226..1a5927fa74 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -1994,11 +1994,9 @@ void tst_qqmlproperty::assignEmptyVariantMap() QCOMPARE(o.variantMap().count(), 1); QCOMPARE(o.variantMap().isEmpty(), false); - QQmlContext context(&engine); - context.setContextProperty("o", &o); QQmlComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml")); - QObject *obj = component.create(&context); + QObject *obj = component.createWithInitialProperties({{"o", QVariant::fromValue(&o)}}); QVERIFY(obj); QCOMPARE(o.variantMap().count(), 0); |