aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlengine/tst_qqmlengine.cpp')
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index 727635ee2c..85c32d8118 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -69,6 +69,9 @@ private slots:
void clearComponentCache();
void trimComponentCache();
void trimComponentCache_data();
+ void repeatedCompilation();
+ void failedCompilation();
+ void failedCompilation_data();
void outputWarningsToStandardError();
void objectOwnership();
void multipleEngines();
@@ -372,6 +375,46 @@ void tst_qqmlengine::trimComponentCache_data()
QTest::newRow("ScriptComponent") << "testScriptComponent.qml";
}
+void tst_qqmlengine::repeatedCompilation()
+{
+ QQmlEngine engine;
+
+ for (int i = 0; i < 100; ++i) {
+ engine.collectGarbage();
+ engine.trimComponentCache();
+
+ QQmlComponent component(&engine, testFileUrl("repeatedCompilation.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+ }
+}
+
+void tst_qqmlengine::failedCompilation()
+{
+ QFETCH(QString, file);
+
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(!component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object == 0);
+
+ engine.collectGarbage();
+ engine.trimComponentCache();
+ engine.clearComponentCache();
+}
+
+void tst_qqmlengine::failedCompilation_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("Invalid URL") << "failedCompilation.does.not.exist.qml";
+ QTest::newRow("Invalid content") << "failedCompilation.1.qml";
+}
+
static QStringList warnings;
static void msgHandler(QtMsgType, const char *warning)
{