diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp b/tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp index 0f8c5bcf66..fb34696ef5 100644 --- a/tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp +++ b/tests/auto/declarative/qdeclarativev4/tst_qdeclarativev4.cpp @@ -72,6 +72,7 @@ private slots: void unnecessaryReeval(); void logicalOr(); + void conditionalExpr(); void qtscript(); void qtscript_data(); void nestedObjectAccess(); @@ -121,6 +122,7 @@ void tst_qdeclarativev4::qtscript_data() QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml"; QTest::newRow("exception on fetch") << "fetchException.qml"; QTest::newRow("logical or") << "logicalOr.qml"; + QTest::newRow("conditional expressions") << "conditionalExpr.qml"; QTest::newRow("double bool jump") << "doubleBoolJump.qml"; QTest::newRow("unary minus") << "unaryMinus.qml"; QTest::newRow("null qobject") << "nullQObject.qml"; @@ -188,6 +190,22 @@ void tst_qdeclarativev4::logicalOr() } } +void tst_qdeclarativev4::conditionalExpr() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("conditionalExpr.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 0); + delete o; + } +} + // This would previously use the metaObject of the root element to result the nested access. // That is, the index for accessing "result" would have been RootObject::result, instead of // NestedObject::result. |