aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml10
-rw-r--r--tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp76
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp2
-rw-r--r--tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp2
-rw-r--r--tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp2
-rw-r--r--tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp2
-rw-r--r--tests/auto/declarative/debugger/shared/debugutil.cpp2
-rw-r--r--tests/auto/declarative/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/parserstress/tst_parserstress.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml47
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml176
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml15
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml25
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml26
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro32
-rw-r--r--tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp501
-rw-r--r--tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/assert.qml62
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml32
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/exception.qml58
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/logging.qml90
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/profiling.qml51
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/data/tracing.qml56
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp133
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml41
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp153
-rw-r--r--tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/testtypes.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml12
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml12
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml15
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml13
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml13
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml15
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml19
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.errors.txt (renamed from tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt)0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.qml (renamed from tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml)0
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp126
-rw-r--r--tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp224
-rw-r--r--tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/console.qml36
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp37
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp2
-rw-r--r--tests/auto/declarative/qjsengine/tst_qjsengine.cpp484
-rw-r--r--tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp433
-rw-r--r--tests/auto/declarative/qjsvalue/tst_qjsvalue.h14
-rw-r--r--tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp16
-rw-r--r--tests/auto/declarative/qmlmin/tst_qmlmin.cpp3
-rw-r--r--tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp2
-rwxr-xr-xtests/auto/declarative/runall.sh2
-rw-r--r--tests/auto/declarative/v4/testtypes.cpp2
-rw-r--r--tests/auto/declarative/v4/testtypes.h2
-rw-r--r--tests/auto/declarative/v4/tst_v4.cpp2
147 files changed, 1812 insertions, 1530 deletions
diff --git a/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml b/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml
index 7377d4584c..4a61f3291a 100644
--- a/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml
+++ b/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -44,8 +44,8 @@ import QtQuick 2.0
Item {
width: 360
height: 360
- Timer {
- interval: 100; running: true; repeat: true
- onTriggered: console.log("Timer")
+ Component.onCompleted: {
+ console.log("console.log")
+ console.count("console.count");
}
}
diff --git a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index 62f89e9540..15fd0c597d 100644
--- a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -48,7 +48,7 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
-const char *NORMALMODE = "-qmljsdebugger=port:3777";
+const char *NORMALMODE = "-qmljsdebugger=port:3777,block";
const char *QMLFILE = "test.qml";
class QDeclarativeDebugMsgClient;
@@ -59,14 +59,16 @@ class tst_QDebugMessageService : public QDeclarativeDataTest
public:
tst_QDebugMessageService();
+ void init(bool extendedOutput);
+
private slots:
void initTestCase();
void cleanupTestCase();
- void init();
void cleanup();
void retrieveDebugOutput();
+ void retrieveDebugOutputExtended();
private:
QDeclarativeDebugProcess *m_process;
@@ -74,6 +76,16 @@ private:
QDeclarativeDebugConnection *m_connection;
};
+struct LogEntry {
+ LogEntry(QtMsgType _type, QString _message)
+ : type(_type), message(_message) {}
+
+ QtMsgType type;
+ QString message;
+
+ QString toString() const { return QString::number(type) + ": " + message; }
+};
+
class QDeclarativeDebugMsgClient : public QDeclarativeDebugClient
{
Q_OBJECT
@@ -83,6 +95,8 @@ public:
{
}
+ QList<LogEntry> logBuffer;
+
protected:
//inherited from QDeclarativeDebugClient
void statusChanged(Status status);
@@ -91,9 +105,6 @@ protected:
signals:
void enabled();
void debugOutput();
-
-public:
- QByteArray debugMessage;
};
void QDeclarativeDebugMsgClient::statusChanged(Status status)
@@ -111,8 +122,17 @@ void QDeclarativeDebugMsgClient::messageReceived(const QByteArray &data)
if (command == "MESSAGE") {
int type;
- ds >> type >> debugMessage;
+ QByteArray message;
+ ds >> type >> message;
+ QVERIFY(ds.atEnd());
+
+ QVERIFY(type >= QtDebugMsg);
+ QVERIFY(type <= QtFatalMsg);
+
+ logBuffer << LogEntry((QtMsgType)type, QString::fromUtf8(message));
emit debugOutput();
+ } else {
+ QFAIL("Unknown message");
}
}
@@ -140,12 +160,14 @@ void tst_QDebugMessageService::cleanupTestCase()
delete m_connection;
}
-void tst_QDebugMessageService::init()
+void tst_QDebugMessageService::init(bool extendedOutput)
{
m_connection = new QDeclarativeDebugConnection();
m_process = new QDeclarativeDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene");
m_client = new QDeclarativeDebugMsgClient(m_connection);
+ if (extendedOutput)
+ m_process->setEnvironment(QProcess::systemEnvironment() << "QML_CONSOLE_EXTENDED=1");
m_process->start(QStringList() << QLatin1String(NORMALMODE) << QDeclarativeDataTest::instance()->testFile(QMLFILE));
if (!m_process->waitForSessionStart()) {
QFAIL(QString("Could not launch app. Application output: \n%1").arg(m_process->output()).toAscii());
@@ -177,8 +199,42 @@ void tst_QDebugMessageService::cleanup()
void tst_QDebugMessageService::retrieveDebugOutput()
{
- if (m_client->debugMessage.isEmpty())
+ init(false);
+
+ int maxTries = 2;
+ while ((m_client->logBuffer.size() < 2)
+ && (maxTries-- > 0))
QVERIFY(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(debugOutput())));
+
+ QCOMPARE(m_client->logBuffer.size(), 2);
+
+ QCOMPARE(m_client->logBuffer.at(0).toString(),
+ LogEntry(QtDebugMsg, QLatin1String("console.log")).toString());
+ QCOMPARE(m_client->logBuffer.at(1).toString(),
+ LogEntry(QtDebugMsg, QLatin1String("console.count: 1")).toString());
+}
+
+void tst_QDebugMessageService::retrieveDebugOutputExtended()
+{
+ init(true);
+
+ int maxTries = 2;
+ while ((m_client->logBuffer.size() < 2)
+ && (maxTries-- > 0))
+ QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(debugOutput()));
+
+ QCOMPARE(m_client->logBuffer.size(), 2);
+
+ const QString path =
+ QUrl::fromLocalFile(QDeclarativeDataTest::instance()->testFile(QMLFILE)).toString();
+
+ QString logMsg = QString::fromLatin1("console.log (%1:%2)").arg(path).arg(48);
+ QString countMsg = QString::fromLatin1("console.count: 1 (%1:%2)").arg(path).arg(49);
+
+ QCOMPARE(m_client->logBuffer.at(0).toString(),
+ LogEntry(QtDebugMsg, logMsg).toString());
+ QCOMPARE(m_client->logBuffer.at(1).toString(),
+ LogEntry(QtDebugMsg, countMsg).toString());
}
QTEST_MAIN(tst_QDebugMessageService)
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
index 60411c8616..d8e25c4b91 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml
index 2e2ceb75d9..13ed4b3101 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml
index e86519afb4..33ab40e0b0 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml
index eb0e54ff2b..2d96bfe800 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml
index af95caba30..7ef751ccdf 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml
index b523d6e1d0..5f8f007d86 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml
index a1b44ee76d..dff3951b3a 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml
index 5497e38642..d386fc8cad 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml
index 6c95e47f73..fa67cfb46f 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js
index 88437a39da..1ba4f18405 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
index 9e0caa2634..150a3311c3 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml
index 7c07101fa2..da48b86088 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index 4f1398cc52..192b475de6 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
index 590cdcf14c..9f31de56e5 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
index 108814da8d..dece1f52d0 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp b/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp
index e861d830ae..83c092b8b0 100644
--- a/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp b/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp
index 03f5a284d5..e13838cf8a 100644
--- a/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp b/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp
index f650d51c8f..155faab050 100644
--- a/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
index 0cc66bcf8e..f2fcb9fb89 100644
--- a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index d4bea2fa89..80a8d0ce5a 100644
--- a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/shared/debugutil.cpp b/tests/auto/declarative/debugger/shared/debugutil.cpp
index e986928fa1..de04c336bb 100644
--- a/tests/auto/declarative/debugger/shared/debugutil.cpp
+++ b/tests/auto/declarative/debugger/shared/debugutil.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/debugger/shared/debugutil_p.h b/tests/auto/declarative/debugger/shared/debugutil_p.h
index 0884b32a07..359c088dbf 100644
--- a/tests/auto/declarative/debugger/shared/debugutil_p.h
+++ b/tests/auto/declarative/debugger/shared/debugutil_p.h
@@ -3,7 +3,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 6e940bd684..7288da27ba 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -28,7 +28,6 @@ PUBLICTESTS += \
PRIVATETESTS += \
animation \
- qdeclarativeaccessibility \
qdeclarativebinding \
qdeclarativechangeset \
qdeclarativeconnection \
diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp
index ed87881698..37ef8880cc 100644
--- a/tests/auto/declarative/parserstress/tst_parserstress.cpp
+++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml b/tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml
deleted file mode 100644
index 22cdad1377..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 400
-
- // button, not checkable
- Rectangle {
- y: 20
- width: 100; height: 20
- Accessible.role : Accessible.Button
- }
-
- // button, checkable, not checked
- Rectangle {
- y: 40
- width: 100; height: 20
- Accessible.role : Accessible.Button
- property bool checkable: true
- property bool checked: false
- }
-
- // button, checkable, checked
- Rectangle {
- y: 60
- width: 100; height: 20
- Accessible.role : Accessible.Button
- property bool checkable: true
- property bool checked: true
- }
-
- // check box, checked
- Rectangle {
- y: 80
- width: 100; height: 20
- Accessible.role : Accessible.CheckBox
- property bool checked: true
- }
- // check box, not checked
- Rectangle {
- y: 100
- width: 100; height: 20
- Accessible.role : Accessible.CheckBox
- property bool checked: false
- }
-}
-
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml b/tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml
deleted file mode 100644
index 52b652e233..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** 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 QtDeclarative module 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$
-**
-****************************************************************************/
-
-
-import QtQuick 2.0
-import "widgets"
-
-Rectangle {
- id: page
- width: 640
- height: 480
- color: "white"
- Rectangle {
- id: header
- color: "#c0c0c0"
- height: usage.height + chkClip.height
- anchors.left: parent.left
- anchors.right: parent.right
- Text {
- id: usage
- text: "Use an a11y inspect tool to see if all visible rectangles can be found with hit testing."
- }
- Rectangle {
- id: chkClip
- property bool checked: true
-
- color: (checked ? "#f0f0f0" : "#c0c0c0")
- height: label.height
- width: label.width
- anchors.left: parent.left
- anchors.bottom: parent.bottom
-
- MouseArea {
- anchors.fill: parent
- onClicked: chkClip.checked = !chkClip.checked
- }
- Text {
- id: label
- text: "Click here to toggle clipping"
- }
- }
- }
- TextRect {
- clip: chkClip.checked
- z: 2
- id: rect1
- text: "rect1"
- width: 100
- height: 100
- color: "#ffc0c0"
- anchors.top: header.bottom
- TextRect {
- id: rect10
- text: "rect10"
- width: 100
- height: 100
- x: 50
- y: 50
- color: "#ffa0a0"
- TextRect {
- id: rect100
- text: "rect100"
- width: 100
- height: 100
- x: 80
- y: 80
- color: "#ff8080"
- }
- TextRect {
- id: rect101
- text: "rect101"
- x: 100
- y: 70
- z: 3
- width: 100
- height: 100
- color: "#e06060"
- }
- TextRect {
- id: rect102
- text: "rect102"
- width: 100
- height: 100
- x: 150
- y: 60
- color: "#c04040"
- }
- }
- }
-
- TextRect {
- x: 0
- y: 50
- id: rect2
- text: "rect2"
- width: 100
- height: 100
- color: "#c0c0ff"
- TextRect {
- id: rect20
- text: "rect20"
- width: 100
- height: 100
- x: 50
- y: 50
- color: "#a0a0ff"
- TextRect {
- id: rect200
- text: "rect200"
- width: 100
- height: 100
- x: 80
- y: 80
- color: "#8080ff"
- }
- TextRect {
- id: rect201
- text: "rect201"
- x: 100
- y: 70
- z: 100
- width: 100
- height: 100
- color: "#6060e0"
- }
- TextRect {
- id: rect202
- text: "rect202"
- width: 100
- height: 100
- x: 150
- y: 60
- color: "#4040c0"
- }
- }
- }
-
-}
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml b/tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml
deleted file mode 100644
index df19231703..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- Accessible.role : Accessible.Button
- property string text : "test"
-
- Text {
- anchors.fill : parent
- text : parent.text
- }
-
- MouseArea {
- anchors.fill : parent
- }
-}
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml b/tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml
deleted file mode 100644
index a0821cfc4d..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml
+++ /dev/null
@@ -1,25 +0,0 @@
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 400
-
- Text {
- x: 100
- y: 20
- width: 200
- height: 50
- text : "Hello Accessibility"
- }
-
- Text {
- x: 100
- y: 40
- width: 100
- height: 40
- text : "Hello 2"
- Accessible.role: Accessible.StaticText
- Accessible.name: "The Hello 2 accessible text"
- Accessible.description: "A text description"
- }
-}
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml b/tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml
deleted file mode 100644
index 937686974b..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml
+++ /dev/null
@@ -1,26 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- id: button
-
- property alias text : buttonText.text
- Accessible.name: text
- Accessible.description: "This button does " + text
- Accessible.role: Accessible.Client
-
- signal clicked
-
- width: 40
- height: 40
- border.width: 2
- border.color: "black";
-
- Text {
- id: buttonText
- text: "TextRect"
- anchors.centerIn: parent
- font.pixelSize: parent.height * .1
- style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
- }
-
-}
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro b/tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro
deleted file mode 100644
index ee93c10da2..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-CONFIG += testcase
-
-TARGET = tst_qdeclarativeaccessibility
-QT += declarative-private network qtquick1-private testlib
-macx:CONFIG -= app_bundle
-
-SOURCES += tst_qdeclarativeaccessibility.cpp
-
-include (../../shared/util.pri)
-
-OTHER_FILES += data/pushbutton.qml
-OTHER_FILES += data/statictext.qml
-
-symbian: {
- importFiles.files = data
- importFiles.path = .
- DEPLOYMENT += importFiles
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
-}
-
-CONFIG += parallel_test
-
-wince*: {
- accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
- accessneeded.path = accessible
- DEPLOYMENT += accessneeded
-}
-
-
-
-
diff --git a/tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp b/tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp
deleted file mode 100644
index 0688edf698..0000000000
--- a/tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp
+++ /dev/null
@@ -1,501 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module 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 <QtTest/QtTest>
-#include "QtTest/qtestaccessible.h"
-
-#include <QtGui/qaccessible.h>
-
-#include <QtQuick1/qdeclarativeview.h>
-#include <QtQuick/qquickview.h>
-#include <QtQuick/qquickitem.h>
-
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativeproperty.h>
-#include <private/qdeclarativeaccessibleattached_p.h>
-
-#include "../../shared/util.h"
-
-
-typedef QSharedPointer<QAccessibleInterface> QAI;
-
-
-static inline bool verifyChild(QWidget *child, QAccessibleInterface *iface,
- int index, const QRect &domain)
-{
- if (!child) {
- qWarning("tst_QAccessibility::verifyChild: null pointer to child.");
- return false;
- }
-
- if (!iface) {
- qWarning("tst_QAccessibility::verifyChild: null pointer to interface.");
- return false;
- }
-
- // Verify that we get a valid QAccessibleInterface for the child.
- QAccessibleInterface *childInterface = QAccessible::queryAccessibleInterface(child);
- if (!childInterface) {
- qWarning("tst_QAccessibility::verifyChild: Failed to retrieve interface for child.");
- return false;
- }
-
- // QAccessibleInterface::indexOfChild():
- // Verify that indexOfChild() returns an index equal to the index passed in
- int indexFromIndexOfChild = iface->indexOfChild(childInterface);
- delete childInterface;
- if (indexFromIndexOfChild != index) {
- qWarning("tst_QAccessibility::verifyChild (indexOfChild()):");
- qWarning() << "Expected:" << index;
- qWarning() << "Actual: " << indexFromIndexOfChild;
- return false;
- }
-
- // Navigate to child, compare its object and role with the interface from queryAccessibleInterface(child).
- QAccessibleInterface *navigatedChildInterface = iface->child(index - 1);
- if (navigatedChildInterface == 0)
- return false;
-
- const QRect rectFromInterface = navigatedChildInterface->rect();
- delete navigatedChildInterface;
-
- // QAccessibleInterface::childAt():
- // Calculate global child position and check that the interface
- // returns the correct index for that position.
- QPoint globalChildPos = child->mapToGlobal(QPoint(0, 0));
- QAccessibleInterface *childAtInterface = iface->childAt(globalChildPos.x(), globalChildPos.y());
- if (!childAtInterface) {
- qWarning("tst_QAccessibility::verifyChild (childAt()):");
- qWarning() << "Expected:" << childInterface;
- qWarning() << "Actual: no child";
- return false;
- }
- if (childAtInterface->object() != childInterface->object()) {
- qWarning("tst_QAccessibility::verifyChild (childAt()):");
- qWarning() << "Expected:" << childInterface;
- qWarning() << "Actual: " << childAtInterface;
- return false;
- }
- delete childInterface;
- delete childAtInterface;
-
- // Verify that the child is within its domain.
- if (!domain.contains(rectFromInterface)) {
- qWarning("tst_QAccessibility::verifyChild: Child is not within its domain.");
- return false;
- }
-
- return true;
-}
-
-static inline int indexOfChild(QAccessibleInterface *parentInterface, QWidget *childWidget)
-{
- if (!parentInterface || !childWidget)
- return -1;
- QAccessibleInterface *childInterface = QAccessible::queryAccessibleInterface(childWidget);
- if (!childInterface)
- return -1;
- int index = parentInterface->indexOfChild(childInterface);
- delete childInterface;
- return index;
-}
-
-#define EXPECT(cond) \
- do { \
- if (!errorAt && !(cond)) { \
- errorAt = __LINE__; \
- qWarning("level: %d, middle: %d, role: %d (%s)", treelevel, middle, iface->role(), #cond); \
- } \
- } while (0)
-
-static int verifyHierarchy(QAccessibleInterface *iface)
-{
- int errorAt = 0;
- static int treelevel = 0; // for error diagnostics
- QAccessibleInterface *middleChild, *if2;
- middleChild = 0;
- ++treelevel;
- int middle = iface->childCount()/2 + 1;
- if (iface->childCount() >= 2) {
- middleChild = iface->child(middle - 1);
- }
- for (int i = 0; i < iface->childCount() && !errorAt; ++i) {
- if2 = iface->child(i);
- EXPECT(if2 != 0);
- // navigate Ancestor...
- QAccessibleInterface *parent = if2->parent();
- EXPECT(iface->object() == parent->object());
- delete parent;
-
- // navigate Sibling...
-// if (middleChild) {
-// entry = if2->navigate(QAccessible::Sibling, middle, &if3);
-// EXPECT(entry == 0 && if3->object() == middleChild->object());
-// if (entry == 0)
-// delete if3;
-// EXPECT(iface->indexOfChild(middleChild) == middle);
-// }
-
- // verify children...
- if (!errorAt)
- errorAt = verifyHierarchy(if2);
- delete if2;
- }
- delete middleChild;
-
- --treelevel;
- return errorAt;
-}
-
-
-//TESTED_FILES=
-
-class tst_QDeclarativeAccessibility : public QDeclarativeDataTest
-{
- Q_OBJECT
-public:
- tst_QDeclarativeAccessibility();
- virtual ~tst_QDeclarativeAccessibility();
-
-private slots:
- void commonTests_data();
- void commonTests();
-
- void declarativeAttachedProperties();
- void basicPropertiesTest();
- void hitTest();
- void checkableTest();
-};
-
-tst_QDeclarativeAccessibility::tst_QDeclarativeAccessibility()
-{
-
-}
-
-tst_QDeclarativeAccessibility::~tst_QDeclarativeAccessibility()
-{
-
-}
-
-void tst_QDeclarativeAccessibility::commonTests_data()
-{
- QTest::addColumn<QString>("accessibleRoleFileName");
-
- QTest::newRow("StaticText") << SRCDIR "/data/statictext.qml";
- QTest::newRow("PushButton") << SRCDIR "/data/pushbutton.qml";
-}
-
-void tst_QDeclarativeAccessibility::commonTests()
-{
- QFETCH(QString, accessibleRoleFileName);
-
- qDebug() << "testing" << accessibleRoleFileName;
-
- QQuickView *view = new QQuickView();
-// view->setFixedSize(240,320);
- view->setSource(QUrl::fromLocalFile(accessibleRoleFileName));
- view->show();
-// view->setFocus();
- QVERIFY(view->rootObject() != 0);
-
- QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view);
- QVERIFY(iface);
-
- delete iface;
- delete view;
-}
-
-
-
-QString eventName(const int ev)
-{
- switch (ev) {
- case 0x0001: return "SoundPlayed";
- case 0x0002: return "Alert";
- case 0x0003: return "ForegroundChanged";
- case 0x0004: return "MenuStart";
- case 0x0005: return "MenuEnd";
- case 0x0006: return "PopupMenuStart";
- case 0x0007: return "PopupMenuEnd";
- case 0x000C: return "ContextHelpStart";
- case 0x000D: return "ContextHelpEnd";
- case 0x000E: return "DragDropStart";
- case 0x000F: return "DragDropEnd";
- case 0x0010: return "DialogStart";
- case 0x0011: return "DialogEnd";
- case 0x0012: return "ScrollingStart";
- case 0x0013: return "ScrollingEnd";
- case 0x0018: return "MenuCommand";
- case 0x8000: return "ObjectCreated";
- case 0x8001: return "ObjectDestroyed";
- case 0x8002: return "ObjectShow";
- case 0x8003: return "ObjectHide";
- case 0x8004: return "ObjectReorder";
- case 0x8005: return "Focus";
- case 0x8006: return "Selection";
- case 0x8007: return "SelectionAdd";
- case 0x8008: return "SelectionRemove";
- case 0x8009: return "SelectionWithin";
- case 0x800A: return "StateChanged";
- case 0x800B: return "LocationChanged";
- case 0x800C: return "NameChanged";
- case 0x800D: return "DescriptionChanged";
- case 0x800E: return "ValueChanged";
- case 0x800F: return "ParentChanged";
- case 0x80A0: return "HelpChanged";
- case 0x80B0: return "DefaultActionChanged";
- case 0x80C0: return "AcceleratorChanged";
- default: return "Unknown Event";
- }
-}
-
-void tst_QDeclarativeAccessibility::declarativeAttachedProperties()
-{
- {
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine);
- component.setData("import QtQuick 1.1\nItem {\n"
- "}", QUrl());
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object);
- QCOMPARE(attachedObject, static_cast<QObject*>(0));
- delete object;
- }
-
- // Attached property
- {
- QObject parent;
- QDeclarativeAccessibleAttached *attachedObj = new QDeclarativeAccessibleAttached(&parent);
-
- attachedObj->name();
-
- QVariant pp = attachedObj->property("name");
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine);
- component.setData("import QtQuick 1.1\nItem {\n"
- "Accessible.role: Accessible.Button\n"
- "}", QUrl());
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object);
- QVERIFY(attachedObject);
- if (attachedObject) {
- QVariant p = attachedObject->property("role");
- QCOMPARE(p.isNull(), false);
- QCOMPARE(p.toInt(), int(QAccessible::PushButton));
- p = attachedObject->property("name");
- QCOMPARE(p.isNull(), true);
- p = attachedObject->property("description");
- QCOMPARE(p.isNull(), true);
- }
- delete object;
- }
-
- // Attached property
- {
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine);
- component.setData("import QtQuick 1.1\nItem {\n"
- "Accessible.role: Accessible.Button\n"
- "Accessible.name: \"Donald\"\n"
- "Accessible.description: \"Duck\"\n"
- "}", QUrl());
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object);
- QVERIFY(attachedObject);
- if (attachedObject) {
- QVariant p = attachedObject->property("role");
- QCOMPARE(p.isNull(), false);
- QCOMPARE(p.toInt(), int(QAccessible::PushButton));
- p = attachedObject->property("name");
- QCOMPARE(p.isNull(), false);
- QCOMPARE(p.toString(), QLatin1String("Donald"));
- p = attachedObject->property("description");
- QCOMPARE(p.isNull(), false);
- QCOMPARE(p.toString(), QLatin1String("Duck"));
- }
- delete object;
- }
-}
-
-
-void tst_QDeclarativeAccessibility::basicPropertiesTest()
-{
- QAI app = QAI(QAccessible::queryAccessibleInterface(qApp));
- QCOMPARE(app->childCount(), 0);
-
- QQuickView *canvas = new QQuickView();
- canvas->setSource(testFileUrl("statictext.qml"));
- canvas->show();
- QCOMPARE(app->childCount(), 1);
-
- QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
- QVERIFY(iface.data());
- QCOMPARE(iface->childCount(), 1);
-
- QAI item = QAI(iface->child(0));
- QVERIFY(item.data());
- QCOMPARE(item->childCount(), 2);
- QCOMPARE(item->rect().size(), QSize(400, 400));
- QCOMPARE(item->role(), QAccessible::Pane);
- QCOMPARE(iface->indexOfChild(item.data()), 0);
-
- QAI text = QAI(item->child(0));
- QVERIFY(text.data());
- QCOMPARE(text->childCount(), 0);
-
- QCOMPARE(text->text(QAccessible::Name), QLatin1String("Hello Accessibility"));
- QCOMPARE(text->rect().size(), QSize(200, 50));
- QCOMPARE(text->rect().x(), item->rect().x() + 100);
- QCOMPARE(text->rect().y(), item->rect().y() + 20);
- QCOMPARE(text->role(), QAccessible::StaticText);
- QCOMPARE(item->indexOfChild(text.data()), 0);
-
- QAI text2 = QAI(item->child(1));
- QVERIFY(text2.data());
- QCOMPARE(text2->childCount(), 0);
-
- QCOMPARE(text2->text(QAccessible::Name), QLatin1String("The Hello 2 accessible text"));
- QCOMPARE(text2->rect().size(), QSize(100, 40));
- QCOMPARE(text2->rect().x(), item->rect().x() + 100);
- QCOMPARE(text2->rect().y(), item->rect().y() + 40);
- QCOMPARE(text2->role(), QAccessible::StaticText);
- QCOMPARE(item->indexOfChild(text2.data()), 1);
-
- QCOMPARE(iface->indexOfChild(text2.data()), -1);
- QCOMPARE(text2->indexOfChild(item.data()), -1);
-
- delete canvas;
-}
-
-QAI topLevelChildAt(QAccessibleInterface *iface, int x, int y)
-{
- QAI child = QAI(iface->childAt(x, y));
- if (!child)
- return QAI();
-
- QAI childOfChild;
- while (childOfChild = QAI(child->childAt(x, y))) {
- child = childOfChild;
- }
- return child;
-}
-
-void tst_QDeclarativeAccessibility::hitTest()
-{
- QQuickView *canvas = new QQuickView;
- canvas->setSource(testFileUrl("hittest.qml"));
- canvas->show();
-
- QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
- QVERIFY(iface.data());
- QAI rootItem = QAI(iface->child(0));
- QRect rootRect = rootItem->rect();
-
- // hit the root item
- QAI itemHit(iface->childAt(rootRect.x() + 200, rootRect.y() + 50));
- QVERIFY(itemHit);
- QCOMPARE(rootRect, itemHit->rect());
-
- // hit rect1
- QAI rect1(rootItem->child(1));
- QRect rect1Rect = rect1->rect();
- itemHit = QAI(rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10));
- QVERIFY(itemHit);
- QCOMPARE(rect1Rect, itemHit->rect());
- QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect1"));
-
- // should also work from top level (app)
- QAI app(QAccessible::queryAccessibleInterface(qApp));
- QAI itemHit2(topLevelChildAt(app.data(), rect1Rect.x() + 10, rect1Rect.y() + 10));
- QVERIFY(itemHit2);
- QCOMPARE(itemHit2->rect(), rect1Rect);
- QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
-
- // hit rect201
- QAI rect2(rootItem->child(2));
- QAI rect20(rect2->child(1));
- QAI rect201(rect20->child(2));
- QVERIFY(rect201);
-
- QRect rect201Rect = rect201->rect();
- itemHit = QAI(iface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20));
- QVERIFY(itemHit);
- QCOMPARE(itemHit->rect(), rect201Rect);
- QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect201"));
-
- delete canvas;
-}
-
-void tst_QDeclarativeAccessibility::checkableTest()
-{
- QQuickView *canvas = new QQuickView();
- canvas->setSource(testFileUrl("checkbuttons.qml"));
- canvas->show();
-
- QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
- QVERIFY(iface.data());
- QAI root = QAI(iface->child(0));
-
- QAI button1 = QAI(root->child(0));
- QCOMPARE(button1->role(), QAccessible::Button);
- QVERIFY(!(button1->state().checked));
- QAI button2 = QAI(root->child(1));
- QVERIFY(!(button2->state().checked));
- QAI button3 = QAI(root->child(2));
- QVERIFY(button3->state().checked);
-
- QAI checkBox1 = QAI(root->child(3));
- QCOMPARE(checkBox1->role(), QAccessible::CheckBox);
- QVERIFY((checkBox1->state().checked));
- QAI checkBox2 = QAI(root->child(4));
- QVERIFY(!(checkBox2->state().checked));
-}
-
-QTEST_MAIN(tst_QDeclarativeAccessibility)
-
-#include "tst_qdeclarativeaccessibility.moc"
diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 637c7d908c..44b7f85af2 100644
--- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
index a102a9dd27..6d8870608b 100644
--- a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
+++ b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index 891d6ab6d4..ddf9254f66 100644
--- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
index 7a25f4414c..e91b035730 100644
--- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
+++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/assert.qml b/tests/auto/declarative/qdeclarativeconsole/data/assert.qml
new file mode 100644
index 0000000000..c623b1a007
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeconsole/data/assert.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ property int q:1
+ function assertFail() {
+ console.assert(0, "This will fail too")
+ }
+
+ Component.onCompleted: {
+ var x = 12;
+ console.assert(x == 12, "This will pass");
+ try {
+ console.assert(x < 12, "This will fail");
+ } catch (e) {
+ console.log(e);
+ }
+ console.assert("x < 12", "This will pass too")
+ assertFail();
+ console.assert(1)
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml b/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml
deleted file mode 100644
index 2692abb82e..0000000000
--- a/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- id: root
- Component.onCompleted: {
- var a = [1, 2]
- var b = {a: "hello", d: 1 }
- var c
- var d = 12
- var e = function() { return 5;}
- var f = true
- var g = {toString: function() { throw new Error('toString'); }}
-
-
- console.log("completed", "ok")
- console.log("completed ok")
- console.debug("completed ok")
- console.warn("completed ok")
- console.error("completed ok")
- console.log(a)
- console.log(b)
- console.log(c)
- console.log(d)
- console.log(e)
- console.log(f)
- console.log(root)
- console.log(g)
- console.log(1, "pong!", new Object)
- console.log(1, ["ping","pong"], new Object, 2)
- console.log(exception) //This has to be at the end
- }
-}
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/exception.qml b/tests/auto/declarative/qdeclarativeconsole/data/exception.qml
new file mode 100644
index 0000000000..d1a32be6bc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeconsole/data/exception.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ function exceptionFail() {
+ console.exception("Exception 2")
+ }
+
+ Component.onCompleted: {
+ try {
+ console.exception("Exception 1")
+ } catch (e) {
+ console.log(e);
+ }
+
+ exceptionFail();
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/logging.qml b/tests/auto/declarative/qdeclarativeconsole/data/logging.qml
new file mode 100644
index 0000000000..05c8be0096
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeconsole/data/logging.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: http://www.qt-project.org/
+**
+** 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$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+
+QtObject {
+ id:root
+
+ function consoleCount() {
+ console.count("console.count", "Ignore additonal argument");
+ console.count();
+ }
+
+ Component.onCompleted: {
+ console.debug("console.debug");
+ console.log("console.log");
+ console.info("console.info");
+ console.warn("console.warn");
+ console.error("console.error");
+
+ consoleCount();
+ consoleCount();
+
+ var a = [1, 2];
+ var b = {a: "hello", d: 1 };
+ var c
+ var d = 12;
+ var e = function() { return 5;};
+ var f = true;
+ var g = {toString: function() { throw new Error('toString'); }};
+
+ console.log(a);
+ console.log(b);
+ console.log(c);
+ console.log(d);
+ console.log(e);
+ console.log(f);
+ console.log(root);
+ console.log(g);
+ console.log(1, "pong!", new Object);
+ console.log(1, ["ping","pong"], new Object, 2);
+
+ try {
+ console.log(exception);
+ } catch (e) {
+ return;
+ }
+
+ throw ("console.log(exception) should have raised an exception");
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml b/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml
new file mode 100644
index 0000000000..10184a7931
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: http://www.qt-project.org/
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: {
+ console.profile("profile1");
+ console.time("timer1");
+ console.timeEnd("timer1");
+ console.profileEnd("profile1");
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml b/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml
new file mode 100644
index 0000000000..152df77384
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: http://www.qt-project.org/
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+// moving lines in here requires fixing tst_qdeclarativeconsole.cpp
+QtObject {
+ id: root
+
+ function tracing()
+ {
+ console.trace();
+ }
+
+ Component.onCompleted: {
+ tracing();
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
index da725dd4e2..34b0f6582f 100644
--- a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
+++ b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -51,51 +51,110 @@ public:
tst_qdeclarativeconsole() {}
private slots:
- void init();
- void consoleLogExtended();
+ void logging();
+ void tracing();
+ void profiling();
+ void assert();
+ void exception();
private:
QDeclarativeEngine engine;
};
-void tst_qdeclarativeconsole::init()
+void tst_qdeclarativeconsole::logging()
{
- qputenv("QML_CONSOLE_EXTENDED", QByteArray("1"));
+ QUrl testUrl = testFileUrl("logging.qml");
+
+ QTest::ignoreMessage(QtDebugMsg, "console.debug");
+ QTest::ignoreMessage(QtDebugMsg, "console.log");
+ QTest::ignoreMessage(QtDebugMsg, "console.info");
+ QTest::ignoreMessage(QtWarningMsg, "console.warn");
+ QTest::ignoreMessage(QtCriticalMsg, "console.error");
+
+ QTest::ignoreMessage(QtDebugMsg, "console.count: 1");
+ QTest::ignoreMessage(QtDebugMsg, ": 1");
+ QTest::ignoreMessage(QtDebugMsg, "console.count: 2");
+ QTest::ignoreMessage(QtDebugMsg, ": 2");
+
+ QTest::ignoreMessage(QtDebugMsg, "[1,2]");
+ QTest::ignoreMessage(QtDebugMsg, "Object");
+ QTest::ignoreMessage(QtDebugMsg, "undefined");
+ QTest::ignoreMessage(QtDebugMsg, "12");
+ QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}");
+ QTest::ignoreMessage(QtDebugMsg, "true");
+ QTest::ignoreMessage(QtDebugMsg, "Object");
+ QTest::ignoreMessage(QtDebugMsg, "Object");
+ QTest::ignoreMessage(QtDebugMsg, "1 pong! Object");
+ QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] Object 2");
+
+ QDeclarativeComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qdeclarativeconsole::tracing()
+{
+ QUrl testUrl = testFileUrl("tracing.qml");
+
+ QString trace1 = QString::fromLatin1("tracing (%1:%2:%3)\n").arg(testUrl.toString()).arg(50).arg(17);
+ QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(9);
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2));
+
+ QDeclarativeComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qdeclarativeconsole::profiling()
+{
+ QUrl testUrl = testFileUrl("profiling.qml");
+
+ // profiling()
+ QTest::ignoreMessage(QtDebugMsg, "Profiling started.");
+ QTest::ignoreMessage(QtDebugMsg, "Profiling ended.");
+
+ QDeclarativeComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qdeclarativeconsole::assert()
+{
+ QUrl testUrl = testFileUrl("assert.qml");
+
+ // assert()
+ QTest::ignoreMessage(QtCriticalMsg, "This will fail");
+ QTest::ignoreMessage(QtCriticalMsg, "This will fail too");
+ QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(17);
+ QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(59).arg(9);
+ QString trace3 = QString::fromLatin1("assertFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(47).arg(17);
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3));
+
+ QDeclarativeComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
}
-void tst_qdeclarativeconsole::consoleLogExtended()
+void tst_qdeclarativeconsole::exception()
{
- int startLineNumber = 15;
- QUrl testUrl = testFileUrl("consoleLog.qml");
- const QString testUrlString = testUrl.toString();
- QString testString = QString(QLatin1String("completed ok (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(testString.arg(startLineNumber++)));
- QTest::ignoreMessage(QtCriticalMsg, qPrintable(testString.arg(startLineNumber++)));
-
- QString testArray = QString(QLatin1String("[1,2] (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testArray.arg(startLineNumber++)));
- QString testObject = QString(QLatin1String("Object (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
- QString testUndefined = QString(QLatin1String("undefined (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testUndefined.arg(startLineNumber++)));
- QString testNumber = QString(QLatin1String("12 (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testNumber.arg(startLineNumber++)));
- QString testFunction = QString(QLatin1String("function () { return 5;} (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testFunction.arg(startLineNumber++)));
- QString testBoolean = QString(QLatin1String("true (%1:%2)")).arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testBoolean.arg(startLineNumber++)));
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
- QString testMix = QString::fromLatin1("1 pong! Object (%1:%2)").arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++)));
- testMix = QString::fromLatin1("1 [ping,pong] Object 2 (%1:%2)").arg(testUrlString);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++)));
-
- QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrlString);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(testException.arg(startLineNumber++)));
+ QUrl testUrl = testFileUrl("exception.qml");
+
+ // exception()
+ QTest::ignoreMessage(QtCriticalMsg, "Exception 1");
+ QTest::ignoreMessage(QtCriticalMsg, "Exception 2");
+ QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(51).arg(21);
+ QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(56).arg(9);
+ QString trace3 = QString::fromLatin1("exceptionFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(46).arg(17);
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3));
QDeclarativeComponent component(&engine, testUrl);
QObject *object = component.create();
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 961fedfae4..ee80c3502d 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp b/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp
index 8f52a49500..3724f90bff 100644
--- a/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp
+++ b/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml
new file mode 100644
index 0000000000..eeb0815f09
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ // single url assignment to url list property
+ MySequenceConversionObject {
+ id: msco1
+ objectName: "msco1"
+ }
+
+ // single url binding to url list property
+ MySequenceConversionObject {
+ id: msco2
+ objectName: "msco2"
+ urlListProperty: "http://qt-project.org/?get%3cDATA%3e";
+ }
+
+ // multiple url assignment to url list property
+ MySequenceConversionObject {
+ id: msco3
+ objectName: "msco3"
+ }
+
+ // multiple url binding to url list property
+ MySequenceConversionObject {
+ id: msco4
+ objectName: "msco4"
+ urlListProperty: [
+ "http://qt-project.org/?get%3cDATA%3e",
+ "http://qt-project.org/?get%3cDATA%3e"
+ ];
+ }
+
+ Component.onCompleted: {
+ msco1.urlListProperty = "http://qt-project.org/?get%3cDATA%3e";
+ msco3.urlListProperty = [
+ "http://qt-project.org/?get%3cDATA%3e",
+ "http://qt-project.org/?get%3cDATA%3e"
+ ];
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml
new file mode 100644
index 0000000000..0e8bdaec96
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool result
+ stringProperty: "http://example.org"
+ urlProperty: stringProperty + "/?get%3cDATA%3e"
+ value: urlProperty == stringProperty + "/?get%3cDATA%3e"
+ result: urlProperty == urlProperty
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
index 5d4f579194..7cfe05eae8 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -127,7 +127,7 @@ static QJSValue readonly_script_api(QDeclarativeEngine *engine, QJSEngine *scrip
// now freeze it so that it's read-only
QJSValue freezeFunction = scriptEngine->evaluate("(function(obj) { return Object.freeze(obj); })");
- v = freezeFunction.call(QJSValue(), (QJSValueList() << v));
+ v = freezeFunction.call(QJSValueList() << v);
return v;
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index e872f02ffa..f76e9d3773 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 5f1f44e278..7ac00b3abe 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -213,6 +213,8 @@ private slots:
void aliasToCompositeElement();
void realToInt();
void urlProperty();
+ void urlPropertyWithEncoding();
+ void urlListPropertyWithEncoding();
void dynamicString();
void include();
void signalHandlers();
@@ -1217,12 +1219,15 @@ void tst_qdeclarativeecmascript::dynamicDestruction()
QMetaObject::invokeMethod(object, "killOther");
QVERIFY(createdQmlObject);
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(createdQmlObject);
for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up
if (createdQmlObject) {
QTest::qWait(100);
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
}
}
QVERIFY(!createdQmlObject);
@@ -1230,8 +1235,8 @@ void tst_qdeclarativeecmascript::dynamicDestruction()
QDeclarativeEngine::setObjectOwnership(object, QDeclarativeEngine::JavaScriptOwnership);
QMetaObject::invokeMethod(object, "killMe");
QVERIFY(object);
- QTest::qWait(0);
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(!object);
}
@@ -1248,7 +1253,8 @@ void tst_qdeclarativeecmascript::dynamicDestruction()
QMetaObject::invokeMethod(o, "destroy");
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
@@ -1763,13 +1769,15 @@ void tst_qdeclarativeecmascript::dynamicCreationOwnership()
QMetaObject::invokeMethod(object, "performGc");
}
if (i % 10 == 0) {
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
}
}
delete object;
}
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, expectedDtorCount);
}
@@ -2610,7 +2618,8 @@ void tst_qdeclarativeecmascript::ownership()
engine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(own.object == 0);
@@ -2628,7 +2637,8 @@ void tst_qdeclarativeecmascript::ownership()
engine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(own.object != 0);
@@ -2683,7 +2693,8 @@ void tst_qdeclarativeecmascript::cppOwnershipReturnValue()
delete object;
}
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(source.value != 0);
}
@@ -2711,7 +2722,8 @@ void tst_qdeclarativeecmascript::ownershipCustomReturnValue()
}
engine.collectGarbage();
- QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(source.value == 0);
}
@@ -3748,7 +3760,8 @@ void tst_qdeclarativeecmascript::propertyVarCpp()
static void gc(QDeclarativeEngine &engine)
{
engine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
}
void tst_qdeclarativeecmascript::propertyVarOwnership()
@@ -3827,7 +3840,8 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QObject *rootObject = object->property("vp").value<QObject*>();
QVERIFY(rootObject != 0);
QObject *childObject = rootObject->findChild<QObject*>("text");
@@ -3837,10 +3851,12 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership()
QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject.
QWeakPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events.
QVERIFY(!qobjectGuard.isNull());
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(!qobjectGuard.isNull());
QMetaObject::invokeMethod(object, "deassignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(qobjectGuard.isNull()); // should have been collected now.
delete object;
}
@@ -3852,7 +3868,8 @@ void tst_qdeclarativeecmascript::propertyVarReparent()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignVarProp");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QObject *rect = object->property("vp").value<QObject*>();
QObject *text = rect->findChild<QObject*>("textOne");
QObject *text2 = rect->findChild<QObject*>("textTwo");
@@ -3873,13 +3890,15 @@ void tst_qdeclarativeecmascript::propertyVarReparent()
// now reparent the "Image" object (currently, it has JS ownership)
image->setParent(text); // shouldn't be collected after deassignVp now, since has a parent.
QMetaObject::invokeMethod(text2, "deassignVp");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QCOMPARE(text->property("textCanary").toInt(), 11);
QCOMPARE(text2->property("textCanary").toInt(), 22);
QVERIFY(!imageGuard.isNull()); // should still be alive.
QCOMPARE(image->property("imageCanary").toInt(), 13); // still able to access var properties
QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(imageGuard.isNull()); // should now have been deleted, due to parent being deleted.
delete object;
}
@@ -3893,7 +3912,8 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignVarProp");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QObject *rect = object->property("vp").value<QObject*>();
QObject *text = rect->findChild<QObject*>("textOne");
QObject *text2 = rect->findChild<QObject*>("textTwo");
@@ -3914,7 +3934,8 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext()
// now reparent the "Image" object (currently, it has JS ownership)
image->setParent(object); // reparented to base object. after deassignVarProp, the ctxt will be invalid.
QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(!imageGuard.isNull()); // should still be alive.
QVERIFY(!image->property("imageCanary").isValid()); // but varProperties won't be available (null context).
delete object;
@@ -3928,17 +3949,20 @@ void tst_qdeclarativeecmascript::propertyVarCircular()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QCOMPARE(object->property("canaryInt"), QVariant(5));
QVariant canaryResourceVariant = object->property("canaryResource");
QVERIFY(canaryResourceVariant.isValid());
QPixmap canaryResourcePixmap = canaryResourceVariant.value<QPixmap>();
canaryResourceVariant = QVariant(); // invalidate it to remove one copy of the pixmap from memory.
QMetaObject::invokeMethod(object, "deassignCanaryResource"); // remove one copy of the pixmap from memory
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(!canaryResourcePixmap.isDetached()); // two copies extant - this and the propertyVar.vp.vp.vp.vp.memoryHog.
QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QCOMPARE(object->property("canaryInt"), QVariant(2));
QCOMPARE(object->property("canaryResource"), QVariant(1));
QVERIFY(canaryResourcePixmap.isDetached()); // now detached, since orig copy was member of qdvmemo which was deleted.
@@ -3953,7 +3977,8 @@ void tst_qdeclarativeecmascript::propertyVarCircular2()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QObject *rootObject = object->property("vp").value<QObject*>();
QVERIFY(rootObject != 0);
QObject *childObject = rootObject->findChild<QObject*>("text");
@@ -3966,7 +3991,8 @@ void tst_qdeclarativeecmascript::propertyVarCircular2()
QCOMPARE(rootObject->property("rectCanary").toInt(), 5);
QCOMPARE(childObject->property("textCanary").toInt(), 10);
QMetaObject::invokeMethod(object, "deassignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(rootObjectTracker.isNull()); // should have been collected
QVERIFY(childObjectTracker.isNull()); // should have been collected
delete object;
@@ -3988,7 +4014,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
// we want to be able to track when the varProperties array of the last metaobject is disposed
QObject *cco5 = object->property("varProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>();
QObject *ico5 = object->property("varProperty").value<QObject*>()->property("inheritanceVarProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>();
@@ -4011,7 +4038,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance()
}
// now we deassign the var prop, which should trigger collection of item subtrees.
QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
// ensure that there are only weak handles to the underlying varProperties array remaining.
gc(engine);
QCOMPARE(propertyVarWeakRefCallbackCount, 2); // should have been called for both, since all refs should be weak.
@@ -4030,7 +4058,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2()
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QObject *rootObject = object->property("vp").value<QObject*>();
QVERIFY(rootObject != 0);
QObject *childObject = rootObject->findChild<QObject*>("text");
@@ -4049,7 +4078,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2()
QCOMPARE(childObject->property("textCanary").toInt(), 10);
}
QMetaObject::invokeMethod(object, "deassignCircular");
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
QVERIFY(propertyVarWeakRefCallbackCount == 1); // should have been collected now.
delete object;
}
@@ -4134,7 +4164,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
QCOMPARE(dtorCount, 0); // second has JS ownership, kept alive by first's reference
delete object;
hrmEngine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 3);
}
@@ -4153,7 +4184,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
QCOMPARE(dtorCount, 2); // both should be cleaned up, since circular references shouldn't keep alive.
delete object;
hrmEngine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 3);
}
@@ -4181,7 +4213,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
QCOMPARE(dtorCount, 0); // due to reference from first to second, second shouldn't be collected.
delete object;
hrmEngine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 3);
}
@@ -4212,7 +4245,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
QCOMPARE(dtorCount, 2); // despite circular references, both will be collected.
delete object;
hrmEngine.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 3);
}
@@ -4250,13 +4284,15 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
second2->setParent(0);
QDeclarativeEngine::setObjectOwnership(second2, QDeclarativeEngine::JavaScriptOwnership);
gc(engine);
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 0); // due to reference from first1 to second2, second2 shouldn't be collected.
delete object1;
delete object2;
hrmEngine1.collectGarbage();
hrmEngine2.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 6);
}
@@ -4303,13 +4339,15 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
QDeclarativeEngine::setObjectOwnership(first2, QDeclarativeEngine::JavaScriptOwnership);
QDeclarativeEngine::setObjectOwnership(second2, QDeclarativeEngine::JavaScriptOwnership);
gc(engine);
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 4); // circular references shouldn't keep them alive.
delete object1;
delete object2;
hrmEngine1.collectGarbage();
hrmEngine2.collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 6);
}
@@ -4361,7 +4399,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
delete object1;
delete object2;
hrmEngine1->collectGarbage();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QCOMPARE(dtorCount, 6);
delete hrmEngine1;
}
@@ -5519,6 +5558,42 @@ void tst_qdeclarativeecmascript::urlProperty()
}
}
+void tst_qdeclarativeecmascript::urlPropertyWithEncoding()
+{
+ {
+ QDeclarativeComponent component(&engine, testFileUrl("urlProperty.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ object->setStringProperty("http://qt-project.org");
+ QUrl encoded;
+ encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode);
+ QCOMPARE(object->urlProperty(), encoded);
+ QCOMPARE(object->value(), 0); // Interpreting URL as string yields canonicalised version
+ QCOMPARE(object->property("result").toBool(), true);
+ }
+}
+
+void tst_qdeclarativeecmascript::urlListPropertyWithEncoding()
+{
+ {
+ QDeclarativeComponent component(&engine, testFileUrl("urlListProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1"));
+ MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2"));
+ MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3"));
+ MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4"));
+ QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0);
+ QUrl encoded;
+ encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode);
+ QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded));
+ QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded));
+ QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << encoded << encoded));
+ QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << encoded << encoded));
+ delete object;
+ }
+}
+
void tst_qdeclarativeecmascript::dynamicString()
{
QDeclarativeComponent component(&engine, testFileUrl("dynamicString.qml"));
diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
index 8de3ee1f1e..1f9a13d444 100644
--- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
+++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
index 7d2754f995..0045d1f7d4 100644
--- a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
+++ b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
index dec8be560c..f56f9d96df 100644
--- a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
+++ b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
index 3c0291d81e..e7406de6a5 100644
--- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index e438885dbf..f968f82e07 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp b/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp
index d9bb9837a8..f5aac96a47 100644
--- a/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeincubator/testtypes.h b/tests/auto/declarative/qdeclarativeincubator/testtypes.h
index ec75b4410c..ba6c2b8d14 100644
--- a/tests/auto/declarative/qdeclarativeincubator/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeincubator/testtypes.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
index 2520b10af8..1d553e9e7e 100644
--- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
+++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -421,7 +421,8 @@ void tst_qdeclarativeincubator::clearDuringCompletion()
QPointer<QObject> srt = SelfRegisteringType::me();
incubator.clear();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(incubator.isNull());
QVERIFY(srt.isNull());
}
@@ -458,7 +459,8 @@ void tst_qdeclarativeincubator::objectDeletionAfterInit()
delete incubator.obj;
incubator.clear();
- QCoreApplication::processEvents(QEventLoop::DeferredDeletion);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
QVERIFY(incubator.isNull());
}
diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
index 2af72996f1..279e9fca29 100644
--- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
+++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -175,7 +175,7 @@ void tst_qdeclarativeinfo::types()
qmlInfo(0) << QByteArray("Qt");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true");
- qmlInfo(0) << QBool(true);
+ qmlInfo(0) << bool(true);
//### do we actually want QUrl to show up in the output?
//### why the extra space at the end?
@@ -212,7 +212,7 @@ void tst_qdeclarativeinfo::chaining()
<< QUrl("http://qt.nokia.com")
<< ref
<< QByteArray("Qt")
- << QBool(true)
+ << bool(true)
<< QString ("Quick");
}
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index c7e8f4e636..6cb836c6d3 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
index 2313499d19..28a340128d 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
@@ -22,7 +22,7 @@ MyTypeObject {
variantProperty: "Hello World!"
vectorProperty: "10,1,2.2"
vector4Property: "10,1,2.2,2.3"
- urlProperty: "main.qml"
+ urlProperty: "main.qml?with%3cencoded%3edata"
objectProperty: MyTypeObject { intProperty: 8 }
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml
new file mode 100644
index 0000000000..eaba98ecd2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml
@@ -0,0 +1,12 @@
+import com.nokia.PureJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml
new file mode 100644
index 0000000000..578ca47ea5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml
@@ -0,0 +1,16 @@
+import com.nokia.PureJsModule 1.0 as PJM
+import com.nokia.PureJsModule 1.0 as AnotherName
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM.FirstAPI.greeting() == "Hello") &&
+ (PJM.FirstAPI.major == 1) &&
+ (PJM.FirstAPI.minor == 0) &&
+ (AnotherName.FirstAPI.greeting() == "Hello") &&
+ (AnotherName.FirstAPI.major == 1) &&
+ (AnotherName.FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml
new file mode 100644
index 0000000000..dd3d65c5dd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml
@@ -0,0 +1,12 @@
+import com.nokia.VersionedOnlyJsModule 9.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((SomeAPI.greeting() == "Hey hey hey") &&
+ (SomeAPI.major == 9) &&
+ (SomeAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml
new file mode 100644
index 0000000000..f59d445a56
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml
@@ -0,0 +1,16 @@
+import com.nokia.PureJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0) &&
+ (SecondAPI.greeting() == "Howdy") &&
+ (SecondAPI.major == 1) &&
+ (SecondAPI.minor == 5))
+
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml
new file mode 100644
index 0000000000..e7b74bac0a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml
@@ -0,0 +1,15 @@
+import com.nokia.PureJsModule 1.6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Good news, everybody!") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 6) &&
+ (SecondAPI.greeting() == "Howdy") &&
+ (SecondAPI.major == 1) &&
+ (SecondAPI.minor == 5))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt
new file mode 100644
index 0000000000..10dbc80297
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.VersionedOnlyJsModule" is not installed
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml
new file mode 100644
index 0000000000..a9ec20c72b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml
@@ -0,0 +1,6 @@
+import com.nokia.VersionedOnlyJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt
new file mode 100644
index 0000000000..41c99702a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt
@@ -0,0 +1 @@
+2:1:"com.nokia.VersionedOnlyJsModule" is ambiguous.
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml
new file mode 100644
index 0000000000..6c4eb89551
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml
@@ -0,0 +1,13 @@
+import com.nokia.VersionedOnlyJsModule 9.0
+import com.nokia.VersionedOnlyJsModule 9.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((SomeAPI.greeting() == "Hey hey hey") &&
+ (SomeAPI.major == 9) &&
+ (SomeAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt
new file mode 100644
index 0000000000..56bc4c548f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt
@@ -0,0 +1 @@
+2:1:"com.nokia.PureJsModule" is ambiguous.
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml
new file mode 100644
index 0000000000..5523a158bd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml
@@ -0,0 +1,13 @@
+import com.nokia.PureJsModule 1.0
+import com.nokia.PureJsModule 1.6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml
new file mode 100644
index 0000000000..4ddedc31a8
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml
@@ -0,0 +1,15 @@
+import com.nokia.PureJsModule 1.5 as PJM
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM.FirstAPI.greeting() == "Hello") &&
+ (PJM.FirstAPI.major == 1) &&
+ (PJM.FirstAPI.minor == 0) &&
+ (PJM.SecondAPI.greeting() == "Howdy") &&
+ (PJM.SecondAPI.major == 1) &&
+ (PJM.SecondAPI.minor == 5))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml
new file mode 100644
index 0000000000..351164ba41
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml
@@ -0,0 +1,19 @@
+import com.nokia.PureJsModule 1.5 as PJM_1_5
+import com.nokia.PureJsModule 1.6 as PJM_1_6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM_1_5.FirstAPI.greeting() == "Hello") &&
+ (PJM_1_5.FirstAPI.major == 1) &&
+ (PJM_1_5.FirstAPI.minor == 0) &&
+ (PJM_1_5.SecondAPI.greeting() == "Howdy") &&
+ (PJM_1_5.SecondAPI.major == 1) &&
+ (PJM_1_5.SecondAPI.minor == 5) &&
+ (PJM_1_6.FirstAPI.greeting() == "Good news, everybody!") &&
+ (PJM_1_6.FirstAPI.major == 1) &&
+ (PJM_1_6.FirstAPI.minor == 6))
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt
new file mode 100644
index 0000000000..eff7c0e6c4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt
@@ -0,0 +1 @@
+1:1:Expected a qualified name id
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.errors.txt
index 4bcc948e92..4bcc948e92 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.errors.txt
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.qml
index 427827ca89..427827ca89 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.qml
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt
new file mode 100644
index 0000000000..fdce1abf06
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt
@@ -0,0 +1 @@
+3:5:Expected type name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml
new file mode 100644
index 0000000000..65e93ed55d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Foo.foo {
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt
new file mode 100644
index 0000000000..3b90f573a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt
@@ -0,0 +1 @@
+3:1:Bar.Item - Bar is not a namespace
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml
new file mode 100644
index 0000000000..ba4c8ae1f7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Bar.Item {
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt
new file mode 100644
index 0000000000..4bcc948e92
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt
@@ -0,0 +1 @@
+1:1:Expected type name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml
new file mode 100644
index 0000000000..658b72d9f2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml
@@ -0,0 +1,2 @@
+item {
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt
new file mode 100644
index 0000000000..fdce1abf06
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt
@@ -0,0 +1 @@
+3:5:Expected type name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml
new file mode 100644
index 0000000000..9c83238282
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0 as Foo
+
+Foo.item {
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt
new file mode 100644
index 0000000000..208df2b84a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt
@@ -0,0 +1 @@
+5:9:Expected type name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml
new file mode 100644
index 0000000000..2f7027081e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0 as Foo
+
+Foo.Item {
+
+ Foo.item {
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt
new file mode 100644
index 0000000000..3b90f573a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt
@@ -0,0 +1 @@
+3:1:Bar.Item - Bar is not a namespace
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml
new file mode 100644
index 0000000000..ba4c8ae1f7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Bar.Item {
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js
new file mode 100644
index 0000000000..c7b3c8b6ca
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 6
+
+function greeting() { return "Good news, everybody!" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js
new file mode 100644
index 0000000000..b802477cb6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 5
+
+function greeting() { return "Howdy" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir
new file mode 100644
index 0000000000..083afb051c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir
@@ -0,0 +1,3 @@
+FirstAPI 1.0 FirstAPI.js
+FirstAPI 1.6 FirstAPI.1.6.js
+SecondAPI 1.5 SecondAPI.js
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js
new file mode 100644
index 0000000000..b802477cb6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 5
+
+function greeting() { return "Howdy" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir
new file mode 100644
index 0000000000..5c3acebd39
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir
@@ -0,0 +1,2 @@
+FirstAPI 1.0 FirstAPI.js
+SecondAPI 1.5 SecondAPI.js
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js
new file mode 100644
index 0000000000..efac613fc2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js
@@ -0,0 +1,5 @@
+var major = 9
+var minor = 0
+
+function greeting() { return "Hey hey hey" }
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir
new file mode 100644
index 0000000000..5c1b182028
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir
@@ -0,0 +1 @@
+SomeAPI 9.0 SomeAPI.js
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
index 78c49f97a6..7b25784041 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index ccbd32930f..b76c0c36aa 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index ff5de84a28..ff956ec182 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -159,6 +159,8 @@ private slots:
void importsOrder_data();
void importsOrder();
void importIncorrectCase();
+ void importJs_data();
+ void importJs();
void qmlAttachedPropertiesObjectMethod();
void customOnProperty();
@@ -179,21 +181,17 @@ private:
void testType(const QString& qml, const QString& type, const QString& error);
};
-#define VERIFY_ERRORS(errorfile) \
- if (!errorfile) { \
- if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \
- qWarning() << "Unexpected Errors:" << component.errors(); \
- QVERIFY(!component.isError()); \
- QVERIFY(component.errors().isEmpty()); \
- } else { \
+#define DETERMINE_ERRORS(errorfile,expected,actual)\
+ QList<QByteArray> expected; \
+ QList<QByteArray> actual; \
+ do { \
QFile file(testdata(QLatin1String(errorfile))); \
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
file.close(); \
- QList<QByteArray> expected = data.split('\n'); \
+ expected = data.split('\n'); \
expected.removeAll(QByteArray("")); \
QList<QDeclarativeError> errors = component.errors(); \
- QList<QByteArray> actual; \
for (int ii = 0; ii < errors.count(); ++ii) { \
const QDeclarativeError &error = errors.at(ii); \
QByteArray errorStr = QByteArray::number(error.line()) + ":" + \
@@ -201,6 +199,16 @@ private:
error.description().toUtf8(); \
actual << errorStr; \
} \
+ } while (false);
+
+#define VERIFY_ERRORS(errorfile) \
+ if (!errorfile) { \
+ if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \
+ qWarning() << "Unexpected Errors:" << component.errors(); \
+ QVERIFY(!component.isError()); \
+ QVERIFY(component.errors().isEmpty()); \
+ } else { \
+ DETERMINE_ERRORS(errorfile,actual,expected);\
if (qgetenv("DEBUG") != "" && expected != actual) \
qWarning() << "Expected:" << expected << "Actual:" << actual; \
if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
@@ -417,7 +425,6 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false;
QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false;
QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false;
- QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false;
QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false;
QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false;
QTest::newRow("enumTypes") << "enumTypes.qml" << "enumTypes.errors.txt" << false;
@@ -442,6 +449,16 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false;
QTest::newRow("metaobjectRevision.3") << "metaobjectRevision.3.qml" << "metaobjectRevision.3.errors.txt" << false;
+ QTest::newRow("invalidRoot.1") << "invalidRoot.1.qml" << "invalidRoot.1.errors.txt" << false;
+ QTest::newRow("invalidRoot.2") << "invalidRoot.2.qml" << "invalidRoot.2.errors.txt" << false;
+ QTest::newRow("invalidRoot.3") << "invalidRoot.3.qml" << "invalidRoot.3.errors.txt" << false;
+ QTest::newRow("invalidRoot.4") << "invalidRoot.4.qml" << "invalidRoot.4.errors.txt" << false;
+
+ QTest::newRow("invalidTypeName.1") << "invalidTypeName.1.qml" << "invalidTypeName.1.errors.txt" << false;
+ QTest::newRow("invalidTypeName.2") << "invalidTypeName.2.qml" << "invalidTypeName.2.errors.txt" << false;
+ QTest::newRow("invalidTypeName.3") << "invalidTypeName.3.qml" << "invalidTypeName.3.errors.txt" << false;
+ QTest::newRow("invalidTypeName.4") << "invalidTypeName.4.qml" << "invalidTypeName.4.errors.txt" << false;
+
QTest::newRow("Major version isolation") << "majorVersionIsolation.qml" << "majorVersionIsolation.errors.txt" << false;
}
@@ -571,7 +588,9 @@ void tst_qdeclarativelanguage::assignBasicTypes()
QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3));
- QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
+ QUrl encoded;
+ encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode);
+ QCOMPARE(object->urlProperty(), component.url().resolved(encoded));
QVERIFY(object->objectProperty() != 0);
MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty());
QVERIFY(child != 0);
@@ -1912,6 +1931,89 @@ void tst_qdeclarativelanguage::importIncorrectCase()
QCOMPARE(errors.at(0).description(), expectedError);
}
+void tst_qdeclarativelanguage::importJs_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+ QTest::addColumn<bool>("performTest");
+
+ QTest::newRow("defaultVersion")
+ << "importJs.1.qml"
+ << "importJs.1.errors.txt"
+ << true;
+
+ QTest::newRow("specifiedVersion")
+ << "importJs.2.qml"
+ << "importJs.2.errors.txt"
+ << true;
+
+ QTest::newRow("excludeExcessiveVersion")
+ << "importJs.3.qml"
+ << "importJs.3.errors.txt"
+ << false;
+
+ QTest::newRow("includeAppropriateVersion")
+ << "importJs.4.qml"
+ << "importJs.4.errors.txt"
+ << true;
+
+ QTest::newRow("noDefaultVersion")
+ << "importJs.5.qml"
+ << "importJs.5.errors.txt"
+ << false;
+
+ QTest::newRow("repeatImportFails")
+ << "importJs.6.qml"
+ << "importJs.6.errors.txt"
+ << false;
+
+ QTest::newRow("multipleVersionImportFails")
+ << "importJs.7.qml"
+ << "importJs.7.errors.txt"
+ << false;
+
+ QTest::newRow("namespacedImport")
+ << "importJs.8.qml"
+ << "importJs.8.errors.txt"
+ << true;
+
+ QTest::newRow("namespacedVersionedImport")
+ << "importJs.9.qml"
+ << "importJs.9.errors.txt"
+ << true;
+
+ QTest::newRow("namespacedRepeatImport")
+ << "importJs.10.qml"
+ << "importJs.10.errors.txt"
+ << true;
+}
+
+void tst_qdeclarativelanguage::importJs()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, performTest);
+
+ QDeclarativeComponent component(&engine, TEST_FILE(file));
+
+ {
+ DETERMINE_ERRORS(errorFile.toLatin1().constData(),expected,actual);
+ QCOMPARE(expected.size(), actual.size());
+ for (int i = 0; i < expected.size(); ++i)
+ {
+ size_t compareLen = std::min(expected.at(i).length(), actual.at(i).length());
+ QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen));
+ }
+ }
+
+ if (performTest) {
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toBool(),true);
+ delete object;
+ }
+}
+
void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod()
{
QObject object;
diff --git a/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp b/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp
index 508648a136..6a9c7872c8 100644
--- a/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp
+++ b/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 90ffec2432..cfae97aa4d 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
index 407b9794b6..186dd9f11a 100644
--- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
+++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
index 254bbb74c8..cf29d56abd 100644
--- a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
+++ b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
index 85d4c51208..b4daebd63b 100644
--- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
+++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp
index 4774c32995..95ca4f2165 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp
index 271c59e5ca..68ac9dcfbf 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
index f023963b55..94f905282d 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
index 2da3c82cac..0fa78c0a90 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
index 427bf64895..382209aaf1 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp
index 1b5a9d8569..4b8cb6a4a0 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp
index 8397dbf399..a405049446 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index b52d2d0f1c..d1dcfcba26 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp b/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp
index 173a5008d4..211d678156 100644
--- a/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp
+++ b/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml b/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml
new file mode 100644
index 0000000000..a9e51c1255
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ Component.onCompleted: { o.variantMap = {}; }
+}
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index bf927a74fc..a4d6b09083 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -41,6 +41,7 @@
#include <qtest.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qdeclarativeproperty.h>
#include <QtDeclarative/private/qdeclarativeproperty_p.h>
#include <private/qdeclarativebinding_p.h>
@@ -49,6 +50,7 @@
#include <QtCore/qdir.h>
#include "../../shared/util.h"
+#include <QDebug>
class MyQmlObject : public QObject
{
Q_OBJECT
@@ -120,10 +122,17 @@ private slots:
//writeToReadOnly();
+ void urlHandling_data();
+ void urlHandling();
+
+ void variantMapHandling_data();
+ void variantMapHandling();
+
// Bugs
void crashOnValueProperty();
void aliasPropertyBindings();
void noContext();
+ void assignEmptyVariantMap();
void copy();
private:
@@ -184,6 +193,7 @@ class PropertyObject : public QObject
Q_PROPERTY(QRect rectProperty READ rectProperty)
Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty)
Q_PROPERTY(QUrl url READ url WRITE setUrl)
+ Q_PROPERTY(QVariantMap variantMap READ variantMap WRITE setVariantMap)
Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject)
@@ -201,6 +211,9 @@ public:
QUrl url() { return m_url; }
void setUrl(const QUrl &u) { m_url = u; }
+ QVariantMap variantMap() const { return m_variantMap; }
+ void setVariantMap(const QVariantMap &variantMap) { m_variantMap = variantMap; }
+
int resettableProperty() const { return m_resetProperty; }
void setResettableProperty(int r) { m_resetProperty = r; }
void resetProperty() { m_resetProperty = 9; }
@@ -209,6 +222,7 @@ public:
void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); }
MyQmlObject *qmlObject() { return &m_qmlObject; }
+
signals:
void clicked();
void oddlyNamedNotifySignal();
@@ -217,6 +231,7 @@ private:
int m_resetProperty;
QRect m_rect;
QUrl m_url;
+ QVariantMap m_variantMap;
int m_propertyWithNotify;
MyQmlObject m_qmlObject;
};
@@ -1192,6 +1207,32 @@ void tst_qdeclarativeproperty::write()
QCOMPARE(o.url(), result);
}
+ // VariantMap-property
+ QVariantMap vm;
+ vm.insert("key", "value");
+
+ {
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "variantMap");
+
+ QCOMPARE(p.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+
+ QDeclarativeProperty p2(&o, "variantMap", engine.rootContext());
+
+ QCOMPARE(p2.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+ }
+ { // static
+ PropertyObject o;
+
+ QCOMPARE(QDeclarativeProperty::write(&o, "variantMap", vm), true);
+ QCOMPARE(o.variantMap(), vm);
+
+ QCOMPARE(QDeclarativeProperty::write(&o, "variantMap", vm, engine.rootContext()), true);
+ QCOMPARE(o.variantMap(), vm);
+ }
+
// Attached property
{
QDeclarativeComponent component(&engine);
@@ -1315,7 +1356,6 @@ void tst_qdeclarativeproperty::writeObjectToList()
QCOMPARE(list.at(0), qobject_cast<QObject*>(object));
}
-Q_DECLARE_METATYPE(QList<QObject *>);
void tst_qdeclarativeproperty::writeListToList()
{
QDeclarativeComponent containerComponent(&engine);
@@ -1338,6 +1378,163 @@ void tst_qdeclarativeproperty::writeListToList()
QCOMPARE(container->children()->size(), 1);*/
}
+void tst_qdeclarativeproperty::urlHandling_data()
+{
+ QTest::addColumn<QByteArray>("input");
+ QTest::addColumn<QString>("scheme");
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<QByteArray>("encoded");
+
+ QTest::newRow("unspecifiedFile")
+ << QByteArray("main.qml")
+ << QString("")
+ << QString("main.qml")
+ << QByteArray("main.qml");
+
+ QTest::newRow("specifiedFile")
+ << QByteArray("file:///main.qml")
+ << QString("file")
+ << QString("/main.qml")
+ << QByteArray("file:///main.qml");
+
+ QTest::newRow("httpFile")
+ << QByteArray("http://www.example.com/main.qml")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml");
+
+ QTest::newRow("pathFile")
+ << QByteArray("http://www.example.com/resources/main.qml")
+ << QString("http")
+ << QString("/resources/main.qml")
+ << QByteArray("http://www.example.com/resources/main.qml");
+
+ QTest::newRow("encodableName")
+ << QByteArray("http://www.example.com/main file.qml")
+ << QString("http")
+ << QString("/main file.qml")
+ << QByteArray("http://www.example.com/main%20file.qml");
+
+ QTest::newRow("preencodedName")
+ << QByteArray("http://www.example.com/resources%7cmain%20file.qml")
+ << QString("http")
+ << QString("/resources|main file.qml")
+ << QByteArray("http://www.example.com/resources%7cmain%20file.qml");
+
+ QTest::newRow("encodableQuery")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now working?")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working?");
+
+ QTest::newRow("preencodedQuery")
+ << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now working%3f")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now%20working%3f");
+
+ QTest::newRow("encodableFragment")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000|volume+50%")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume+50%25");
+
+ QTest::newRow("preencodedFragment")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%25");
+}
+
+void tst_qdeclarativeproperty::urlHandling()
+{
+ QFETCH(QByteArray, input);
+ QFETCH(QString, scheme);
+ QFETCH(QString, path);
+ QFETCH(QByteArray, encoded);
+
+ QString inputString(QString::fromUtf8(input));
+
+ {
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "url");
+
+ // Test url written as QByteArray
+ QCOMPARE(p.write(input), true);
+ QUrl byteArrayResult(o.url());
+
+ QCOMPARE(byteArrayResult.scheme(), scheme);
+ QCOMPARE(byteArrayResult.path(), path);
+ QCOMPARE(byteArrayResult.toEncoded(), encoded);
+ }
+
+ {
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "url");
+
+ // Test url written as QString
+ QCOMPARE(p.write(inputString), true);
+ QUrl stringResult(o.url());
+
+ QCOMPARE(stringResult.scheme(), scheme);
+ QCOMPARE(stringResult.path(), path);
+ QCOMPARE(stringResult.toEncoded(), encoded);
+ }
+}
+
+void tst_qdeclarativeproperty::variantMapHandling_data()
+{
+ QTest::addColumn<QVariantMap>("vm");
+
+ // Object literals
+ {
+ QVariantMap m;
+ QTest::newRow("{}") << m;
+ }
+ {
+ QVariantMap m;
+ m["a"] = QVariantMap();
+ QTest::newRow("{ a:{} }") << m;
+ }
+ {
+ QVariantMap m, m2;
+ m2["b"] = 10;
+ m2["c"] = 20;
+ m["a"] = m2;
+ QTest::newRow("{ a:{b:10, c:20} }") << m;
+ }
+ {
+ QVariantMap m;
+ m["a"] = 10;
+ m["b"] = QVariantList() << 20 << 30;
+ QTest::newRow("{ a:10, b:[20, 30]}") << m;
+ }
+
+ // Cyclic objects
+ {
+ QVariantMap m;
+ m["p"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=o") << m;
+ }
+ {
+ QVariantMap m;
+ m["p"] = 123;
+ m["q"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=123; o.q=o") << m;
+ }
+}
+
+void tst_qdeclarativeproperty::variantMapHandling()
+{
+ QFETCH(QVariantMap, vm);
+
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "variantMap");
+
+ QCOMPARE(p.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+}
+
void tst_qdeclarativeproperty::crashOnValueProperty()
{
QDeclarativeEngine *engine = new QDeclarativeEngine;
@@ -1488,6 +1685,29 @@ void tst_qdeclarativeproperty::noContext()
delete b;
}
+void tst_qdeclarativeproperty::assignEmptyVariantMap()
+{
+ PropertyObject o;
+
+ QVariantMap map;
+ map.insert("key", "value");
+ o.setVariantMap(map);
+ QCOMPARE(o.variantMap().count(), 1);
+ QCOMPARE(o.variantMap().isEmpty(), false);
+
+ QDeclarativeContext context(&engine);
+ context.setContextProperty("o", &o);
+
+ QDeclarativeComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml"));
+ QObject *obj = component.create(&context);
+ QVERIFY(obj);
+
+ QCOMPARE(o.variantMap().count(), 0);
+ QCOMPARE(o.variantMap().isEmpty(), true);
+
+ delete obj;
+}
+
void tst_qdeclarativeproperty::initTestCase()
{
QDeclarativeDataTest::initTestCase();
diff --git a/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp b/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp
index 01bad382a3..11867191c9 100644
--- a/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp
+++ b/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
index a0c903c93f..0946538ca5 100644
--- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
+++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeqt/data/console.qml b/tests/auto/declarative/qdeclarativeqt/data/console.qml
deleted file mode 100644
index 634239c31f..0000000000
--- a/tests/auto/declarative/qdeclarativeqt/data/console.qml
+++ /dev/null
@@ -1,36 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- id: root
- Component.onCompleted: {
- var a = [1, 2]
- var b = {a: "hello", d: 1 }
- var c
- var d = 12
- var e = function() { return 5;}
- var f = true
- var g = {toString: function() { throw new Error('toString'); }}
-
- console.profile("profile1")
- console.time("timer1")
- console.log("completed", "ok")
- console.log("completed ok")
- console.debug("completed ok")
- console.warn("completed ok")
- console.error("completed ok")
- console.log(a)
- console.log(b)
- console.log(c)
- console.log(d)
- console.log(e)
- console.log(f)
- console.log(root)
- console.log(g)
- console.log(1, "pong!", new Object)
- console.log(1, ["ping","pong"], new Object, 2)
- console.trace()
- console.timeEnd("timer1")
- console.profileEnd("profile1")
- console.log(exception) //This has to be at the end
- }
-}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 6a03af503f..18283f0f3c 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -78,7 +78,6 @@ private slots:
void createComponent();
void createComponent_pragmaLibrary();
void createQmlObject();
- void console();
void dateTimeConversion();
void dateTimeFormatting();
void dateTimeFormatting_data();
@@ -453,40 +452,6 @@ void tst_qdeclarativeqt::createQmlObject()
delete object;
}
-void tst_qdeclarativeqt::console()
-{
- QUrl testUrl = testFileUrl("console.qml");
- QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrl.toString()).arg(34);
- QString testTrace = QString(QLatin1String("onCompleted (%1:%2:%3)\n")).arg(testUrl.toString()).arg(31).arg(17);
- QTest::ignoreMessage(QtDebugMsg, qPrintable(testTrace));
- QTest::ignoreMessage(QtDebugMsg, "Profiling started.");
- QTest::ignoreMessage(QtDebugMsg, "Profiling ended.");
- QTest::ignoreMessage(QtDebugMsg, "completed ok");
- QTest::ignoreMessage(QtDebugMsg, "completed ok");
- QTest::ignoreMessage(QtDebugMsg, "completed ok");
- QTest::ignoreMessage(QtWarningMsg, "completed ok");
- QTest::ignoreMessage(QtCriticalMsg, "completed ok");
-
- QTest::ignoreMessage(QtDebugMsg, "[1,2]");
- QTest::ignoreMessage(QtDebugMsg, "Object");
- QTest::ignoreMessage(QtDebugMsg, "undefined");
- QTest::ignoreMessage(QtDebugMsg, "12");
- QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}");
- QTest::ignoreMessage(QtDebugMsg, "true");
- QTest::ignoreMessage(QtDebugMsg, "Object");
- QTest::ignoreMessage(QtDebugMsg, "Object");
- QTest::ignoreMessage(QtDebugMsg, "1 pong! Object");
- QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] Object 2");
-
-
- QTest::ignoreMessage(QtWarningMsg, qPrintable(testException));
-
-
- QDeclarativeComponent component(&engine, testUrl);
- QObject *object = component.create();
- QVERIFY(object != 0);
- delete object;
-}
void tst_qdeclarativeqt::dateTimeConversion()
{
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
index 47202c5029..f7392f47e7 100644
--- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
+++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
index 063a772187..fd7515068b 100644
--- a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
+++ b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp
index abe3039c3a..faa6cf2b07 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
index b705356475..42f160fc75 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index 69e64bd675..6e7aca96e8 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 05325997d5..857f13eb4d 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index 490557faf5..70090091eb 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
index 4b41765a58..f3bf3157d5 100644
--- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -436,7 +436,7 @@ void tst_QJSEngine::newFunction()
{
QScriptValue fun = eng.newFunction(myFunction);
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
QCOMPARE(fun.scriptClass(), (QScriptClass*)0);
// a prototype property is automatically constructed
@@ -449,11 +449,11 @@ void tst_QJSEngine::newFunction()
}
// prototype should be Function.prototype
QCOMPARE(fun.prototype().isValid(), true);
- QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().isCallable(), true);
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
QCOMPARE(fun.call().isNull(), true);
- QCOMPARE(fun.construct().isObject(), true);
+ QCOMPARE(fun.callAsConstructor().isObject(), true);
}
}
@@ -462,7 +462,7 @@ void tst_QJSEngine::newFunctionWithArg()
QScriptEngine eng;
{
QScriptValue fun = eng.newFunction(myFunctionWithVoidArg, (void*)this);
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QCOMPARE(fun.scriptClass(), (QScriptClass*)0);
// a prototype property is automatically constructed
{
@@ -474,11 +474,11 @@ void tst_QJSEngine::newFunctionWithArg()
}
// prototype should be Function.prototype
QCOMPARE(fun.prototype().isValid(), true);
- QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().isCallable(), true);
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
QCOMPARE(fun.call().isNull(), true);
- QCOMPARE(fun.construct().isObject(), true);
+ QCOMPARE(fun.callAsConstructor().isObject(), true);
}
}
@@ -489,11 +489,11 @@ void tst_QJSEngine::newFunctionWithProto()
QScriptValue proto = eng.newObject();
QScriptValue fun = eng.newFunction(myFunction, proto);
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
// internal prototype should be Function.prototype
QCOMPARE(fun.prototype().isValid(), true);
- QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().isCallable(), true);
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
// public prototype should be the one we passed
QCOMPARE(fun.property("prototype").strictlyEquals(proto), true);
@@ -502,30 +502,30 @@ void tst_QJSEngine::newFunctionWithProto()
QCOMPARE(proto.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
QCOMPARE(fun.call().isNull(), true);
- QCOMPARE(fun.construct().isObject(), true);
+ QCOMPARE(fun.callAsConstructor().isObject(), true);
}
// whether the return value is correct
{
QScriptValue fun = eng.newFunction(myFunctionThatReturns);
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
QScriptValue result = fun.call();
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 42);
+ QCOMPARE(result.toInt(), 42);
}
// whether the return value is assigned to the correct engine
{
QScriptValue fun = eng.newFunction(myFunctionThatReturnsWithoutEngine);
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
QScriptValue result = fun.call();
QCOMPARE(result.engine(), &eng);
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 1024);
+ QCOMPARE(result.toInt(), 1024);
}
// whether the return value is undefined when returning a value with wrong engine
{
@@ -533,7 +533,7 @@ void tst_QJSEngine::newFunctionWithProto()
QScriptValue fun = eng.newFunction(myFunctionThatReturnsWrongEngine, reinterpret_cast<void *>(&wrongEngine));
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
QTest::ignoreMessage(QtWarningMsg, "QScriptValue::call(): Value from different engine returned from native function, returning undefined value instead.");
@@ -547,24 +547,24 @@ void tst_QJSEngine::newFunctionWithProto()
QScriptValue fun = eng.newFunction(sumFunction);
QCOMPARE(fun.isValid(), true);
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.isObject(), true);
QScriptValue result = fun.call();
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 0);
+ QCOMPARE(result.toInt(), 0);
result = fun.call(QScriptValue(), QScriptValueList() << 1);
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 1);
+ QCOMPARE(result.toInt(), 1);
result = fun.call(QScriptValue(), QScriptValueList() << 1 << 2 << 3);
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 6);
+ QCOMPARE(result.toInt(), 6);
result = fun.call(QScriptValue(), QScriptValueList() << 1 << 2 << 3 << 4);
QCOMPARE(result.isNumber(), true);
- QCOMPARE(result.toInt32(), 10);
+ QCOMPARE(result.toInt(), 10);
}
}
#endif
@@ -575,7 +575,7 @@ void tst_QJSEngine::newObject()
QJSValue object = eng.newObject();
QCOMPARE(object.isValid(), true);
QCOMPARE(object.isObject(), true);
- QCOMPARE(object.isFunction(), false);
+ QCOMPARE(object.isCallable(), false);
// ###FIXME: No QScriptClass QCOMPARE(object.scriptClass(), (QScriptClass*)0);
// prototype should be Object.prototype
QCOMPARE(object.prototype().isValid(), true);
@@ -590,7 +590,7 @@ void tst_QJSEngine::newArray()
QCOMPARE(array.isValid(), true);
QCOMPARE(array.isArray(), true);
QCOMPARE(array.isObject(), true);
- QVERIFY(!array.isFunction());
+ QVERIFY(!array.isCallable());
// ###FIXME: No QScriptClass QCOMPARE(array.scriptClass(), (QScriptClass*)0);
// prototype should be Array.prototype
QCOMPARE(array.prototype().isValid(), true);
@@ -604,27 +604,27 @@ void tst_QJSEngine::newArray_HooliganTask218092()
{
QJSValue ret = eng.evaluate("[].splice(0, 0, 'a')");
QVERIFY(ret.isArray());
- QCOMPARE(ret.property("length").toInt32(), 0);
+ QCOMPARE(ret.property("length").toInt(), 0);
}
{
QJSValue ret = eng.evaluate("['a'].splice(0, 1, 'b')");
QVERIFY(ret.isArray());
- QCOMPARE(ret.property("length").toInt32(), 1);
+ QCOMPARE(ret.property("length").toInt(), 1);
}
{
QJSValue ret = eng.evaluate("['a', 'b'].splice(0, 1, 'c')");
QVERIFY(ret.isArray());
- QCOMPARE(ret.property("length").toInt32(), 1);
+ QCOMPARE(ret.property("length").toInt(), 1);
}
{
QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(0, 2, 'd')");
QVERIFY(ret.isArray());
- QCOMPARE(ret.property("length").toInt32(), 2);
+ QCOMPARE(ret.property("length").toInt(), 2);
}
{
QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(1, 2, 'd', 'e', 'f')");
QVERIFY(ret.isArray());
- QCOMPARE(ret.property("length").toInt32(), 2);
+ QCOMPARE(ret.property("length").toInt(), 2);
}
}
@@ -639,15 +639,15 @@ void tst_QJSEngine::newArray_HooliganTask233836()
{
QJSValue ret = eng.newArray(0xFFFFFFFF);
QEXPECT_FAIL("", "The maximum length of arrays is defined by v8 currently and differs from QtScript", Abort);
- QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF));
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
ret.setProperty(0xFFFFFFFF, 123);
- QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF));
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
QVERIFY(ret.property(0xFFFFFFFF).isNumber());
- QCOMPARE(ret.property(0xFFFFFFFF).toInt32(), 123);
+ QCOMPARE(ret.property(0xFFFFFFFF).toInt(), 123);
ret.setProperty(123, 456);
- QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF));
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
QVERIFY(ret.property(123).isNumber());
- QCOMPARE(ret.property(123).toInt32(), 456);
+ QCOMPARE(ret.property(123).toInt(), 456);
}
}
@@ -658,12 +658,12 @@ void tst_QJSEngine::newVariant()
QJSValue opaque = eng.newVariant(QVariant());
QCOMPARE(opaque.isValid(), true);
QCOMPARE(opaque.isVariant(), true);
- QVERIFY(!opaque.isFunction());
+ QVERIFY(!opaque.isCallable());
QCOMPARE(opaque.isObject(), true);
QCOMPARE(opaque.prototype().isValid(), true);
QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue);
QCOMPARE(opaque.prototype().isVariant(), true);
- QVERIFY(opaque.property("valueOf").call(opaque).isUndefined());
+ QVERIFY(opaque.property("valueOf").callWithInstance(opaque).isUndefined());
}
}
@@ -734,15 +734,15 @@ void tst_QJSEngine::newVariant_valueOfToString()
QJSEngine eng;
{
QJSValue object = eng.newVariant(QVariant(123));
- QJSValue value = object.property("valueOf").call(object);
+ QJSValue value = object.property("valueOf").callWithInstance(object);
QVERIFY(value.isNumber());
- QCOMPARE(value.toInt32(), 123);
+ QCOMPARE(value.toInt(), 123);
QCOMPARE(object.toString(), QString::fromLatin1("123"));
QCOMPARE(object.toVariant().toString(), object.toString());
}
{
QJSValue object = eng.newVariant(QVariant(QString::fromLatin1("hello")));
- QJSValue value = object.property("valueOf").call(object);
+ QJSValue value = object.property("valueOf").callWithInstance(object);
QVERIFY(value.isString());
QCOMPARE(value.toString(), QString::fromLatin1("hello"));
QCOMPARE(object.toString(), QString::fromLatin1("hello"));
@@ -750,7 +750,7 @@ void tst_QJSEngine::newVariant_valueOfToString()
}
{
QJSValue object = eng.newVariant(QVariant(false));
- QJSValue value = object.property("valueOf").call(object);
+ QJSValue value = object.property("valueOf").callWithInstance(object);
QVERIFY(value.isBool());
QCOMPARE(value.toBool(), false);
QCOMPARE(object.toString(), QString::fromLatin1("false"));
@@ -758,7 +758,7 @@ void tst_QJSEngine::newVariant_valueOfToString()
}
{
QJSValue object = eng.newVariant(QVariant(QPoint(10, 20)));
- QJSValue value = object.property("valueOf").call(object);
+ QJSValue value = object.property("valueOf").callWithInstance(object);
QVERIFY(value.isObject());
QVERIFY(value.strictlyEquals(object));
QCOMPARE(object.toString(), QString::fromLatin1("QVariant(QPoint)"));
@@ -802,7 +802,7 @@ void tst_QJSEngine::newRegExp()
QCOMPARE(rexp.isValid(), true);
QCOMPARE(rexp.isRegExp(), true);
QCOMPARE(rexp.isObject(), true);
- QVERIFY(rexp.isFunction()); // in JSC, RegExp objects are callable
+ QVERIFY(rexp.isCallable()); // in JSC, RegExp objects are callable
// prototype should be RegExp.prototype
QCOMPARE(rexp.prototype().isValid(), true);
QCOMPARE(rexp.prototype().isObject(), true);
@@ -830,18 +830,18 @@ void tst_QJSEngine::jsRegExp()
QCOMPARE(r.toString(), QString::fromLatin1("/foo/gim"));
QJSValue rxCtor = eng.globalObject().property("RegExp");
- QJSValue r2 = rxCtor.call(QJSValue(), QJSValueList() << r);
+ QJSValue r2 = rxCtor.call(QJSValueList() << r);
QVERIFY(r2.isRegExp());
QVERIFY(r2.strictlyEquals(r));
- QJSValue r3 = rxCtor.call(QJSValue(), QJSValueList() << r << "gim");
+ QJSValue r3 = rxCtor.call(QJSValueList() << r << "gim");
QVERIFY(r3.isError());
QVERIFY(r3.toString().contains(QString::fromLatin1("TypeError"))); // Cannot supply flags when constructing one RegExp from another
- QJSValue r4 = rxCtor.call(QJSValue(), QJSValueList() << "foo" << "gim");
+ QJSValue r4 = rxCtor.call(QJSValueList() << "foo" << "gim");
QVERIFY(r4.isRegExp());
- QJSValue r5 = rxCtor.construct(QJSValueList() << r);
+ QJSValue r5 = rxCtor.callAsConstructor(QJSValueList() << r);
QVERIFY(r5.isRegExp());
QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim"));
// In JSC, constructing a RegExp from another produces the same identical object.
@@ -849,7 +849,7 @@ void tst_QJSEngine::jsRegExp()
QVERIFY(!r5.strictlyEquals(r));
QEXPECT_FAIL("", "V8 and jsc ignores invalid flags", Continue); //https://bugs.webkit.org/show_bug.cgi?id=41614
- QJSValue r6 = rxCtor.construct(QJSValueList() << "foo" << "bar");
+ QJSValue r6 = rxCtor.callAsConstructor(QJSValueList() << "foo" << "bar");
QVERIFY(r6.isError());
// QVERIFY(r6.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag
@@ -865,15 +865,15 @@ void tst_QJSEngine::jsRegExp()
QVERIFY(r8.isRegExp());
QCOMPARE(r8.toString(), QString::fromLatin1("/foo/gim"));
- QJSValue r9 = rxCtor.construct();
+ QJSValue r9 = rxCtor.callAsConstructor();
QVERIFY(r9.isRegExp());
QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/"));
- QJSValue r10 = rxCtor.construct(QJSValueList() << "" << "gim");
+ QJSValue r10 = rxCtor.callAsConstructor(QJSValueList() << "" << "gim");
QVERIFY(r10.isRegExp());
QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim"));
- QJSValue r11 = rxCtor.construct(QJSValueList() << "{1.*}" << "g");
+ QJSValue r11 = rxCtor.callAsConstructor(QJSValueList() << "{1.*}" << "g");
QVERIFY(r11.isRegExp());
QCOMPARE(r11.toString(), QString::fromLatin1("/{1.*}/g"));
}
@@ -887,7 +887,7 @@ void tst_QJSEngine::newDate()
QCOMPARE(date.isValid(), true);
QCOMPARE(date.isDate(), true);
QCOMPARE(date.isObject(), true);
- QVERIFY(!date.isFunction());
+ QVERIFY(!date.isCallable());
// prototype should be Date.prototype
QCOMPARE(date.prototype().isValid(), true);
QCOMPARE(date.prototype().isDate(), true);
@@ -951,7 +951,7 @@ void tst_QJSEngine::newQObject()
QCOMPARE(qobject.isQObject(), true);
QCOMPARE(qobject.isObject(), true);
QCOMPARE(qobject.toQObject(), (QObject *)this);
- QVERIFY(!qobject.isFunction());
+ QVERIFY(!qobject.isCallable());
// prototype should be QObject.prototype
QCOMPARE(qobject.prototype().isValid(), true);
QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue);
@@ -1179,7 +1179,7 @@ static QScriptValue myConstructor(QScriptContext *ctx, QScriptEngine *eng)
static QScriptValue instanceofJS(const QScriptValue &inst, const QScriptValue &ctor)
{
return inst.engine()->evaluate("(function(inst, ctor) { return inst instanceof ctor; })")
- .call(QScriptValue(), QScriptValueList() << inst << ctor);
+ .call(QScriptValueList() << inst << ctor);
}
void tst_QJSEngine::newQMetaObject()
@@ -1195,27 +1195,27 @@ void tst_QJSEngine::newQMetaObject()
QCOMPARE(qclass.isValid(), true);
QCOMPARE(qclass.isQMetaObject(), true);
QCOMPARE(qclass.toQMetaObject(), &QObject::staticMetaObject);
- QCOMPARE(qclass.isFunction(), true);
+ QCOMPARE(qclass.isCallable(), true);
QVERIFY(qclass.property("prototype").isObject());
QCOMPARE(qclass2.isValid(), true);
QCOMPARE(qclass2.isQMetaObject(), true);
QCOMPARE(qclass2.toQMetaObject(), &QWidget::staticMetaObject);
- QCOMPARE(qclass2.isFunction(), true);
+ QCOMPARE(qclass2.isCallable(), true);
QVERIFY(qclass2.property("prototype").isObject());
// prototype should be QMetaObject.prototype
QCOMPARE(qclass.prototype().isObject(), true);
QCOMPARE(qclass2.prototype().isObject(), true);
- QScriptValue instance = qclass.construct();
+ QScriptValue instance = qclass.callAsConstructor();
QCOMPARE(instance.isQObject(), true);
QCOMPARE(instance.toQObject()->metaObject(), qclass.toQMetaObject());
QEXPECT_FAIL("", "FIXME: newQMetaObject not implemented properly yet", Abort);
QVERIFY(instance.instanceOf(qclass));
QVERIFY(instanceofJS(instance, qclass).strictlyEquals(true));
- QScriptValue instance2 = qclass2.construct();
+ QScriptValue instance2 = qclass2.callAsConstructor();
QCOMPARE(instance2.isQObject(), true);
QCOMPARE(instance2.toQObject()->metaObject(), qclass2.toQMetaObject());
QVERIFY(instance2.instanceOf(qclass2));
@@ -1225,7 +1225,7 @@ void tst_QJSEngine::newQMetaObject()
QScriptValueList args;
args << instance;
- QScriptValue instance3 = qclass.construct(args);
+ QScriptValue instance3 = qclass.callAsConstructor(args);
QCOMPARE(instance3.isQObject(), true);
QCOMPARE(instance3.toQObject()->parent(), instance.toQObject());
QVERIFY(instance3.instanceOf(qclass));
@@ -1272,7 +1272,7 @@ void tst_QJSEngine::newQMetaObject()
QVERIFY(instanceofJS(ret, qclass).strictlyEquals(false));
}
{
- QScriptValue ret = qclass3.construct();
+ QScriptValue ret = qclass3.callAsConstructor();
QVERIFY(ret.isObject());
QVERIFY(ret.property("isCalledAsConstructor").isBool());
QVERIFY(ret.property("isCalledAsConstructor").toBool());
@@ -1283,14 +1283,14 @@ void tst_QJSEngine::newQMetaObject()
}
// subclassing
- qclass2.setProperty("prototype", qclass.construct());
- QVERIFY(qclass2.construct().instanceOf(qclass));
- QVERIFY(instanceofJS(qclass2.construct(), qclass).strictlyEquals(true));
+ qclass2.setProperty("prototype", qclass.callAsConstructor());
+ QVERIFY(qclass2.callAsConstructor().instanceOf(qclass));
+ QVERIFY(instanceofJS(qclass2.callAsConstructor(), qclass).strictlyEquals(true));
// with meta-constructor
QScriptValue qclass4 = eng.newQMetaObject(&QObject::staticMetaObject);
{
- QScriptValue inst = qclass4.construct();
+ QScriptValue inst = qclass4.callAsConstructor();
QVERIFY(inst.isQObject());
QVERIFY(inst.toQObject() != 0);
QCOMPARE(inst.toQObject()->parent(), (QObject*)0);
@@ -1300,7 +1300,7 @@ void tst_QJSEngine::newQMetaObject()
QVERIFY(instanceofJS(inst, qclass3).strictlyEquals(false));
}
{
- QScriptValue inst = qclass4.construct(QScriptValueList() << eng.newQObject(this));
+ QScriptValue inst = qclass4.callAsConstructor(QScriptValueList() << eng.newQObject(this));
QVERIFY(inst.isQObject());
QVERIFY(inst.toQObject() != 0);
QCOMPARE(inst.toQObject()->parent(), (QObject*)this);
@@ -1322,7 +1322,7 @@ void tst_QJSEngine::newActivationObject()
QCOMPARE(act.isValid(), true);
QEXPECT_FAIL("", "", Continue);
QCOMPARE(act.isObject(), true);
- QVERIFY(!act.isFunction());
+ QVERIFY(!act.isCallable());
QScriptValue v(&eng, 123);
act.setProperty("prop", v);
QEXPECT_FAIL("", "", Continue);
@@ -1357,7 +1357,7 @@ void tst_QJSEngine::getSetGlobalObject()
glob = eng.globalObject();
QCOMPARE(glob.isValid(), true);
QCOMPARE(glob.isObject(), true);
- QVERIFY(!glob.isFunction());
+ QVERIFY(!glob.isCallable());
QVERIFY(eng.currentContext()->thisObject().strictlyEquals(glob));
QVERIFY(eng.currentContext()->activationObject().strictlyEquals(glob));
QEXPECT_FAIL("", "FIXME: Do we really want to enforce this? ECMA standard says that it is implementation dependent, skipping for now", Continue);
@@ -1401,7 +1401,7 @@ void tst_QJSEngine::getSetGlobalObject()
{
QScriptValue ret = obj.property("foo");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
QVERIFY(!obj.property("bar").isValid());
@@ -1409,7 +1409,7 @@ void tst_QJSEngine::getSetGlobalObject()
{
QScriptValue ret = obj.property("bar");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 456);
+ QCOMPARE(ret.toInt(), 456);
}
QVERIFY(!obj.property("baz").isValid());
@@ -1417,7 +1417,7 @@ void tst_QJSEngine::getSetGlobalObject()
{
QScriptValue ret = obj.property("baz");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 789);
+ QCOMPARE(ret.toInt(), 789);
}
{
@@ -1437,8 +1437,8 @@ void tst_QJSEngine::getSetGlobalObject()
//the custom global object have an interceptor
QVERIFY(eng.evaluate("this.__defineGetter__('oof', function() { return this.bar; })").isUndefined());
QVERIFY(eng.evaluate("this.__defineSetter__('oof', function(v) { this.bar = v; })").isUndefined());
- QVERIFY(eng.evaluate("this.__lookupGetter__('oof')").isFunction());
- QVERIFY(eng.evaluate("this.__lookupSetter__('oof')").isFunction());
+ QVERIFY(eng.evaluate("this.__lookupGetter__('oof')").isCallable());
+ QVERIFY(eng.evaluate("this.__lookupSetter__('oof')").isCallable());
eng.evaluate("oof = 123");
QVERIFY(eng.evaluate("oof").equals(obj.property("bar")));
@@ -1478,65 +1478,65 @@ void tst_QJSEngine::globalObjectProperties()
QVERIFY(global.property("undefined").isUndefined());
QCOMPARE(global.propertyFlags("undefined"), QJSValue::SkipInEnumeration | QJSValue::Undeletable);
- QVERIFY(global.property("eval").isFunction());
+ QVERIFY(global.property("eval").isCallable());
QCOMPARE(global.propertyFlags("eval"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("parseInt").isFunction());
+ QVERIFY(global.property("parseInt").isCallable());
QCOMPARE(global.propertyFlags("parseInt"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("parseFloat").isFunction());
+ QVERIFY(global.property("parseFloat").isCallable());
QCOMPARE(global.propertyFlags("parseFloat"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("isNaN").isFunction());
+ QVERIFY(global.property("isNaN").isCallable());
QCOMPARE(global.propertyFlags("isNaN"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("isFinite").isFunction());
+ QVERIFY(global.property("isFinite").isCallable());
QCOMPARE(global.propertyFlags("isFinite"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("decodeURI").isFunction());
+ QVERIFY(global.property("decodeURI").isCallable());
QCOMPARE(global.propertyFlags("decodeURI"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("decodeURIComponent").isFunction());
+ QVERIFY(global.property("decodeURIComponent").isCallable());
QCOMPARE(global.propertyFlags("decodeURIComponent"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("encodeURI").isFunction());
+ QVERIFY(global.property("encodeURI").isCallable());
QCOMPARE(global.propertyFlags("encodeURI"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("encodeURIComponent").isFunction());
+ QVERIFY(global.property("encodeURIComponent").isCallable());
QCOMPARE(global.propertyFlags("encodeURIComponent"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Object").isFunction());
+ QVERIFY(global.property("Object").isCallable());
QCOMPARE(global.propertyFlags("Object"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Function").isFunction());
+ QVERIFY(global.property("Function").isCallable());
QCOMPARE(global.propertyFlags("Function"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Array").isFunction());
+ QVERIFY(global.property("Array").isCallable());
QCOMPARE(global.propertyFlags("Array"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("String").isFunction());
+ QVERIFY(global.property("String").isCallable());
QCOMPARE(global.propertyFlags("String"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Boolean").isFunction());
+ QVERIFY(global.property("Boolean").isCallable());
QCOMPARE(global.propertyFlags("Boolean"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Number").isFunction());
+ QVERIFY(global.property("Number").isCallable());
QCOMPARE(global.propertyFlags("Number"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Date").isFunction());
+ QVERIFY(global.property("Date").isCallable());
QCOMPARE(global.propertyFlags("Date"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("RegExp").isFunction());
+ QVERIFY(global.property("RegExp").isCallable());
QCOMPARE(global.propertyFlags("RegExp"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("Error").isFunction());
+ QVERIFY(global.property("Error").isCallable());
QCOMPARE(global.propertyFlags("Error"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("EvalError").isFunction());
+ QVERIFY(global.property("EvalError").isCallable());
QCOMPARE(global.propertyFlags("EvalError"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("RangeError").isFunction());
+ QVERIFY(global.property("RangeError").isCallable());
QCOMPARE(global.propertyFlags("RangeError"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("ReferenceError").isFunction());
+ QVERIFY(global.property("ReferenceError").isCallable());
QCOMPARE(global.propertyFlags("ReferenceError"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("SyntaxError").isFunction());
+ QVERIFY(global.property("SyntaxError").isCallable());
QCOMPARE(global.propertyFlags("SyntaxError"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("TypeError").isFunction());
+ QVERIFY(global.property("TypeError").isCallable());
QCOMPARE(global.propertyFlags("TypeError"), QJSValue::SkipInEnumeration);
- QVERIFY(global.property("URIError").isFunction());
+ QVERIFY(global.property("URIError").isCallable());
QCOMPARE(global.propertyFlags("URIError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Math").isObject());
- QVERIFY(!global.property("Math").isFunction());
+ QVERIFY(!global.property("Math").isCallable());
QCOMPARE(global.propertyFlags("Math"), QJSValue::SkipInEnumeration);
}
@@ -1684,12 +1684,12 @@ void tst_QJSEngine::customGlobalObjectWithPrototype()
}
{
QScriptValue ret = engine.evaluate("print");
- QVERIFY(ret.isFunction());
+ QVERIFY(ret.isCallable());
QVERIFY(ret.strictlyEquals(wrap.property("print")));
}
{
QScriptValue ret = engine.evaluate("this.print");
- QVERIFY(ret.isFunction());
+ QVERIFY(ret.isCallable());
QVERIFY(ret.strictlyEquals(wrap.property("print")));
}
{
@@ -1710,7 +1710,7 @@ void tst_QJSEngine::customGlobalObjectWithPrototype()
global.setPrototype(anotherProto);
{
QScriptValue ret = engine.evaluate("print");
- QVERIFY(ret.isFunction());
+ QVERIFY(ret.isCallable());
QVERIFY(ret.strictlyEquals(wrap.property("print")));
}
{
@@ -1746,7 +1746,7 @@ void tst_QJSEngine::customGlobalObjectWithPrototype()
}
{
QScriptValue ret = engine.evaluate("print");
- QVERIFY(ret.isFunction());
+ QVERIFY(ret.isCallable());
QVERIFY(ret.strictlyEquals(global.property("print")));
}
QVERIFY(!anotherProto.property("print").isValid());
@@ -2215,7 +2215,7 @@ void tst_QJSEngine::nestedEvaluate()
}
// From QScriptValue::call()
{
- QScriptValue result = fun.call(eng.evaluate("p = { id:'foo' }") , QScriptValueList() );
+ QScriptValue result = fun.callWithInstance(eng.evaluate("p = { id:'foo' }") , QScriptValueList() );
QCOMPARE(result.property("local_bar").toString(), QString("local"));
QCOMPARE(result.property("thisObjectIdBefore").toString(), QString("foo"));
QCOMPARE(result.property("thisObjectIdAfter").toString(), QString("foo"));
@@ -2352,8 +2352,8 @@ static QJSValue fooToScriptValue(QJSEngine *eng, const Foo &foo)
static void fooFromScriptValue(const QJSValue &value, Foo &foo)
{
- foo.x = value.property("x").toInt32();
- foo.y = value.property("y").toInt32();
+ foo.x = value.property("x").toInt();
+ foo.y = value.property("y").toInt();
}
static QJSValue fooToScriptValueV2(QJSEngine *eng, const Foo &foo)
@@ -2363,7 +2363,7 @@ static QJSValue fooToScriptValueV2(QJSEngine *eng, const Foo &foo)
static void fooFromScriptValueV2(const QJSValue &value, Foo &foo)
{
- foo.x = value.toInt32();
+ foo.x = value.toInt();
}
Q_DECLARE_METATYPE(QLinkedList<QString>)
@@ -2498,7 +2498,7 @@ void tst_QJSEngine::valueConversion_sequence()
lst << QLatin1String("foo") << QLatin1String("bar");
QScriptValue lstVal = eng.toScriptValue(lst);
QCOMPARE(lstVal.isArray(), true);
- QCOMPARE(lstVal.property("length").toInt32(), 2);
+ QCOMPARE(lstVal.property("length").toInt(), 2);
QCOMPARE(lstVal.property("0").isString(), true);
QCOMPARE(lstVal.property("0").toString(), QLatin1String("foo"));
QCOMPARE(lstVal.property("1").isString(), true);
@@ -2517,14 +2517,14 @@ void tst_QJSEngine::valueConversion_sequence()
QStack<int> second; second << 99999;lst << second;
QScriptValue lstVal = eng.toScriptValue(lst);
QCOMPARE(lstVal.isArray(), true);
- QCOMPARE(lstVal.property("length").toInt32(), 2);
+ QCOMPARE(lstVal.property("length").toInt(), 2);
QCOMPARE(lstVal.property("0").isArray(), true);
- QCOMPARE(lstVal.property("0").property("length").toInt32(), 2);
- QCOMPARE(lstVal.property("0").property("0").toInt32(), first.at(0));
- QCOMPARE(lstVal.property("0").property("1").toInt32(), first.at(1));
+ QCOMPARE(lstVal.property("0").property("length").toInt(), 2);
+ QCOMPARE(lstVal.property("0").property("0").toInt(), first.at(0));
+ QCOMPARE(lstVal.property("0").property("1").toInt(), first.at(1));
QCOMPARE(lstVal.property("1").isArray(), true);
- QCOMPARE(lstVal.property("1").property("length").toInt32(), 1);
- QCOMPARE(lstVal.property("1").property("0").toInt32(), second.at(0));
+ QCOMPARE(lstVal.property("1").property("length").toInt(), 1);
+ QCOMPARE(lstVal.property("1").property("0").toInt(), second.at(0));
QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("0")), first);
QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("1")), second);
QCOMPARE(qscriptvalue_cast<QLinkedList<QStack<int> > >(lstVal), lst);
@@ -2552,10 +2552,10 @@ void tst_QJSEngine::valueConversion_sequence()
lst << 1 << 2 << 3;
QScriptValue val = eng.toScriptValue(lst);
QVERIFY(val.isArray());
- QCOMPARE(val.property("length").toInt32(), lst.size());
- QCOMPARE(val.property(0).toInt32(), lst.at(0));
- QCOMPARE(val.property(1).toInt32(), lst.at(1));
- QCOMPARE(val.property(2).toInt32(), lst.at(2));
+ QCOMPARE(val.property("length").toInt(), lst.size());
+ QCOMPARE(val.property(0).toInt(), lst.at(0));
+ QCOMPARE(val.property(1).toInt(), lst.at(1));
+ QCOMPARE(val.property(2).toInt(), lst.at(2));
QCOMPARE(qscriptvalue_cast<QList<int> >(val), lst);
}
@@ -2564,7 +2564,7 @@ void tst_QJSEngine::valueConversion_sequence()
lst << this;
QScriptValue val = eng.toScriptValue(lst);
QVERIFY(val.isArray());
- QCOMPARE(val.property("length").toInt32(), lst.size());
+ QCOMPARE(val.property("length").toInt(), lst.size());
QCOMPARE(val.property(0).toQObject(), (QObject *)this);
QCOMPARE(qscriptvalue_cast<QObjectList>(val), lst);
@@ -2689,37 +2689,37 @@ void tst_QJSEngine::valueConversion_basic2()
{
QJSValue val = eng.toScriptValue(uint(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(qulonglong(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(float(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(short(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(ushort(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(char(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
{
QJSValue val = eng.toScriptValue(uchar(123));
QVERIFY(val.isNumber());
- QCOMPARE(val.toInt32(), 123);
+ QCOMPARE(val.toInt(), 123);
}
}
@@ -2896,7 +2896,7 @@ static QScriptValue recurse(QScriptContext *ctx, QScriptEngine *eng)
static QScriptValue recurse2(QScriptContext *ctx, QScriptEngine *eng)
{
Q_UNUSED(eng);
- return ctx->callee().construct();
+ return ctx->callee().callAsConstructor();
}
void tst_QJSEngine::infiniteRecursion()
@@ -2920,7 +2920,7 @@ void tst_QJSEngine::infiniteRecursion()
}
{
QScriptValue fun = eng.newFunction(recurse2);
- QScriptValue ret = fun.construct();
+ QScriptValue ret = fun.callAsConstructor();
QCOMPARE(ret.isError(), true);
QCOMPARE(ret.toString(), stackOverflowError);
}
@@ -2977,7 +2977,7 @@ void tst_QJSEngine::castWithPrototypeChain()
Zoo zoo;
QScriptValue scriptZoo = eng.newQObject(&zoo);
QScriptValue toBaz = scriptZoo.property("toBaz");
- QVERIFY(toBaz.isFunction());
+ QVERIFY(toBaz.isCallable());
// no relation between Bar and Baz's proto --> casting fails
{
@@ -2986,7 +2986,7 @@ void tst_QJSEngine::castWithPrototypeChain()
}
{
- QScriptValue ret = toBaz.call(scriptZoo, QScriptValueList() << baz2Value);
+ QScriptValue ret = toBaz.callWithInstance(scriptZoo, QScriptValueList() << baz2Value);
QVERIFY(ret.isError());
QCOMPARE(ret.toString(), QLatin1String("TypeError: incompatible type of argument(s) in call to toBaz(); candidates were\n toBaz(Bar*)"));
}
@@ -3008,7 +3008,7 @@ void tst_QJSEngine::castWithPrototypeChain()
}
{
- QScriptValue ret = toBaz.call(scriptZoo, QScriptValueList() << baz2Value);
+ QScriptValue ret = toBaz.callWithInstance(scriptZoo, QScriptValueList() << baz2Value);
QEXPECT_FAIL("", "Cannot convert Baz* to Bar*", Continue);
QVERIFY(!ret.isError());
QEXPECT_FAIL("", "Cannot convert Baz* to Bar*", Continue);
@@ -3236,7 +3236,7 @@ void tst_QJSEngine::processEventsWhileRunning_function()
QCOMPARE(eng.processEventsInterval(), 100);
if (x) script.call();
- else script.construct();
+ else script.callAsConstructor();
QVERIFY(!eng.hasUncaughtException());
QVERIFY(receiver.received);
@@ -3353,13 +3353,13 @@ void tst_QJSEngine::stacktrace()
// FIXME? it is not standard.
//QCOMPARE(result.property("fileName").toString(), fileName);
- //QCOMPARE(result.property("lineNumber").toInt32(), 9);
+ //QCOMPARE(result.property("lineNumber").toInt(), 9);
QJSValue stack = result.property("stack");
// FIXME? it is not standard.
// QVERIFY(stack.isArray());
- //QCOMPARE(stack.property("length").toInt32(), 7);
+ //QCOMPARE(stack.property("length").toInt(), 7);
QJSValueIterator it(stack);
int counter = 5;
@@ -3373,7 +3373,7 @@ void tst_QJSEngine::stacktrace()
QJSValue callee = frame.property("arguments").property("callee");
QVERIFY(callee.strictlyEquals(eng.globalObject().property("foo")));
QCOMPARE(obj.property("functionName").toString(), QString("foo"));
- int line = obj.property("lineNumber").toInt32();
+ int line = obj.property("lineNumber").toInt();
if (counter == 5)
QCOMPARE(line, 9);
else
@@ -3467,7 +3467,7 @@ void tst_QJSEngine::automaticSemicolonInsertion()
{
QJSValue ret = eng.evaluate("{ 1\n2 } 3");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
{
QJSValue ret = eng.evaluate("for (a; b\n)");
@@ -3482,7 +3482,7 @@ void tst_QJSEngine::automaticSemicolonInsertion()
eng.evaluate("c = 2; b = 1");
QJSValue ret = eng.evaluate("a = b\n++c");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
{
QJSValue ret = eng.evaluate("if (a > b)\nelse c = d");
@@ -3494,7 +3494,7 @@ void tst_QJSEngine::automaticSemicolonInsertion()
eng.evaluate("b = 1; d = 2; e = 3");
QJSValue ret = eng.evaluate("a = b + c\n(d + e).foo()");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 6);
+ QCOMPARE(ret.toInt(), 6);
}
{
QJSValue ret = eng.evaluate("throw\n1");
@@ -3504,7 +3504,7 @@ void tst_QJSEngine::automaticSemicolonInsertion()
{
QJSValue ret = eng.evaluate("a = Number(1)\n++a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 2);
+ QCOMPARE(ret.toInt(), 2);
}
// "a semicolon is never inserted automatically if the semicolon
@@ -3513,31 +3513,31 @@ void tst_QJSEngine::automaticSemicolonInsertion()
eng.evaluate("a = 123");
QJSValue ret = eng.evaluate("if (0)\n ++a; a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
eng.evaluate("a = 123");
QJSValue ret = eng.evaluate("if (0)\n --a; a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
eng.evaluate("a = 123");
QJSValue ret = eng.evaluate("if ((0))\n ++a; a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
eng.evaluate("a = 123");
QJSValue ret = eng.evaluate("if ((0))\n --a; a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
eng.evaluate("a = 123");
QJSValue ret = eng.evaluate("if (0\n)\n ++a; a");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
eng.evaluate("a = 123");
@@ -3552,83 +3552,83 @@ void tst_QJSEngine::automaticSemicolonInsertion()
{
QJSValue ret = eng.evaluate("n = 0; for (i = 0; i < 10; ++i)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
{
QJSValue ret = eng.evaluate("n = 30; for (i = 0; i < 10; ++i)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 20);
+ QCOMPARE(ret.toInt(), 20);
}
{
QJSValue ret = eng.evaluate("n = 0; for (var i = 0; i < 10; ++i)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
{
QJSValue ret = eng.evaluate("n = 30; for (var i = 0; i < 10; ++i)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 20);
+ QCOMPARE(ret.toInt(), 20);
}
{
QJSValue ret = eng.evaluate("n = 0; i = 0; while (i++ < 10)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
{
QJSValue ret = eng.evaluate("n = 30; i = 0; while (i++ < 10)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 20);
+ QCOMPARE(ret.toInt(), 20);
}
{
QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (i in o)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
{
QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (i in o)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 6);
+ QCOMPARE(ret.toInt(), 6);
}
{
QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (var i in o)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
{
QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (var i in o)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 6);
+ QCOMPARE(ret.toInt(), 6);
}
{
QJSValue ret = eng.evaluate("o = { n: 3 }; n = 5; with (o)\n ++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 5);
+ QCOMPARE(ret.toInt(), 5);
}
{
QJSValue ret = eng.evaluate("o = { n: 3 }; n = 10; with (o)\n --n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
{
QJSValue ret = eng.evaluate("n = 5; i = 0; do\n ++n; while (++i < 10); n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 15);
+ QCOMPARE(ret.toInt(), 15);
}
{
QJSValue ret = eng.evaluate("n = 20; i = 0; do\n --n; while (++i < 10); n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
{
QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n++n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 2);
+ QCOMPARE(ret.toInt(), 2);
}
{
QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n--n; n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 0);
+ QCOMPARE(ret.toInt(), 0);
}
{
@@ -3753,7 +3753,7 @@ void tst_QJSEngine::abortEvaluation()
case EventReceiver3::Number:
QVERIFY(!eng.hasUncaughtException());
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 1234);
+ QCOMPARE(ret.toInt(), 1234);
break;
case EventReceiver3::String:
QVERIFY(!eng.hasUncaughtException());
@@ -3796,7 +3796,7 @@ void tst_QJSEngine::abortEvaluation_tryCatch()
case EventReceiver3::Number:
QVERIFY(!eng.hasUncaughtException());
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 1234);
+ QCOMPARE(ret.toInt(), 1234);
break;
case EventReceiver3::String:
QVERIFY(!eng.hasUncaughtException());
@@ -3953,7 +3953,7 @@ void tst_QJSEngine::printFunctionWithCustomHandler()
// This behavior is not documented.
QJSEngine eng;
QtMsgHandler oldHandler = qInstallMsgHandler(myMsgHandler);
- QVERIFY(eng.globalObject().property("print").isFunction());
+ QVERIFY(eng.globalObject().property("print").isCallable());
theMessageType = QtSystemMsg;
QVERIFY(theMessage.isEmpty());
@@ -4002,7 +4002,7 @@ void tst_QJSEngine::errorConstructors()
QVERIFY(ret.toString().startsWith(name));
//QTBUG-6138: JSC doesn't assign lineNumber when errors are not thrown
QEXPECT_FAIL("", "we have no more lineNumber property ", Continue);
- QCOMPARE(ret.property("lineNumber").toInt32(), i+2);
+ QCOMPARE(ret.property("lineNumber").toInt(), i+2);
}
}
}
@@ -4021,7 +4021,7 @@ void tst_QJSEngine::argumentsProperty_globalContext()
{
QJSValue ret = eng.evaluate("arguments");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 10);
+ QCOMPARE(ret.toInt(), 10);
}
QVERIFY(eng.evaluate("delete arguments").toBool());
QVERIFY(!eng.globalObject().property("arguments").isValid());
@@ -4034,7 +4034,7 @@ void tst_QJSEngine::argumentsProperty_JS()
eng.evaluate("o = { arguments: 123 }");
QJSValue ret = eng.evaluate("with (o) { arguments; }");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
{
QJSEngine eng;
@@ -4043,7 +4043,7 @@ void tst_QJSEngine::argumentsProperty_JS()
// appears like a local variable, and it can be replaced.
QJSValue ret = eng.evaluate("(function() { arguments = 456; return arguments; })()");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 456);
+ QCOMPARE(ret.toInt(), 456);
QVERIFY(!eng.globalObject().property("arguments").isValid());
}
}
@@ -4066,7 +4066,7 @@ void tst_QJSEngine::argumentsProperty_evaluateInNativeFunction()
eng.globalObject().setProperty("fun", eng.newFunction(argumentsProperty_fun));
QScriptValue result = eng.evaluate("fun(18)");
QVERIFY(result.isNumber());
- QCOMPARE(result.toInt32(), 200+18);
+ QCOMPARE(result.toInt(), 200+18);
}
#endif
@@ -4135,7 +4135,7 @@ void tst_QJSEngine::jsNumberClass()
QCOMPARE(ret.toNumber(), qreal(456));
}
- QVERIFY(proto.property("toString").isFunction());
+ QVERIFY(proto.property("toString").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toString()");
QVERIFY(ret.isString());
@@ -4151,31 +4151,31 @@ void tst_QJSEngine::jsNumberClass()
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("7b"));
}
- QVERIFY(proto.property("toLocaleString").isFunction());
+ QVERIFY(proto.property("toLocaleString").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toLocaleString()");
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("123"));
}
- QVERIFY(proto.property("valueOf").isFunction());
+ QVERIFY(proto.property("valueOf").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).valueOf()");
QVERIFY(ret.isNumber());
QCOMPARE(ret.toNumber(), qreal(123));
}
- QVERIFY(proto.property("toExponential").isFunction());
+ QVERIFY(proto.property("toExponential").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toExponential()");
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("1.23e+2"));
}
- QVERIFY(proto.property("toFixed").isFunction());
+ QVERIFY(proto.property("toFixed").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toFixed()");
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("123"));
}
- QVERIFY(proto.property("toPrecision").isFunction());
+ QVERIFY(proto.property("toPrecision").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toPrecision()");
QVERIFY(ret.isString());
@@ -4339,19 +4339,19 @@ void tst_QJSEngine::jsFunctionDeclarationAsStatement()
"}");
QVERIFY(!eng.globalObject().property("bar").isValid());
QVERIFY(!eng.globalObject().property("baz").isValid());
- QVERIFY(eng.evaluate("foo").isFunction());
+ QVERIFY(eng.evaluate("foo").isCallable());
{
QJSValue ret = eng.evaluate("foo('bar')");
- QVERIFY(ret.isFunction());
- QJSValue ret2 = ret.call(QJSValue());
+ QVERIFY(ret.isCallable());
+ QJSValue ret2 = ret.call();
QCOMPARE(ret2.toString(), QString::fromLatin1("bar"));
QVERIFY(!eng.globalObject().property("bar").isValid());
QVERIFY(!eng.globalObject().property("baz").isValid());
}
{
QJSValue ret = eng.evaluate("foo('baz')");
- QVERIFY(ret.isFunction());
- QJSValue ret2 = ret.call(QJSValue());
+ QVERIFY(ret.isCallable());
+ QJSValue ret2 = ret.call();
QCOMPARE(ret2.toString(), QString::fromLatin1("baz"));
QVERIFY(!eng.globalObject().property("bar").isValid());
QVERIFY(!eng.globalObject().property("baz").isValid());
@@ -4367,7 +4367,7 @@ void tst_QJSEngine::stringObjects()
// in C++
{
QJSValue obj = QJSValue(&eng, str).toObject();
- QCOMPARE(obj.property("length").toInt32(), str.length());
+ QCOMPARE(obj.property("length").toInt(), str.length());
QCOMPARE(obj.propertyFlags("length"), QJSValue::PropertyFlags(QJSValue::Undeletable | QJSValue::SkipInEnumeration | QJSValue::ReadOnly));
for (int i = 0; i < str.length(); ++i) {
QString pname = QString::number(i);
@@ -4406,11 +4406,11 @@ void tst_QJSEngine::stringObjects()
QJSValue ret3 = eng.evaluate("s[-1] = 123; s[-1]");
QVERIFY(ret3.isNumber());
- QCOMPARE(ret3.toInt32(), 123);
+ QCOMPARE(ret3.toInt(), 123);
QJSValue ret4 = eng.evaluate("s[s.length] = 456; s[s.length]");
QVERIFY(ret4.isNumber());
- QCOMPARE(ret4.toInt32(), 456);
+ QCOMPARE(ret4.toInt(), 456);
QJSValue ret5 = eng.evaluate("delete s[0]");
QVERIFY(ret5.isBool());
@@ -4434,15 +4434,15 @@ void tst_QJSEngine::jsStringPrototypeReplaceBugs()
{
QJSValue ret = eng.evaluate("replace_args = []; \"a a a\".replace(/(a)/g, function() { replace_args.push(arguments); }); replace_args");
QVERIFY(ret.isArray());
- int len = ret.property("length").toInt32();
+ int len = ret.property("length").toInt();
QCOMPARE(len, 3);
for (int i = 0; i < len; ++i) {
QJSValue args = ret.property(i);
- QCOMPARE(args.property("length").toInt32(), 4);
+ QCOMPARE(args.property("length").toInt(), 4);
QCOMPARE(args.property(0).toString(), QString::fromLatin1("a")); // matched string
QCOMPARE(args.property(1).toString(), QString::fromLatin1("a")); // capture
QVERIFY(args.property(2).isNumber());
- QCOMPARE(args.property(2).toInt32(), i*2); // index of match
+ QCOMPARE(args.property(2).toInt(), i*2); // index of match
QCOMPARE(args.property(3).toString(), QString::fromLatin1("a a a"));
}
}
@@ -4604,7 +4604,7 @@ void tst_QJSEngine::jsContinueInSwitch()
" }\n"
"}; j");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
// for - switch - case - default - continue
{
@@ -4617,7 +4617,7 @@ void tst_QJSEngine::jsContinueInSwitch()
" }\n"
"}; j");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
// switch - for - continue
{
@@ -4628,7 +4628,7 @@ void tst_QJSEngine::jsContinueInSwitch()
" }\n"
"}; i\n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 100000);
+ QCOMPARE(ret.toInt(), 100000);
}
// switch - switch - continue
{
@@ -4646,7 +4646,7 @@ void tst_QJSEngine::jsContinueInSwitch()
" }\n"
"}; j");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 1);
+ QCOMPARE(ret.toInt(), 1);
}
// switch - for - switch - continue
{
@@ -4660,7 +4660,7 @@ void tst_QJSEngine::jsContinueInSwitch()
" }\n"
"}; i\n");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 100000);
+ QCOMPARE(ret.toInt(), 100000);
}
}
@@ -4673,7 +4673,7 @@ void tst_QJSEngine::jsShadowReadOnlyPrototypeProperty()
// just seems weird -- and non-compliant. Adopt the JSC behavior instead.
QJSEngine eng;
QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber());
- QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt32(), 123);
+ QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt(), 123);
QVERIFY(eng.evaluate("o.hasOwnProperty('length')").toBool());
}
@@ -4948,7 +4948,7 @@ void tst_QJSEngine::jsThrowInsideWithStatement()
" }"
"}");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
QVERIFY(eng.hasUncaughtException());
}
{
@@ -5045,8 +5045,8 @@ void tst_QJSEngine::reentrancy_typeConversion()
QScriptValue fooVal = qScriptValueFromValue(&eng1, foo);
QVERIFY(fooVal.isObject());
QVERIFY(!fooVal.isVariant());
- QCOMPARE(fooVal.property("x").toInt32(), 12);
- QCOMPARE(fooVal.property("y").toInt32(), 34);
+ QCOMPARE(fooVal.property("x").toInt(), 12);
+ QCOMPARE(fooVal.property("y").toInt(), 34);
fooVal.setProperty("x", 56);
fooVal.setProperty("y", 78);
@@ -5084,7 +5084,7 @@ void tst_QJSEngine::reentrancy_globalObjectProperties()
QVERIFY(!eng2.globalObject().property("a").isValid());
eng2.evaluate("a = 20");
QVERIFY(eng2.globalObject().property("a").isNumber());
- QCOMPARE(eng1.globalObject().property("a").toInt32(), 10);
+ QCOMPARE(eng1.globalObject().property("a").toInt(), 10);
}
void tst_QJSEngine::reentrancy_Array()
@@ -5182,22 +5182,22 @@ void tst_QJSEngine::jsIncDecNonObjectProperty()
{
QJSValue ret = eng.evaluate("var a = 'ciao'; a.length++");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 4);
+ QCOMPARE(ret.toInt(), 4);
}
{
QJSValue ret = eng.evaluate("var a = 'ciao'; a.length--");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 4);
+ QCOMPARE(ret.toInt(), 4);
}
{
QJSValue ret = eng.evaluate("var a = 'ciao'; ++a.length");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 5);
+ QCOMPARE(ret.toInt(), 5);
}
{
QJSValue ret = eng.evaluate("var a = 'ciao'; --a.length");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 3);
+ QCOMPARE(ret.toInt(), 3);
}
}
@@ -5215,13 +5215,13 @@ void tst_QJSEngine::installTranslatorFunctions()
QVERIFY(!global.property("String").property("prototype").property("arg").isValid());
eng.installTranslatorFunctions();
- QVERIFY(global.property("qsTranslate").isFunction());
- QVERIFY(global.property("QT_TRANSLATE_NOOP").isFunction());
- QVERIFY(global.property("qsTr").isFunction());
- QVERIFY(global.property("QT_TR_NOOP").isFunction());
- QVERIFY(global.property("qsTrId").isFunction());
- QVERIFY(global.property("QT_TRID_NOOP").isFunction());
- QVERIFY(global.property("String").property("prototype").property("arg").isFunction());
+ QVERIFY(global.property("qsTranslate").isCallable());
+ QVERIFY(global.property("QT_TRANSLATE_NOOP").isCallable());
+ QVERIFY(global.property("qsTr").isCallable());
+ QVERIFY(global.property("QT_TR_NOOP").isCallable());
+ QVERIFY(global.property("qsTrId").isCallable());
+ QVERIFY(global.property("QT_TRID_NOOP").isCallable());
+ QVERIFY(global.property("String").property("prototype").property("arg").isCallable());
{
QScriptValue ret = eng.evaluate("qsTr('foo')");
@@ -5418,7 +5418,7 @@ void tst_QJSEngine::translateScript_crossScript()
static QScriptValue callQsTr(QScriptContext *ctx, QScriptEngine *eng)
{
- return eng->globalObject().property("qsTr").call(ctx->thisObject(), ctx->argumentsObject());
+ return eng->globalObject().property("qsTr").callWithInstance(ctx->thisObject(), ctx->argumentsObject());
}
void tst_QJSEngine::translateScript_callQsTrFromNative()
@@ -5459,7 +5459,7 @@ void tst_QJSEngine::translateScript_callQsTrFromCpp()
// There is no context, but it shouldn't crash
QCOMPARE(engine.globalObject().property("qsTr").call(
- QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One"));
+ QScriptValueList() << "One").toString(), QString::fromLatin1("One"));
}
void tst_QJSEngine::translateWithInvalidArgs_data()
@@ -5689,7 +5689,7 @@ void tst_QJSEngine::functionScopes()
{
// top-level functions have only the global object in their scope
QScriptValue fun = eng.evaluate("(function() {})");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QEXPECT_FAIL("", "QScriptValue::scope() is internal, not implemented", Abort);
QVERIFY(fun.scope().isObject());
QVERIFY(fun.scope().strictlyEquals(eng.globalObject()));
@@ -5697,31 +5697,31 @@ void tst_QJSEngine::functionScopes()
}
{
QScriptValue fun = eng.globalObject().property("Object");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
// native built-in functions don't have scope
QVERIFY(!fun.scope().isValid());
}
{
// closure
QScriptValue fun = eng.evaluate("(function(arg) { var foo = arg; return function() { return foo; }; })(123)");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
{
QScriptValue ret = fun.call();
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
QScriptValue scope = fun.scope();
QVERIFY(scope.isObject());
{
QScriptValue ret = scope.property("foo");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable);
}
{
QScriptValue ret = scope.property("arg");
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
QCOMPARE(scope.propertyFlags("arg"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
}
@@ -5729,7 +5729,7 @@ void tst_QJSEngine::functionScopes()
{
QScriptValue ret = fun.call();
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 456);
+ QCOMPARE(ret.toInt(), 456);
}
scope = scope.scope();
@@ -5751,7 +5751,7 @@ static QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *)
static QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng)
{
QScriptValue act = ctx->activationObject();
- act.setProperty("count", ctx->argument(0).toInt32());
+ act.setProperty("count", ctx->argument(0).toInt());
QScriptValue result = eng->newFunction(counter_inner);
result.setScope(act);
return result;
@@ -5760,7 +5760,7 @@ static QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng)
static QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng)
{
QScriptValue act = ctx->activationObject();
- act.setProperty("count", ctx->argument(0).toInt32());
+ act.setProperty("count", ctx->argument(0).toInt());
return eng->evaluate("(function() { return count++; })");
}
@@ -5769,23 +5769,23 @@ void tst_QJSEngine::nativeFunctionScopes()
QScriptEngine eng;
{
QScriptValue fun = eng.newFunction(counter);
- QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123);
- QVERIFY(cnt.isFunction());
+ QScriptValue cnt = fun.call(QScriptValueList() << 123);
+ QVERIFY(cnt.isCallable());
{
QScriptValue ret = cnt.call();
QVERIFY(ret.isNumber());
QEXPECT_FAIL("", "QScriptValue::setScope not implemented", Continue);
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
}
{
QScriptValue fun = eng.newFunction(counter_hybrid);
- QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123);
- QVERIFY(cnt.isFunction());
+ QScriptValue cnt = fun.call(QScriptValueList() << 123);
+ QVERIFY(cnt.isCallable());
{
QScriptValue ret = cnt.call();
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
}
@@ -5917,15 +5917,15 @@ void tst_QJSEngine::evaluateProgram_closure()
QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })");
QVERIFY(!program.isNull());
QScriptValue createCounter = eng.evaluate(program);
- QVERIFY(createCounter.isFunction());
+ QVERIFY(createCounter.isCallable());
QScriptValue counter = createCounter.call();
- QVERIFY(counter.isFunction());
+ QVERIFY(counter.isCallable());
{
QScriptValue ret = counter.call();
QVERIFY(ret.isNumber());
}
QScriptValue counter2 = createCounter.call();
- QVERIFY(counter2.isFunction());
+ QVERIFY(counter2.isCallable());
QVERIFY(!counter2.equals(counter));
{
QScriptValue ret = counter2.call();
@@ -5941,7 +5941,7 @@ void tst_QJSEngine::evaluateProgram_executeLater()
{
QScriptValue fun = eng.newFunction(createProgram);
QScriptProgram program = qscriptvalue_cast<QScriptProgram>(
- fun.call(QScriptValue(), QScriptValueList() << "a + 1"));
+ fun.call(QScriptValueList() << "a + 1"));
QVERIFY(!program.isNull());
eng.globalObject().setProperty("a", QScriptValue());
{
@@ -5954,7 +5954,7 @@ void tst_QJSEngine::evaluateProgram_executeLater()
QScriptValue ret = eng.evaluate(program);
QVERIFY(!ret.isError());
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
}
}
@@ -6039,7 +6039,7 @@ void tst_QJSEngine::promoteThisObjectToQObjectInConstructor()
QVERIFY(object.isQObject());
QVERIFY(object.toQObject() != 0);
QVERIFY(object.property("objectName").isString());
- QVERIFY(object.property("deleteLater").isFunction());
+ QVERIFY(object.property("deleteLater").isCallable());
}
#endif
@@ -6089,10 +6089,10 @@ void tst_QJSEngine::qRegExpInport()
QCOMPARE(rexp.isValid(), true);
QCOMPARE(rexp.isRegExp(), true);
- QVERIFY(rexp.isFunction());
+ QVERIFY(rexp.isCallable());
QJSValue func = eng.evaluate("(function(string, regexp) { return string.match(regexp); })");
- QJSValue result = func.call(QJSValue(), QJSValueList() << string << rexp);
+ QJSValue result = func.call(QJSValueList() << string << rexp);
rx.indexIn(string);
for (int i = 0; i <= rx.captureCount(); i++) {
@@ -6139,7 +6139,7 @@ void tst_QJSEngine::dateConversionJSQt()
QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0));
QDateTime qtDate = jsDate.toDateTime();
QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
- QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString();
+ QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString();
jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
if (qtUTCDateStr != jsUTCDateStr)
QFAIL(qPrintable(jsDate.toString()));
@@ -6153,7 +6153,7 @@ void tst_QJSEngine::dateConversionQtJS()
QJSEngine eng;
for (int i = 0; i < 8000; ++i) {
QJSValue jsDate = eng.newDate(qtDate);
- QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString();
+ QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString();
jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
if (jsUTCDateStr != qtUTCDateStr)
@@ -6168,7 +6168,7 @@ static QScriptValue createAnotherEngine(QScriptContext *, QScriptEngine *)
QScriptEngine eng;
eng.evaluate("function foo(x, y) { return x + y; }" );
eng.evaluate("hello = 5; world = 6" );
- return eng.evaluate("foo(hello,world)").toInt32();
+ return eng.evaluate("foo(hello,world)").toInt();
}
@@ -6177,10 +6177,10 @@ void tst_QJSEngine::reentrency()
QScriptEngine eng;
eng.globalObject().setProperty("foo", eng.newFunction(createAnotherEngine));
eng.evaluate("function bar() { return foo(); } hello = 9; function getHello() { return hello; }");
- QCOMPARE(eng.evaluate("foo() + getHello() + foo()").toInt32(), 5+6 + 9 + 5+6);
- QCOMPARE(eng.evaluate("foo").call().toInt32(), 5+6);
- QCOMPARE(eng.evaluate("hello").toInt32(), 9);
- QCOMPARE(eng.evaluate("foo() + hello").toInt32(), 5+6+9);
+ QCOMPARE(eng.evaluate("foo() + getHello() + foo()").toInt(), 5+6 + 9 + 5+6);
+ QCOMPARE(eng.evaluate("foo").call().toInt(), 5+6);
+ QCOMPARE(eng.evaluate("hello").toInt(), 9);
+ QCOMPARE(eng.evaluate("foo() + hello").toInt(), 5+6+9);
}
#endif
@@ -6331,7 +6331,7 @@ void tst_QJSEngine::newFixedStaticScopeObject()
}
QScriptValue fun = eng.evaluate("(function() { return foo; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
eng.popContext();
// Function's scope chain persists after popContext().
QVERIFY(fun.call().equals(scope.property("foo")));
@@ -6423,7 +6423,7 @@ void tst_QJSEngine::newGrowingStaticScopeObject()
// Function declarations will create properties on the scope.
eng.evaluate("function fun() { return baz; }");
- QVERIFY(scope.property("fun").isFunction());
+ QVERIFY(scope.property("fun").isCallable());
QVERIFY(scope.property("fun").call().equals(scope.property("baz")));
// Demonstrate the limitation of a growable static scope: Once a function that
@@ -6431,7 +6431,7 @@ void tst_QJSEngine::newGrowingStaticScopeObject()
// to the scope later.
{
QScriptValue fun = eng.evaluate("(function() { return futureProperty; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QVERIFY(fun.call().toString().contains(QString::fromLatin1("ReferenceError")));
scope.setProperty("futureProperty", "added after the function was compiled");
// If scope were dynamic, this would return the new property.
@@ -6456,13 +6456,13 @@ void tst_QJSEngine::scriptValueFromQMetaObject()
QCOMPARE(meta.toQMetaObject(), &QScriptEngine::staticMetaObject);
// Because of missing Q_SCRIPT_DECLARE_QMETAOBJECT() for QScriptEngine.
QEXPECT_FAIL("", "FIXME: because construct never returns invalid values", Continue);
- QVERIFY(!meta.construct().isValid());
+ QVERIFY(!meta.callAsConstructor().isValid());
}
{
QScriptValue meta = eng.scriptValueFromQMetaObject<QStandardItemModel>();
QVERIFY(meta.isQMetaObject());
QCOMPARE(meta.toQMetaObject(), &QStandardItemModel::staticMetaObject);
- QScriptValue obj = meta.construct(QScriptValueList() << eng.newQObject(&eng));
+ QScriptValue obj = meta.callAsConstructor(QScriptValueList() << eng.newQObject(&eng));
QVERIFY(obj.isQObject());
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(obj.toQObject());
QVERIFY(model != 0);
@@ -6476,17 +6476,17 @@ void tst_QJSEngine::functionPrototypeExtensions()
// QJS adds connect and disconnect properties to Function.prototype.
QJSEngine eng;
QJSValue funProto = eng.globalObject().property("Function").property("prototype");
- QVERIFY(funProto.isFunction());
- QVERIFY(funProto.property("connect").isFunction());
+ QVERIFY(funProto.isCallable());
+ QVERIFY(funProto.property("connect").isCallable());
QCOMPARE(funProto.propertyFlags("connect"), QJSValue::SkipInEnumeration);
- QVERIFY(funProto.property("disconnect").isFunction());
+ QVERIFY(funProto.property("disconnect").isCallable());
QCOMPARE(funProto.propertyFlags("disconnect"), QJSValue::SkipInEnumeration);
// No properties should appear in for-in statements.
QJSValue props = eng.evaluate("props = []; for (var p in Function.prototype) props.push(p); props");
QVERIFY(!eng.hasUncaughtException());
QVERIFY(props.isArray());
- QCOMPARE(props.property("length").toInt32(), 0);
+ QCOMPARE(props.property("length").toInt(), 0);
}
class ThreadedTestEngine : public QThread {
diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
index 5a9ccc521c..52e47732ae 100644
--- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -123,7 +123,7 @@ void tst_QJSValue::ctor_int()
{
QJSValue v(int(0x43211234));
QVERIFY(v.isNumber());
- QCOMPARE(v.toInt32(), 0x43211234);
+ QCOMPARE(v.toInt(), 0x43211234);
}
{
QJSValue v(int(1));
@@ -153,7 +153,7 @@ void tst_QJSValue::ctor_uint()
{
QJSValue v(uint(0x43211234));
QVERIFY(v.isNumber());
- QCOMPARE(v.toUInt32(), uint(0x43211234));
+ QCOMPARE(v.toUInt(), uint(0x43211234));
}
{
QJSValue v(uint(1));
@@ -818,271 +818,271 @@ void tst_QJSValue::toInteger()
QCOMPARE(inv.toInteger(), 0.0);
}
-void tst_QJSValue::toInt32()
+void tst_QJSValue::toInt()
{
QJSEngine eng;
{
QJSValue zer0 = QJSValue(&eng, 0.0);
- QCOMPARE(zer0.toInt32(), 0);
+ QCOMPARE(zer0.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(zer0), 0);
QJSValue number = QJSValue(&eng, 123.0);
- QCOMPARE(number.toInt32(), 123);
+ QCOMPARE(number.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(number), 123);
QJSValue number2 = QJSValue(&eng, qSNaN());
- QCOMPARE(number2.toInt32(), 0);
+ QCOMPARE(number2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number2), 0);
QJSValue number3 = QJSValue(&eng, +qInf());
- QCOMPARE(number3.toInt32(), 0);
+ QCOMPARE(number3.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number3), 0);
QJSValue number3_2 = QJSValue(&eng, -qInf());
- QCOMPARE(number3_2.toInt32(), 0);
+ QCOMPARE(number3_2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0);
QJSValue number4 = QJSValue(&eng, 0.5);
- QCOMPARE(number4.toInt32(), 0);
+ QCOMPARE(number4.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number4), 0);
QJSValue number5 = QJSValue(&eng, 123.5);
- QCOMPARE(number5.toInt32(), 123);
+ QCOMPARE(number5.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(number5), 123);
QJSValue number6 = QJSValue(&eng, -456.5);
- QCOMPARE(number6.toInt32(), -456);
+ QCOMPARE(number6.toInt(), -456);
QCOMPARE(qjsvalue_cast<qint32>(number6), -456);
QJSValue str = QJSValue(&eng, QLatin1String("123.0"));
- QCOMPARE(str.toInt32(), 123);
+ QCOMPARE(str.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(str), 123);
QJSValue str2 = QJSValue(&eng, QLatin1String("NaN"));
- QCOMPARE(str2.toInt32(), 0);
+ QCOMPARE(str2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str2), 0);
QJSValue str3 = QJSValue(&eng, QLatin1String("Infinity"));
- QCOMPARE(str3.toInt32(), 0);
+ QCOMPARE(str3.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str3), 0);
QJSValue str3_2 = QJSValue(&eng, QLatin1String("-Infinity"));
- QCOMPARE(str3_2.toInt32(), 0);
+ QCOMPARE(str3_2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0);
QJSValue str4 = QJSValue(&eng, QLatin1String("0.5"));
- QCOMPARE(str4.toInt32(), 0);
+ QCOMPARE(str4.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str4), 0);
QJSValue str5 = QJSValue(&eng, QLatin1String("123.5"));
- QCOMPARE(str5.toInt32(), 123);
+ QCOMPARE(str5.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(str5), 123);
QJSValue str6 = QJSValue(&eng, QLatin1String("-456.5"));
- QCOMPARE(str6.toInt32(), -456);
+ QCOMPARE(str6.toInt(), -456);
QCOMPARE(qjsvalue_cast<qint32>(str6), -456);
}
// V2 constructors
{
QJSValue zer0 = QJSValue(0.0);
- QCOMPARE(zer0.toInt32(), 0);
+ QCOMPARE(zer0.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(zer0), 0);
QJSValue number = QJSValue(123.0);
- QCOMPARE(number.toInt32(), 123);
+ QCOMPARE(number.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(number), 123);
QJSValue number2 = QJSValue(qSNaN());
- QCOMPARE(number2.toInt32(), 0);
+ QCOMPARE(number2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number2), 0);
QJSValue number3 = QJSValue(+qInf());
- QCOMPARE(number3.toInt32(), 0);
+ QCOMPARE(number3.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number3), 0);
QJSValue number3_2 = QJSValue(-qInf());
- QCOMPARE(number3_2.toInt32(), 0);
+ QCOMPARE(number3_2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0);
QJSValue number4 = QJSValue(0.5);
- QCOMPARE(number4.toInt32(), 0);
+ QCOMPARE(number4.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(number4), 0);
QJSValue number5 = QJSValue(123.5);
- QCOMPARE(number5.toInt32(), 123);
+ QCOMPARE(number5.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(number5), 123);
QJSValue number6 = QJSValue(-456.5);
- QCOMPARE(number6.toInt32(), -456);
+ QCOMPARE(number6.toInt(), -456);
QCOMPARE(qjsvalue_cast<qint32>(number6), -456);
QJSValue number7 = QJSValue(0x43211234);
- QCOMPARE(number7.toInt32(), 0x43211234);
+ QCOMPARE(number7.toInt(), 0x43211234);
QJSValue str = QJSValue("123.0");
- QCOMPARE(str.toInt32(), 123);
+ QCOMPARE(str.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(str), 123);
QJSValue str2 = QJSValue("NaN");
- QCOMPARE(str2.toInt32(), 0);
+ QCOMPARE(str2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str2), 0);
QJSValue str3 = QJSValue("Infinity");
- QCOMPARE(str3.toInt32(), 0);
+ QCOMPARE(str3.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str3), 0);
QJSValue str3_2 = QJSValue("-Infinity");
- QCOMPARE(str3_2.toInt32(), 0);
+ QCOMPARE(str3_2.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0);
QJSValue str4 = QJSValue("0.5");
- QCOMPARE(str4.toInt32(), 0);
+ QCOMPARE(str4.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(str4), 0);
QJSValue str5 = QJSValue("123.5");
- QCOMPARE(str5.toInt32(), 123);
+ QCOMPARE(str5.toInt(), 123);
QCOMPARE(qjsvalue_cast<qint32>(str5), 123);
QJSValue str6 = QJSValue("-456.5");
- QCOMPARE(str6.toInt32(), -456);
+ QCOMPARE(str6.toInt(), -456);
QCOMPARE(qjsvalue_cast<qint32>(str6), -456);
}
QJSValue inv;
- QCOMPARE(inv.toInt32(), 0);
+ QCOMPARE(inv.toInt(), 0);
QCOMPARE(qjsvalue_cast<qint32>(inv), 0);
}
-void tst_QJSValue::toUInt32()
+void tst_QJSValue::toUInt()
{
QJSEngine eng;
{
- QJSValue zer0 = QJSValue(&eng, 0.0);
- QCOMPARE(zer0.toUInt32(), quint32(0));
+ QJSValue zer0 = eng.toScriptValue(0.0);
+ QCOMPARE(zer0.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0));
- QJSValue number = QJSValue(&eng, 123.0);
- QCOMPARE(number.toUInt32(), quint32(123));
+ QJSValue number = eng.toScriptValue(123.0);
+ QCOMPARE(number.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123));
- QJSValue number2 = QJSValue(&eng, qSNaN());
- QCOMPARE(number2.toUInt32(), quint32(0));
+ QJSValue number2 = eng.toScriptValue(qSNaN());
+ QCOMPARE(number2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0));
- QJSValue number3 = QJSValue(&eng, +qInf());
- QCOMPARE(number3.toUInt32(), quint32(0));
+ QJSValue number3 = eng.toScriptValue(+qInf());
+ QCOMPARE(number3.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0));
- QJSValue number3_2 = QJSValue(&eng, -qInf());
- QCOMPARE(number3_2.toUInt32(), quint32(0));
+ QJSValue number3_2 = eng.toScriptValue(-qInf());
+ QCOMPARE(number3_2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0));
- QJSValue number4 = QJSValue(&eng, 0.5);
- QCOMPARE(number4.toUInt32(), quint32(0));
+ QJSValue number4 = eng.toScriptValue(0.5);
+ QCOMPARE(number4.toUInt(), quint32(0));
- QJSValue number5 = QJSValue(&eng, 123.5);
- QCOMPARE(number5.toUInt32(), quint32(123));
+ QJSValue number5 = eng.toScriptValue(123.5);
+ QCOMPARE(number5.toUInt(), quint32(123));
- QJSValue number6 = QJSValue(&eng, -456.5);
- QCOMPARE(number6.toUInt32(), quint32(-456));
+ QJSValue number6 = eng.toScriptValue(-456.5);
+ QCOMPARE(number6.toUInt(), quint32(-456));
QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456));
- QJSValue str = QJSValue(&eng, QLatin1String("123.0"));
- QCOMPARE(str.toUInt32(), quint32(123));
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("123.0"));
+ QCOMPARE(str.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123));
- QJSValue str2 = QJSValue(&eng, QLatin1String("NaN"));
- QCOMPARE(str2.toUInt32(), quint32(0));
+ QJSValue str2 = eng.toScriptValue(QString::fromLatin1("NaN"));
+ QCOMPARE(str2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0));
- QJSValue str3 = QJSValue(&eng, QLatin1String("Infinity"));
- QCOMPARE(str3.toUInt32(), quint32(0));
+ QJSValue str3 = eng.toScriptValue(QString::fromLatin1("Infinity"));
+ QCOMPARE(str3.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0));
- QJSValue str3_2 = QJSValue(&eng, QLatin1String("-Infinity"));
- QCOMPARE(str3_2.toUInt32(), quint32(0));
+ QJSValue str3_2 = eng.toScriptValue(QString::fromLatin1("-Infinity"));
+ QCOMPARE(str3_2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0));
- QJSValue str4 = QJSValue(&eng, QLatin1String("0.5"));
- QCOMPARE(str4.toUInt32(), quint32(0));
+ QJSValue str4 = eng.toScriptValue(QString::fromLatin1("0.5"));
+ QCOMPARE(str4.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0));
- QJSValue str5 = QJSValue(&eng, QLatin1String("123.5"));
- QCOMPARE(str5.toUInt32(), quint32(123));
+ QJSValue str5 = eng.toScriptValue(QString::fromLatin1("123.5"));
+ QCOMPARE(str5.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123));
- QJSValue str6 = QJSValue(&eng, QLatin1String("-456.5"));
- QCOMPARE(str6.toUInt32(), quint32(-456));
+ QJSValue str6 = eng.toScriptValue(QString::fromLatin1("-456.5"));
+ QCOMPARE(str6.toUInt(), quint32(-456));
QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456));
}
// V2 constructors
{
QJSValue zer0 = QJSValue(0.0);
- QCOMPARE(zer0.toUInt32(), quint32(0));
+ QCOMPARE(zer0.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0));
QJSValue number = QJSValue(123.0);
- QCOMPARE(number.toUInt32(), quint32(123));
+ QCOMPARE(number.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123));
QJSValue number2 = QJSValue(qSNaN());
- QCOMPARE(number2.toUInt32(), quint32(0));
+ QCOMPARE(number2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0));
QJSValue number3 = QJSValue(+qInf());
- QCOMPARE(number3.toUInt32(), quint32(0));
+ QCOMPARE(number3.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0));
QJSValue number3_2 = QJSValue(-qInf());
- QCOMPARE(number3_2.toUInt32(), quint32(0));
+ QCOMPARE(number3_2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0));
QJSValue number4 = QJSValue(0.5);
- QCOMPARE(number4.toUInt32(), quint32(0));
+ QCOMPARE(number4.toUInt(), quint32(0));
QJSValue number5 = QJSValue(123.5);
- QCOMPARE(number5.toUInt32(), quint32(123));
+ QCOMPARE(number5.toUInt(), quint32(123));
QJSValue number6 = QJSValue(-456.5);
- QCOMPARE(number6.toUInt32(), quint32(-456));
+ QCOMPARE(number6.toUInt(), quint32(-456));
QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456));
QJSValue number7 = QJSValue(0x43211234);
- QCOMPARE(number7.toUInt32(), quint32(0x43211234));
+ QCOMPARE(number7.toUInt(), quint32(0x43211234));
QJSValue str = QJSValue(QLatin1String("123.0"));
- QCOMPARE(str.toUInt32(), quint32(123));
+ QCOMPARE(str.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123));
QJSValue str2 = QJSValue(QLatin1String("NaN"));
- QCOMPARE(str2.toUInt32(), quint32(0));
+ QCOMPARE(str2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0));
QJSValue str3 = QJSValue(QLatin1String("Infinity"));
- QCOMPARE(str3.toUInt32(), quint32(0));
+ QCOMPARE(str3.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0));
QJSValue str3_2 = QJSValue(QLatin1String("-Infinity"));
- QCOMPARE(str3_2.toUInt32(), quint32(0));
+ QCOMPARE(str3_2.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0));
QJSValue str4 = QJSValue(QLatin1String("0.5"));
- QCOMPARE(str4.toUInt32(), quint32(0));
+ QCOMPARE(str4.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0));
QJSValue str5 = QJSValue(QLatin1String("123.5"));
- QCOMPARE(str5.toUInt32(), quint32(123));
+ QCOMPARE(str5.toUInt(), quint32(123));
QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123));
QJSValue str6 = QJSValue(QLatin1String("-456.5"));
- QCOMPARE(str6.toUInt32(), quint32(-456));
+ QCOMPARE(str6.toUInt(), quint32(-456));
QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456));
}
QJSValue inv;
- QCOMPARE(inv.toUInt32(), quint32(0));
+ QCOMPARE(inv.toUInt(), quint32(0));
QCOMPARE(qjsvalue_cast<quint32>(inv), quint32(0));
}
@@ -1340,7 +1340,7 @@ void tst_QJSValue::toVariant()
listIn << 123 << "hello";
QJSValue array = qScriptValueFromValue(&eng, listIn);
QVERIFY(array.isArray());
- QCOMPARE(array.property("length").toInt32(), 2);
+ QCOMPARE(array.property("length").toInt(), 2);
QVariant ret = array.toVariant();
QCOMPARE(ret.type(), QVariant::List);
QVariantList listOut = ret.toList();
@@ -1350,8 +1350,8 @@ void tst_QJSValue::toVariant()
// round-trip conversion
QJSValue array2 = qScriptValueFromValue(&eng, ret);
QVERIFY(array2.isArray());
- QCOMPARE(array2.property("length").toInt32(), array.property("length").toInt32());
- for (int i = 0; i < array.property("length").toInt32(); ++i)
+ QCOMPARE(array2.property("length").toInt(), array.property("length").toInt());
+ for (int i = 0; i < array.property("length").toInt(); ++i)
QVERIFY(array2.property(i).strictlyEquals(array.property(i)));
}
#endif
@@ -1530,7 +1530,7 @@ void tst_QJSValue::toObject()
{
QJSValue tmp = eng.toObject(number);
QVERIFY(tmp.isObject());
- QCOMPARE(tmp.toInt32(), number.toInt32());
+ QCOMPARE(tmp.toInt(), number.toInt());
}
QVERIFY(number.isNumber());
@@ -1698,7 +1698,7 @@ void tst_QJSValue::isError_propertiesOfGlobalObject()
QJSEngine eng;
for (int i = 0; i < errors.size(); ++i) {
QJSValue ctor = eng.globalObject().property(errors.at(i));
- QVERIFY(ctor.isFunction());
+ QVERIFY(ctor.isCallable());
QVERIFY(ctor.property("prototype").isError());
}
}
@@ -1792,6 +1792,101 @@ static QJSValue getSet__proto__(QScriptContext *ctx, QScriptEngine *)
}
#endif
+void tst_QJSValue::hasProperty_basic()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QVERIFY(obj.hasProperty("hasOwnProperty")); // inherited from Object.prototype
+ QVERIFY(!obj.hasOwnProperty("hasOwnProperty"));
+
+ QVERIFY(!obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+ obj.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(obj.hasOwnProperty("foo"));
+
+ QVERIFY(!obj.hasProperty("bar"));
+ QVERIFY(!obj.hasOwnProperty("bar"));
+}
+
+void tst_QJSValue::hasProperty_globalObject()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+ QVERIFY(global.hasProperty("Math"));
+ QVERIFY(global.hasOwnProperty("Math"));
+ QVERIFY(!global.hasProperty("NoSuchStandardProperty"));
+ QVERIFY(!global.hasOwnProperty("NoSuchStandardProperty"));
+
+ QVERIFY(!global.hasProperty("foo"));
+ QVERIFY(!global.hasOwnProperty("foo"));
+ global.setProperty("foo", 123);
+ QVERIFY(global.hasProperty("foo"));
+ QVERIFY(global.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::hasProperty_changePrototype()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QJSValue proto = eng.newObject();
+ obj.setPrototype(proto);
+
+ QVERIFY(!obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+ proto.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+
+ obj.setProperty("foo", 456); // override prototype property
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(obj.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::deleteProperty_basic()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(obj.deleteProperty("foo"));
+
+ obj.setProperty("foo", 123);
+ QVERIFY(obj.deleteProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::deleteProperty_globalObject()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(global.deleteProperty("foo"));
+
+ global.setProperty("foo", 123);
+ QVERIFY(global.deleteProperty("foo"));
+ QVERIFY(!global.hasProperty("foo"));
+
+ QVERIFY(global.deleteProperty("Math"));
+ QVERIFY(!global.hasProperty("Math"));
+
+ QVERIFY(!global.deleteProperty("NaN")); // read-only
+ QVERIFY(global.hasProperty("NaN"));
+}
+
+void tst_QJSValue::deleteProperty_inPrototype()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QJSValue proto = eng.newObject();
+ obj.setPrototype(proto);
+
+ proto.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(obj.deleteProperty("foo"));
+ QVERIFY(obj.hasProperty("foo"));
+}
+
void tst_QJSValue::getSetProperty_HooliganTask162051()
{
QJSEngine eng;
@@ -2102,9 +2197,9 @@ void tst_QJSValue::getSetProperty_gettersAndSettersChange()
eng.globalObject().setProperty("object", object);
QJSValue res = eng.evaluate("object.x = 89; var a = object.foo; object.foo = 65; a");
- QCOMPARE(res.toInt32(), 89);
- QCOMPARE(object.property("x").toInt32(), 65);
- QCOMPARE(object.property("foo").toInt32(), 65);
+ QCOMPARE(res.toInt(), 89);
+ QCOMPARE(object.property("x").toInt(), 65);
+ QCOMPARE(object.property("foo").toInt(), 65);
#endif
}
@@ -2119,13 +2214,13 @@ void tst_QJSValue::getSetProperty_array()
array.setProperty(0, num);
QCOMPARE(array.property(0).toNumber(), num.toNumber());
QCOMPARE(array.property("0").toNumber(), num.toNumber());
- QCOMPARE(array.property("length").toUInt32(), quint32(1));
+ QCOMPARE(array.property("length").toUInt(), quint32(1));
array.setProperty(1, str);
QCOMPARE(array.property(1).toString(), str.toString());
QCOMPARE(array.property("1").toString(), str.toString());
- QCOMPARE(array.property("length").toUInt32(), quint32(2));
+ QCOMPARE(array.property("length").toUInt(), quint32(2));
array.setProperty("length", QJSValue(&eng, 1));
- QCOMPARE(array.property("length").toUInt32(), quint32(1));
+ QCOMPARE(array.property("length").toUInt(), quint32(1));
QCOMPARE(array.property(1).isValid(), false);
}
@@ -2487,7 +2582,7 @@ void tst_QJSValue::getSetScope()
{
QJSValue ret = object2.property("foo", QJSValue::ResolveScope);
QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 123);
+ QCOMPARE(ret.toInt(), 123);
}
QJSValue inv;
@@ -2721,18 +2816,18 @@ void tst_QJSValue::call_function()
{
QJSEngine eng;
QJSValue fun = eng.evaluate("(function() { return 1; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QJSValue result = fun.call();
QVERIFY(result.isNumber());
- QCOMPARE(result.toInt32(), 1);
+ QCOMPARE(result.toInt(), 1);
}
void tst_QJSValue::call_object()
{
QJSEngine eng;
QJSValue Object = eng.evaluate("Object");
- QCOMPARE(Object.isFunction(), true);
- QJSValue result = Object.call(Object);
+ QCOMPARE(Object.isCallable(), true);
+ QJSValue result = Object.callWithInstance(Object);
QCOMPARE(result.isObject(), true);
}
@@ -2742,10 +2837,10 @@ void tst_QJSValue::call_newObjects()
// test that call() doesn't construct new objects
QJSValue Number = eng.evaluate("Number");
QJSValue Object = eng.evaluate("Object");
- QCOMPARE(Object.isFunction(), true);
+ QCOMPARE(Object.isCallable(), true);
QJSValueList args;
args << QJSValue(&eng, 123);
- QJSValue result = Number.call(Object, args);
+ QJSValue result = Number.callWithInstance(Object, args);
QCOMPARE(result.strictlyEquals(args.at(0)), true);
}
@@ -2754,10 +2849,10 @@ void tst_QJSValue::call_this()
QJSEngine eng;
// test that correct "this" object is used
QJSValue fun = eng.evaluate("(function() { return this; })");
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QJSValue numberObject = QJSValue(&eng, 123.0).toObject();
- QJSValue result = fun.call(numberObject);
+ QJSValue result = fun.callWithInstance(numberObject);
QCOMPARE(result.isObject(), true);
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2768,15 +2863,15 @@ void tst_QJSValue::call_arguments()
// test that correct arguments are passed
QJSValue fun = eng.evaluate("(function() { return arguments[0]; })");
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
{
- QJSValue result = fun.call(eng.undefinedValue());
+ QJSValue result = fun.callWithInstance(eng.undefinedValue());
QCOMPARE(result.isUndefined(), true);
}
{
QJSValueList args;
args << QJSValue(&eng, 123.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2784,7 +2879,7 @@ void tst_QJSValue::call_arguments()
{
QJSValueList args;
args << QJSValue(123.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2792,7 +2887,7 @@ void tst_QJSValue::call_arguments()
{
QJSValue args = eng.newArray();
args.setProperty(0, 123);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QVERIFY(result.isNumber());
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2804,12 +2899,12 @@ void tst_QJSValue::call()
QJSEngine eng;
{
QJSValue fun = eng.evaluate("(function() { return arguments[1]; })");
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
{
QJSValueList args;
args << QJSValue(&eng, 123.0) << QJSValue(&eng, 456.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 456.0);
}
@@ -2818,7 +2913,7 @@ void tst_QJSValue::call()
QJSValue args = eng.newArray();
args.setProperty(0, 123);
args.setProperty(1, 456);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QVERIFY(result.isNumber());
QCOMPARE(result.toNumber(), 456.0);
}
@@ -2826,7 +2921,7 @@ void tst_QJSValue::call()
}
{
QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })");
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QVERIFY(!eng.hasUncaughtException());
{
@@ -2843,7 +2938,7 @@ void tst_QJSValue::call()
{
QJSValueList args;
args << QJSValue(&eng, 123.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QVERIFY(!eng.hasUncaughtException());
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 123.0);
@@ -2852,7 +2947,7 @@ void tst_QJSValue::call()
{
QJSValueList args;
args << QJSValue(123.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2860,7 +2955,7 @@ void tst_QJSValue::call()
{
QJSValue args = eng.newArray();
args.setProperty(0, 123);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QVERIFY(result.isNumber());
QCOMPARE(result.toNumber(), 123.0);
}
@@ -2871,7 +2966,7 @@ void tst_QJSValue::call()
{
QJSValueList args;
args << QJSValue(&eng, 123.0);
- QJSValue result = fun.call(eng.undefinedValue(), args);
+ QJSValue result = fun.callWithInstance(eng.undefinedValue(), args);
QVERIFY(!eng.hasUncaughtException());
QCOMPARE(result.isNumber(), true);
QCOMPARE(result.toNumber(), 123.0);
@@ -2890,7 +2985,7 @@ void tst_QJSValue::call_invalidArguments()
{
QJSValueList args;
args << QJSValue();
- QJSValue ret = fun.call(QJSValue(), args);
+ QJSValue ret = fun.callWithInstance(args);
QVERIFY(!eng.hasUncaughtException());
QCOMPARE(ret.isValid(), true);
QCOMPARE(ret.isUndefined(), true);
@@ -2901,7 +2996,7 @@ void tst_QJSValue::call_invalidArguments()
{
QJSValueList args;
args << QJSValue();
- QJSValue ret = fun.call(QJSValue(), args);
+ QJSValue ret = fun.call(args);
QCOMPARE(ret.isValid(), true);
QCOMPARE(ret.isUndefined(), true);
}
@@ -2911,7 +3006,7 @@ void tst_QJSValue::call_invalidArguments()
{
QJSValueList args;
args << QJSValue() << QJSValue();
- QJSValue ret = fun.call(QJSValue(), args);
+ QJSValue ret = fun.call(args);
QCOMPARE(ret.isValid(), true);
QCOMPARE(ret.isNumber(), true);
QCOMPARE(qIsNaN(ret.toNumber()), true);
@@ -2940,25 +3035,25 @@ void tst_QJSValue::call_twoEngines()
QJSValue object = eng.evaluate("Object");
QJSEngine otherEngine;
QJSValue fun = otherEngine.evaluate("(function() { return 1; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QTest::ignoreMessage(QtWarningMsg, "JSValue can't be rassigned to an another engine.");
QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: "
"cannot call function with thisObject created in "
"a different engine");
- QCOMPARE(fun.call(object).isValid(), false);
+ QCOMPARE(fun.callWithInstance(object).isValid(), false);
QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: "
"cannot call function with argument created in "
"a different engine");
- QCOMPARE(fun.call(QJSValue(), QJSValueList() << QJSValue(&eng, 123)).isValid(), false);
+ QCOMPARE(fun.call(QJSValueList() << QJSValue(&eng, 123)).isValid(), false);
{
QJSValue fun = eng.evaluate("Object");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QJSEngine eng2;
QJSValue objectInDifferentEngine = eng2.newObject();
QJSValueList args;
args << objectInDifferentEngine;
QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: cannot call function with argument created in a different engine");
- fun.call(QJSValue(), args);
+ fun.call(args);
}
}
@@ -2967,7 +3062,7 @@ void tst_QJSValue::call_array()
#if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API
QScriptEngine eng;
QJSValue fun = eng.evaluate("(function() { return arguments; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QJSValue array = eng.newArray(3);
array.setProperty(0, QJSValue(&eng, 123.0));
array.setProperty(1, QJSValue(&eng, 456.0));
@@ -3069,18 +3164,18 @@ void tst_QJSValue::construct_nonFunction_data()
void tst_QJSValue::construct_nonFunction()
{
QFETCH(QJSValue, value);
- QVERIFY(!value.construct().isValid());
+ QVERIFY(!value.callAsConstructor().isValid());
}
void tst_QJSValue::construct_simple()
{
QJSEngine eng;
QJSValue fun = eng.evaluate("(function () { this.foo = 123; })");
- QVERIFY(fun.isFunction());
- QJSValue ret = fun.construct();
+ QVERIFY(fun.isCallable());
+ QJSValue ret = fun.callAsConstructor();
QVERIFY(ret.isObject());
QVERIFY(ret.instanceOf(fun));
- QCOMPARE(ret.property("foo").toInt32(), 123);
+ QCOMPARE(ret.property("foo").toInt(), 123);
}
void tst_QJSValue::construct_newObjectJS()
@@ -3088,11 +3183,11 @@ void tst_QJSValue::construct_newObjectJS()
QJSEngine eng;
// returning a different object overrides the default-constructed one
QJSValue fun = eng.evaluate("(function () { return { bar: 456 }; })");
- QVERIFY(fun.isFunction());
- QJSValue ret = fun.construct();
+ QVERIFY(fun.isCallable());
+ QJSValue ret = fun.callAsConstructor();
QVERIFY(ret.isObject());
QVERIFY(!ret.instanceOf(fun));
- QCOMPARE(ret.property("bar").toInt32(), 456);
+ QCOMPARE(ret.property("bar").toInt(), 456);
}
#if 0 // FIXME: no c-style callbacks
@@ -3100,20 +3195,20 @@ void tst_QJSValue::construct_undefined()
{
QScriptEngine eng;
QJSValue fun = eng.newFunction(ctorReturningUndefined);
- QJSValue ret = fun.construct();
+ QJSValue ret = fun.callAsConstructor();
QVERIFY(ret.isObject());
QVERIFY(ret.instanceOf(fun));
- QCOMPARE(ret.property("foo").toInt32(), 123);
+ QCOMPARE(ret.property("foo").toInt(), 123);
}
void tst_QJSValue::construct_newObjectCpp()
{
QScriptEngine eng;
QJSValue fun = eng.newFunction(ctorReturningNewObject);
- QJSValue ret = fun.construct();
+ QJSValue ret = fun.callAsConstructor();
QVERIFY(ret.isObject());
QVERIFY(!ret.instanceOf(fun));
- QCOMPARE(ret.property("bar").toInt32(), 456);
+ QCOMPARE(ret.property("bar").toInt(), 456);
}
#endif
@@ -3121,10 +3216,10 @@ void tst_QJSValue::construct_arg()
{
QJSEngine eng;
QJSValue Number = eng.evaluate("Number");
- QCOMPARE(Number.isFunction(), true);
+ QCOMPARE(Number.isCallable(), true);
QJSValueList args;
args << QJSValue(&eng, 123);
- QJSValue ret = Number.construct(args);
+ QJSValue ret = Number.callAsConstructor(args);
QCOMPARE(ret.isObject(), true);
QCOMPARE(ret.toNumber(), args.at(0).toNumber());
}
@@ -3134,9 +3229,9 @@ void tst_QJSValue::construct_proto()
QJSEngine eng;
// test that internal prototype is set correctly
QJSValue fun = eng.evaluate("(function() { return this.__proto__; })");
- QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isCallable(), true);
QCOMPARE(fun.property("prototype").isObject(), true);
- QJSValue ret = fun.construct();
+ QJSValue ret = fun.callAsConstructor();
QCOMPARE(fun.property("prototype").strictlyEquals(ret), true);
}
@@ -3145,8 +3240,8 @@ void tst_QJSValue::construct_returnInt()
QJSEngine eng;
// test that we return the new object even if a non-object value is returned from the function
QJSValue fun = eng.evaluate("(function() { return 123; })");
- QCOMPARE(fun.isFunction(), true);
- QJSValue ret = fun.construct();
+ QCOMPARE(fun.isCallable(), true);
+ QJSValue ret = fun.callAsConstructor();
QCOMPARE(ret.isObject(), true);
}
@@ -3154,8 +3249,8 @@ void tst_QJSValue::construct_throw()
{
QJSEngine eng;
QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })");
- QCOMPARE(fun.isFunction(), true);
- QJSValue ret = fun.construct();
+ QCOMPARE(fun.isCallable(), true);
+ QJSValue ret = fun.callAsConstructor();
QCOMPARE(ret.isError(), true);
QCOMPARE(eng.hasUncaughtException(), true);
QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
@@ -3166,13 +3261,13 @@ void tst_QJSValue::construct()
{
QScriptEngine eng;
QJSValue fun = eng.evaluate("(function() { return arguments; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
QJSValue array = eng.newArray(3);
array.setProperty(0, QJSValue(&eng, 123.0));
array.setProperty(1, QJSValue(&eng, 456.0));
array.setProperty(2, QJSValue(&eng, 789.0));
// construct with single array object as arguments
- QJSValue ret = fun.construct(array);
+ QJSValue ret = fun.callAsConstructor(array);
QVERIFY(!eng.hasUncaughtException());
QVERIFY(ret.isValid());
QVERIFY(ret.isObject());
@@ -3180,25 +3275,25 @@ void tst_QJSValue::construct()
QCOMPARE(ret.property(1).strictlyEquals(array.property(1)), true);
QCOMPARE(ret.property(2).strictlyEquals(array.property(2)), true);
// construct with arguments object as arguments
- QJSValue ret2 = fun.construct(ret);
+ QJSValue ret2 = fun.callAsConstructor(ret);
QCOMPARE(ret2.property(0).strictlyEquals(ret.property(0)), true);
QCOMPARE(ret2.property(1).strictlyEquals(ret.property(1)), true);
QCOMPARE(ret2.property(2).strictlyEquals(ret.property(2)), true);
// construct with null as arguments
- QJSValue ret3 = fun.construct(eng.nullValue());
+ QJSValue ret3 = fun.callAsConstructor(eng.nullValue());
QCOMPARE(ret3.isError(), false);
QCOMPARE(ret3.property("length").isNumber(), true);
QCOMPARE(ret3.property("length").toNumber(), 0.0);
// construct with undefined as arguments
- QJSValue ret4 = fun.construct(eng.undefinedValue());
+ QJSValue ret4 = fun.callAsConstructor(eng.undefinedValue());
QCOMPARE(ret4.isError(), false);
QCOMPARE(ret4.property("length").isNumber(), true);
QCOMPARE(ret4.property("length").toNumber(), 0.0);
// construct with something else as arguments
- QJSValue ret5 = fun.construct(QJSValue(&eng, 123.0));
+ QJSValue ret5 = fun.callAsConstructor(QJSValue(&eng, 123.0));
QCOMPARE(ret5.isError(), true);
// construct with a non-array object as arguments
- QJSValue ret6 = fun.construct(eng.globalObject());
+ QJSValue ret6 = fun.callAsConstructor(eng.globalObject());
QVERIFY(ret6.isError());
QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
}
@@ -3210,20 +3305,20 @@ void tst_QJSValue::construct_twoEngines()
QJSEngine otherEngine;
QJSValue ctor = engine.evaluate("(function (a, b) { this.foo = 123; })");
QJSValue arg(&otherEngine, 124567);
- QTest::ignoreMessage(QtWarningMsg, "QJSValue::construct() failed: cannot construct function with argument created in a different engine");
- QVERIFY(!ctor.construct(QJSValueList() << arg).isValid());
- QTest::ignoreMessage(QtWarningMsg, "QJSValue::construct() failed: cannot construct function with argument created in a different engine");
- QVERIFY(!ctor.construct(QJSValueList() << arg << otherEngine.newObject()).isValid());
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
+ QVERIFY(!ctor.callAsConstructor(QJSValueList() << arg).isValid());
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
+ QVERIFY(!ctor.callAsConstructor(QJSValueList() << arg << otherEngine.newObject()).isValid());
}
void tst_QJSValue::construct_constructorThrowsPrimitive()
{
QJSEngine eng;
QJSValue fun = eng.evaluate("(function() { throw 123; })");
- QVERIFY(fun.isFunction());
+ QVERIFY(fun.isCallable());
// construct(QJSValueList)
{
- QJSValue ret = fun.construct();
+ QJSValue ret = fun.callAsConstructor();
QVERIFY(ret.isNumber());
QCOMPARE(ret.toNumber(), 123.0);
QVERIFY(eng.hasUncaughtException());
@@ -3233,7 +3328,7 @@ void tst_QJSValue::construct_constructorThrowsPrimitive()
#if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API
// construct(QJSValue)
{
- QJSValue ret = fun.construct(eng.newArray());
+ QJSValue ret = fun.callAsConstructor(eng.newArray());
QVERIFY(ret.isNumber());
QCOMPARE(ret.toNumber(), 123.0);
QVERIFY(eng.hasUncaughtException());
@@ -3443,17 +3538,17 @@ void tst_QJSValue::equals()
QVERIFY(!qobj2.equals(obj2)); // compares the QObject pointers
QJSValue compareFun = eng.evaluate("(function(a, b) { return a == b; })");
- QVERIFY(compareFun.isFunction());
+ QVERIFY(compareFun.isCallable());
{
- QJSValue ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj2);
+ QJSValue ret = compareFun.call(QJSValueList() << qobj1 << qobj2);
QVERIFY(ret.isBool());
- ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj3);
+ ret = compareFun.call(QJSValueList() << qobj1 << qobj3);
QVERIFY(ret.isBool());
QVERIFY(!ret.toBool());
- ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj4);
+ ret = compareFun.call(QJSValueList() << qobj1 << qobj4);
QVERIFY(ret.isBool());
QVERIFY(!ret.toBool());
- ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << obj1);
+ ret = compareFun.call(QJSValueList() << qobj1 << obj1);
QVERIFY(ret.isBool());
QVERIFY(!ret.toBool());
}
@@ -3897,7 +3992,7 @@ void tst_QJSValue::prettyPrinter()
QFETCH(QString, expected);
QJSEngine eng;
QJSValue val = eng.evaluate("(" + function + ")");
- QVERIFY(val.isFunction());
+ QVERIFY(val.isCallable());
QString actual = val.toString();
int count = qMin(actual.size(), expected.size());
// qDebug() << actual << expected;
@@ -3945,7 +4040,7 @@ void tst_QJSValue::valueOfWithClosure()
{
QJSValue obj = eng.evaluate("o = {}; (function(foo) { o.valueOf = function() { return foo; } })(123); o");
QVERIFY(obj.isObject());
- QCOMPARE(obj.toInt32(), 123);
+ QCOMPARE(obj.toInt(), 123);
}
// toString()
{
@@ -4023,6 +4118,12 @@ void tst_QJSValue::nestedObjectToVariant_data()
// Object literals
{
QVariantMap m;
+ QTest::newRow("{}")
+ << QString::fromLatin1("({})")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
m["a"] = QVariantMap();
QTest::newRow("{ a:{} }")
<< QString::fromLatin1("({ a:{} })")
diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
index 2e11832f07..b6e6f51079 100644
--- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
+++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -86,8 +86,8 @@ private slots:
void toBoolean();
void toBool();
void toInteger();
- void toInt32();
- void toUInt32();
+ void toInt();
+ void toUInt();
void toUInt16();
void toVariant();
void toQObject_nonQObject_data();
@@ -113,6 +113,14 @@ private slots:
void equals();
void strictlyEquals();
+ void hasProperty_basic();
+ void hasProperty_globalObject();
+ void hasProperty_changePrototype();
+
+ void deleteProperty_basic();
+ void deleteProperty_globalObject();
+ void deleteProperty_inPrototype();
+
void getSetPrototype_cyclicPrototype();
void getSetPrototype_evalCyclicPrototype();
void getSetPrototype_eval();
diff --git a/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp
index d8a490f694..58c380057d 100644
--- a/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp
+++ b/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -173,7 +173,7 @@ void tst_QJSValueIterator::iterateArray()
// Iterate thru array properties. Note that the QJSValueIterator doesn't guarantee
// any order on the iteration!
- int length = array.property("length").toInt32();
+ int length = array.property("length").toInt();
QCOMPARE(length, propertyNames.size());
bool iteratedThruLength = false;
@@ -187,7 +187,7 @@ void tst_QJSValueIterator::iterateArray()
const QString name = it.name();
if (name == QString::fromLatin1("length")) {
QVERIFY(it.value().isNumber());
- QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.value().toInt(), length);
QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
iteratedThruLength = true;
continue;
@@ -220,7 +220,7 @@ void tst_QJSValueIterator::iterateArray()
const QString name = it.name();
if (name == QString::fromLatin1("length")) {
QVERIFY(it.value().isNumber());
- QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.value().toInt(), length);
QCOMPARE(it.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
iteratedThruLength = true;
@@ -255,7 +255,7 @@ void tst_QJSValueIterator::iterateArray()
const QString name = it2.name();
if (name == QString::fromLatin1("length")) {
QVERIFY(it2.value().isNumber());
- QCOMPARE(it2.value().toInt32(), length);
+ QCOMPARE(it2.value().toInt(), length);
QCOMPARE(it2.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
iteratedThruLength = true;
@@ -286,7 +286,7 @@ void tst_QJSValueIterator::iterateString()
QVERIFY(str.isString());
QJSValue obj = str.toObject();
QVERIFY(obj.property("length").isNumber());
- int length = obj.property("length").toInt32();
+ int length = obj.property("length").toInt();
QCOMPARE(length, 4);
QJSValueIterator it(obj);
@@ -299,7 +299,7 @@ void tst_QJSValueIterator::iterateString()
if (name == QString::fromLatin1("length")) {
QVERIFY(it.value().isNumber());
- QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.value().toInt(), length);
QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
iteratedThruLength = true;
continue;
@@ -324,7 +324,7 @@ void tst_QJSValueIterator::iterateString()
if (name == QString::fromLatin1("length")) {
QVERIFY(it.value().isNumber());
- QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.value().toInt(), length);
QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
iteratedThruLength = true;
continue;
diff --git a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp
index 69ec0cb199..4663bed78f 100644
--- a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -103,6 +103,7 @@ void tst_qmlmin::initTestCase()
invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml";
invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/insertedSemicolon.1.qml";
invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml";
+ invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml";
invalidFiles << "tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml";
invalidFiles << "tests/auto/declarative/qdeclarativeecmascript/data/qtbug_22843.js";
invalidFiles << "tests/auto/declarative/qdeclarativeecmascript/data/qtbug_22843.library.js";
diff --git a/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp
index 5970fd406e..8b24b4eff6 100644
--- a/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/runall.sh b/tests/auto/declarative/runall.sh
index 710d7504bb..7e17aca0c1 100755
--- a/tests/auto/declarative/runall.sh
+++ b/tests/auto/declarative/runall.sh
@@ -4,7 +4,7 @@
##
## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
-## Contact: Nokia Corporation (qt-info@nokia.com)
+## Contact: http://www.qt-project.org/
##
## This file is part of the test suite of the Qt Toolkit.
##
diff --git a/tests/auto/declarative/v4/testtypes.cpp b/tests/auto/declarative/v4/testtypes.cpp
index edf31b2893..64326e6341 100644
--- a/tests/auto/declarative/v4/testtypes.cpp
+++ b/tests/auto/declarative/v4/testtypes.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/v4/testtypes.h b/tests/auto/declarative/v4/testtypes.h
index 0d4d8d764b..161304df16 100644
--- a/tests/auto/declarative/v4/testtypes.h
+++ b/tests/auto/declarative/v4/testtypes.h
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp
index 852d36ec80..3d54f078e8 100644
--- a/tests/auto/declarative/v4/tst_v4.cpp
+++ b/tests/auto/declarative/v4/tst_v4.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**