aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlexpression
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-01 12:27:28 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-05 12:27:03 +0100
commit7fa4b8600be74c10c555ba07317e9b754f18ce3d (patch)
treef5d0ba9c076f4b9f2dfba0a510a1b1b26ea10d0a /tests/auto/qml/qqmlexpression
parent5375c095c3eb71c669053c4ca569a960dc76fabf (diff)
Fix crash with when evaluating bindings with QQmlExpression that throw exceptions
We must handle a thrown exception and cannot pass the undefined value back to QV8Engine::toVariant. Change-Id: Ia466b175706dccd513895ef5bb166b811fbdc26b Task-number: QTBUG-41860 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlexpression')
-rw-r--r--tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
index f53ef82891..522fafe7af 100644
--- a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
+++ b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
@@ -47,6 +47,7 @@ public:
private slots:
void scriptString();
void syntaxError();
+ void exception();
void expressionFromDataComponent();
};
@@ -109,6 +110,15 @@ void tst_qqmlexpression::syntaxError()
QCOMPARE(v, QVariant());
}
+void tst_qqmlexpression::exception()
+{
+ QQmlEngine engine;
+ QQmlExpression expression(engine.rootContext(), 0, "abc=123");
+ QVariant v = expression.evaluate();
+ QCOMPARE(v, QVariant());
+ QVERIFY(expression.hasError());
+}
+
void tst_qqmlexpression::expressionFromDataComponent()
{
qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");