diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-11-18 16:36:10 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-11-22 16:17:05 +0100 |
commit | c58d2e5229c39e8007ce5b93822c66af5e765a50 (patch) | |
tree | 41dda4299f2f39e366a5af45780ab23c01913412 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | e3a2b78cc2488ee247d59209dc53ebbfb785588e (diff) |
QtQml: Recognize JavaScript null as equivalent to nullptr QObject*
Otherwise we can go into infinite recursion there.
Pick-to: 6.2 6.4
Fixes: QTBUG-108651
Change-Id: I73a7c524b28d0eacb151f2090e3dce6afbc029d1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 9d0c4d3519..6884826894 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -400,6 +400,7 @@ private slots: void signalInlineComponentArg(); void functionSignatureEnforcement(); void importPrecedence(); + void nullIsNull(); private: QQmlEngine engine; @@ -7728,6 +7729,17 @@ void tst_qqmllanguage::importPrecedence() QCOMPARE(o2->property("theAgent").value<QObject *>(), nullptr); } +void tst_qqmllanguage::nullIsNull() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("nullIsNull.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + QVERIFY(o->property("someProperty").value<QObject*>() != nullptr); + QTRY_COMPARE(o->property("someProperty").value<QObject*>(), nullptr); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |