aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-16 17:05:21 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-16 17:05:21 +0100
commit13e88fe2b9b1680cb161a249289c3ba998f08c0c (patch)
tree496a9d88c69b441e8c88aa0416b327faca3a1532 /tests/auto/qml/qqmlecmascript
parenta2dad3ddee9c4bf274a7c6469342e4104605ceeb (diff)
parent470ba767663e4ad9d3183fb56ee89361354dfefb (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/quick/items/qquickitem.cpp src/quick/items/qquicktext.cpp tests/auto/quick/qquicklistview/tst_qquicklistview.cpp Change-Id: I0bc5786098193c2c40b6fd8905de75d90f6ed0cf
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/misctypetest.qml4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp15
5 files changed, 45 insertions, 6 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml
index 60ff53a2b4..088ede67ec 100644
--- a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml
+++ b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml
@@ -11,7 +11,7 @@ Item {
return mtt.invalidUrl() == mtt.invalidUrl();
}
- function test_invalid_url_refequal()
+ function test_invalid_url_strictequal()
{
return mtt.invalidUrl() === mtt.invalidUrl();
}
@@ -21,7 +21,7 @@ Item {
return mtt.validUrl() == mtt.validUrl();
}
- function test_valid_url_refequal()
+ function test_valid_url_strictequal()
{
return mtt.validUrl() === mtt.validUrl();
}
diff --git a/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml b/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml
new file mode 100644
index 0000000000..8b8601692d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/noCaptureWhenWritingProperty.qml
@@ -0,0 +1,14 @@
+import QtQml 2.0
+QtObject {
+ property bool somePropertyEvaluated: false;
+
+ property int someProperty: {
+ // It's sort of evil to set the property here, but that doesn't mean that
+ // this expression should get re-evaluated when unrelatedProperty changes later.
+ somePropertyEvaluated = true
+ return 20;
+ }
+ Component.onCompleted: {
+ somePropertyEvaluated = false
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
index 52abda1e55..8d08cc5559 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
@@ -140,6 +140,22 @@ Item {
if (msco.intListProperty.toString() != expected.toString()) success = false;
expected = 7;
if (poppedVal != expected) success = false;
+
+ // concat
+ msco.stringListProperty = [ "one", "two" ]
+ stringList = [ "hello", "world" ]
+ stringList = stringList.concat(msco.stringListProperty)
+ expected = [ "hello", "world", "one", "two" ]
+ if (stringList.length != expected.length) {
+ success = false;
+ } else {
+ for (var i = 0; i < stringList.length; ++i) {
+ if (stringList[i] != expected[i]) {
+ success = false;
+ break;
+ }
+ }
+ }
}
property variant variantList: [ 1, 2, 3, 4, 5 ];
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index 41fa3672bd..22fac2013e 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -106,7 +106,7 @@ public:
void MyQmlObject::v8function(QQmlV4Function *function)
{
- QV8Engine::getV4(function->engine())->current->throwError(QStringLiteral("Exception thrown from within QObject slot"));
+ QV8Engine::getV4(function->engine())->currentContext()->throwError(QStringLiteral("Exception thrown from within QObject slot"));
}
static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 660be13f71..7b89709923 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -319,6 +319,7 @@ private slots:
void stackLimits();
void idsAsLValues();
void qtbug_34792();
+ void noCaptureWhenWritingProperty();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -2267,7 +2268,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons
QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource);
program.inheritContext = true;
- QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current;
+ QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext();
QV4::Scope scope(ctx);
QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
@@ -2295,7 +2296,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o,
QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource);
program.inheritContext = true;
- QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current;
+ QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext();
QV4::Scope scope(ctx);
QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
@@ -2324,7 +2325,7 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
- QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->current;
+ QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext();
QV4::Scope scope(ctx);
QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource);
@@ -7498,6 +7499,14 @@ void tst_qqmlecmascript::qtbug_34792()
delete object;
}
+void tst_qqmlecmascript::noCaptureWhenWritingProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("noCaptureWhenWritingProperty.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("somePropertyEvaluated").toBool(), false);
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"