diff options
Diffstat (limited to 'tests/auto/qml/v4/tst_v4.cpp')
-rw-r--r-- | tests/auto/qml/v4/tst_v4.cpp | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 91a32268cf..1c89617157 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(); @@ -122,6 +124,8 @@ void tst_v4::qtscript_data() { QTest::addColumn<QString>("file"); + QTest::newRow("equals") << "equals.qml"; + QTest::newRow("strict equals") << "strictEquals.qml"; QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml"; QTest::newRow("exception on fetch") << "fetchException.qml"; QTest::newRow("logical or") << "logicalOr.qml"; @@ -208,6 +212,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() { { |