diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-07-29 16:19:21 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-08-03 08:32:50 +0200 |
| commit | b184d026484572915c3ff34224dfc371a4e6a3cc (patch) | |
| tree | adb40361adde8226dd3413dea0f362c336adf2a5 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | ed3da31fd0248d48d960de566293cd9e8d12b9f4 (diff) | |
QmlCompiler: Allow any conversion possible via QJSPrimitiveValue
All of those are legal in ECMAScript, and so we need to support them in
script bindings. As we have stricter rules for literal bindings, add an
extra method there to check for what QQmlPropertyValidator does.
Pick-to: 6.4
Fixes: QTBUG-105252
Task-number: QTBUG-105188
Change-Id: I0621b2c3aa196414f669873e93670557284a8bca
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 80ea1952cd..938d726784 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -134,6 +134,7 @@ private slots: void trivialSignalHandler(); void stringToByteArray(); void listPropertyAsModel(); + void notNotString(); }; void tst_QmlCppCodegen::simpleBinding() @@ -2465,6 +2466,18 @@ void tst_QmlCppCodegen::listPropertyAsModel() QCOMPARE(children.count(), 5); } +void tst_QmlCppCodegen::notNotString() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/notNotString.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + + QCOMPARE(o->property("notNotString").value<bool>(), false); + o->setObjectName(u"a"_s); + QCOMPARE(o->property("notNotString").value<bool>(), true); +} + void tst_QmlCppCodegen::runInterpreted() { #ifdef Q_OS_ANDROID |
