aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp')
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp53
1 files changed, 36 insertions, 17 deletions
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 3745fad470..0c4abf19f4 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -55,6 +55,7 @@ private slots:
void redirect();
void qmlSingletonWithinModule();
void multiSingletonModule();
+ void implicitComponentModule();
};
void tst_QQMLTypeLoader::testLoadComplete()
@@ -446,23 +447,8 @@ void tst_QQMLTypeLoader::qmlSingletonWithinModule()
QVERIFY(obj->property("ok").toBool());
}
-void tst_QQMLTypeLoader::multiSingletonModule()
+static void checkCleanCacheLoad(const QString &testCase)
{
- qmlClearTypeRegistrations();
- QQmlEngine engine;
- engine.addImportPath(testFile("imports"));
-
- qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton1.qml"), "cppsingletonmodule",
- 1, 0, "CppRegisteredSingleton1");
- qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton2.qml"), "cppsingletonmodule",
- 1, 0, "CppRegisteredSingleton2");
-
- QQmlComponent component(&engine, testFileUrl("multisingletonuser.qml"));
- QCOMPARE(component.status(), QQmlComponent::Ready);
- QScopedPointer<QObject> obj(component.create());
- QVERIFY(!obj.isNull());
- QVERIFY(obj->property("ok").toBool());
-
#if QT_CONFIG(process)
const char *skipKey = "QT_TST_QQMLTYPELOADER_SKIP_MISMATCH";
if (qEnvironmentVariableIsSet(skipKey))
@@ -470,7 +456,7 @@ void tst_QQMLTypeLoader::multiSingletonModule()
for (int i = 0; i < 5; ++i) {
QProcess child;
child.setProgram(QCoreApplication::applicationFilePath());
- child.setArguments(QStringList(QLatin1String("multiSingletonModule")));
+ child.setArguments(QStringList(testCase));
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QLatin1String("QT_LOGGING_RULES"), QLatin1String("qt.qml.diskcache.debug=true"));
env.insert(QLatin1String(skipKey), QLatin1String("1"));
@@ -481,9 +467,42 @@ void tst_QQMLTypeLoader::multiSingletonModule()
QVERIFY(!child.readAllStandardOutput().contains("Checksum mismatch for cached version"));
QVERIFY(!child.readAllStandardError().contains("Checksum mismatch for cached version"));
}
+#else
+ Q_UNUSED(testCase);
#endif
}
+void tst_QQMLTypeLoader::multiSingletonModule()
+{
+ qmlClearTypeRegistrations();
+ QQmlEngine engine;
+ engine.addImportPath(testFile("imports"));
+
+ qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton1.qml"), "cppsingletonmodule",
+ 1, 0, "CppRegisteredSingleton1");
+ qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton2.qml"), "cppsingletonmodule",
+ 1, 0, "CppRegisteredSingleton2");
+
+ QQmlComponent component(&engine, testFileUrl("multisingletonuser.qml"));
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QVERIFY(obj->property("ok").toBool());
+
+ checkCleanCacheLoad(QLatin1String("multiSingletonModule"));
+}
+
+void tst_QQMLTypeLoader::implicitComponentModule()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("implicitcomponent.qml"));
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+
+ checkCleanCacheLoad(QLatin1String("implicitComponentModule"));
+}
+
QTEST_MAIN(tst_QQMLTypeLoader)
#include "tst_qqmltypeloader.moc"