aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-05-14 14:07:15 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-05-14 14:07:15 +0200
commit3ed33ec74b70bbac016dd080889bb3df3a78d90c (patch)
treea7dfaa6a921e43435757a629c6e2a86a721b1460 /tests
parent8279fb44cba551e139f307217da24d3f26a86c2e (diff)
parent5a3d9309ec018445a3471d40366f41ee2f6ebef7 (diff)
Merge remote-tracking branch 'origin/5.15.0' into 5.15
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp16
-rw-r--r--tests/auto/quick/qquickrepeater/data/package2.qml36
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp10
3 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index aeb0303899..26737e79c4 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -263,6 +263,7 @@ private slots:
void arrayIncludesWithLargeArray();
void printCircularArray();
void typedArraySet();
+ void dataViewCtor();
void uiLanguage();
@@ -5145,6 +5146,21 @@ void tst_QJSEngine::typedArraySet()
}
}
+void tst_QJSEngine::dataViewCtor()
+{
+ QJSEngine engine;
+ const auto error = engine.evaluate(R"(
+ (function() { try {
+ var buf = new ArrayBuffer(0x200);
+ var vuln = new DataView(buf, 8, 0xfffffff8);
+ } catch (e) {
+ return e;
+ }})()
+ )");
+ QVERIFY(error.isError());
+ QCOMPARE(error.toString(), "RangeError: DataView: constructor arguments out of range");
+}
+
void tst_QJSEngine::uiLanguage()
{
{
diff --git a/tests/auto/quick/qquickrepeater/data/package2.qml b/tests/auto/quick/qquickrepeater/data/package2.qml
new file mode 100644
index 0000000000..0ceb34b362
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/package2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import QtQml.Models 2.2
+import QtQuick.Window 2.0
+
+Item {
+ width: 300
+ height: 300
+ visible: true
+ DelegateModel {
+ id: mdl
+
+ model: 1
+ delegate: Package {
+ Item {
+ id: first
+ Package.name: "first"
+ }
+ Item{
+ id: second
+ Package.name: "second"
+ }
+ }
+ }
+
+ Repeater {
+ model: mdl.parts.first
+ }
+ Repeater {
+ model: mdl.parts.second
+ }
+
+ function setup(): bool {
+ mdl.model = 2
+ return true;
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index 33b8742170..35883339d7 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -1056,6 +1056,16 @@ void tst_QQuickRepeater::package()
QCOMPARE(repeater2->count(), 1);
QCOMPARE(repeater2->itemAt(0)->objectName(), "secondItem");
}
+
+ {
+ QQmlComponent component(&engine, testFileUrl("package2.qml"));
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(root != nullptr);
+ bool returnedValue = false;
+ // calling setup should not crash
+ QMetaObject::invokeMethod(root.get(), "setup", Q_RETURN_ARG(bool, returnedValue));
+ QVERIFY(returnedValue);
+ }
}
void tst_QQuickRepeater::ownership()