aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2024-02-07 10:11:41 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2024-02-07 17:23:01 +0100
commit72308ce2076aef3b663aa769e32e71d4b0bf645c (patch)
tree5a9caca89c5179a8d03734fdc48465b85f5930b8 /tests/auto/qml/qmlcppcodegen
parentbf7ed10ce1ed31e24a35bc786424656308c91256 (diff)
Compiler: Convert from stored to original type when generating equality
Pick-to: 6.7 Fixes: QTBUG-121909 Change-Id: I913f59324364052d7893d4c4072f92fcf418a388 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen')
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt1
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/shadowedPrimitiveCmpEqNull.qml16
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp10
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
index b896de4a1f..7263766b5d 100644
--- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
+++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
@@ -235,6 +235,7 @@ set(qml_files
setLookupConversion.qml
shadowedAsCasts.qml
shadowedMethod.qml
+ shadowedPrimitiveCmpEqNull.qml
shared/Slider.qml
shifts.qml
signal.qml
diff --git a/tests/auto/qml/qmlcppcodegen/data/shadowedPrimitiveCmpEqNull.qml b/tests/auto/qml/qmlcppcodegen/data/shadowedPrimitiveCmpEqNull.qml
new file mode 100644
index 0000000000..0e130b9afc
--- /dev/null
+++ b/tests/auto/qml/qmlcppcodegen/data/shadowedPrimitiveCmpEqNull.qml
@@ -0,0 +1,16 @@
+import QtQuick
+
+QtObject {
+ id: win
+
+ component Foo: QtObject {
+ property int progress: 0
+ }
+
+ property int progress: 0
+ readonly property Foo configuring: Foo {}
+
+ Component.onCompleted: {
+ win.configuring.progress = win?.progress ?? 0
+ }
+}
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index b98da74716..1f7e7eeb1f 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -202,6 +202,7 @@ private slots:
void setLookupConversion();
void shadowedAsCasts();
void shadowedMethod();
+ void shadowedPrimitiveCmpEqNull();
void shifts();
void signalHandler();
void signalIndexMismatch();
@@ -4099,6 +4100,15 @@ void tst_QmlCppCodegen::shadowedMethod()
QCOMPARE(o->property("cthing"), QVariant::fromValue(u"c"_s));
}
+void tst_QmlCppCodegen::shadowedPrimitiveCmpEqNull()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/shadowedPrimitiveCmpEqNull.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+}
+
void tst_QmlCppCodegen::shifts()
{
QQmlEngine engine;