diff options
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 0814d92429..0cad3eb68e 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2021 The Qt Company Ltd. #include "data/druggeljug.h" +#include "data/enumProperty.h" #include "data/withlength.h" #include <data/birthdayparty.h> #include <data/cppbaseclass.h> @@ -185,6 +186,7 @@ private slots: void jsArrayMethodsWithParams(); void shadowedMethod(); void topLevelComponent(); + void intToEnum(); }; void tst_QmlCppCodegen::initTestCase() @@ -3793,6 +3795,18 @@ void tst_QmlCppCodegen::topLevelComponent() QCOMPARE(o2->objectName(), u"foo"_s); } +void tst_QmlCppCodegen::intToEnum() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/intToEnum.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + MyType *m = qobject_cast<MyType *>(o.data()); + QCOMPARE(m->a(), MyType::D); + QCOMPARE(m->property("b").toInt(), 24); +} + QTEST_MAIN(tst_QmlCppCodegen) #include "tst_qmlcppcodegen.moc" |
