diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-03-31 16:18:49 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-04-15 20:14:42 +0200 |
| commit | f27cb5e3c1cfdf2cb19f3a4d62c72129dfd4f798 (patch) | |
| tree | 68ad8c7667a6ba77395a9e72ad057b36b748e6e8 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | efc037191ae12fda978a3617c8d468f7d55fe279 (diff) | |
QmlCompiler: Merge bool and any pointer type into the pointer type
A pointer type can hold bool as either nullptr or some value. We don't
need to produce a QVariant for that.
Change-Id: I368c3fa703d08ff396a5b4702ba7d1f2614b1467
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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 92b8efc203..e5e7597cb6 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -176,6 +176,7 @@ private slots: void multipleCtors(); void boolCoercions(); void ambiguousAs(); + void boolPointerMerge(); }; void tst_QmlCppCodegen::initTestCase() @@ -3545,6 +3546,18 @@ void tst_QmlCppCodegen::ambiguousAs() QCOMPARE(o->property("other").value<QObject *>(), nullptr); } +void tst_QmlCppCodegen::boolPointerMerge() +{ + QQmlEngine e; + QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/boolPointerMerge.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + QObject *item = o->property("item").value<QObject *>(); + QVERIFY(item); + QCOMPARE(item->property("ppp").toInt(), -99); +} + QTEST_MAIN(tst_QmlCppCodegen) #include "tst_qmlcppcodegen.moc" |
