diff options
Diffstat (limited to 'tests/auto/qml/v4/tst_v4.cpp')
-rw-r--r-- | tests/auto/qml/v4/tst_v4.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 91a32268cf..ed65cd2a82 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -64,6 +64,8 @@ private slots: void unnecessaryReeval(); void logicalOr(); void nestedLogicalOr(); + void logicalAnd(); + void nestedLogicalAnd(); void conditionalExpr(); void qtscript(); void qtscript_data(); @@ -208,6 +210,115 @@ void tst_v4::nestedLogicalOr() delete o; } +void tst_v4::logicalAnd() +{ + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 0); + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.2.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.3.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } + + { + // QTBUG-24660 + QQmlComponent component(&engine, testFileUrl("logicalAnd.4.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.5.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.6.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } + + { + QQmlComponent component(&engine, testFileUrl("logicalAnd.7.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; + } +} + +void tst_v4::nestedLogicalAnd() +{ + QQmlComponent component(&engine, testFileUrl("nestedLogicalAnd.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + ResultObject *ro = qobject_cast<ResultObject *>(o); + QVERIFY(ro != 0); + + QCOMPARE(ro->result(), 1); + delete o; +} + void tst_v4::conditionalExpr() { { |