aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-06 09:17:24 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-06 09:17:24 +0200
commit9b6d55ddf361f14c05c2965b29184a95e3c6a989 (patch)
treea1b4327662b257f4d18541ed136062d3bc38b229 /tests/auto/qml/qqmlecmascript
parent9a7cf067a178c7a08a7ed9f2c6253e1feade5569 (diff)
parent9530a6a8744e9eb2b4ed947b528ab7c51d8c360f (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml
new file mode 100644
index 0000000000..03f90c15c8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml
@@ -0,0 +1,13 @@
+import QtQml 2.0
+
+QtObject {
+ property bool someProperty: true
+ function testCall() {
+ try {
+ someProperty(); // should throw
+ return false
+ } catch (e) {
+ return true
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 87f9f963f9..29f81cd063 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -322,6 +322,7 @@ private slots:
void writeUnregisteredQObjectProperty();
void switchExpression();
void qtbug_46022();
+ void qtbug_52340();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7903,6 +7904,17 @@ void tst_qqmlecmascript::qtbug_46022()
QCOMPARE(obj->property("test2").toBool(), true);
}
+void tst_qqmlecmascript::qtbug_52340()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_52340.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+ QVariant returnValue;
+ QVERIFY(QMetaObject::invokeMethod(object.data(), "testCall", Q_RETURN_ARG(QVariant, returnValue)));
+ QVERIFY(returnValue.isValid());
+ QVERIFY(returnValue.toBool());
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"