diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-04-04 16:54:32 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-04-05 16:09:26 +0200 |
commit | fe9d9b22f20ecfd119c4dcaf1d05f5b27906a49e (patch) | |
tree | f22b510908c9bc919375d495f738e4a3d01221d3 /tests | |
parent | 929e3d080d5cf3eaf314262d6cae6f0f2b913a67 (diff) |
QmlCompiler: Define variables also for conversion registers
The previous code relies on any jump-induced conversion types to also
show up somewhere else. This does not apply to dev because the register
variables have been re-organized there.
Pick-to: 6.2 6.3
Fixes: QTBUG-102273
Change-Id: I7723ff3b4992cecc38ce531e76494874910dfaea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/fromBoolValue.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 17 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt index 36741105af..038557bd22 100644 --- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt +++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt @@ -66,6 +66,7 @@ set(qml_files failures.qml fallbacklookups.qml fileDialog.qml + fromBoolValue.qml functionLookup.qml funcWithParams.qml functionReturningVoid.qml diff --git a/tests/auto/qml/qmlcppcodegen/data/fromBoolValue.qml b/tests/auto/qml/qmlcppcodegen/data/fromBoolValue.qml new file mode 100644 index 0000000000..f56a75ecea --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/fromBoolValue.qml @@ -0,0 +1,6 @@ +pragma Strict +import QtQuick 6 + +Item { + height: !(parent && parent.visible) ? 100 : 0 +} diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index bc6fa5a106..e088556f0f 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -126,6 +126,7 @@ private slots: void testIsnan(); void fallbackLookups(); void prefixedMetaType(); + void fromBoolValue(); }; void tst_QmlCppCodegen::simpleBinding() @@ -1906,6 +1907,22 @@ void tst_QmlCppCodegen::prefixedMetaType() QVERIFY(qvariant_cast<QObject *>(o->property("f")) == nullptr); } +void tst_QmlCppCodegen::fromBoolValue() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/fromBoolValue.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QCOMPARE(o->property("height").toInt(), 100); + + QScopedPointer<QObject> parent(c.create()); + o->setProperty("parent", QVariant::fromValue(parent.data())); + QCOMPARE(o->property("height").toInt(), 0); + + parent->setProperty("visible", QVariant::fromValue(false)); + QCOMPARE(o->property("height").toInt(), 100); +} + void tst_QmlCppCodegen::runInterpreted() { if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER")) |