aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmllanguage/data/enumPropsManyUnderlyingTypes.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.cpp2
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h34
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp18
4 files changed, 64 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/enumPropsManyUnderlyingTypes.qml b/tests/auto/qml/qqmllanguage/data/enumPropsManyUnderlyingTypes.qml
new file mode 100644
index 0000000000..b713d2aa24
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/enumPropsManyUnderlyingTypes.qml
@@ -0,0 +1,10 @@
+import Test
+
+EnumPropsManyUnderlyingTypes {
+ si8prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+ ui8prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+ si16prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+ ui16prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+ si64prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+ ui64prop: EnumPropsManyUnderlyingTypes.ResolvedValue
+}
diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp
index df09d43653..c4fd954450 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.cpp
+++ b/tests/auto/qml/qqmllanguage/testtypes.cpp
@@ -92,6 +92,8 @@ void registerTypes()
qmlRegisterType<MyArrayBufferTestClass>("Test", 1, 0, "MyArrayBufferTestClass");
+ qmlRegisterTypesAndRevisions<EnumPropsManyUnderlyingTypes>("Test", 1);
+
qmlRegisterType<LazyDeferredSubObject>("Test", 1, 0, "LazyDeferredSubObject");
qmlRegisterType<DeferredProperties>("Test", 1, 0, "DeferredProperties");
qmlRegisterType<ImmediateProperties>("Test", 1, 0, "ImmediateProperties");
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
index 568872fb4e..bbf328b9a7 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.h
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -1294,6 +1294,40 @@ public:
}
};
+class EnumPropsManyUnderlyingTypes : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+public:
+ enum si8 : qint8 { ResolvedValue = 1};
+ enum ui8 : quint8 {};
+ enum si16 : qint16 {};
+ enum ui16 : quint16 {};
+ enum ui64 : qint64 {};
+ enum si64 : quint64 {};
+ Q_ENUM(si8)
+ Q_ENUM(ui8)
+ Q_ENUM(si16)
+ Q_ENUM(ui16)
+ Q_ENUM(si64)
+ Q_ENUM(ui64)
+
+
+ Q_PROPERTY(si8 si8prop MEMBER si8prop)
+ Q_PROPERTY(ui8 ui8prop MEMBER ui8prop)
+ Q_PROPERTY(si16 si16prop MEMBER si16prop)
+ Q_PROPERTY(ui16 ui16prop MEMBER ui16prop)
+ Q_PROPERTY(si64 si64prop MEMBER si64prop)
+ Q_PROPERTY(ui64 ui64prop MEMBER ui64prop)
+
+ si8 si8prop = si8(0);
+ ui8 ui8prop = ui8(0);
+ si16 si16prop = si16(0);
+ ui16 ui16prop = ui16(0);
+ si64 si64prop = si64(0);
+ ui64 ui64prop = ui64(0);
+};
+
Q_DECLARE_METATYPE(MyEnum2Class::EnumB)
Q_DECLARE_METATYPE(MyEnum1Class::EnumA)
Q_DECLARE_METATYPE(Qt::TextFormat)
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 4569fabf0a..350a8da03a 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -411,6 +411,8 @@ private slots:
void longConversion();
+ void enumPropsManyUnderylingTypes();
+
void typedEnums_data();
void typedEnums();
@@ -7976,6 +7978,22 @@ void tst_qqmllanguage::longConversion()
}
}
+void tst_qqmllanguage::enumPropsManyUnderylingTypes()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, testFileUrl("enumPropsManyUnderlyingTypes.qml"));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ auto *enumObject = qobject_cast<EnumPropsManyUnderlyingTypes *>(o.get());
+ QCOMPARE(enumObject->si8prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+ QCOMPARE(enumObject->ui8prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+ QCOMPARE(enumObject->si16prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+ QCOMPARE(enumObject->ui16prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+ QCOMPARE(enumObject->si64prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+ QCOMPARE(enumObject->ui64prop, EnumPropsManyUnderlyingTypes::ResolvedValue);
+}
+
void tst_qqmllanguage::asValueType()
{
QQmlEngine engine;