diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-01-04 21:21:48 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-01-04 21:21:48 +0200 |
commit | 6ab9856ef379fc3fe44d5fac03a83f679f398511 (patch) | |
tree | c18ec00e799549cf0c32bdfd8ecd8af9845e7e8f /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | 105e610548a62d943301153afb337a49f14e9e25 (diff) | |
parent | 0a8a7521ed395f385d111aa602f9c7b8d09ca991 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.13' into tqtc/lts-5.15-opensourcev5.15.13-lts-lgpl
Change-Id: I7060c2fbc681a8bd0fc1be478db2ab67976db5b9
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index ac6634290a..92d0069ce4 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -343,6 +343,8 @@ private slots: void bindingAliasToComponentUrl(); void badGroupedProperty(); + void objectAsBroken(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -5951,6 +5953,24 @@ void tst_qqmllanguage::badGroupedProperty() .arg(url.toString())); } +void tst_qqmllanguage::objectAsBroken() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("asBroken.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + QVariant selfAsBroken = o->property("selfAsBroken"); + QVERIFY(selfAsBroken.isValid()); + + // 5.15 doesn't enforce type annotation. So the "as" cast succeeds even though + // the target type cannot be resolved. + QCOMPARE(selfAsBroken.value<QObject *>(), o.data()); + + QQmlComponent b(&engine, testFileUrl("Broken.qml")); + QVERIFY(b.isError()); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |