aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-06-22 15:32:46 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-27 02:28:40 +0200
commita93c2608d69fa385c675a6b49e4d4bfb97f83ed2 (patch)
tree88b9bc5b459600d85c6519995367669396787568 /tests/auto/qml/qqmllanguage
parenta2aa4705702256c15aaaf64e08b90c4749233f9d (diff)
Add enum values from related types
If moc marks a type as being related to another type (by using that type's enums or properties), then include the enum values exported by the related type in those exposed by the dependent type. Task-number: QTBUG-22675 Change-Id: I78e72791a4f470200a9ba986a865ffac6c873725 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
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);