diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-29 13:01:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-29 13:01:22 +0100 |
commit | 1e421097f08876f5e2242be6f7a20db2aeb51692 (patch) | |
tree | c45b9323368cfdede67facd43c076a85322f12f6 /tests/auto/qml/qqmlecmascript | |
parent | f4788a13e98aa4e5438327094524d7b8239893ec (diff) | |
parent | 666bc731a0ba930ca0cfda18daf836913fd91361 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml | 12 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 17 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 9 |
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml new file mode 100644 index 0000000000..0493a7c0b9 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml @@ -0,0 +1,12 @@ +import Qt.test 1.1 +import QtQuick 2.0 + +MyItemUsingRevisionedObject { + property real test + + revisioned.prop1: 10 + revisioned.prop2: 1 + + Component.onCompleted: test = revisioned.prop1 + revisioned.prop2 +} + diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 70bf50cae4..2afa21ddd6 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -447,6 +447,7 @@ void registerTypes() qmlRegisterType<MyRevisionedSubclass>("Qt.test",1,0,"MyRevisionedSubclass"); // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 qmlRegisterType<MyRevisionedSubclass,1>("Qt.test",1,1,"MyRevisionedSubclass"); + qmlRegisterType<MyItemUsingRevisionedObject>("Qt.test", 1, 0, "MyItemUsingRevisionedObject"); #ifndef QT_NO_WIDGETS qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget"); diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 1a740b9a93..e0d75e7baa 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1079,10 +1079,27 @@ protected: qreal m_p4; }; + +class MyItemUsingRevisionedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(MyRevisionedClass *revisioned READ revisioned) + +public: + MyItemUsingRevisionedObject() { + m_revisioned = new MyRevisionedClass; + } + + MyRevisionedClass *revisioned() const { return m_revisioned; } +private: + MyRevisionedClass *m_revisioned; +}; + QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) QML_DECLARE_TYPE(MyRevisionedClass) QML_DECLARE_TYPE(MyRevisionedSubclass) +QML_DECLARE_TYPE(MyItemUsingRevisionedObject) Q_DECLARE_METATYPE(MyQmlObject::MyType) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index a16f9a356c..5ca760020c 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -6573,6 +6573,15 @@ void tst_qqmlecmascript::revision() QCOMPARE(object->property("test").toReal(), 11.); delete object; } + + { + QQmlComponent component(&engine, testFileUrl("metaobjectRevision5.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toReal(), 11.); + delete object; + } } void tst_qqmlecmascript::realToInt() |