aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h19
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp1
3 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml
index 697278e0b7..4d54bc83c1 100644
--- a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml
+++ b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml
@@ -1,9 +1,12 @@
import Test 1.0
+import QtQuick 2.0
+
MyTypeObject {
flagProperty: "FlagVal1 | FlagVal3"
enumProperty: "EnumVal2"
qtEnumProperty: Qt.RichText
mirroredEnumProperty: Qt.AlignHCenter
+ relatedEnumProperty: "RelatedValue"
stringProperty: "Hello World!"
uintProperty: 10
intProperty: -19
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
index 50b6089ffc..01f26c7f67 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.h
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -205,11 +205,21 @@ private:
};
+class MyEnumContainer : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(RelatedEnum)
+
+public:
+ enum RelatedEnum { RelatedInvalid = -1, RelatedValue = 42 };
+};
+
class MyTypeObject : public QObject
{
Q_OBJECT
Q_ENUMS(MyEnum)
Q_ENUMS(MyMirroredEnum)
+ Q_ENUMS(MyEnumContainer::RelatedEnum)
Q_FLAGS(MyFlags)
Q_PROPERTY(QString id READ id WRITE setId)
@@ -220,6 +230,7 @@ class MyTypeObject : public QObject
Q_PROPERTY(MyEnum readOnlyEnumProperty READ readOnlyEnumProperty)
Q_PROPERTY(Qt::TextFormat qtEnumProperty READ qtEnumProperty WRITE setQtEnumProperty NOTIFY qtEnumPropertyChanged)
Q_PROPERTY(MyMirroredEnum mirroredEnumProperty READ mirroredEnumProperty WRITE setMirroredEnumProperty NOTIFY mirroredEnumPropertyChanged)
+ Q_PROPERTY(MyEnumContainer::RelatedEnum relatedEnumProperty READ relatedEnumProperty WRITE setRelatedEnumProperty)
Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringPropertyChanged)
Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty NOTIFY uintPropertyChanged)
Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged)
@@ -323,6 +334,14 @@ public:
emit mirroredEnumPropertyChanged();
}
+ MyEnumContainer::RelatedEnum relatedEnumPropertyValue;
+ MyEnumContainer::RelatedEnum relatedEnumProperty() const {
+ return relatedEnumPropertyValue;
+ }
+ void setRelatedEnumProperty(MyEnumContainer::RelatedEnum v) {
+ relatedEnumPropertyValue = v;
+ }
+
QString stringPropertyValue;
QString stringProperty() const {
return stringPropertyValue;
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 2f2f0a78d4..ed94eff574 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -587,6 +587,7 @@ void tst_qqmllanguage::assignBasicTypes()
QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2);
QCOMPARE(object->qtEnumProperty(), Qt::RichText);
QCOMPARE(object->mirroredEnumProperty(), MyTypeObject::MirroredEnumVal3);
+ QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue);
QCOMPARE(object->stringProperty(), QString("Hello World!"));
QCOMPARE(object->uintProperty(), uint(10));
QCOMPARE(object->intProperty(), -19);