diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-11-01 17:11:38 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-11-06 10:00:07 +0100 |
| commit | 05b783617ff897c5c7b94bd9df19d0ff26c20396 (patch) | |
| tree | 83ecf68a6abb6a3fe8fdf13e32b169985d8f4544 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 9a64a5cc9083afcaf43cb65e132ec5d1e66e65c3 (diff) | |
QmlCompiler: Support construction of value types with 'new'
This allows us to create value types with invokable copy ctors from
JavaScript objects that describe their properties. That way we now have
a full replacement for the Qt.foo() methods.
As a side effect, we support retrieval of enums for certain kinds of
broken value types now, if prefixed with a namespace.
Fixes: QTBUG-124634
Change-Id: If2a3c59d647e211ef5a0cd1ddee04b409d9ea5f3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 3cc7e6a62c..b8ea5477fb 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -1623,6 +1623,7 @@ void tst_QmlCppCodegen::enumLookup() QScopedPointer<QObject> o(c.create()); QCOMPARE(o->property("ready").toBool(), true); + QCOMPARE(o->property("enumFromGadget2").toInt(), 3); } void tst_QmlCppCodegen::enumMarkedAsFlag() @@ -4764,11 +4765,16 @@ void tst_QmlCppCodegen::structuredValueType() QCOMPARE(o->property("r").value<QRectF>(), QRectF(1, 2, 3, 4)); QCOMPARE(o->property("r2").value<QRectF>(), QRectF(42, 0, 0, 0)); + QCOMPARE(o->property("r3").value<QRectF>(), QRectF(4, 3, 2, 1)); + QCOMPARE(o->property("r4").value<QRectF>(), QRectF(43, 0, 0, 0)); WeatherModelUrl w; w.setStrings(QStringList({u"one"_s, u"two"_s, u"three"_s})); QCOMPARE(o->property("w").value<WeatherModelUrl>(), w); + + w.setStrings(QStringList({u"three"_s, u"two"_s, u"one"_s})); + QCOMPARE(o->property("w2").value<WeatherModelUrl>(), w); } void tst_QmlCppCodegen::testIsnan() |
