aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-03-05 14:16:37 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-03-18 16:37:01 +0100
commitdf6d816fe3b0444db2c4165c86b330edd610e531 (patch)
tree56a98389badf3540996cc914bdc6778cd072c201 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parent2757f8e0e18d3222bf3802280ad28256d12bb810 (diff)
QQmlPropertyCache: Avoid costly string comparison
The qqmlecmacsript required changes, because the call to id makes the type now known to the QML engine. Change-Id: I73aed804ae8769c71676b44d8450e1dabf5baa6d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 6b7dda8afe..cfbc329198 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -1273,44 +1273,36 @@ void tst_qqmlecmascript::enums()
// Non-existent enums
{
QUrl file = testFileUrl("enums.2.qml");
- QString w1 = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'MyEnum' for property 'MyUnregisteredEnumTypeObject::enumProperty'");
QString w2 = QLatin1String("QQmlExpression: Expression ") + testFileUrl("enums.2.qml").toString() + QLatin1String(":9:5 depends on non-NOTIFYable properties:");
QString w3 = QLatin1String(" MyUnregisteredEnumTypeObject::enumProperty");
QString w4 = file.toString() + ":7:5: Unable to assign [undefined] to int";
QString w5 = file.toString() + ":8:5: Unable to assign [undefined] to int";
- QString w6 = file.toString() + ":9:5: Unable to assign [undefined] to int";
- QString w7 = file.toString() + ":13:9: Unable to assign [undefined] to [unknown property type]";
- QString w8 = file.toString() + ":31:9: Unable to assign int to [unknown property type]";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w1));
+ QString w7 = file.toString() + ":13:9: Unable to assign [undefined] to MyUnregisteredEnumTypeObject::MyEnum";
QTest::ignoreMessage(QtWarningMsg, qPrintable(w2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w4));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w5));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w6));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w7));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w8));
QQmlComponent component(&engine, testFileUrl("enums.2.qml"));
QObject *object = component.create();
QVERIFY(object != nullptr);
QCOMPARE(object->property("a").toInt(), 0);
QCOMPARE(object->property("b").toInt(), 0);
- QCOMPARE(object->property("c").toInt(), 0);
+ QCOMPARE(object->property("c").toInt(), 1); // Change from Qt 5: type gets automatically registered
- QString w9 = file.toString() + ":18: Error: Cannot assign JavaScript function to [unknown property type]";
+ QString w9 = file.toString() + ":18: Error: Cannot assign JavaScript function to MyUnregisteredEnumTypeObject::MyEnum";
QTest::ignoreMessage(QtWarningMsg, qPrintable(w9));
QMetaObject::invokeMethod(object, "testAssignmentOne");
- QString w10 = file.toString() + ":21: Error: Cannot assign [undefined] to [unknown property type]";
+ QString w10 = file.toString() + ":21: Error: Cannot assign [undefined] to MyUnregisteredEnumTypeObject::MyEnum";
QTest::ignoreMessage(QtWarningMsg, qPrintable(w10));
QMetaObject::invokeMethod(object, "testAssignmentTwo");
- QString w11 = file.toString() + ":24: Error: Cannot assign [undefined] to [unknown property type]";
+ QString w11 = file.toString() + ":24: Error: Cannot assign [undefined] to MyUnregisteredEnumTypeObject::MyEnum";
QTest::ignoreMessage(QtWarningMsg, qPrintable(w11));
QMetaObject::invokeMethod(object, "testAssignmentThree");
- QString w12 = file.toString() + ":34: Error: Cannot assign int to an unregistered type";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w12));
QMetaObject::invokeMethod(object, "testAssignmentFour");
delete object;