aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-07-04 10:14:01 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-07-07 19:35:20 +0200
commit560bacbc9302b9622e8cabaf8dde2b3348480b3d (patch)
tree6373f111b67f7d199a374402647cb7cf04f8d999 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent210f2c8a40460725b6d422b5d844576296ff3bf9 (diff)
qmltyperegistrar: Manually register names for Q_ENUMS
Flags declared with Q_FLAGS lack the methods for properly extracting the typedef'd name. We need to manually register the typedef. Amends commit 8bf5aae19b77b618f3f7a55a59e87c8a319475a8. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138174 Change-Id: I7c373f4d810a0c9a5590f39cc629015662a69ed4 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index f8b67ee7fb..b13c3f0755 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -212,6 +212,7 @@ private slots:
void objectLookupOnListElement();
void objectToString();
void objectWithStringListMethod();
+ void oldEnum();
void onAssignment();
void optionalComparison();
void outOfBoundsArray();
@@ -4305,6 +4306,16 @@ void tst_QmlCppCodegen::objectWithStringListMethod()
QVERIFY(!o.isNull());
}
+void tst_QmlCppCodegen::oldEnum()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/oldEnum.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("foos").value<OldEnum::Foos>(), OldEnum::Bar);
+}
+
void tst_QmlCppCodegen::onAssignment()
{
QQmlEngine engine;