From aa0e97f08a4266906d97c26cc1ba05686b1cd72e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 28 Jan 2015 16:04:03 +0100 Subject: Fix testBrokenJSMethodConnect autotest Since qtdeclarative change e2c1e7b8a exceptions in JS slots do _not_ set the engine to an error state anymore, but are rather printed to console, and ignored. This prevents exceptions to silently propagate ... Change-Id: Icb065314730cf2142eedbde14b0c77c21bdd6f6f Reviewed-by: Niels Weber Reviewed-by: Jarek Kobus Reviewed-by: Kai Koehne --- tests/auto/installer/scriptengine/data/broken_connect.qs | 2 +- tests/auto/installer/scriptengine/tst_scriptengine.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/installer/scriptengine/data/broken_connect.qs b/tests/auto/installer/scriptengine/data/broken_connect.qs index 2fe873b63..9c7c2b864 100644 --- a/tests/auto/installer/scriptengine/data/broken_connect.qs +++ b/tests/auto/installer/scriptengine/data/broken_connect.qs @@ -6,6 +6,6 @@ function BrokenConnect() function receive() { print("function receive()"); - // this should throw an exception, "foo" does not exist + // this will print an error. foo.bar = "test"; } diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp index 09785850e..0da511581 100644 --- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -232,6 +232,9 @@ private slots: void testBrokenJSMethodConnect() { +#if QT_VERSION <= 0x50400 + QSKIP("Behavior changed from 5.4.1 onwards"); +#endif EmitSignalObject emiter; m_scriptEngine->globalObject().setProperty(QLatin1String("emiter"), m_scriptEngine->newQObject(&emiter)); @@ -248,11 +251,11 @@ private slots: // ignore Output from script setExpectedScriptOutput("\"function receive()\""); + QTest::ignoreMessage(QtWarningMsg, ":10: ReferenceError: foo is not defined"); emiter.produceSignal(); const QJSValue value = m_scriptEngine->evaluate(""); - QCOMPARE(value.isError(), true); - QCOMPARE(value.toString(), QLatin1String("ReferenceError: foo is not defined")); + QCOMPARE(value.isError(), false); } void testScriptPrint() -- cgit v1.2.3