aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJaeyoon Jung <jaeyoon.jung@lge.com>2018-02-08 14:24:20 +0900
committerDominik Holland <dominik.holland@qt.io>2020-06-16 12:36:42 +0200
commit2bad18ff33503ec291917894aca1740fb419d7c9 (patch)
treeb5e3f2b494b1402ddbfd91375bf7777b49a86e1d /tests
parent6adf57e8f3dac1912f532cb6956d989b8a148742 (diff)
Warn circular dependency when loading types
Detect a circular dependency between two QML types and print a warning message if found. Task-number: QTBUG-83354 Change-Id: I826b28775ba3212ccccaeb56d50b64fec6f38ea9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f0c08dc2175cffadb73e06d2cc69a152002e0df0)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmltypeloader/data/CircularDependency.qml3
-rw-r--r--tests/auto/qml/qqmltypeloader/data/CircularDependencyBase.qml3
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp9
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmltypeloader/data/CircularDependency.qml b/tests/auto/qml/qqmltypeloader/data/CircularDependency.qml
new file mode 100644
index 0000000000..0b7c030063
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/CircularDependency.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+CircularDependencyBase {}
diff --git a/tests/auto/qml/qqmltypeloader/data/CircularDependencyBase.qml b/tests/auto/qml/qqmltypeloader/data/CircularDependencyBase.qml
new file mode 100644
index 0000000000..d068d1cabc
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/CircularDependencyBase.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+CircularDependency {}
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 266a4e97d6..1303a4b19c 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -63,6 +63,7 @@ private slots:
void implicitImport();
void compositeSingletonCycle();
void declarativeCppType();
+ void circularDependency();
};
void tst_QQMLTypeLoader::testLoadComplete()
@@ -592,6 +593,14 @@ void tst_QQMLTypeLoader::declarativeCppType()
QVERIFY(!obj.isNull());
}
+void tst_QQMLTypeLoader::circularDependency()
+{
+ QQmlEngine engine;
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("Cyclic dependency detected between (.*) and (.*)"));
+ QQmlComponent component(&engine, testFileUrl("CircularDependency.qml"));
+ QCOMPARE(component.status(), QQmlComponent::Null);
+}
+
QTEST_MAIN(tst_QQMLTypeLoader)
#include "tst_qqmltypeloader.moc"