diff options
| author | Semih Yavuz <semih.yavuz@qt.io> | 2022-12-02 22:07:12 +0100 |
|---|---|---|
| committer | Semih Yavuz <semih.yavuz@qt.io> | 2022-12-05 17:39:24 +0100 |
| commit | 9793c663ccd1fbcbbe56f9dcab1515909113d704 (patch) | |
| tree | 517db468d1520f078268eeda35abc76817595c68 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 4f92f018ea0639b8127ad25f4430e5a5ee4e61a1 (diff) | |
Fix comparison AOT-lookup and intended type in value types
We currently force the lookup metatype to be exactly the same data type
with the caller's. As a result, the conversion from enum to integral
data type is not recognized. Relax this comparison by using
isTypeCompatible helper.
Pick-to: 6.4
Fixes: QTBUG-109007
Change-Id: I188dc3e6c1fd7100e9ed5c4ba5d0c90d85d79be4
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.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 3f76090e6f..497eef66e8 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -151,6 +151,7 @@ private slots: void multiForeign(); void namespaceWithEnum(); void enumProblems(); + void enumConversion(); }; void tst_QmlCppCodegen::initTestCase() @@ -2902,6 +2903,19 @@ void tst_QmlCppCodegen::enumProblems() QCOMPARE(fighter->type(), Foo::Fighter); } +void tst_QmlCppCodegen::enumConversion() +{ + QQmlEngine engine; + + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/enumConversion.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + QCOMPARE(o->property("test").toInt(), 0x04); + QCOMPARE(o->property("test_1").toBool(), true); +}; + QTEST_MAIN(tst_QmlCppCodegen) #include "tst_qmlcppcodegen.moc" |
