diff options
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml new file mode 100644 index 0000000000..c76d2b679e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml @@ -0,0 +1,6 @@ +import QtQml 2.15 +import QtTest 1.0 + +QtObject { + component Comp: QtObject {} +} diff --git a/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml new file mode 100644 index 0000000000..765dc91fe1 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml @@ -0,0 +1,3 @@ +import QtQml 2.15 + +TestCase {} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 31bf30c57c..bffb62c59e 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -337,6 +337,8 @@ private slots: void hangOnWarning(); + void ambiguousContainingType(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -5860,6 +5862,20 @@ void tst_qqmllanguage::hangOnWarning() QVERIFY(object != nullptr); } +void tst_qqmllanguage::ambiguousContainingType() +{ + // Need to do it twice, so that we load from disk cache the second time. + for (int i = 0; i < 2; ++i) { + QQmlEngine engine; + + // Should not crash when loading the type + QQmlComponent c(&engine, testFileUrl("ambiguousBinding/ambiguousContainingType.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + } +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |