aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro7
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scarceresources/scarceResourceFunctionFail.qml1
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp269
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/model.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp241
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/dateTimeConversion.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp117
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml12
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp1
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp6
-rw-r--r--tests/auto/declarative/v8/tst_v8.cpp96
-rw-r--r--tests/auto/declarative/v8/v8.pro14
21 files changed, 591 insertions, 266 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 20fa8548fd..8859b83e9e 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -7,6 +7,8 @@ SUBDIRS += \
SUBDIRS += \
examples \
+ geometry \
+ node \
parserstress \
qdeclarativecomponent \
qdeclarativecontext \
@@ -37,6 +39,7 @@ contains(QT_CONFIG, private_tests) {
qdeclarativeconnection \
qdeclarativedebug \
qdeclarativedebugclient \
+ qdeclarativedebughelper \
qdeclarativedebugservice \
qdeclarativeecmascript \
qdeclarativeflickable \
@@ -59,6 +62,7 @@ contains(QT_CONFIG, private_tests) {
qdeclarativeproperty \
qdeclarativepropertymap \
qdeclarativerepeater \
+ qdeclarativescriptdebugging \
qdeclarativesmoothedanimation \
qdeclarativespringanimation \
qdeclarativestyledtext \
@@ -94,7 +98,8 @@ contains(QT_CONFIG, private_tests) {
qsgtext \
qsgtextedit \
qsgtextinput \
- qsgvisualdatamodel
+ qsgvisualdatamodel \
+ v8
}
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 97cd0c9ea5..fdb8ff7dc2 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -342,7 +342,7 @@ void tst_qdeclarativecontext::setContextProperty()
QDeclarativeContext ctxt(engine.rootContext());
ctxt.setContextProperty("ctxtProp", QVariant());
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1: TypeError: Result of expression 'ctxtProp' [undefined] is not an object.");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1: TypeError: Cannot read property 'a' of undefined");
QObject *obj = component.create(&ctxt);
QVariant v = obj->property("obj");
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
index a778dcc8b6..0455271dac 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
@@ -6,17 +6,24 @@ QtObject {
property int a
property variant b
+ property bool test1: false;
+ property bool test2: false;
+
Component.onCompleted: {
try {
root.a = undefined;
} catch(e) {
- console.log (e.fileName + ":" + e.lineNumber + ":" + e);
+ if (e.message == "Cannot assign [undefined] to int" &&
+ e.stack.indexOf("propertyAssignmentErrors.qml:14") != -1)
+ root.test1 = true;
}
try {
root.a = "Hello";
} catch(e) {
- console.log (e.fileName + ":" + e.lineNumber + ":" + e);
+ if (e.message == "Cannot assign QString to int" &&
+ e.stack.indexOf("propertyAssignmentErrors.qml:22") != -1)
+ root.test2 = true;
}
}
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml
index b7bb366698..7fcf2bebd7 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml
@@ -4,5 +4,5 @@ import "qtbug_11600.js" as Test
QtObject {
id: goo
- property bool test: undefined == goo.Test.foo
+ property bool test: undefined == goo.Test
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scarceresources/scarceResourceFunctionFail.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scarceresources/scarceResourceFunctionFail.qml
index b1342fea90..9b07080054 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scarceresources/scarceResourceFunctionFail.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scarceresources/scarceResourceFunctionFail.qml
@@ -11,6 +11,7 @@ QtObject {
id: root
property MyScarceResourceObject a: MyScarceResourceObject { id: scarceResourceProvider }
property variant scarceResourceCopy;
+ property string srp_name: a.toString();
function retrieveScarceResource() {
root.scarceResourceCopy = scarceResourceProvider.scarceResource(); // common syntax error, should throw exception
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index cabaddeeb7..80701d52f2 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -49,7 +49,6 @@
#include <QtCore/qdir.h>
#include <QtCore/qnumeric.h>
#include <private/qdeclarativeengine_p.h>
-#include <private/qdeclarativeglobalscriptclass_p.h>
#include <private/qscriptdeclarativeclass_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
@@ -1199,7 +1198,11 @@ void tst_qdeclarativeecmascript::functionErrors()
url = componentTwo.url().toString();
object = componentTwo.create();
QVERIFY(object != 0);
- warning = url + QLatin1String(":16: TypeError: Result of expression 'scarceResourceProvider.scarceResource' [[object Object]] is not a function.");
+
+ QString srpname = object->property("srp_name").toString();
+
+ warning = url + QLatin1String(":17: TypeError: Property 'scarceResource' of object ") + srpname +
+ QLatin1String(" is not a function");
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
delete object;
@@ -1214,15 +1217,12 @@ void tst_qdeclarativeecmascript::propertyAssignmentErrors()
QString url = component.url().toString();
- QString warning1 = url + ":11:Error: Cannot assign [undefined] to int";
- QString warning2 = url + ":17:Error: Cannot assign QString to int";
-
- QTest::ignoreMessage(QtDebugMsg, warning1.toLatin1().constData());
- QTest::ignoreMessage(QtDebugMsg, warning2.toLatin1().constData());
-
QObject *object = component.create();
QVERIFY(object != 0);
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+
delete object;
}
@@ -1277,7 +1277,7 @@ void tst_qdeclarativeecmascript::exceptionClearsOnReeval()
QDeclarativeComponent component(&engine, TEST_FILE("exceptionClearsOnReeval.qml"));
QString url = component.url().toString();
- QString warning = url + ":4: TypeError: Result of expression 'objectProperty' [null] is not an object.";
+ QString warning = url + ":4: TypeError: Cannot read property 'objectProperty' of null";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
@@ -1490,56 +1490,119 @@ void tst_qdeclarativeecmascript::regExpBug()
delete object;
}
+static inline bool evaluate_error(QV8Engine *engine, v8::Handle<v8::Object> o, const char *source)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return false;
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return false;
+ v8::Handle<v8::Value> args[] = { o };
+ function->Call(engine->global(), 1, args);
+ return tc.HasCaught();
+}
+
+static inline bool evaluate_value(QV8Engine *engine, v8::Handle<v8::Object> o,
+ const char *source, v8::Handle<v8::Value> result)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return false;
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return false;
+ v8::Handle<v8::Value> args[] = { o };
+
+ v8::Handle<v8::Value> value = function->Call(engine->global(), 1, args);
+
+ if (tc.HasCaught())
+ return false;
+
+ return value->StrictEquals(result);
+}
+
+static inline v8::Handle<v8::Value> evaluate(QV8Engine *engine, v8::Handle<v8::Object> o,
+ const char *source)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return v8::Handle<v8::Value>();
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return v8::Handle<v8::Value>();
+ v8::Handle<v8::Value> args[] = { o };
+
+ v8::Handle<v8::Value> value = function->Call(engine->global(), 1, args);
+
+ if (tc.HasCaught())
+ return v8::Handle<v8::Value>();
+ return value;
+}
+
+#define EVALUATE_ERROR(source) evaluate_error(engine, object, source)
+#define EVALUATE_VALUE(source, result) evaluate_value(engine, object, source, result)
+#define EVALUATE(source) evaluate(engine, object, source)
+
void tst_qdeclarativeecmascript::callQtInvokables()
{
MyInvokableObject o;
QDeclarativeEngine qmlengine;
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(&qmlengine);
- QScriptEngine *engine = &ep->scriptEngine;
+
+ QV8Engine *engine = &ep->v8engine;
- QStringList names; QList<QScriptValue> values;
- names << QLatin1String("object"); values << ep->objectClass->newQObject(&o);
- names << QLatin1String("undefined"); values << engine->undefinedValue();
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
- ep->globalClass->explicitSetProperty(names, values);
+ v8::Local<v8::Object> object = engine->newQObject(&o)->ToObject();
// Non-existent methods
o.reset();
- QCOMPARE(engine->evaluate("object.method_nonexistent()").isError(), true);
+ QVERIFY(EVALUATE_ERROR("object.method_nonexistent()"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QCOMPARE(engine->evaluate("object.method_nonexistent(10, 11)").isError(), true);
+ QVERIFY(EVALUATE_ERROR("object.method_nonexistent(10, 11)"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
// Insufficient arguments
o.reset();
- QCOMPARE(engine->evaluate("object.method_int()").isError(), true);
+ QVERIFY(EVALUATE_ERROR("object.method_int()"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QCOMPARE(engine->evaluate("object.method_intint(10)").isError(), true);
+ QVERIFY(EVALUATE_ERROR("object.method_intint(10)"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
// Excessive arguments
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(10, 11)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(10));
o.reset();
- QCOMPARE(engine->evaluate("object.method_intint(10, 11, 12)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 9);
QCOMPARE(o.actuals().count(), 2);
@@ -1548,27 +1611,28 @@ void tst_qdeclarativeecmascript::callQtInvokables()
// Test return types
o.reset();
- QCOMPARE(engine->evaluate("object.method_NoArgs()").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 0);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QVERIFY(engine->evaluate("object.method_NoArgs_int()").strictlyEquals(QScriptValue(engine, 6)));
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", v8::Integer::New(6)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 1);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.75)));
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", v8::Number::New(19.75)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 2);
QCOMPARE(o.actuals().count(), 0);
o.reset();
{
- QScriptValue ret = engine->evaluate("object.method_NoArgs_QPointF()");
- QCOMPARE(ret.toVariant(), QVariant(QPointF(123, 4.5)));
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QPointF()");
+ QVERIFY(!ret.IsEmpty());
+ QCOMPARE(engine->toVariant(ret, -1), QVariant(QPointF(123, 4.5)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 3);
QCOMPARE(o.actuals().count(), 0);
@@ -1576,81 +1640,83 @@ void tst_qdeclarativeecmascript::callQtInvokables()
o.reset();
{
- QScriptValue ret = engine->evaluate("object.method_NoArgs_QObject()");
- QVERIFY(ret.isQObject());
- QCOMPARE(ret.toQObject(), (QObject *)&o);
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QObject()");
+ QCOMPARE(engine->toQObject(ret), (QObject *)&o);
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 4);
QCOMPARE(o.actuals().count(), 0);
}
o.reset();
- QCOMPARE(engine->evaluate("object.method_NoArgs_unknown()").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_unknown()", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 5);
QCOMPARE(o.actuals().count(), 0);
+ // XXX enable once qml/qtscript integration is implemented
+#if 0
o.reset();
{
- QScriptValue ret = engine->evaluate("object.method_NoArgs_QScriptValue()");
- QVERIFY(ret.isString());
- QCOMPARE(ret.toString(), QString("Hello world"));
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QScriptValue()");
+ QVERIFY(ret->IsString());
+ QCOMPARE(engine->toString(ret), QString("Hello world"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 6);
QCOMPARE(o.actuals().count(), 0);
}
+#endif
o.reset();
- QVERIFY(engine->evaluate("object.method_NoArgs_QVariant()").strictlyEquals(QScriptValue(engine, "QML rocks")));
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_QVariant()", engine->toString("QML rocks")));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 7);
QCOMPARE(o.actuals().count(), 0);
// Test arg types
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(94)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(94)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(94));
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(\"94\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(94));
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(\"not a number\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_int(object)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_int(object)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 8);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_intint(122, 9)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 9);
QCOMPARE(o.actuals().count(), 2);
@@ -1658,56 +1724,56 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(1), QVariant(9));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(94.3)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(94.3));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(\"94.3\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(94.3));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(\"not a number\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qIsNaN(o.actuals().at(0).toDouble()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qIsNaN(o.actuals().at(0).toDouble()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_real(object)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_real(object)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 10);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qIsNaN(o.actuals().at(0).toDouble()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QString(\"Hello world\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 11);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant("Hello world"));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QString(19)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QString(19)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 11);
QCOMPARE(o.actuals().count(), 1);
@@ -1716,7 +1782,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
o.reset();
{
QString expected = "MyInvokableObject(0x" + QString::number((quintptr)&o, 16) + ")";
- QCOMPARE(engine->evaluate("object.method_QString(object)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QString(object)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 11);
QCOMPARE(o.actuals().count(), 1);
@@ -1724,126 +1790,128 @@ void tst_qdeclarativeecmascript::callQtInvokables()
}
o.reset();
- QCOMPARE(engine->evaluate("object.method_QString(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QString(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 11);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QString()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QString(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 11);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QString()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(0)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(0)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(object)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF()));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPointF())").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF(99.3, -10.2)));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPoint())").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 12);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QPointF(9, 12)));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QObject(0)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(0)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 13);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QObject(\"Hello world\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 13);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QObject(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 13);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QObject(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 13);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QObject(object)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 13);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)&o));
+ // XXX enable once qml/qtscript integration is implemented
+#if 0
o.reset();
- QCOMPARE(engine->evaluate("object.method_QScriptValue(null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 14);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isNull());
o.reset();
- QCOMPARE(engine->evaluate("object.method_QScriptValue(undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 14);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isUndefined());
o.reset();
- QCOMPARE(engine->evaluate("object.method_QScriptValue(19)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 14);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).strictlyEquals(QScriptValue(engine, 19)));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QScriptValue([19, 20])").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 14);
QCOMPARE(o.actuals().count(), 1);
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isArray());
o.reset();
- QCOMPARE(engine->evaluate("object.method_intQScriptValue(4, null)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 15);
QCOMPARE(o.actuals().count(), 2);
@@ -1851,7 +1919,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isNull());
o.reset();
- QCOMPARE(engine->evaluate("object.method_intQScriptValue(8, undefined)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 15);
QCOMPARE(o.actuals().count(), 2);
@@ -1859,7 +1927,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isUndefined());
o.reset();
- QCOMPARE(engine->evaluate("object.method_intQScriptValue(3, 19)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 15);
QCOMPARE(o.actuals().count(), 2);
@@ -1867,28 +1935,29 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).strictlyEquals(QScriptValue(engine, 19)));
o.reset();
- QCOMPARE(engine->evaluate("object.method_intQScriptValue(44, [19, 20])").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 15);
QCOMPARE(o.actuals().count(), 2);
QCOMPARE(o.actuals().at(0), QVariant(44));
QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isArray());
+#endif
o.reset();
- QCOMPARE(engine->evaluate("object.method_overload()").isError(), true);
+ QVERIFY(EVALUATE_ERROR("object.method_overload()"));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -1);
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QCOMPARE(engine->evaluate("object.method_overload(10)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_overload(10)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 16);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(10));
o.reset();
- QCOMPARE(engine->evaluate("object.method_overload(10, 11)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 17);
QCOMPARE(o.actuals().count(), 2);
@@ -1896,21 +1965,21 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(1), QVariant(11));
o.reset();
- QCOMPARE(engine->evaluate("object.method_overload(\"Hello\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 18);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(QString("Hello")));
o.reset();
- QCOMPARE(engine->evaluate("object.method_with_enum(9)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 19);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(9));
o.reset();
- QVERIFY(engine->evaluate("object.method_default(10)").strictlyEquals(QScriptValue(19)));
+ QVERIFY(EVALUATE_VALUE("object.method_default(10)", v8::Integer::New(19)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 20);
QCOMPARE(o.actuals().count(), 2);
@@ -1918,7 +1987,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(1), QVariant(19));
o.reset();
- QVERIFY(engine->evaluate("object.method_default(10, 13)").strictlyEquals(QScriptValue(13)));
+ QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", v8::Integer::New(13)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 20);
QCOMPARE(o.actuals().count(), 2);
@@ -1926,14 +1995,14 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(1), QVariant(13));
o.reset();
- QCOMPARE(engine->evaluate("object.method_inherited(9)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), -3);
QCOMPARE(o.actuals().count(), 1);
QCOMPARE(o.actuals().at(0), QVariant(9));
o.reset();
- QCOMPARE(engine->evaluate("object.method_QVariant(9)").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 21);
QCOMPARE(o.actuals().count(), 2);
@@ -1941,7 +2010,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(1), QVariant());
o.reset();
- QCOMPARE(engine->evaluate("object.method_QVariant(\"Hello\", \"World\")").isUndefined(), true);
+ QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", v8::Undefined()));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 21);
QCOMPARE(o.actuals().count(), 2);
@@ -2236,7 +2305,8 @@ void tst_qdeclarativeecmascript::ownership()
QVERIFY(own.object != 0);
QObject *object = component.create(context);
- QDeclarativeEnginePrivate::getScriptEngine(&engine)->collectGarbage();
+
+ engine.collectGarbage();
QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
@@ -2253,7 +2323,8 @@ void tst_qdeclarativeecmascript::ownership()
QVERIFY(own.object != 0);
QObject *object = component.create(context);
- QDeclarativeEnginePrivate::getScriptEngine(&engine)->collectGarbage();
+
+ engine.collectGarbage();
QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
@@ -2337,6 +2408,7 @@ void tst_qdeclarativeecmascript::ownershipCustomReturnValue()
delete object;
}
+ engine.collectGarbage();
QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
QVERIFY(source.value == 0);
@@ -2638,7 +2710,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object != 0);
QVERIFY(object->property("scarceResourceCopy").isValid());
QCOMPARE(object->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(!eo->scarceResourceIsDetached()); // there are two copies of it in existence: the property of object, and the property of eo.
delete object;
@@ -2648,7 +2720,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object != 0);
QVERIFY(object->property("scarceResourceCopy").isValid());
QCOMPARE(object->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(!eo->scarceResourceIsDetached()); // there are two copies of it in existence: the property of object, and the property of eo.
delete object;
@@ -2657,7 +2729,7 @@ void tst_qdeclarativeecmascript::scarceResources()
object = componentThree.create();
QVERIFY(object != 0);
QVERIFY(!(object->property("scarceResourceCopy").isValid())); // was manually released prior to being returned.
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should have explicitly been released during the evaluation of the binding.
delete object;
@@ -2669,7 +2741,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object != 0);
QVERIFY(object->property("scarceResourceTest").isValid());
QCOMPARE(object->property("scarceResourceTest").toInt(), 100);
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // the resource should have been released after the binding was evaluated.
delete object;
@@ -2679,7 +2751,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object != 0);
QVERIFY(object->property("scarceResourceTest").isValid());
QCOMPARE(object->property("scarceResourceTest").toInt(), 100);
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(!eo->scarceResourceIsDetached()); // this won't be detached since we explicitly preserved it.
delete object;
@@ -2689,7 +2761,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object != 0);
QVERIFY(object->property("scarceResourceTest").isValid());
QCOMPARE(object->property("scarceResourceTest").toInt(), 100);
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // all resources were released manually or automatically released.
delete object;
@@ -2698,14 +2770,14 @@ void tst_qdeclarativeecmascript::scarceResources()
QDeclarativeComponent componentSeven(&engine, TEST_FILE("scarceresources/scarceResourceCopyImportNoBinding.qml"));
object = componentSeven.create();
QVERIFY(object != 0); // the import should have caused the addition of a resource to the ScarceResources list
- QVERIFY(ep->scarceResources == 0); // but they should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // but they should have been released by this point.
delete object;
QDeclarativeComponent componentEight(&engine, TEST_FILE("scarceresources/scarceResourceCopyImportFail.qml"));
object = componentEight.create();
QVERIFY(object != 0);
QVERIFY(!object->property("scarceResourceCopy").isValid()); // wasn't preserved, so shouldn't be valid.
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
delete object;
QDeclarativeComponent componentNine(&engine, TEST_FILE("scarceresources/scarceResourceCopyImport.qml"));
@@ -2716,7 +2788,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(object->property("scarceResourceAssignedCopyOne").isValid()); // assigned before destroy(), so should be valid.
QCOMPARE(object->property("scarceResourceAssignedCopyOne").value<QPixmap>(), origPixmap);
QVERIFY(!object->property("scarceResourceAssignedCopyTwo").isValid()); // assigned after destroy(), so should be invalid.
- QVERIFY(ep->scarceResources == 0); // this will still be zero, because "preserve()" REMOVES it from this list.
+ QVERIFY(ep->scarceResources.isEmpty()); // this will still be zero, because "preserve()" REMOVES it from this list.
delete object;
// test that scarce resources are handled properly in signal invocation
@@ -2739,7 +2811,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QCOMPARE(srsc->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(!(eo->scarceResourceIsDetached())); // should be another copy of the resource now.
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
delete object;
// test that scarce resources are handled properly from js functions in qml files
@@ -2758,7 +2830,7 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(!object->property("scarceResourceCopy").isValid()); // just released, so should not be valid
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
delete object;
// test that if an exception occurs while invoking js function from cpp, that the resources are released.
@@ -2768,13 +2840,14 @@ void tst_qdeclarativeecmascript::scarceResources()
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
- QString expectedWarning = QLatin1String("file://") + TEST_FILE("scarceresources/scarceResourceFunctionFail.qml").toLocalFile() + QLatin1String(":16: TypeError: Result of expression 'scarceResourceProvider.scarceResource' [[object Object]] is not a function.");
- QTest::ignoreMessage(QtWarningMsg, expectedWarning.toAscii().constData()); // we expect a meaningful warning to be printed.
+ QString srp_name = object->property("srp_name").toString();
+ QString expectedWarning = componentTwelve.url().toString() + QLatin1String(":17: TypeError: Property 'scarceResource' of object ") + srp_name + QLatin1String(" is not a function");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
eo = qobject_cast<ScarceResourceObject*>(QDeclarativeProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
- QVERIFY(ep->scarceResources == 0); // should have been released by this point.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
delete object;
}
@@ -3060,11 +3133,11 @@ void tst_qdeclarativeecmascript::functionAssignmentfromJS_invalid()
QVERIFY(!o->property("a").isValid());
QString url = component.url().toString();
- QString warning = url + ":63: Unable to assign QString to int";
+ QString warning = url + ":67: Unable to assign QString to int";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
o->setProperty("assignWrongType", true);
- warning = url + ":70: Unable to assign QString to int";
+ warning = url + ":71: Unable to assign QString to int";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
o->setProperty("assignWrongTypeToValueType", true);
diff --git a/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml
index bb20ecc8f6..48fb38da2b 100644
--- a/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml
+++ b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml
@@ -33,11 +33,11 @@ Item {
function checkMapAToInvalid(x, y) {
var pos = itemA.mapToItem(1122, x, y)
- return pos.x == undefined && pos.y == undefined
+ return pos == undefined;
}
function checkMapAFromInvalid(x, y) {
var pos = itemA.mapFromItem(1122, x, y)
- return pos.x == undefined && pos.y == undefined
+ return pos == undefined;
}
}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml
index bfd547ed32..a1a599c9a5 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml
@@ -19,4 +19,8 @@ Item {
item.done = true
}
}
+
+ function runEval(js) {
+ eval(js);
+ }
}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index d923a7a7cb..0cd9df29b7 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -108,6 +108,7 @@ private slots:
void property_changes_worker_data();
void clear();
};
+
int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName)
{
QList<int> roles = model->roles();
@@ -152,19 +153,74 @@ void tst_qdeclarativelistmodel::waitForWorker(QDeclarativeItem *item)
QVERIFY(timer.isActive());
}
+void tst_qdeclarativelistmodel::static_types_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QVariant>("value");
+
+ QTest::newRow("string")
+ << "ListElement { foo: \"bar\" }"
+ << QVariant(QString("bar"));
+
+ QTest::newRow("real")
+ << "ListElement { foo: 10.5 }"
+ << QVariant(10.5);
+
+ QTest::newRow("real0")
+ << "ListElement { foo: 0 }"
+ << QVariant(double(0));
+
+ QTest::newRow("bool")
+ << "ListElement { foo: false }"
+ << QVariant(false);
+
+ QTest::newRow("bool")
+ << "ListElement { foo: true }"
+ << QVariant(true);
+
+ QTest::newRow("enum")
+ << "ListElement { foo: Text.AlignHCenter }"
+ << QVariant(double(QDeclarativeText::AlignHCenter));
+}
+
+void tst_qdeclarativelistmodel::static_types()
+{
+ QFETCH(QString, qml);
+ QFETCH(QVariant, value);
+
+ qml = "import QtQuick 1.0\nItem { property variant test: model.get(0).foo; ListModel { id: model; " + qml + " } }";
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+
+ QVERIFY(!component.isError());
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ QVariant actual = obj->property("test");
+
+ QCOMPARE(actual, value);
+ QCOMPARE(actual.toString(), value.toString());
+
+ delete obj;
+}
+
void tst_qdeclarativelistmodel::static_i18n()
{
QString expect = QString::fromUtf8("na\303\257ve");
- QString componentStr = "import QtQuick 1.0\nListModel { ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } }";
+ QString componentStr = "import QtQuick 1.0\nItem { property string prop1: model.get(0).prop1; property string prop2: model.get(0).prop2; ListModel { id: model; ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } } }";
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
component.setData(componentStr.toUtf8(), QUrl::fromLocalFile(""));
- QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create());
+ QObject *obj = component.create();
QVERIFY(obj != 0);
- QString prop1 = obj->get(0).property(QLatin1String("prop1")).toString();
+ QString prop1 = obj->property("prop1").toString();
QCOMPARE(prop1,expect);
- QString prop2 = obj->get(0).property(QLatin1String("prop2")).toString();
+ QString prop2 = obj->property("prop2").toString();
QCOMPARE(prop2,expect); // (no, not translated, QT_TR_NOOP is a no-op)
delete obj;
}
@@ -180,25 +236,29 @@ void tst_qdeclarativelistmodel::static_nestedElements()
QString componentStr =
"import QtQuick 1.0\n"
- "ListModel {\n"
- " ListElement {\n"
- " attributes: [\n";
+ "Item {\n"
+ " property variant count: model.get(0).attributes.count\n"
+ " ListModel {\n"
+ " id: model\n"
+ " ListElement {\n"
+ " attributes: [\n";
componentStr += elementsStr.toUtf8().constData();
componentStr +=
- " ]\n"
- " }\n"
+ " ]\n"
+ " }\n"
+ " }\n"
"}";
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
component.setData(componentStr.toUtf8(), QUrl::fromLocalFile(""));
- QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create());
+ QObject *obj = component.create();
QVERIFY(obj != 0);
- QScriptValue prop = obj->get(0).property(QLatin1String("attributes")).property(QLatin1String("count"));
- QVERIFY(prop.isNumber());
- QCOMPARE(prop.toInt32(), qint32(elementCount));
+ QVariant count = obj->property("count");
+ QCOMPARE(count.type(), QVariant::Int);
+ QCOMPARE(count.toInt(), elementCount);
delete obj;
}
@@ -384,8 +444,6 @@ void tst_qdeclarativelistmodel::dynamic_worker()
qApp->processEvents();
}
-
-
void tst_qdeclarativelistmodel::dynamic_worker_sync_data()
{
dynamic_data();
@@ -438,6 +496,17 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync()
qApp->processEvents();
}
+#define RUNEVAL(object, string) \
+ QVERIFY(QMetaObject::invokeMethod(object, "runEval", Q_ARG(QVariant, QString(string))));
+
+inline QVariant runexpr(QDeclarativeEngine *engine, const QString &str)
+{
+ QDeclarativeExpression expr(engine->rootContext(), 0, str);
+ return expr.evaluate();
+}
+
+#define RUNEXPR(string) runexpr(&engine, QString(string))
+
void tst_qdeclarativelistmodel::convertNestedToFlat_fail()
{
// If a model has nested data, it cannot be used at all from a worker script
@@ -450,11 +519,9 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_fail()
QDeclarativeItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
- QScriptEngine s_eng;
- QScriptValue plainData = s_eng.newObject();
- plainData.setProperty("foo", QScriptValue(123));
- model.append(plainData);
- model.append(nestedListValue(&s_eng));
+ RUNEVAL(item, "model.append({foo: 123})");
+ RUNEVAL(item, "model.append({foo: [{}, {}]})");
+
QCOMPARE(model.count(), 2);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML ListModel: List contains list-type data and cannot be used from a worker script");
@@ -482,6 +549,7 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_fail_data()
}
void tst_qdeclarativelistmodel::convertNestedToFlat_ok()
+
{
// If a model only has plain data, it can be modified from a worker script. However,
// once the model is used from a worker script, it no longer accepts nested data
@@ -494,10 +562,8 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_ok()
QDeclarativeItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
- QScriptEngine s_eng;
- QScriptValue plainData = s_eng.newObject();
- plainData.setProperty("foo", QScriptValue(123));
- model.append(plainData);
+ RUNEVAL(item, "model.append({foo: 123})");
+
QCOMPARE(model.count(), 1);
QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, script)));
@@ -505,20 +571,21 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_ok()
// can still add plain data
int count = model.count();
- model.append(plainData);
+
+ RUNEVAL(item, "model.append({foo: 123})");
+
QCOMPARE(model.count(), count+1);
- QScriptValue nested = nestedListValue(&s_eng);
const char *warning = "<Unknown File>: QML ListModel: Cannot add list-type data when modifying or after modification from a worker script";
QTest::ignoreMessage(QtWarningMsg, warning);
- model.append(nested);
+ RUNEVAL(item, "model.append({foo: [{}, {}]})");
QTest::ignoreMessage(QtWarningMsg, warning);
- model.insert(0, nested);
+ RUNEVAL(item, "model.insert(0, {foo: [{}, {}]})");
QTest::ignoreMessage(QtWarningMsg, warning);
- model.set(0, nested);
+ RUNEVAL(item, "model.set(0, {foo: [{}, {}]})");
QCOMPARE(model.count(), count+1);
@@ -531,67 +598,6 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_ok_data()
convertNestedToFlat_fail_data();
}
-void tst_qdeclarativelistmodel::static_types_data()
-{
- QTest::addColumn<QString>("qml");
- QTest::addColumn<QVariant>("value");
-
- QTest::newRow("string")
- << "ListElement { foo: \"bar\" }"
- << QVariant(QString("bar"));
-
- QTest::newRow("real")
- << "ListElement { foo: 10.5 }"
- << QVariant(10.5);
-
- QTest::newRow("real0")
- << "ListElement { foo: 0 }"
- << QVariant(double(0));
-
- QTest::newRow("bool")
- << "ListElement { foo: false }"
- << QVariant(false);
-
- QTest::newRow("bool")
- << "ListElement { foo: true }"
- << QVariant(true);
-
- QTest::newRow("enum")
- << "ListElement { foo: Text.AlignHCenter }"
- << QVariant(double(QDeclarativeText::AlignHCenter));
-}
-
-void tst_qdeclarativelistmodel::static_types()
-{
- QFETCH(QString, qml);
- QFETCH(QVariant, value);
-
- qml = "import QtQuick 1.0\nListModel { " + qml + " }";
-
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine);
- component.setData(qml.toUtf8(),
- QUrl::fromLocalFile(QString("dummy.qml")));
-
- if (value.toString().startsWith("QTBUG-"))
- QEXPECT_FAIL("",value.toString().toLatin1(),Abort);
-
- QVERIFY(!component.isError());
-
- QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create());
- QVERIFY(obj != 0);
-
- QScriptValue actual = obj->get(0).property(QLatin1String("foo"));
-
- QCOMPARE(actual.isString(), value.type() == QVariant::String);
- QCOMPARE(actual.isBoolean(), value.type() == QVariant::Bool);
- QCOMPARE(actual.isNumber(), value.type() == QVariant::Double);
-
- QCOMPARE(actual.toString(), value.toString());
-
- delete obj;
-}
-
void tst_qdeclarativelistmodel::enumerate()
{
QDeclarativeEngine eng;
@@ -608,7 +614,6 @@ void tst_qdeclarativelistmodel::enumerate()
delete item;
}
-
void tst_qdeclarativelistmodel::error_data()
{
QTest::addColumn<QString>("qml");
@@ -701,21 +706,16 @@ void tst_qdeclarativelistmodel::set()
QDeclarativeEngine engine;
QDeclarativeListModel model;
QDeclarativeEngine::setContextForObject(&model,engine.rootContext());
- engine.rootContext()->setContextObject(&model);
- QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(&engine);
+ engine.rootContext()->setContextProperty("model", &model);
- QScriptValue sv = seng->newObject();
- sv.setProperty("test", QScriptValue(false));
- model.append(sv);
+ RUNEXPR("model.append({test:false})");
+ RUNEXPR("model.set(0, {test:true})");
- sv.setProperty("test", QScriptValue(true));
- model.set(0, sv);
- QCOMPARE(model.get(0).property("test").toBool(), true); // triggers creation of model cache
+ QCOMPARE(RUNEXPR("model.get(0).test").toBool(), true); // triggers creation of model cache
QCOMPARE(model.data(0, model.roles()[0]), qVariantFromValue(true));
- sv.setProperty("test", QScriptValue(false));
- model.set(0, sv);
- QCOMPARE(model.get(0).property("test").toBool(), false); // tests model cache is updated
+ RUNEXPR("model.set(0, {test:false})");
+ QCOMPARE(RUNEXPR("model.get(0).test").toBool(), false); // tests model cache is updated
QCOMPARE(model.data(0, model.roles()[0]), qVariantFromValue(false));
}
@@ -729,8 +729,8 @@ void tst_qdeclarativelistmodel::get()
QFETCH(QString, roleName);
QFETCH(QVariant, roleValue);
- QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng);
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
component.setData(
"import QtQuick 1.0\n"
"ListModel { \n"
@@ -743,7 +743,7 @@ void tst_qdeclarativelistmodel::get()
QVERIFY(role >= 0);
QSignalSpy spy(model, SIGNAL(itemsChanged(int, int, QList<int>)));
- QDeclarativeExpression expr(eng.rootContext(), model, expression);
+ QDeclarativeExpression expr(engine.rootContext(), model, expression);
expr.evaluate();
QVERIFY(!expr.hasError());
@@ -792,17 +792,12 @@ void tst_qdeclarativelistmodel::get_worker()
QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
QDeclarativeItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
- QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(&eng);
// Add some values like get() test
- QScriptValue sv = seng->newObject();
- sv.setProperty(QLatin1String("roleA"), seng->newVariant(QVariant::fromValue(100)));
- model.append(sv);
- sv = seng->newObject();
- sv.setProperty(QLatin1String("roleA"), seng->newVariant(QVariant::fromValue(200)));
- sv.setProperty(QLatin1String("roleB"), seng->newVariant(QVariant::fromValue(400)));
- model.append(sv);
- model.append(sv);
+ RUNEVAL(item, "model.append({roleA: 100})");
+ RUNEVAL(item, "model.append({roleA: 200, roleB: 400})");
+ RUNEVAL(item, "model.append({roleA: 200, roleB: 400})");
+
int role = roleFromName(&model, roleName);
QVERIFY(role >= 0);
@@ -1055,7 +1050,6 @@ void tst_qdeclarativelistmodel::property_changes_data()
<< "b" << 0 << true << "get(0).b.count == 0";
}
-
void tst_qdeclarativelistmodel::property_changes_worker()
{
// nested models are not supported when WorkerScript is involved
@@ -1108,33 +1102,26 @@ void tst_qdeclarativelistmodel::clear()
QDeclarativeEngine engine;
QDeclarativeListModel model;
QDeclarativeEngine::setContextForObject(&model, engine.rootContext());
- engine.rootContext()->setContextObject(&model);
-
- QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(&engine);
- QScriptValue sv = seng->newObject();
- QVariant result;
+ engine.rootContext()->setContextProperty("model", &model);
model.clear();
QCOMPARE(model.count(), 0);
- sv.setProperty("propertyA", "value a");
- sv.setProperty("propertyB", "value b");
- model.append(sv);
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
QCOMPARE(model.count(), 1);
model.clear();
QCOMPARE(model.count(), 0);
- model.append(sv);
- model.append(sv);
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
QCOMPARE(model.count(), 2);
model.clear();
QCOMPARE(model.count(), 0);
// clearing does not remove the roles
- sv.setProperty("propertyC", "value c");
- model.append(sv);
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\", propertyC: \"value c\"})");
QList<int> roles = model.roles();
model.clear();
QCOMPARE(model.count(), 0);
diff --git a/tests/auto/declarative/qdeclarativeqt/data/dateTimeConversion.qml b/tests/auto/declarative/qdeclarativeqt/data/dateTimeConversion.qml
new file mode 100644
index 0000000000..06203285a9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/dateTimeConversion.qml
@@ -0,0 +1,14 @@
+import QtQuick 1.0
+
+QtObject {
+ // months are 0-based - so January = 0, December = 11.
+ property variant qtime: new Date(0,0,0,14,15,38,200) // yyyy/MM/dd 14:15:38.200
+ property variant qdate: new Date(2008,11,24) // 2008/12/24 hh:mm:ss.zzz
+ property variant qdatetime: new Date(2008,11,24,14,15,38,200) // 2008/12/24 14:15:38.200
+
+ property variant qdatetime2: new Date(2852,11,31,23,59,59,500) // 2852/12/31 23:59:59.500
+ property variant qdatetime3: new Date(1970,0,1,0,0,0,0) // 1970/01/01 00:00:00.000
+ property variant qdatetime4: new Date(1586,1,2) // 1586/02/02 hh:mm:ss.zzz
+ property variant qdatetime5: new Date(955,0,1,0,0,0,0) // 955/01/01 00:00:00.000
+ property variant qdatetime6: new Date(113,1,24,14,15,38,200) // 113/02/24 14:15:38.200
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 960616294f..948307d955 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -82,8 +82,11 @@ private slots:
void createComponent_pragmaLibrary();
void createQmlObject();
void consoleLog();
+ void dateTimeConversion();
void dateTimeFormatting();
void dateTimeFormatting_data();
+ void dateTimeFormattingVariants();
+ void dateTimeFormattingVariants_data();
void isQtObject();
void btoa();
void atob();
@@ -412,11 +415,11 @@ void tst_qdeclarativeqt::createQmlObject()
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
QString warning1 = component.url().toString() + ":7: Error: Qt.createQmlObject(): Invalid arguments";
- QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject() failed to create object: \n " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type";
- QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject() failed to create object: \n " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name";
QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
- QString warning6 = "RunTimeError: Qt.createQmlObject() failed to create object: \n " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method";
+ QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -448,6 +451,31 @@ void tst_qdeclarativeqt::consoleLog()
delete object;
}
+void tst_qdeclarativeqt::dateTimeConversion()
+{
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+ QDateTime dateTime2(QDate(2852,12,31), QTime(23,59,59,500));
+ QDateTime dateTime3(QDate(1970,1,1), QTime(0,0,0,0));
+ QDateTime dateTime4(QDate(1586,2,2), QTime(0,0,0,0));
+ QDateTime dateTime5(QDate(955,1,1), QTime(0,0,0,0));
+ QDateTime dateTime6(QDate(113,2,24), QTime(14,15,38,200));
+
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, TEST_FILE("dateTimeConversion.qml"));
+ QObject *obj = component.create();
+
+ QCOMPARE(obj->property("qdate").toDate(), date);
+ QCOMPARE(obj->property("qtime").toTime(), time);
+ QCOMPARE(obj->property("qdatetime").toDateTime(), dateTime);
+ QCOMPARE(obj->property("qdatetime2").toDateTime(), dateTime2);
+ QCOMPARE(obj->property("qdatetime3").toDateTime(), dateTime3);
+ QCOMPARE(obj->property("qdatetime4").toDateTime(), dateTime4);
+ QCOMPARE(obj->property("qdatetime5").toDateTime(), dateTime5);
+ QCOMPARE(obj->property("qdatetime6").toDateTime(), dateTime6);
+}
+
void tst_qdeclarativeqt::dateTimeFormatting()
{
QFETCH(QString, method);
@@ -482,14 +510,13 @@ void tst_qdeclarativeqt::dateTimeFormatting()
QVERIFY(object != 0);
QVERIFY(inputProperties.count() > 0);
-
QVariant result;
foreach(const QString &prop, inputProperties) {
QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(),
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, prop)));
-
QStringList output = result.toStringList();
+ QCOMPARE(output.size(), expectedResults.size());
for (int i=0; i<output.count(); i++)
QCOMPARE(output[i], expectedResults[i]);
}
@@ -530,6 +557,86 @@ void tst_qdeclarativeqt::dateTimeFormatting_data()
<< dateTime.toString("M/d/yy H:m:s a"));
}
+void tst_qdeclarativeqt::dateTimeFormattingVariants()
+{
+ QFETCH(QString, method);
+ QFETCH(QVariant, variant);
+ QFETCH(QStringList, expectedResults);
+
+ QDeclarativeEngine eng;
+ eng.rootContext()->setContextProperty("qvariant", variant);
+ QDeclarativeComponent component(&eng, TEST_FILE("formatting.qml"));
+
+ QStringList warnings;
+ warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
+ << component.url().toString() + ":36: Error: Qt.formatDate(): Invalid arguments"
+ << component.url().toString() + ":40: Error: Qt.formatTime(): Invalid time format"
+ << component.url().toString() + ":39: Error: Qt.formatTime(): Invalid arguments"
+ << component.url().toString() + ":43: Error: Qt.formatDateTime(): Invalid datetime format"
+ << component.url().toString() + ":42: Error: Qt.formatDateTime(): Invalid arguments";
+
+ foreach (const QString &warning, warnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+ QVERIFY(object != 0);
+
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(),
+ Q_RETURN_ARG(QVariant, result),
+ Q_ARG(QVariant, QString(QLatin1String("qvariant")))));
+ QStringList output = result.toStringList();
+ QCOMPARE(output, expectedResults);
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::dateTimeFormattingVariants_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QVariant>("variant");
+ QTest::addColumn<QStringList>("expectedResults");
+
+ QDateTime temporary;
+
+ QTime time(11, 16, 39, 755);
+ temporary = QDateTime(QDate(1970,1,1), time);
+ QTest::newRow("formatDate, qtime") << "formatDate" << QVariant::fromValue(time) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qtime") << "formatDateTime" << QVariant::fromValue(time) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qtime") << "formatTime" << QVariant::fromValue(time) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QDate date(2011,5,31);
+ temporary = QDateTime(date);
+ QTest::newRow("formatDate, qdate") << "formatDate" << QVariant::fromValue(date) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qdate") << "formatDateTime" << QVariant::fromValue(date) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qdate") << "formatTime" << QVariant::fromValue(date) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QDateTime dateTime(date, time);
+ temporary = dateTime;
+ QTest::newRow("formatDate, qdatetime") << "formatDate" << QVariant::fromValue(dateTime) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qdatetime") << "formatDateTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qdatetime") << "formatTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QString string(QLatin1String("2011/05/31 11:16:39.755"));
+ temporary = QDateTime::fromString(string, "yyyy/MM/dd HH:mm:ss.zzz");
+ QTest::newRow("formatDate, qstring") << "formatDate" << QVariant::fromValue(string) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qstring") << "formatDateTime" << QVariant::fromValue(string) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qstring") << "formatTime" << QVariant::fromValue(string) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QColor color(Qt::red);
+ temporary = QVariant::fromValue(color).toDateTime();
+ QTest::newRow("formatDate, qcolor") << "formatDate" << QVariant::fromValue(color) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qcolor") << "formatDateTime" << QVariant::fromValue(color) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qcolor") << "formatTime" << QVariant::fromValue(color) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ int integer(4);
+ temporary = QVariant::fromValue(integer).toDateTime();
+ QTest::newRow("formatDate, int") << "formatDate" << QVariant::fromValue(integer) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, int") << "formatDateTime" << QVariant::fromValue(integer) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, int") << "formatTime" << QVariant::fromValue(integer) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+}
+
void tst_qdeclarativeqt::isQtObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml"));
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
index 37755a9929..94b1cd630a 100644
--- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
+++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
@@ -230,7 +230,8 @@ void tst_qdeclarativesqldatabase::testQml_cleanopen()
// making it more like the tests are running in new processes.
testQml();
- QDeclarativeEnginePrivate::getScriptEngine(engine)->collectGarbage(); // close databases
+ engine->collectGarbage();
+
foreach (QString dbname, QSqlDatabase::connectionNames()) {
QSqlDatabase::removeDatabase(dbname);
}
diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
index 39c3a9419c..ee787e2923 100644
--- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
+++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
@@ -451,9 +451,9 @@ void tst_qdeclarativevisualdatamodel::modelProperties()
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Cannot read property 'display' of undefined");
view.setSource(source);
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js
new file mode 100644
index 0000000000..5c4c5ec906
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function() {
+}
+for (var ii = 0; ii < 100; ++ii) {
+ var a = "HELLO WORLD";
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml
new file mode 100644
index 0000000000..d05918a074
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml
@@ -0,0 +1,13 @@
+import QtQuick 1.0
+
+Item {
+ WorkerScript {
+ id: worker
+ source: "stressDispose.js"
+ }
+
+ Component.onCompleted: {
+ worker.sendMessage(10);
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 66090ce7ff..2c85040f5f 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -53,8 +53,6 @@
#include <private/qdeclarativeengine_p.h>
#include "../../../shared/util.h"
-Q_DECLARE_METATYPE(QScriptValue)
-
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
#define SRCDIR "."
@@ -82,6 +80,7 @@ private slots:
void script_included();
void scriptError_onLoad();
void scriptError_onCall();
+ void stressDispose();
private:
void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
@@ -191,13 +190,12 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
// QVariant roundtrip, since the properties will be stored in a QVariantMap.
QString jsObject = "{'haste': 1125, 'name': 'zyz', 'spell power': 3101}";
- QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(worker));
- QScriptValue sv = engine->newObject();
- sv.setProperty("haste", 1125);
- sv.setProperty("name", "zyz");
- sv.setProperty("spell power", 3101);
+ QVariantMap map;
+ map.insert("haste", 1125);
+ map.insert("name", "zyz");
+ map.insert("spell power", 3101);
- QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(sv))));
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(map))));
waitForEchoMessage(worker);
QVariant result = qVariantFromValue(false);
@@ -261,7 +259,7 @@ void tst_QDeclarativeWorkerScript::scriptError_onLoad()
QVERIFY(worker != 0);
QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
- TEST_FILE("data/script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Parse error"));
+ TEST_FILE("data/script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
@@ -286,6 +284,18 @@ void tst_QDeclarativeWorkerScript::scriptError_onCall()
delete worker;
}
+// Rapidly create and destroy worker scripts to test resources are being disposed
+// in the correct isolate
+void tst_QDeclarativeWorkerScript::stressDispose()
+{
+ for (int ii = 0; ii < 100; ++ii) {
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, SRCDIR "/data/stressDispose.qml");
+ QObject *o = component.create();
+ QVERIFY(o);
+ delete o;
+ }
+}
QTEST_MAIN(tst_QDeclarativeWorkerScript)
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml
index 68f22f5f33..312292deaf 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml
@@ -1,7 +1,6 @@
import QtQuick 1.0
QtObject {
- property bool onreadystatechange: false
property bool readyState: false
property bool status: false
property bool statusText: false
@@ -19,17 +18,6 @@ QtObject {
var o = 10;
try {
- XMLHttpRequest.prototype.onreadystatechange
- } catch (e) {
- if (!(e instanceof ReferenceError))
- return;
-
- if (e.message != "Not an XMLHttpRequest object")
- return;
-
- onreadystatechange = true;
- }
- try {
XMLHttpRequest.prototype.readyState
} catch (e) {
if (!(e instanceof ReferenceError))
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index de16cf41f5..e243f60872 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -958,7 +958,6 @@ void tst_qdeclarativexmlhttprequest::invalidMethodUsage()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("onreadystatechange").toBool(), true);
QCOMPARE(object->property("readyState").toBool(), true);
QCOMPARE(object->property("status").toBool(), true);
QCOMPARE(object->property("statusText").toBool(), true);
diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
index 078c9976ed..d12d285d39 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
+++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
@@ -466,9 +466,9 @@ void tst_qsgvisualdatamodel::modelProperties()
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
- QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Result of expression 'model.modelData' [undefined] is not an object.");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
view.setSource(source);
diff --git a/tests/auto/declarative/v8/tst_v8.cpp b/tests/auto/declarative/v8/tst_v8.cpp
new file mode 100644
index 0000000000..740bd8952d
--- /dev/null
+++ b/tests/auto/declarative/v8/tst_v8.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include "../../../../src/3rdparty/v8/include/v8.h"
+
+using namespace v8;
+
+class tst_v8 : public QObject
+{
+ Q_OBJECT
+public:
+ tst_v8() {}
+
+private slots:
+ void initTestCase() {}
+ void cleanupTestCase();
+
+ void eval();
+
+private:
+ Persistent<Context> context;
+};
+
+void tst_v8::eval()
+{
+ HandleScope handle_scope;
+ context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<Object> qmlglobal = Object::New();
+ qmlglobal->Set(String::New("a"), v8::Integer::New(1922));
+
+ Local<Script> script = Script::Compile(String::New("eval(\"a\")"), NULL, NULL,
+ Handle<String>(), Script::QmlMode);
+
+ TryCatch tc;
+ Local<Value> result = script->Run(qmlglobal);
+
+ QVERIFY(!tc.HasCaught());
+ QCOMPARE(result->Int32Value(), 1922);
+}
+
+void tst_v8::cleanupTestCase()
+{
+ context.Dispose();
+ context = Persistent<Context>();
+}
+
+int main(int argc, char *argv[])
+{
+ V8::SetFlagsFromCommandLine(&argc, argv, true);
+
+ QCoreApplication app(argc, argv);
+ tst_v8 tc;
+ return QTest::qExec(&tc, argc, argv);
+}
+
+#include "tst_v8.moc"
diff --git a/tests/auto/declarative/v8/v8.pro b/tests/auto/declarative/v8/v8.pro
new file mode 100644
index 0000000000..0fc27d80b4
--- /dev/null
+++ b/tests/auto/declarative/v8/v8.pro
@@ -0,0 +1,14 @@
+load(qttest_p4)
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_v8.cpp
+
+CONFIG += parallel_test
+
+LIBS += -L../../../../src/v8/
+macx:CONFIG(debug, debug|release) {
+ LIBS += -lv8_debug
+} else {
+ LIBS += -lv8
+}
+