aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-02-02 14:47:07 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-03 00:39:18 +0100
commit348b51327fe72fc8ea4292a3b5cb4df178c1d234 (patch)
treef2d116b02509f183e10522f1c747b9d56d4324cc /tests
parent3499561431ea2ea15b2b70b5e9ea335e863d008e (diff)
Ensure || expressions in v4 will always exit.
Change-Id: I7188e38403fec96f83f3bdfc68b763a9aec9346a Task-number: QTBUG-24038 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/v4/data/nestedLogicalOr.qml14
-rw-r--r--tests/auto/declarative/v4/tst_v4.cpp16
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/v4/data/nestedLogicalOr.qml b/tests/auto/declarative/v4/data/nestedLogicalOr.qml
new file mode 100644
index 0000000000..c4478a3e7b
--- /dev/null
+++ b/tests/auto/declarative/v4/data/nestedLogicalOr.qml
@@ -0,0 +1,14 @@
+import Qt.v4 1.0
+
+Result {
+ property bool val1: false
+ property bool val2: true
+ property bool val3: false
+
+ property bool b1: (false || false || true)
+ property bool b2: (false || (false || true))
+ property bool b3: ((false || false) || true)
+ property bool b4: (val1 || (val2 || val3)) ? true : false
+
+ result: b1 && b2 && b3 && b4
+}
diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp
index 751fb337b4..fb6f8776e0 100644
--- a/tests/auto/declarative/v4/tst_v4.cpp
+++ b/tests/auto/declarative/v4/tst_v4.cpp
@@ -62,6 +62,7 @@ private slots:
void unnecessaryReeval();
void logicalOr();
+ void nestedLogicalOr();
void conditionalExpr();
void qtscript();
void qtscript_data();
@@ -183,6 +184,21 @@ void tst_v4::logicalOr()
}
}
+void tst_v4::nestedLogicalOr()
+{
+ //we are primarily testing that v4 does not get caught in a loop (QTBUG-24038)
+ QDeclarativeComponent component(&engine, testFileUrl("nestedLogicalOr.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()
{
{