aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine/tst_qjsengine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-11 11:08:11 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-02-11 12:00:31 +0100
commit7c9497a6d47a02d961baef3993ba4cf4267ec607 (patch)
tree335fae3e9e3a84d33310efca23f1d6993265805b /tests/auto/qml/qjsengine/tst_qjsengine.cpp
parent67ba88947f57ab2d1859bbeb96c6dcba020561b1 (diff)
parent6c840c70d61c3ae277b60a024a086215c743e5b3 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
Diffstat (limited to 'tests/auto/qml/qjsengine/tst_qjsengine.cpp')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 529b97ed89..bb5f83bed1 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -47,6 +47,7 @@
#include <qgraphicsitem.h>
#include <qstandarditemmodel.h>
#include <QtCore/qnumeric.h>
+#include <qqmlengine.h>
#include <stdlib.h>
#include <private/qv4alloca_p.h>
@@ -82,6 +83,7 @@ private slots:
void newQObject();
void newQObject_ownership();
void newQObject_deletedEngine();
+ void exceptionInSlot();
void globalObjectProperties();
void globalObjectEquals();
void globalObjectProperties_enumerate();
@@ -145,6 +147,9 @@ private slots:
void arrayPop_QTBUG_35979();
void regexpLastMatch();
+
+signals:
+ void testSignal();
};
tst_QJSEngine::tst_QJSEngine()
@@ -507,6 +512,25 @@ void tst_QJSEngine::newQObject_deletedEngine()
QTRY_VERIFY(spy.count());
}
+void tst_QJSEngine::exceptionInSlot()
+{
+ QJSEngine engine;
+ QJSValue wrappedThis = engine.newQObject(this);
+ QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
+ engine.globalObject().setProperty("testCase", wrappedThis);
+ engine.evaluate(
+ "var called = false\n"
+ "function throwingSlot() {\n"
+ " called = true\n"
+ " throw 42;\n"
+ "}\n"
+ "testCase.testSignal.connect(throwingSlot)\n"
+ );
+ QCOMPARE(engine.globalObject().property("called").toBool(), false);
+ emit testSignal();
+ QCOMPARE(engine.globalObject().property("called").toBool(), true);
+}
+
void tst_QJSEngine::globalObjectProperties()
{
// See ECMA-262 Section 15.1, "The Global Object".