diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-11-03 16:02:27 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-11-13 10:13:18 +0100 |
| commit | 7df34d498d1df456cdcdcb28681616794c9549ce (patch) | |
| tree | d66297d9756dd792fea1f43faca6cd79ed34a804 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | bcd03432094e0b57f8d961278eb0e1a4c15971cc (diff) | |
QmlCompiler: Retrieve original types for comparison
If an original type is merely wrapped into a more generic type by the
basic blocks pass, we know the original data is still there and can be
used for comparison.
Fixes: QTBUG-117795
Change-Id: Ia7582cd8ed48e47a3a1b3bd8e2595e9cb42828de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
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 3f0e2a4569..37f874ba91 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -59,6 +59,7 @@ private slots: void callWithSpread(); void colorAsVariant(); void colorString(); + void compareOriginals(); void comparisonTypes(); void componentReturnType(); void compositeSingleton(); @@ -967,6 +968,18 @@ void tst_QmlCppCodegen::colorString() QCOMPARE(qvariant_cast<QColor>(rootObject->property("e")), QColor::fromRgb(0x11, 0x22, 0x33)); } +void tst_QmlCppCodegen::compareOriginals() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/compareOriginals.qml"_s)); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QCOMPARE(object->property("compareOriginals").toInt(), 5); + QVERIFY(object->property("optionalThis").toBool()); +} + void tst_QmlCppCodegen::comparisonTypes() { QQmlEngine engine; |
