aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-08-25 14:16:29 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2021-08-26 11:17:17 +0200
commitf0e5ff83a10a12cb38c3d6770e42f587d9392d51 (patch)
treedadb79aee98e63b0c02ed34c586b524106bad023 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parent0d3f0b581c2272c70c14b1811a3d65a52276988c (diff)
tst_qqmlecmascript: Check that parent can defer child class properties
It is arguably a bad idea to defer properties which might get defined in child classes, but checking it in the engine would be expensive: We cannot simply check that the property exist, as we might want to defer attached properties. So for now, we add a test to document and verify the behavior. Change-Id: I264b136638c4ecddfa52b6687797cb981d9b531e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index eb9fa14aa5..9b7286dc0e 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -101,6 +101,7 @@ private slots:
void dependenciesWithFunctions();
void deferredProperties();
void deferredPropertiesParent();
+ void deferredPropertiesByParent();
void deferredPropertiesErrors();
void deferredPropertiesInComponents();
void deferredPropertiesInDestruction();
@@ -1229,6 +1230,20 @@ void tst_qqmlecmascript::deferredPropertiesParent()
qmlExecuteDeferred(object);
QCOMPARE(object->baseValue(), 10);
}
+
+void tst_qqmlecmascript::deferredPropertiesByParent()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("deferredPropertiesChild.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY2(obj, qPrintable(component.errorString()));
+ DeferredByParentChild *object = qobject_cast<DeferredByParentChild *>(obj.data());
+ QVERIFY(object != nullptr);
+ QCOMPARE(object->childValue(), 0);
+ qmlExecuteDeferred(object);
+ QCOMPARE(object->childValue(), 10);
+}
+
// Check errors on deferred properties are correctly emitted
void tst_qqmlecmascript::deferredPropertiesErrors()
{