aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-04-04 16:54:32 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-04-05 14:27:12 +0200
commitd425712e930fe308fc081e71f7cc838bd20afb05 (patch)
tree69691daf0830af52c6afeb3851683835d76f6213 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent598bfdb139e64c9e6fd9c8542ef457fe8091bad1 (diff)
QmlCompiler: Allow primitive conversion from any number to bool
Task-number: QTBUG-102281 Change-Id: I0dac4ce9c86c55e52283a6e05b0c3c0cc46551be 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.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 02411f8b9a..e885e403ac 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -129,6 +129,7 @@ private slots:
void typedArray();
void prefixedMetaType();
void evadingAmbiguity();
+ void fromBoolValue();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -1982,6 +1983,17 @@ void tst_QmlCppCodegen::evadingAmbiguity()
QCOMPARE(o2->property("i").toString(), QStringLiteral("Ambiguous2"));
}
+void tst_QmlCppCodegen::fromBoolValue()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/fromBoolValue.qml"_qs));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QCOMPARE(o->property("a").toBool(), true);
+ o->setProperty("x", 100);
+ QCOMPARE(o->property("a").toBool(), false);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
#ifdef Q_OS_ANDROID