diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2010-03-04 08:19:40 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2010-03-04 08:19:40 (GMT) |
commit | 0a6401da552805d2e3f3ca228153d66590d3a142 (patch) | |
tree | 74af62e9a32c0832b5940955ce68a840722afc69 /tests | |
parent | a65e37f0fd48158403296d5ca9ffa0f0feae2940 (diff) | |
parent | 6633234f5f19899dc54510b2bddb2ae1afd38318 (diff) | |
download | Qt-0a6401da552805d2e3f3ca228153d66590d3a142.zip Qt-0a6401da552805d2e3f3ca228153d66590d3a142.tar.gz Qt-0a6401da552805d2e3f3ca228153d66590d3a142.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
5 files changed, 42 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml new file mode 100644 index 0000000..4b5464d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml @@ -0,0 +1,9 @@ +import Qt 4.6 +import Qt.test 1.0 + +QtObject { + property int value: 9 + property int value2 + + MyQmlObject.onMySignal: value2 = value +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 8fbd071..a283e3f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -60,10 +60,21 @@ class MyQmlAttachedObject : public QObject { Q_OBJECT Q_PROPERTY(int value READ value CONSTANT) + Q_PROPERTY(int value2 READ value2 WRITE setValue2) public: - MyQmlAttachedObject(QObject *parent) : QObject(parent) {} + MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {} int value() const { return 19; } + int value2() const { return m_value2; } + void setValue2(int v) { m_value2 = v; } + + void emitMySignal() { emit mySignal(); } + +signals: + void mySignal(); + +private: + int m_value2; }; class MyQmlObject : public QObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 75ee7ce..2e00e10 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -123,6 +123,7 @@ private slots: void multiEngineObject(); void deletedObject(); void scriptScope(); + void attachedPropertyScope(); void bug1(); @@ -1693,6 +1694,26 @@ void tst_qdeclarativeecmascript::scriptScope() } } +void tst_qdeclarativeecmascript::attachedPropertyScope() +{ + QDeclarativeComponent component(&engine, TEST_FILE("attachedPropertyScope.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + MyQmlAttachedObject *attached = + qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); + QVERIFY(attached != 0); + + QCOMPARE(object->property("value2").toInt(), 0); + + attached->emitMySignal(); + + QCOMPARE(object->property("value2").toInt(), 9); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml index aecb3c3..b46ec34 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml @@ -3,8 +3,6 @@ import Test 1.0 as Namespace import Qt 4.6 QtObject { - property int value2: 8 MyQmlObject.value: 10 Namespace.MyQmlObject.value2: 13 - MyQmlObject.onValueChanged: value2 = MyQmlObject.value } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index a339a6d..3ce15cb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -718,11 +718,6 @@ void tst_qdeclarativelanguage::attachedProperties() QVERIFY(attached != 0); QCOMPARE(attached->property("value"), QVariant(10)); QCOMPARE(attached->property("value2"), QVariant(13)); - - QEXPECT_FAIL("", "QTBUG-8677", Abort); - attached->setProperty("value", QVariant(12)); - int val = object->property("value2").toInt(); - QCOMPARE(val, 12); } // Tests non-static object properties |