diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-11-08 11:35:30 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-11-08 14:46:56 +0100 |
commit | ee8589dd9a681a469511308345e4ef0b304aaaab (patch) | |
tree | 7e61e6c309ff9552b1a56ca6502db2029e2fdce7 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | 8f4765534f83c27301ea758f5189f8f9b6684b6b (diff) |
instanceof: return false instead of throwing
[ChangeLog][Important Behavior Changes] Using instanceof to check
whether an instance has the type of QObject or one of its derived
classes used to raise a TypeError, if the instance was not derived from
QObject. Now, it instead returns false, which is more in line with the
ECMAScript semantic.
Fixes: QTBUG-79868
Change-Id: I0999807165eb36e7ebb888dce66238619a02a127
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 380925ded8..7fff982cde 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -4969,24 +4969,24 @@ void tst_qqmllanguage::instanceof_data() // assert that basic types don't convert to QObject QTest::newRow("1 instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); QTest::newRow("true instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); QTest::newRow("\"foobar\" instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); // assert that Managed don't either QTest::newRow("new String(\"foobar\") instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); QTest::newRow("new Object() instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); QTest::newRow("new Date() instanceof QtObject") << testFileUrl("instanceof_qtqml.qml") - << QVariant("TypeError: Type error"); + << QVariant(false); // test that simple QtQml comparisons work QTest::newRow("qtobjectInstance instanceof QtObject") |