diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-03-02 11:33:46 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-09 11:03:23 +0100 |
commit | 9ba6a3b21cf012c3223ed848d102f8fa9ce00779 (patch) | |
tree | 441bda281cd5aad3fcf58634d3d1cd017ea46f4e /tests | |
parent | 4eab1984cebe9972283e88e7b91f763636e17c47 (diff) |
Add autotest for v4 nested object bug.
Task-number: QTBUG-24606
Change-Id: I0909d60316f7213b21fc315e8a3d0a6124e84409
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/v4/data/nestedObjectAccess2.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/v4/testtypes.h | 3 | ||||
-rw-r--r-- | tests/auto/qml/v4/tst_v4.cpp | 31 |
3 files changed, 32 insertions, 7 deletions
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess2.qml b/tests/auto/qml/v4/data/nestedObjectAccess2.qml new file mode 100644 index 0000000000..2f0e0db01c --- /dev/null +++ b/tests/auto/qml/v4/data/nestedObjectAccess2.qml @@ -0,0 +1,5 @@ +import Qt.v4 1.0 + +Result { + result: nested2.result +} diff --git a/tests/auto/qml/v4/testtypes.h b/tests/auto/qml/v4/testtypes.h index 02ba721839..18b5b27b36 100644 --- a/tests/auto/qml/v4/testtypes.h +++ b/tests/auto/qml/v4/testtypes.h @@ -59,6 +59,7 @@ class ResultObject : public QObject Q_OBJECT Q_PROPERTY(int result READ result WRITE setResult FINAL) Q_PROPERTY(NestedObject *nested READ nested CONSTANT) + Q_PROPERTY(NestedObject *nested2 READ nested2 FINAL CONSTANT) public: ResultObject() : m_result(0), m_resultCounter(0) {} @@ -69,12 +70,14 @@ public: void setResult(int result) { m_result = result; m_resultCounter++; } NestedObject *nested() { return &m_nested; } + NestedObject *nested2() { return &m_nested2; } private: int m_result; int m_resultCounter; NestedObject m_nested; + NestedObject m_nested2; }; void registerTypes(); diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 4e3e71f717..041d9ab8e6 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -225,17 +225,34 @@ void tst_v4::conditionalExpr() // NestedObject::result. void tst_v4::nestedObjectAccess() { - QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml")); + { + QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml")); - QObject *o = component.create(); - QVERIFY(o != 0); + QObject *o = component.create(); + QVERIFY(o != 0); - ResultObject *ro = qobject_cast<ResultObject *>(o); - QVERIFY(ro != 0); + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); - QCOMPARE(ro->result(), 37); + QCOMPARE(ro->result(), 37); - delete o; + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("nestedObjectAccess2.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QEXPECT_FAIL("","QTBUG-24606", Continue); + QCOMPARE(ro->result(), 37); + + delete o; + } } void tst_v4::subscriptionsInConditionalExpressions() |