aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmetatype
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-23 01:00:50 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-25 09:20:43 +0100
commita1aee495c8a69a076d3981ef005c627d74bb3660 (patch)
tree3fac2d8c217caf57f4faf0ead448126d44a28a51 /tests/auto/qml/qqmlmetatype
parentb15654d77f7886ae23f06d760b90973983e12779 (diff)
parent3baa2d550512702dfc227aef0af3542ab189824f (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
Diffstat (limited to 'tests/auto/qml/qqmlmetatype')
-rw-r--r--tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesInvalid.qml6
-rw-r--r--tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesValid.qml6
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp57
3 files changed, 69 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesInvalid.qml b/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesInvalid.qml
new file mode 100644
index 0000000000..df6d801cde
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesInvalid.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import GroupedTest 1.0
+
+MyItem {
+ grouped.prop: 5
+}
diff --git a/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesValid.qml b/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesValid.qml
new file mode 100644
index 0000000000..b7ea017acf
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/revisionedGroupedPropertiesValid.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import GroupedTest 1.1
+
+MyItem {
+ grouped.prop: 5
+}
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index bce4c7d08c..ac75eeab26 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -65,6 +65,7 @@ private slots:
void normalizeUrls();
void unregisterAttachedProperties();
+ void revisionedGroupedProperties();
};
class TestType : public QObject
@@ -571,6 +572,62 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
}
}
+class Grouped : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int prop READ prop WRITE setProp NOTIFY propChanged REVISION 1)
+public:
+ int prop() const { return m_prop; }
+ void setProp(int prop)
+ {
+ if (prop != m_prop) {
+ m_prop = prop;
+ emit propChanged(prop);
+ }
+ }
+
+signals:
+ Q_REVISION(1) void propChanged(int prop);
+
+private:
+ int m_prop = 0;
+};
+
+class MyItem : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Grouped *grouped READ grouped CONSTANT)
+public:
+ MyItem() : m_grouped(new Grouped) {}
+ Grouped *grouped() const { return m_grouped.data(); }
+
+private:
+ QScopedPointer<Grouped> m_grouped;
+};
+
+void tst_qqmlmetatype::revisionedGroupedProperties()
+{
+ qmlClearTypeRegistrations();
+ qmlRegisterType<MyItem>("GroupedTest", 1, 0, "MyItem");
+ qmlRegisterType<MyItem, 1>("GroupedTest", 1, 1, "MyItem");
+ qmlRegisterUncreatableType<Grouped>("GroupedTest", 1, 0, "Grouped", "Grouped");
+ qmlRegisterUncreatableType<Grouped, 1>("GroupedTest", 1, 1, "Grouped", "Grouped");
+
+ {
+ QQmlEngine engine;
+ QQmlComponent valid(&engine, testFileUrl("revisionedGroupedPropertiesValid.qml"));
+ QVERIFY(valid.isReady());
+ QScopedPointer<QObject> obj(valid.create());
+ QVERIFY(!obj.isNull());
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent invalid(&engine, testFileUrl("revisionedGroupedPropertiesInvalid.qml"));
+ QVERIFY(invalid.isError());
+ }
+}
+
QTEST_MAIN(tst_qqmlmetatype)
#include "tst_qqmlmetatype.moc"