aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-10-12 12:13:45 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2019-04-16 08:37:22 +0000
commit398d586a59e768f6e442fdc912d9180df71ff374 (patch)
treedd835351f4bb706047da993edacfd8c790d1e63f /tests
parent5fcc9906d7b6d19ea3d79ccf0d6446d01b583973 (diff)
QML: Allow fetchOrCreateTypeForUrl to report errors without qFatal
Because qFatal will abort() the program. Task-number: QTBUG-71116 Change-Id: Ifd6be996cfbd6fff8e75ad2b26682c34f837ac88 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp1
-rw-r--r--tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/fuzzed.2.qmlbin0 -> 404 bytes
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp4
4 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
index c393149f59..d1e74aecef 100644
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -128,6 +128,7 @@ void tst_qmlmin::initTestCase()
invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js";
invalidFiles << "tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js";
invalidFiles << "tests/auto/qml/debugger/qqmlpreview/data/broken.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.2.qml";
}
QStringList tst_qmlmin::findFiles(const QDir &d)
diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt
new file mode 100644
index 0000000000..92ce4c649f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt
@@ -0,0 +1,2 @@
+5:1:TetZ$ is not a type
+-1:-1:Invalid QML type name "TetZ$"
diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml b/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml
new file mode 100644
index 0000000000..e726f6783c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml
Binary files differ
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 10af8d70e8..85dddbcb54 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -361,7 +361,7 @@ private:
} \
file.close(); \
} else { \
- QCOMPARE(expected, actual); \
+ QCOMPARE(actual, expected); \
} \
}
@@ -615,6 +615,7 @@ void tst_qqmllanguage::errors_data()
QTest::newRow("cyclicAlias") << "cyclicAlias.qml" << "cyclicAlias.errors.txt" << false;
QTest::newRow("fuzzed.1") << "fuzzed.1.qml" << "fuzzed.1.errors.txt" << false;
+ QTest::newRow("fuzzed.2") << "fuzzed.2.qml" << "fuzzed.2.errors.txt" << false;
}
@@ -625,6 +626,7 @@ void tst_qqmllanguage::errors()
QFETCH(bool, create);
QQmlComponent component(&engine, testFileUrl(file));
+ QTRY_VERIFY(!component.isLoading());
QScopedPointer<QObject> object;