diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-11-03 12:00:32 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-11-09 19:12:37 +0100 |
| commit | 674dc3f73d9d730e87483b86aa9d55186c57cd52 (patch) | |
| tree | 457c3063a2a41be096c611419b2599b2a95f3f79 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 0fdf9042ce36c1dcfed64d1600f1526ac176768d (diff) | |
QmlCompiler: Always record original types for equality comparison
The shadow check may adjust the types later on and cause a different
comparison to happen than what we've expected when propagating. We can
only see this at code generation time.
Pick-to: 6.6 6.5 6.2
Task-number: QTBUG-117795
Change-Id: I04f1dd9902385f87114e48b0994e0f243f0c2c84
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index b8364a51b2..fedcd477a0 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 comparisonTypes(); void componentReturnType(); void compositeSingleton(); void compositeTypeMethod(); @@ -965,6 +966,21 @@ void tst_QmlCppCodegen::colorString() QCOMPARE(qvariant_cast<QColor>(rootObject->property("e")), QColor::fromRgb(0x11, 0x22, 0x33)); } +void tst_QmlCppCodegen::comparisonTypes() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/comparisonTypes.qml"_s)); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QCOMPARE(object->property("found").toInt(), 1); + QCOMPARE(object->property("foundStrict").toInt(), 0); + + QCOMPARE(object->property("foundNot").toInt(), 2); + QCOMPARE(object->property("foundNotStrict").toInt(), 10); +} + void tst_QmlCppCodegen::componentReturnType() { QQmlEngine engine; |
