aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-06-23 10:10:41 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-06-23 21:22:34 +0200
commitc6d599bf60759e774284ddd94b5f9a7de09302b0 (patch)
treec5b51b8ed250d61ae9e7f09f71d3089d8aea3d30 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent9573506fe04d9581f8c60df6b6e2e20473639bf8 (diff)
QmlCompiler: Use int for flag-type enums
The isFlag flag overrides the underlying type as the resulting type is then a QFlags. Pick-to: 6.6 Fixes: QTBUG-114815 Change-Id: I9cc3b260a280b784fc8af38fafbc9ffbd7ca3453 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.cpp13
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 2ccd104ed9..5e4a576846 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -82,6 +82,7 @@ private slots:
void failures();
void fallbackLookups();
void fileImportsContainCxxTypes();
+ void flagEnum();
void flushBeforeCapture();
void fromBoolValue();
void funcWithParams();
@@ -1566,6 +1567,18 @@ void tst_QmlCppCodegen::fileImportsContainCxxTypes()
QCOMPARE(o->objectName(), u"horst guenther"_s);
}
+void tst_QmlCppCodegen::flagEnum()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/flagEnum.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QQmlCommunicationPermission *p = qobject_cast<QQmlCommunicationPermission *>(o.data());
+ QCOMPARE(p->communicationModes(), CommunicationPermission::Access);
+}
+
void tst_QmlCppCodegen::flushBeforeCapture()
{
QQmlEngine engine;