aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2025-02-14 11:08:50 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2025-02-18 20:02:02 +0100
commit73227258b05ff3aa2a92a18048d3d216bdefa230 (patch)
tree272c5a90aea2074c61be495d59a580af9ad582f5 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent5c308edb3a5551ab1e013a052de709a36e04f948 (diff)
Compiler: Add missing conversion for variant equality comparisons
The comparison code was generated properly but the conversion to safely assign the result of the comparison to the out accumulator was missing. Amends 78b58582baccb2c214dfb07083e91eb47e45358a Fixes: QTBUG-133636 Pick-to: 6.9 6.8 Change-Id: I9f790b449b48c382064954ad4235d25d221f1168 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 673155119b..83a31b3f1c 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -108,6 +108,7 @@ private slots:
void equalityTestsWithNullOrUndefined();
void equalityVarAndNonStorable();
void equalityVarAndStorable();
+ void equalityVarWithOutConversion();
void equalsUndefined();
void evadingAmbiguity();
void exceptionFromInner();
@@ -1901,6 +1902,20 @@ void tst_QmlCppCodegen::equalityVarAndStorable()
QMetaObject::invokeMethod(p.data(), "verify", 11);
}
+void tst_QmlCppCodegen::equalityVarWithOutConversion()
+{
+ QQmlEngine engine;
+ QUrl url(u"qrc:/qt/qml/TestTypes/equalityVarWithOutConversion.qml"_s);
+ QQmlComponent component(&engine, url);
+ QVERIFY2(!component.isError(), component.errorString().toUtf8());
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+
+ auto ss = o->property("ss").value<QQmlScriptString>();
+ QQmlExpression expr(ss);
+ expr.evaluate();
+}
+
void tst_QmlCppCodegen::equalsUndefined()
{
QQmlEngine engine;