diff options
Diffstat (limited to 'tests')
194 files changed, 2165 insertions, 573 deletions
diff --git a/tests/auto/particles/qquickgroupgoal/data/basic.qml b/tests/auto/particles/qquickgroupgoal/data/basic.qml index 8e25a4dc3f..8e3833916f 100644 --- a/tests/auto/particles/qquickgroupgoal/data/basic.qml +++ b/tests/auto/particles/qquickgroupgoal/data/basic.qml @@ -61,7 +61,7 @@ Rectangle { goalState: "" jump: true } - + Emitter { //0,0 position group: "notdefault" diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index 149f034903..45960c9e97 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -868,6 +868,9 @@ void tst_QParallelAnimationGroupJob::addAndRemoveDuration() void tst_QParallelAnimationGroupJob::pauseResume() { +#ifdef Q_CC_MINGW + QSKIP("QTBUG-36290 - MinGW Animation tests are flaky."); +#endif QParallelAnimationGroupJob group; TestAnimation *anim = new TestAnimation(250); // 0, duration = 250; group.appendAnimation(anim); diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro index 98e41411ee..4c4342a6a5 100644 --- a/tests/auto/qml/debugger/debugger.pro +++ b/tests/auto/qml/debugger/debugger.pro @@ -6,11 +6,12 @@ PUBLICTESTS += \ qqmlinspector \ qqmlprofilerservice \ qpacketprotocol \ -# qv8profilerservice \ +# qv4profilerservice \ # qdebugmessageservice \ qqmlenginedebuginspectorintegrationtest \ qqmlinspector \ - qqmlprofilerservice + qqmlprofilerservice \ + qqmlenginecontrol PRIVATETESTS += \ qqmldebugclient \ diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index 7fd1f47838..26919af1b6 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -82,10 +82,10 @@ void tst_QPacketProtocol::init() m_server = new QTcpServer(this); m_serverConn = 0; QVERIFY(m_server->listen(QHostAddress("127.0.0.1"))); - + m_client = new QTcpSocket(this); m_client->connectToHost(m_server->serverAddress(), m_server->serverPort()); - + QVERIFY(m_client->waitForConnected()); QVERIFY(m_server->waitForNewConnection(10000)); m_serverConn = m_server->nextPendingConnection(); diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp index bca40e9acd..4a8025c254 100644 --- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp +++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp @@ -124,7 +124,7 @@ void tst_QQmlDebugClient::state() QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable); // duplicate plugin name - QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\" "); + QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\""); QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn); QCOMPARE(client2.state(), QQmlDebugClient::NotConnected); diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index 2cf6ee958a..fef020704f 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -984,7 +984,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback() QVERIFY(init(TIMER_QMLFILE)); client->connect(); - + //We can set the breakpoint after connect() here because the timer is repeating and if we miss + //its first iteration we can still catch the second one. client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine, -1, true); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); @@ -1004,8 +1005,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile() int sourceLine = 43; QVERIFY(init(LOADJSFILE_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true); + client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); QString jsonString(client->response); @@ -1025,8 +1026,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComment() int actualLine = 49; QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); + client->connect(); QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1)); @@ -1047,8 +1048,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine() int actualLine = 49; QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); + client->connect(); QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1)); @@ -1093,6 +1094,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition() QVERIFY(init(CONDITION_QMLFILE)); client->connect(); + //The breakpoint is in a timer loop so we can set it after connect(). client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CONDITION_QMLFILE), sourceLine, 1, true, QLatin1String("a > 10")); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); @@ -1148,31 +1150,12 @@ void tst_QQmlDebugJS::setBreakpointWhenAttaching() QVERIFY(init(QLatin1String(TIMER_QMLFILE), false)); client->connect(); + //The breakpoint is in a timer loop so we can set it after connect(). client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); } */ -//void tst_QQmlDebugJS::setBreakpointInFunction() -//{ -// //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) - -// int actualLine = 31; - -// client->connect(); -// client->setBreakpoint(QLatin1String(FUNCTION), QLatin1String("doSomethingElse"), -1, -1, true); - -// QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); - -// QString jsonString(client->response); -// QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap(); - -// QVariantMap body = value.value("body").toMap(); - -// QCOMPARE(body.value("sourceLine").toInt(), actualLine); -// QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(QMLFILE)); -//} - #if 0 void tst_QQmlDebugJS::setBreakpointOnEvent() { @@ -1182,9 +1165,8 @@ void tst_QQmlDebugJS::setBreakpointOnEvent() QVERIFY(init(TIMER_QMLFILE)); - client->connect(); - client->setBreakpoint(QLatin1String(EVENT), QLatin1String("triggered"), -1, -1, true); + client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); QString jsonString(client->response); @@ -1205,6 +1187,9 @@ void tst_QQmlDebugJS::clearBreakpoint() QVERIFY(init(CHANGEBREAKPOINT_QMLFILE)); client->connect(); + //The breakpoints are in a timer loop so we can set them after connect(). + //Furthermore the breakpoints should be hit in the right order because setting of breakpoints + //can only occur in the QML event loop. (see QCOMPARE for sourceLine2 below) client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true); @@ -1281,8 +1266,8 @@ void tst_QQmlDebugJS::stepIn() int actualLine = 50; QVERIFY(init(STEPACTION_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true); + client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); client->continueDebugging(QJSDebugClient::In); @@ -1305,8 +1290,8 @@ void tst_QQmlDebugJS::stepOut() int actualLine = 54; QVERIFY(init(STEPACTION_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true); + client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); client->continueDebugging(QJSDebugClient::Out); @@ -1329,9 +1314,9 @@ void tst_QQmlDebugJS::continueDebugging() int sourceLine2 = 51; QVERIFY(init(STEPACTION_QMLFILE)); - client->connect(); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true); + client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); client->continueDebugging(QJSDebugClient::Continue); diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp index 1c1d84f37b..c50bb10035 100644 --- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp +++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp @@ -164,7 +164,7 @@ void tst_QQmlDebugService::state() QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable); - QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" "); + QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\""); QQmlDebugTestService duplicate("tst_QQmlDebugService::state()"); QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected); } @@ -183,7 +183,7 @@ void tst_QQmlDebugService::sendMessage() QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); - QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\" "); + QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\""); QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()"); duplicate.sendMessage("msg"); } diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/data/exit.qml b/tests/auto/qml/debugger/qqmlenginecontrol/data/exit.qml new file mode 100644 index 0000000000..b250524caa --- /dev/null +++ b/tests/auto/qml/debugger/qqmlenginecontrol/data/exit.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +Item { + Timer { + running: true + interval: 1 + onTriggered: Qt.quit(); + } +} diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/test.qml b/tests/auto/qml/debugger/qqmlenginecontrol/data/test.qml index 9c36e13c5b..9c36e13c5b 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/data/test.qml +++ b/tests/auto/qml/debugger/qqmlenginecontrol/data/test.qml diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro new file mode 100644 index 0000000000..09332cc302 --- /dev/null +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -0,0 +1,18 @@ +CONFIG += testcase +TARGET = tst_qqmlenginecontrol +macx:CONFIG -= app_bundle + +SOURCES += tst_qqmlenginecontrol.cpp + +INCLUDEPATH += ../shared +include(../../../shared/util.pri) +include(../shared/debugutil.pri) + +TESTDATA = data/* + +QT += core qml testlib gui-private +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +OTHER_FILES += \ + data/test.qml \ + data/exit.qml diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp new file mode 100644 index 0000000000..3a88091165 --- /dev/null +++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp @@ -0,0 +1,228 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QLibraryInfo> + +#include "debugutil_p.h" +#include "qqmldebugclient.h" +#include "../../../shared/util.h" + +#define STR_PORT_FROM "13773" +#define STR_PORT_TO "13783" + +class QQmlEngineControlClient : public QQmlDebugClient +{ + Q_OBJECT +public: + enum MessageType { + EngineAboutToBeAdded, + EngineAdded, + EngineAboutToBeRemoved, + EngineRemoved, + + MaximumMessageType + }; + + enum CommandType { + StartWaitingEngine, + StopWaitingEngine, + + MaximumCommandType + }; + + QQmlEngineControlClient(QQmlDebugConnection *connection) + : QQmlDebugClient(QLatin1String("EngineControl"), connection) + {} + + + void command(CommandType command, int engine) { + QByteArray message; + QDataStream stream(&message, QIODevice::WriteOnly); + stream << (int)command << engine; + sendMessage(message); + } + + QList<int> startingEngines; + QList<int> stoppingEngines; + +signals: + void engineAboutToBeAdded(); + void engineAdded(); + void engineAboutToBeRemoved(); + void engineRemoved(); + +protected: + void messageReceived(const QByteArray &message); +}; + +class tst_QQmlEngineControl : public QQmlDataTest +{ + Q_OBJECT + +public: + tst_QQmlEngineControl() + : m_process(0) + , m_connection(0) + , m_client(0) + {} + + +private: + QQmlDebugProcess *m_process; + QQmlDebugConnection *m_connection; + QQmlEngineControlClient *m_client; + + void connect(const QString &testFile); + +private slots: + void cleanup(); + + void startEngine(); + void stopEngine(); +}; + +void QQmlEngineControlClient::messageReceived(const QByteArray &message) +{ + QByteArray msg = message; + QDataStream stream(&msg, QIODevice::ReadOnly); + + int messageType; + int engineId; + stream >> messageType >> engineId; + + switch (messageType) { + case EngineAboutToBeAdded: + startingEngines.append(engineId); + emit engineAboutToBeAdded(); + break; + case EngineAdded: + QVERIFY(startingEngines.contains(engineId)); + startingEngines.removeOne(engineId); + emit engineAdded(); + break; + case EngineAboutToBeRemoved: + stoppingEngines.append(engineId); + emit engineAboutToBeRemoved(); + break; + case EngineRemoved: + QVERIFY(stoppingEngines.contains(engineId)); + stoppingEngines.removeOne(engineId); + emit engineRemoved(); + break; + default: + QString failMsg = QString("Unknown message type:") + messageType; + QFAIL(qPrintable(failMsg)); + break; + } + QVERIFY(stream.atEnd()); +} + +void tst_QQmlEngineControl::connect(const QString &testFile) +{ + const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"; + QStringList arguments; + arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block"); + + arguments << QQmlDataTest::instance()->testFile(testFile); + + m_process = new QQmlDebugProcess(executable, this); + m_process->start(QStringList() << arguments); + QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); + + m_connection = new QQmlDebugConnection(); + m_client = new QQmlEngineControlClient(m_connection); + + const int port = m_process->debugPort(); + m_connection->connectToHost(QLatin1String("127.0.0.1"), port); +} + +void tst_QQmlEngineControl::cleanup() +{ + if (QTest::currentTestFailed()) { + qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null")); + qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null")); + qDebug() << "Connection State:" << (m_connection ? m_connection->stateString() : QLatin1String("null")); + qDebug() << "Client State:" << (m_client ? m_client->stateString() : QLatin1String("null")); + } + delete m_process; + m_process = 0; + delete m_client; + m_client = 0; + delete m_connection; + m_connection = 0; +} + +void tst_QQmlEngineControl::startEngine() +{ + connect("test.qml"); + QVERIFY(m_client); + QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + QTRY_VERIFY(!m_client->startingEngines.empty()); + m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last()); + + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded())), + "No engine start message received in time."); +} + +void tst_QQmlEngineControl::stopEngine() +{ + connect("exit.qml"); + QVERIFY(m_client); + QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + QTRY_VERIFY(!m_client->startingEngines.empty()); + m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last()); + + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded())), + "No engine start message received in time."); + + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAboutToBeRemoved())), + "No engine about to stop message received in time."); + m_client->command(QQmlEngineControlClient::StopWaitingEngine, m_client->stoppingEngines.last()); + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineRemoved())), + "No engine stop message received in time."); +} + +QTEST_MAIN(tst_QQmlEngineControl) + +#include "tst_qqmlenginecontrol.moc" diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml new file mode 100644 index 0000000000..0555d49652 --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Rectangle { + function something(i) { + if (i > 10) { + something(i / 4); + } else { + console.log("done"); + } + } + + width: 400 + height: 400 + + onWidthChanged: something(width); + Component.onCompleted: width = 500; +} diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index d08ed31e8b..1bab614b63 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -16,4 +16,9 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/pixmapCacheTest.qml \ data/controlFromJS.qml \ - data/signalSourceLocation.qml + data/test.qml \ + data/exit.qml \ + data/scenegraphTest.qml \ + data/TestImage_2x2.png \ + data/signalSourceLocation.qml \ + data/javascript.qml diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 276dcf5d29..6dbdc83b08 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -100,6 +100,7 @@ public: Creating, Binding, //running a binding HandlingSignal, //running a signal handler + Javascript, MaximumRangeType }; @@ -182,6 +183,7 @@ private slots: void profileOnExit(); void controlFromJS(); void signalSourceLocation(); + void javascript(); }; void QQmlProfilerClient::messageReceived(const QByteArray &message) @@ -214,9 +216,16 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message) case QQmlProfilerClient::FramePaint: case QQmlProfilerClient::Mouse: case QQmlProfilerClient::Key: - case QQmlProfilerClient::StartTrace: + break; case QQmlProfilerClient::EndTrace: + case QQmlProfilerClient::StartTrace: { + int engineId = -1; + if (!stream.atEnd()) { + stream >> engineId; + QVERIFY(engineId >= 0); + } break; + } default: { QString failMsg = QString("Unknown event type:") + data.detailType; QFAIL(qPrintable(failMsg)); @@ -406,14 +415,14 @@ void tst_QQmlProfilerService::pixmapCacheData() m_client->setTraceState(true); QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - QVERIFY(m_process->output().indexOf(QLatin1String("image loaded")) != -1 || - m_process->output().indexOf(QLatin1String("image error")) != -1 ); - + while (m_process->output().indexOf(QLatin1String("image loaded")) == -1 && + m_process->output().indexOf(QLatin1String("image error")) == -1) + QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); m_client->setTraceState(false); QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); - QVERIFY(m_client->traceMessages.count()); + QVERIFY(m_client->traceMessages.count() >= 20); // must start with "StartTrace" QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); @@ -423,15 +432,15 @@ void tst_QQmlProfilerService::pixmapCacheData() QCOMPARE(m_client->traceMessages[16].messageType, (int)QQmlProfilerClient::PixmapCacheEvent); QCOMPARE(m_client->traceMessages[16].detailType, (int)QQmlProfilerClient::PixmapLoadingStarted); - // image loaded + // image size QCOMPARE(m_client->traceMessages[17].messageType, (int)QQmlProfilerClient::PixmapCacheEvent); - QCOMPARE(m_client->traceMessages[17].detailType, (int)QQmlProfilerClient::PixmapLoadingFinished); + QCOMPARE(m_client->traceMessages[17].detailType, (int)QQmlProfilerClient::PixmapSizeKnown); + QCOMPARE(m_client->traceMessages[17].line, 2); // width + QCOMPARE(m_client->traceMessages[17].column, 2); // height - // image size + // image loaded QCOMPARE(m_client->traceMessages[18].messageType, (int)QQmlProfilerClient::PixmapCacheEvent); - QCOMPARE(m_client->traceMessages[18].detailType, (int)QQmlProfilerClient::PixmapSizeKnown); - QCOMPARE(m_client->traceMessages[18].line, 2); // width - QCOMPARE(m_client->traceMessages[18].column, 2); // height + QCOMPARE(m_client->traceMessages[18].detailType, (int)QQmlProfilerClient::PixmapLoadingFinished); // cache size QCOMPARE(m_client->traceMessages[19].messageType, (int)QQmlProfilerClient::PixmapCacheEvent); @@ -486,6 +495,7 @@ void tst_QQmlProfilerService::profileOnExit() m_client->setTraceState(true); QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + QVERIFY(m_client->traceMessages.count() >= 2); // must start with "StartTrace" QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); @@ -504,6 +514,7 @@ void tst_QQmlProfilerService::controlFromJS() m_client->setTraceState(false); QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + QVERIFY(m_client->traceMessages.count() >= 2); // must start with "StartTrace" QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); @@ -526,17 +537,60 @@ void tst_QQmlProfilerService::signalSourceLocation() m_client->setTraceState(false); QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + QVERIFY(m_client->traceMessages.count() >= 20); // must start with "StartTrace" QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace); + QVERIFY(m_client->traceMessages[14].messageType == QQmlProfilerClient::RangeLocation); + QVERIFY(m_client->traceMessages[14].detailType == QQmlProfilerClient::HandlingSignal); QVERIFY(m_client->traceMessages[14].detailData.endsWith("signalSourceLocation.qml")); QVERIFY(m_client->traceMessages[14].line == 8); QVERIFY(m_client->traceMessages[14].column == 28); - QVERIFY(m_client->traceMessages[16].detailData.endsWith("signalSourceLocation.qml")); - QVERIFY(m_client->traceMessages[16].line == 7); - QVERIFY(m_client->traceMessages[16].column == 21); + QVERIFY(m_client->traceMessages[19].messageType == QQmlProfilerClient::RangeLocation); + QVERIFY(m_client->traceMessages[19].detailType == QQmlProfilerClient::HandlingSignal); + QVERIFY(m_client->traceMessages[19].detailData.endsWith("signalSourceLocation.qml")); + QVERIFY(m_client->traceMessages[19].line == 7); + QVERIFY(m_client->traceMessages[19].column == 21); + + // must end with "EndTrace" + QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event); + QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace); +} + +void tst_QQmlProfilerService::javascript() +{ + connect(true, "javascript.qml"); + QVERIFY(m_client); + QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + m_client->setTraceState(true); + while (!(m_process->output().contains(QLatin1String("done")))) + QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); + m_client->setTraceState(false); + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + + QVERIFY(m_client->traceMessages.count() >= 36); + // must start with "StartTrace" + QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); + QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace); + + QVERIFY(m_client->traceMessages[32].messageType == QQmlProfilerClient::RangeStart); + QVERIFY(m_client->traceMessages[32].detailType == QQmlProfilerClient::Javascript); + + QVERIFY(m_client->traceMessages[33].messageType == QQmlProfilerClient::RangeLocation); + QVERIFY(m_client->traceMessages[33].detailType == QQmlProfilerClient::Javascript); + QVERIFY(m_client->traceMessages[33].detailData.endsWith("javascript.qml")); + QVERIFY(m_client->traceMessages[33].line == 4); + QVERIFY(m_client->traceMessages[33].column == 5); + + QVERIFY(m_client->traceMessages[34].messageType == QQmlProfilerClient::RangeData); + QVERIFY(m_client->traceMessages[34].detailType == QQmlProfilerClient::Javascript); + QVERIFY(m_client->traceMessages[34].detailData == "something"); + + QVERIFY(m_client->traceMessages[35].messageType == QQmlProfilerClient::RangeEnd); + QVERIFY(m_client->traceMessages[35].detailType == QQmlProfilerClient::Javascript); // must end with "EndTrace" QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event); diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/console.qml b/tests/auto/qml/debugger/qv4profilerservice/data/console.qml index c23c820216..c23c820216 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/data/console.qml +++ b/tests/auto/qml/debugger/qv4profilerservice/data/console.qml diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/exit.qml b/tests/auto/qml/debugger/qv4profilerservice/data/exit.qml index 604265354c..604265354c 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/data/exit.qml +++ b/tests/auto/qml/debugger/qv4profilerservice/data/exit.qml diff --git a/tests/auto/qml/debugger/qv4profilerservice/data/test.qml b/tests/auto/qml/debugger/qv4profilerservice/data/test.qml new file mode 100644 index 0000000000..9c36e13c5b --- /dev/null +++ b/tests/auto/qml/debugger/qv4profilerservice/data/test.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + +} diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro index dc6f4c5038..459f931f94 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro +++ b/tests/auto/qml/debugger/qv4profilerservice/qv4profilerservice.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qv8profilerservice +TARGET = tst_qv4profilerservice macx:CONFIG -= app_bundle -SOURCES += tst_qv8profilerservice.cpp +SOURCES += tst_qv4profilerservice.cpp INCLUDEPATH += ../shared include(../../../shared/util.pri) diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv4profilerservice/tst_qv4profilerservice.cpp index a461519c75..23dfb3c75f 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp +++ b/tests/auto/qml/debugger/qv4profilerservice/tst_qv4profilerservice.cpp @@ -49,7 +49,7 @@ #define STR_PORT_FROM "13774" #define STR_PORT_TO "13790" -struct QV8ProfilerData +struct QV4ProfilerData { int messageType; QString filename; @@ -62,24 +62,24 @@ struct QV8ProfilerData QByteArray toByteArray() const; }; -class QV8ProfilerClient : public QQmlDebugClient +class QV4ProfilerClient : public QQmlDebugClient { Q_OBJECT public: enum MessageType { - V8Entry, - V8Complete, - V8SnapshotChunk, - V8SnapshotComplete, - V8Started, + V4Entry, + V4Complete, + V4SnapshotChunk, + V4SnapshotComplete, + V4Started, - V8MaximumMessage + V4MaximumMessage }; enum ServiceState { NotRunning, Running } serviceState; - QV8ProfilerClient(QQmlDebugConnection *connection) + QV4ProfilerClient(QQmlDebugConnection *connection) : QQmlDebugClient(QLatin1String("V8Profiler"), connection) , serviceState(NotRunning) { @@ -113,7 +113,7 @@ public: sendMessage(message); } - QList<QV8ProfilerData> traceMessages; + QList<QV4ProfilerData> traceMessages; QList<QByteArray> snapshotMessages; signals: @@ -125,12 +125,12 @@ protected: void messageReceived(const QByteArray &message); }; -class tst_QV8ProfilerService : public QQmlDataTest +class tst_QV4ProfilerService : public QQmlDataTest { Q_OBJECT public: - tst_QV8ProfilerService() + tst_QV4ProfilerService() : m_process(0) , m_connection(0) , m_client(0) @@ -140,7 +140,7 @@ public: private: QQmlDebugProcess *m_process; QQmlDebugConnection *m_connection; - QV8ProfilerClient *m_client; + QV4ProfilerClient *m_client; bool connect(bool block, const QString &testFile, QString *error); @@ -155,7 +155,7 @@ private slots: void console(); }; -void QV8ProfilerClient::messageReceived(const QByteArray &message) +void QV4ProfilerClient::messageReceived(const QByteArray &message) { QByteArray msg = message; QDataStream stream(&msg, QIODevice::ReadOnly); @@ -164,31 +164,31 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message) stream >> messageType; QVERIFY(messageType >= 0); - QVERIFY(messageType < QV8ProfilerClient::V8MaximumMessage); + QVERIFY(messageType < QV4ProfilerClient::V4MaximumMessage); switch (messageType) { - case QV8ProfilerClient::V8Entry: { + case QV4ProfilerClient::V4Entry: { QCOMPARE(serviceState, Running); - QV8ProfilerData entry; + QV4ProfilerData entry; stream >> entry.filename >> entry.functionname >> entry.lineNumber >> entry.totalTime >> entry.selfTime >> entry.treeLevel; traceMessages.append(entry); break; } - case QV8ProfilerClient::V8Complete: + case QV4ProfilerClient::V4Complete: QCOMPARE(serviceState, Running); serviceState = NotRunning; emit complete(); break; - case QV8ProfilerClient::V8SnapshotChunk: { + case QV4ProfilerClient::V4SnapshotChunk: { QByteArray json; stream >> json; snapshotMessages.append(json); break; } - case QV8ProfilerClient::V8SnapshotComplete: + case QV4ProfilerClient::V4SnapshotComplete: emit snapshot(); break; - case QV8ProfilerClient::V8Started: + case QV4ProfilerClient::V4Started: QCOMPARE(serviceState, NotRunning); serviceState = Running; emit started(); @@ -201,7 +201,7 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message) QVERIFY(stream.atEnd()); } -bool tst_QV8ProfilerService::connect(bool block, const QString &testFile, +bool tst_QV4ProfilerService::connect(bool block, const QString &testFile, QString *error) { const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml"; @@ -215,7 +215,7 @@ bool tst_QV8ProfilerService::connect(bool block, const QString &testFile, arguments << QQmlDataTest::instance()->testFile(testFile); m_connection = new QQmlDebugConnection(); - m_client = new QV8ProfilerClient(m_connection); + m_client = new QV4ProfilerClient(m_connection); m_process = new QQmlDebugProcess(executable); m_process->start(QStringList() << arguments); @@ -232,7 +232,7 @@ bool tst_QV8ProfilerService::connect(bool block, const QString &testFile, return true; } -void tst_QV8ProfilerService::cleanup() +void tst_QV4ProfilerService::cleanup() { if (QTest::currentTestFailed()) { qDebug() << "Process State:" << m_process->state(); @@ -243,7 +243,7 @@ void tst_QV8ProfilerService::cleanup() delete m_connection; } -void tst_QV8ProfilerService::blockingConnectWithTraceEnabled() +void tst_QV4ProfilerService::blockingConnectWithTraceEnabled() { QString error; if (!connect(true, "test.qml", &error)) @@ -257,7 +257,7 @@ void tst_QV8ProfilerService::blockingConnectWithTraceEnabled() "No trace received in time."); } -void tst_QV8ProfilerService::blockingConnectWithTraceDisabled() +void tst_QV4ProfilerService::blockingConnectWithTraceDisabled() { QString error; if (!connect(true, "test.qml", &error)) @@ -274,7 +274,7 @@ void tst_QV8ProfilerService::blockingConnectWithTraceDisabled() "No trace received in time."); } -void tst_QV8ProfilerService::nonBlockingConnect() +void tst_QV4ProfilerService::nonBlockingConnect() { QString error; if (!connect(false, "test.qml", &error)) @@ -288,7 +288,7 @@ void tst_QV8ProfilerService::nonBlockingConnect() "No trace received in time."); } -void tst_QV8ProfilerService::snapshot() +void tst_QV4ProfilerService::snapshot() { QString error; if (!connect(false, "test.qml", &error)) @@ -301,7 +301,7 @@ void tst_QV8ProfilerService::snapshot() "No trace received in time."); } -void tst_QV8ProfilerService::profileOnExit() +void tst_QV4ProfilerService::profileOnExit() { QString error; if (!connect(true, "exit.qml", &error)) @@ -314,7 +314,7 @@ void tst_QV8ProfilerService::profileOnExit() "No trace received in time."); } -void tst_QV8ProfilerService::console() +void tst_QV4ProfilerService::console() { QString error; if (!connect(true, "console.qml", &error)) @@ -329,6 +329,6 @@ void tst_QV8ProfilerService::console() QVERIFY(!m_client->traceMessages.isEmpty()); } -QTEST_MAIN(tst_QV8ProfilerService) +QTEST_MAIN(tst_QV4ProfilerService) -#include "tst_qv8profilerservice.moc" +#include "tst_qv4profilerservice.moc" diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp index 6474a04796..80322dc841 100644 --- a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp +++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp @@ -388,7 +388,7 @@ QQmlDebugClientPrivate::QQmlDebugClientPrivate() { } -QQmlDebugClient::QQmlDebugClient(const QString &name, +QQmlDebugClient::QQmlDebugClient(const QString &name, QQmlDebugConnection *parent) : QObject(parent), d(new QQmlDebugClientPrivate) diff --git a/tests/auto/qml/parserstress/tests/shell.js b/tests/auto/qml/parserstress/tests/shell.js index 40af0f3799..b3a84cc2ed 100644 --- a/tests/auto/qml/parserstress/tests/shell.js +++ b/tests/auto/qml/parserstress/tests/shell.js @@ -191,7 +191,7 @@ function reportFailure (msg) var l; var funcName = currentFunc(); var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; - + for (var i=0; i<lines.length; i++) print (FAILED + prefix + lines[i]); } @@ -224,11 +224,11 @@ function printBugNumber (num) function toPrinted(value) { - if (typeof value == "xml") + if (typeof value == "xml") { value = value.toXMLString(); - } - else + } + else { value = String(value); } @@ -406,7 +406,7 @@ function enterFunc (funcName) function exitFunc (funcName) { var lastFunc = callStack.pop(); - + if (funcName) { if (!funcName.match(/\(\)$/)) @@ -516,7 +516,7 @@ function BigO(data) { var Ydiff = Y[i] - this.Yavg; var Xdiff = X[i] - this.Xavg; - + SUM_Ydiff2 += Ydiff * Ydiff; SUM_Xdiff2 += Xdiff * Xdiff; SUM_XdiffYdiff += Xdiff * Ydiff; @@ -552,7 +552,7 @@ function BigO(data) { deriv.X[i] = (X[i] + X[i+1])/2; deriv.Y[i] = (Y[i+1] - Y[i])/(X[i+1] - X[i]); - } + } return deriv; } @@ -628,7 +628,7 @@ function optionsInit() { } function optionsClear() { - + // turn off current settings var optionNames = options().split(','); for (var i = 0; i < optionNames.length; i++) @@ -696,27 +696,27 @@ function getTestCaseResult(expected, actual) var expected_t = typeof expected; var actual_t = typeof actual; var passed = true; - + // because ( NaN == NaN ) always returns false, need to do // a special compare to see if we got the right result. - if ( actual != actual ) + if ( actual != actual ) { - if ( actual_t == "object" ) + if ( actual_t == "object" ) { actual = "NaN object"; - } - else + } + else { actual = "NaN number"; } } - if ( expected != expected ) + if ( expected != expected ) { - if ( expected_t == "object" ) + if ( expected_t == "object" ) { expected = "NaN object"; - } - else + } + else { expected = "NaN number"; } @@ -733,7 +733,7 @@ function getTestCaseResult(expected, actual) passed = false; } } - + return passed; } diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 44c113ba13..bb5f83bed1 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -49,6 +49,7 @@ #include <QtCore/qnumeric.h> #include <qqmlengine.h> #include <stdlib.h> +#include <private/qv4alloca_p.h> #ifdef Q_CC_MSVC #define NO_INLINE __declspec(noinline) @@ -56,12 +57,6 @@ #define NO_INLINE __attribute__((noinline)) #endif -#if defined(Q_OS_WIN) -#include <malloc.h> -#else -#include <alloca.h> -#endif - Q_DECLARE_METATYPE(QList<int>) Q_DECLARE_METATYPE(QObjectList) diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index 489972716d..7811ce5e5b 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -129,11 +129,10 @@ void tst_qqmlapplicationengine::application() void tst_qqmlapplicationengine::applicationProperties() { - QCoreApplication* coreApp = QCoreApplication::instance(); - QString originalName = coreApp->applicationName(); - QString originalVersion = coreApp->applicationVersion(); - QString originalOrganization = coreApp->organizationName(); - QString originalDomain = coreApp->organizationDomain(); + const QString originalName = QCoreApplication::applicationName(); + const QString originalVersion = QCoreApplication::applicationVersion(); + const QString originalOrganization = QCoreApplication::organizationName(); + const QString originalDomain = QCoreApplication::organizationDomain(); QString firstName = QLatin1String("Test A"); QString firstVersion = QLatin1String("0.0A"); QString firstOrganization = QLatin1String("Org A"); @@ -143,10 +142,10 @@ void tst_qqmlapplicationengine::applicationProperties() QString secondOrganization = QLatin1String("Org B"); QString secondDomain = QLatin1String("b.org"); - coreApp->setApplicationName(firstName); - coreApp->setApplicationVersion(firstVersion); - coreApp->setOrganizationName(firstOrganization); - coreApp->setOrganizationDomain(firstDomain); + QCoreApplication::setApplicationName(firstName); + QCoreApplication::setApplicationVersion(firstVersion); + QCoreApplication::setOrganizationName(firstOrganization); + QCoreApplication::setOrganizationDomain(firstDomain); QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("applicationTest.qml")); QObject* root = test->rootObjects().at(0); @@ -159,10 +158,10 @@ void tst_qqmlapplicationengine::applicationProperties() QCOMPARE(root->property("currentVersion").toString(), secondVersion); QCOMPARE(root->property("currentOrganization").toString(), secondOrganization); QCOMPARE(root->property("currentDomain").toString(), secondDomain); - QCOMPARE(coreApp->applicationName(), secondName); - QCOMPARE(coreApp->applicationVersion(), secondVersion); - QCOMPARE(coreApp->organizationName(), secondOrganization); - QCOMPARE(coreApp->organizationDomain(), secondDomain); + QCOMPARE(QCoreApplication::applicationName(), secondName); + QCOMPARE(QCoreApplication::applicationVersion(), secondVersion); + QCOMPARE(QCoreApplication::organizationName(), secondOrganization); + QCOMPARE(QCoreApplication::organizationDomain(), secondDomain); QObject* application = root->property("applicationInstance").value<QObject*>(); QVERIFY(application); @@ -171,10 +170,10 @@ void tst_qqmlapplicationengine::applicationProperties() QSignalSpy organizationChanged(application, SIGNAL(organizationChanged())); QSignalSpy domainChanged(application, SIGNAL(domainChanged())); - coreApp->setApplicationName(originalName); - coreApp->setApplicationVersion(originalVersion); - coreApp->setOrganizationName(originalOrganization); - coreApp->setOrganizationDomain(originalDomain); + QCoreApplication::setApplicationName(originalName); + QCoreApplication::setApplicationVersion(originalVersion); + QCoreApplication::setOrganizationName(originalOrganization); + QCoreApplication::setOrganizationDomain(originalDomain); QCOMPARE(nameChanged.count(), 1); QCOMPARE(versionChanged.count(), 1); diff --git a/tests/auto/qml/qqmlcomponent/data/incubateObject.qml b/tests/auto/qml/qqmlcomponent/data/incubateObject.qml index c11319db30..fcc88a7647 100644 --- a/tests/auto/qml/qqmlcomponent/data/incubateObject.qml +++ b/tests/auto/qml/qqmlcomponent/data/incubateObject.qml @@ -8,12 +8,12 @@ Item{ property var i - Component{ + Component{ id: component Item { property int dummy: 13 property int dummy2: 26 - } + } } Component.onCompleted: { diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index a37d705284..43aa82e1e4 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -116,7 +116,7 @@ void tst_qqmlconsole::profiling() // profiling() QTest::ignoreMessage(QtWarningMsg, "Cannot start profiling because debug service is disabled. Start with -qmljsdebugger=port:XXXXX."); - QTest::ignoreMessage(QtWarningMsg, "Profiling was not started."); + QTest::ignoreMessage(QtWarningMsg, "Ignoring console.profileEnd(): the debug service is disabled."); QQmlComponent component(&engine, testUrl); QObject *object = component.create(); diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml index ff6c553c31..113b9f111b 100644 --- a/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml +++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 Item { id: root - + property bool test: false property real testData: 9 diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml index 3e4cda6ba3..c68dfcd60d 100644 --- a/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml +++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml @@ -11,7 +11,7 @@ Item { id: obj testProperty: root.value1 * 9 - aliasProperty: root.value2 * 10 + aliasProperty: root.value2 * 10 } Component.onCompleted: { diff --git a/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml b/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml index f228b2c19f..7c871875b2 100644 --- a/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml +++ b/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml @@ -4,9 +4,9 @@ import Qt.test 1.0 MyQmlObject { property alias c1: myObject.c1 property int c2: 3 - property int c3: c2 - objectProperty: QtObject { - id: myObject + property int c3: c2 + objectProperty: QtObject { + id: myObject property int c1 } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml index ff6d7311a1..821e1b2356 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml @@ -12,7 +12,7 @@ MyTypeObject { floatProperty: if(1) 8.5 colorProperty: if(1) "red" dateProperty: if(1) "1982-11-25" - timeProperty: if(1) "11:11:32" + timeProperty: if(1) "11:11:32" dateTimeProperty: if(1) "2009-05-12T13:22:01" pointProperty: if(1) "99,13" pointFProperty: if(1) "-10.1,12.3" diff --git a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml index ce3511f72a..b7c1e1cc39 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml @@ -14,7 +14,7 @@ MyTypeObject { floatProperty = 8.5 colorProperty = "red" dateProperty = "1982-11-25" - timeProperty = "11:11:32" + timeProperty = "11:11:32" dateTimeProperty = "2009-05-12T13:22:01" pointProperty = "99,13" pointFProperty = "-10.1,12.3" diff --git a/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml b/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml index 80545cf72b..e49a26d909 100644 --- a/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml +++ b/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml @@ -1,14 +1,14 @@ import Qt.test 1.0 -MyQmlContainer { - children : [ - MyQmlObject { - id: object1 - stringProperty: "hello" + object2.stringProperty +MyQmlContainer { + children : [ + MyQmlObject { + id: object1 + stringProperty: "hello" + object2.stringProperty }, - MyQmlObject { - id: object2 - stringProperty: "hello" + object1.stringProperty - } - ] + MyQmlObject { + id: object2 + stringProperty: "hello" + object1.stringProperty + } + ] } diff --git a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml index 3147f63989..054ecb98f6 100644 --- a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - stringProperty: trueProperty?'pass':'fail' +MyQmlObject { + stringProperty: trueProperty?'pass':'fail' } diff --git a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml index c89bb49b45..37c747b3a0 100644 --- a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - stringProperty: falseProperty?'fail':'pass' +MyQmlObject { + stringProperty: falseProperty?'fail':'pass' } diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml index 207a06b700..7a0b0d6e3c 100644 --- a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml @@ -4,8 +4,8 @@ MyQmlObject { property alias c1: myConstants.c1 property alias c2: myConstants.c2 - objectProperty: ConstantsOverrideBindings { + objectProperty: ConstantsOverrideBindings { id: myConstants - c2: 10 + c2: 10 } } diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml index 5a2091f71c..0c900d78a4 100644 --- a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml +++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml @@ -4,7 +4,7 @@ MyQmlObject { property alias c1: myConstants.c1 property alias c3: myConstants.c3 - objectProperty: ConstantsOverrideBindings { + objectProperty: ConstantsOverrideBindings { id: myConstants c3: 10 } diff --git a/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml b/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml index 97acddf5fc..b3adaac20e 100644 --- a/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml +++ b/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 QtObject { function calculate() { - return b * 13; + return b * 13; } property int a: calculate() diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml index 9a5732c194..af995150f1 100644 --- a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml @@ -14,7 +14,7 @@ QtObject { function create() { objectProperty = c.createObject(root); } - + function destroy() { objectProperty.destroy(); } diff --git a/tests/auto/qml/qqmlecmascript/data/eval.qml b/tests/auto/qml/qqmlecmascript/data/eval.qml index a752b8c0d3..87e52d383a 100644 --- a/tests/auto/qml/qqmlecmascript/data/eval.qml +++ b/tests/auto/qml/qqmlecmascript/data/eval.qml @@ -1,11 +1,11 @@ import QtQuick 2.0 QtObject { - property bool test1: false; - property bool test2: false; - property bool test3: false; - property bool test4: false; - property bool test5: false; + property bool test1: false; + property bool test2: false; + property bool test3: false; + property bool test4: false; + property bool test5: false; property int a: 7 diff --git a/tests/auto/qml/qqmlecmascript/data/include.qml b/tests/auto/qml/qqmlecmascript/data/include.qml index 5ce2ed78ec..7a8c69d3f7 100644 --- a/tests/auto/qml/qqmlecmascript/data/include.qml +++ b/tests/auto/qml/qqmlecmascript/data/include.qml @@ -11,8 +11,8 @@ QtObject { property int testValue: 99 - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); test0 = IncludeTest.value test1 = IncludeTest.test1 test2 = IncludeTest.test2 diff --git a/tests/auto/qml/qqmlecmascript/data/include_callback.qml b/tests/auto/qml/qqmlecmascript/data/include_callback.qml index fbebcdcd58..2f8ae28696 100644 --- a/tests/auto/qml/qqmlecmascript/data/include_callback.qml +++ b/tests/auto/qml/qqmlecmascript/data/include_callback.qml @@ -9,7 +9,7 @@ QtObject { property bool test5: false property bool test6: false - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); } } diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote.js b/tests/auto/qml/qqmlecmascript/data/include_remote.js index e6a4676819..4331cb79d0 100644 --- a/tests/auto/qml/qqmlecmascript/data/include_remote.js +++ b/tests/auto/qml/qqmlecmascript/data/include_remote.js @@ -2,8 +2,8 @@ var myvar = 10; function go() { - var a = Qt.include("http://127.0.0.1:8111/remote_file.js", - function(o) { + var a = Qt.include("http://127.0.0.1:8111/remote_file.js", + function(o) { test2 = o.status == o.OK test3 = a.status == a.OK test4 = myvar == 13 @@ -13,8 +13,8 @@ function go() test1 = a.status == a.LOADING - var b = Qt.include("http://127.0.0.1:8111/exception.js", - function(o) { + var b = Qt.include("http://127.0.0.1:8111/exception.js", + function(o) { test7 = o.status == o.EXCEPTION test8 = b.status == a.EXCEPTION test9 = b.exception.toString() == "Whoops!"; diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js index cc90860cc9..27dd63badf 100644 --- a/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js +++ b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js @@ -1,7 +1,7 @@ function go() { - var a = Qt.include("http://127.0.0.1:8111/missing.js", - function(o) { + var a = Qt.include("http://127.0.0.1:8111/missing.js", + function(o) { test2 = o.status == o.NETWORK_ERROR test3 = a.status == a.NETWORK_ERROR diff --git a/tests/auto/qml/qqmlecmascript/data/include_shared.qml b/tests/auto/qml/qqmlecmascript/data/include_shared.qml index 28b1003fd4..66c07e871b 100644 --- a/tests/auto/qml/qqmlecmascript/data/include_shared.qml +++ b/tests/auto/qml/qqmlecmascript/data/include_shared.qml @@ -9,8 +9,8 @@ QtObject { property bool test3: false property bool test3_1: false - Component.onCompleted: { - IncludeTest.go(); + Component.onCompleted: { + IncludeTest.go(); test0 = IncludeTest.value test1 = IncludeTest.test1 test2 = IncludeTest.test2 diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/creationContext.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/creationContext.qml new file mode 100644 index 0000000000..c4d0c7284c --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/jsimport/creationContext.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 +import "importFour.js" as SomeScript + +Item { + id: root + property bool success: false; + Component { + id: testComponent + Item { + property string valueFromScript: SomeScript.greetingString() + } + } + property Loader loader; + signal loaded + onLoaded: { + success = (loader.item.valueFromScript === SomeScript.greetingString()) + } + Component.onCompleted: { + loader = Qt.createQmlObject("import QtQuick 2.0; Loader {}", this, "dynamic loader") + loader.onLoaded.connect(loaded) + loader.sourceComponent = testComponent + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/methods.1.qml b/tests/auto/qml/qqmlecmascript/data/methods.1.qml index 0bbee16df8..5c5b3412a5 100644 --- a/tests/auto/qml/qqmlecmascript/data/methods.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/methods.1.qml @@ -1,6 +1,6 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { id: myObject - onBasicSignal: myObject.methodNoArgs() + onBasicSignal: myObject.methodNoArgs() } diff --git a/tests/auto/qml/qqmlecmascript/data/methods.2.qml b/tests/auto/qml/qqmlecmascript/data/methods.2.qml index 9f0c6b15fe..b2adaf65cb 100644 --- a/tests/auto/qml/qqmlecmascript/data/methods.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/methods.2.qml @@ -1,6 +1,6 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { id: myObject - onBasicSignal: myObject.method(163) + onBasicSignal: myObject.method(163) } diff --git a/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml b/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml index 090c948f26..a57b09fe6a 100644 --- a/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml +++ b/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml @@ -6,8 +6,8 @@ MyQmlObject { property alias c2: myConstants.c2 property int c3: 0 - objectProperty: ConstantsOverrideBindings { - id: myConstants + objectProperty: ConstantsOverrideBindings { + id: myConstants c2: obj.c3 } diff --git a/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml b/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml index 53711db3f4..d079d5ce99 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml @@ -3,7 +3,7 @@ import QtQuick 2.0 MyDerivedObject { property bool test: false - + Component.onCompleted: { test = intProperty() } diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml index 2ac4807ec5..4a715b7a4f 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml @@ -15,7 +15,7 @@ Item { if (wheelCount != 8) return; // not bindable, but wheelCount will update because truck itself changed. - truck = new vehicle(12); + truck = new vehicle(12); if (wheelCount != 12) return; diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml index 14d4f9fd27..4693202240 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml @@ -18,7 +18,7 @@ Item { if (varProperty.a != 10) return; test = true; - } + } } diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml index d5b449c938..5b0236505f 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml @@ -16,7 +16,7 @@ Item { test1 = true; } - // Run gc() from C++ + // Run gc() from C++ function runTest2() { if (object.dummy != 10) return; diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml index 7b99c4b6ad..935485bb81 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml @@ -17,6 +17,6 @@ Item { if (varProperty.a != 10) return; test = true; - } + } } diff --git a/tests/auto/qml/qqmlecmascript/data/scope.2.qml b/tests/auto/qml/qqmlecmascript/data/scope.2.qml index fe1c4c7931..3a2d653e2c 100644 --- a/tests/auto/qml/qqmlecmascript/data/scope.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/scope.2.qml @@ -27,7 +27,7 @@ Item { // id takes precedence over local, and root properties - property int test1: a.value + property int test1: a.value property alias test2: nested.test // properties takes precedence over local, and root methods diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml index ace473756e..2e15f4327b 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml @@ -1,10 +1,10 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptConnect.1.js" as Script -MyQmlObject { +MyQmlObject { property bool test: false id: root - + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); } diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml index cdf2d6ad98..9f91c5d1f7 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptConnect.2.js" as Script -MyQmlObject { +MyQmlObject { property bool test: false id: root - + Component.onCompleted: { var a = new Object; a.b = 12; diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml index b0e40565c0..e41b1c1f23 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml @@ -1,11 +1,11 @@ import Qt.test 1.0 import QtQuick 2.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root - + function testFunction() { test = true; } diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml index ef5331c94a..05155bf11d 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml @@ -1,7 +1,7 @@ import Qt.test 1.0 import QtQuick 2.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml index 8dcacbcbb7..16b085e109 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml @@ -1,7 +1,7 @@ import Qt.test 1.0 import QtQuick 2.0 -MyQmlObject { +MyQmlObject { property bool test: false id: root diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml index 06b6f0fa62..0a3510fb9d 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml @@ -2,12 +2,12 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptConnect.6.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - Component.onCompleted: { + Component.onCompleted: { root.argumentSignal.connect(Script.testFunction); root.argumentSignal.connect(Script.testFunction); } diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml index e546ee44d8..7057437c33 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); onBasicSignal: root.argumentSignal.disconnect(Script.testFunction); diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml index e70cd8b900..70a9243835 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction); onBasicSignal: root.argumentSignal.disconnect(root, Script.testFunction); diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml index 6f47776ea5..bb9abbd2c4 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction); onBasicSignal: root.argumentSignal.disconnect(Script.testFunction); diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml index b3887545fb..d289d17eeb 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml +++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml @@ -2,11 +2,11 @@ import Qt.test 1.0 import QtQuick 2.0 import "scriptDisconnect.1.js" as Script -MyQmlObject { +MyQmlObject { property int test: 0 id: root - + Component.onCompleted: root.argumentSignal.connect(Script.testFunction); onBasicSignal: root.argumentSignal.disconnect(Script.otherFunction); diff --git a/tests/auto/qml/qqmlecmascript/data/scriptErrors.js b/tests/auto/qml/qqmlecmascript/data/scriptErrors.js index d22f623edb..4f16ef4e82 100644 --- a/tests/auto/qml/qqmlecmascript/data/scriptErrors.js +++ b/tests/auto/qml/qqmlecmascript/data/scriptErrors.js @@ -1,4 +1,4 @@ // Comment a = 10 -function getValue() { a = 10; return 0; } +function getValue() { a = 10; return 0; } diff --git a/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml index 58cf8051f0..d1bddb435c 100644 --- a/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml @@ -11,7 +11,7 @@ MyQmlContainer { MyQmlObject { // Will trigger deletion on binding assignment, but after component creation - deleteOnSet: if (triggerDelete) 1; else 0; + deleteOnSet: if (triggerDelete) 1; else 0; } ] } diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml index fbd09142f7..fbafd843da 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { - onBasicSignal: setString('pass') +MyQmlObject { + onBasicSignal: setString('pass') } diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml index 6467c42bb9..8406566848 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -MyQmlObject { +MyQmlObject { onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c + ' ' + d + ' ' + e) } diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml index 7e85312692..cd68fb9b82 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml @@ -91,4 +91,15 @@ QtObject { testObjectWithAliasHandler.count++ return testObjectWithAliasHandler.testSuccess } + + signal signalWithClosureArgument(var f) + onSignalWithClosureArgument: f() + + function testSignalWithClosureArgument() { + var testSuccess = false + signalWithClosureArgument(function() { + testSuccess = true + }) + return testSuccess + } } diff --git a/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml b/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml index d98d7e9c81..1def3d0307 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml @@ -11,7 +11,7 @@ MyQmlObject { property real test1: base property real test2: Math.max(0, base) } - + // Signal with no args onBasicSignal: base = 200 // Signal with args diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 2aef1d644d..928d594f62 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -152,7 +152,7 @@ public: } QObject *objectProperty() const { return m_object; } - void setObjectProperty(QObject *obj) { + void setObjectProperty(QObject *obj) { if (obj == m_object) return; m_object = obj; @@ -206,7 +206,7 @@ public: int intProperty() const { return m_intProperty; } void setIntProperty(int i) { m_intProperty = i; emit intChanged(); } - + Q_INVOKABLE MyEnum2 getEnumValue() const { return EnumValue4; } MyEnum enumPropertyValue; @@ -803,7 +803,7 @@ public: Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_QScriptValue(QJSValue a) { invoke(14); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_intQScriptValue(int a, QJSValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } - + Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } Q_INVOKABLE void method_overload(QString a) { invoke(18); m_actuals << a; } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 3f412ee6d4..a39564bd19 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -55,6 +55,7 @@ #include "../../shared/util.h" #include <private/qv4functionobject_p.h> #include <private/qv4scopedvalue_p.h> +#include <private/qv4alloca_p.h> #ifdef Q_CC_MSVC #define NO_INLINE __declspec(noinline) @@ -62,12 +63,6 @@ #define NO_INLINE __attribute__((noinline)) #endif -#if defined(Q_OS_WIN) -#include <malloc.h> -#else -#include <alloca.h> -#endif - /* This test covers evaluation of ECMAScript expressions and bindings from within QML. This does not include static QML language issues. @@ -174,6 +169,7 @@ private slots: void singletonTypeResolution(); void importScripts_data(); void importScripts(); + void importCreationContext(); void scarceResources(); void scarceResources_data(); void scarceResources_other(); @@ -385,7 +381,7 @@ void tst_qqmlecmascript::assignBasicTypes() QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); QCOMPARE(object->boolProperty(), true); QCOMPARE(object->variantProperty(), QVariant("Hello World!")); - QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f)); QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); delete object; } @@ -414,7 +410,7 @@ void tst_qqmlecmascript::assignBasicTypes() QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); QCOMPARE(object->boolProperty(), true); QCOMPARE(object->variantProperty(), QVariant("Hello World!")); - QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f)); QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); delete object; } @@ -771,7 +767,7 @@ void tst_qqmlecmascript::contextPropertiesTriggerReeval() context.setContextProperty("testObj", &object1); context.setContextProperty("testObj2", object3); - { + { MyExpression expr(&context, "testProp + 1"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant(2)); @@ -781,7 +777,7 @@ void tst_qqmlecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant(3)); } - { + { MyExpression expr(&context, "testProp + testProp + testProp"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant(6)); @@ -791,7 +787,7 @@ void tst_qqmlecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant(12)); } - { + { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("Hello")); @@ -801,7 +797,7 @@ void tst_qqmlecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("World")); } - { + { MyExpression expr(&context, "testObj.stringProperty /**/"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("World")); @@ -811,7 +807,7 @@ void tst_qqmlecmascript::contextPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("Hello")); } - { + { MyExpression expr(&context, "testObj2"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant::fromValue((QObject *)object3)); @@ -832,7 +828,7 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() object2.setStringProperty(QLatin1String("Dog")); object3.setStringProperty(QLatin1String("Cat")); - { + { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant("Hello")); @@ -842,7 +838,7 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() QCOMPARE(expr.evaluate(), QVariant("World")); } - { + { MyExpression expr(&context, "testObj.objectProperty.stringProperty"); QCOMPARE(expr.changed, false); QCOMPARE(expr.evaluate(), QVariant()); @@ -877,7 +873,7 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() void tst_qqmlecmascript::deferredProperties() { QQmlComponent component(&engine, testFileUrl("deferredProperties.qml")); - MyDeferredObject *object = + MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->value(), 0); @@ -886,7 +882,7 @@ void tst_qqmlecmascript::deferredProperties() qmlExecuteDeferred(object); QCOMPARE(object->value(), 10); QVERIFY(object->objectProperty() != 0); - MyQmlObject *qmlObject = + MyQmlObject *qmlObject = qobject_cast<MyQmlObject *>(object->objectProperty()); QVERIFY(qmlObject != 0); QCOMPARE(qmlObject->value(), 10); @@ -900,7 +896,7 @@ void tst_qqmlecmascript::deferredProperties() void tst_qqmlecmascript::deferredPropertiesErrors() { QQmlComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml")); - MyDeferredObject *object = + MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->value(), 0); @@ -962,7 +958,7 @@ void tst_qqmlecmascript::deferredPropertiesInDestruction() void tst_qqmlecmascript::extensionObjects() { QQmlComponent component(&engine, testFileUrl("extensionObjects.qml")); - MyExtendedObject *object = + MyExtendedObject *object = qobject_cast<MyExtendedObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->baseProperty(), 13); @@ -1154,7 +1150,7 @@ void tst_qqmlecmascript::valueTypeFunctions() delete obj; } -/* +/* Tests that writing a constant to a property with a binding on it disables the binding. */ @@ -1237,7 +1233,7 @@ the original binding to be disabled. */ void tst_qqmlecmascript::outerBindingOverridesInnerBinding() { - QQmlComponent component(&engine, + QQmlComponent component(&engine, testFileUrl("outerBindingOverridesInnerBinding.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); @@ -1260,7 +1256,7 @@ void tst_qqmlecmascript::outerBindingOverridesInnerBinding() } /* -Access a non-existent attached object. +Access a non-existent attached object. Tests for a regression where this used to crash. */ @@ -1917,7 +1913,7 @@ void tst_qqmlecmascript::propertyAssignmentErrors() delete object; } - + /* Test bindings still work when the reeval is triggered from within a signal script. @@ -2264,7 +2260,7 @@ void tst_qqmlecmascript::regExpBug() static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, const char *source) { - QString functionSource = QLatin1String("(function(object) { return ") + + QString functionSource = QLatin1String("(function(object) { return ") + QLatin1String(source) + QLatin1String(" })"); QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource); @@ -2292,7 +2288,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o, const char *source, const QV4::ValueRef result) { - QString functionSource = QLatin1String("(function(object) { return ") + + QString functionSource = QLatin1String("(function(object) { return ") + QLatin1String(source) + QLatin1String(" })"); QV4::Script program(QV8Engine::getV4(engine)->rootContext, functionSource); @@ -2324,7 +2320,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o, static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef o, const char *source) { - QString functionSource = QLatin1String("(function(object) { return ") + + QString functionSource = QLatin1String("(function(object) { return ") + QLatin1String(source) + QLatin1String(" })"); QV4::ExecutionContext *ctx = QV8Engine::getV4(engine)->currentContext(); @@ -2363,7 +2359,7 @@ void tst_qqmlecmascript::callQtInvokables() QQmlEngine qmlengine; QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&qmlengine); - + QV8Engine *engine = ep->v8engine(); QV4::Scope scope(QV8Engine::getV4(engine)); @@ -3027,7 +3023,7 @@ void tst_qqmlecmascript::attachedPropertyScope() QObject *object = component.create(); QVERIFY(object != 0); - MyQmlAttachedObject *attached = + MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); QVERIFY(attached != 0); @@ -3242,7 +3238,7 @@ void tst_qqmlecmascript::ownership() QVERIFY(own.object != 0); QObject *object = component.create(context); - + engine.collectGarbage(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); @@ -3278,7 +3274,7 @@ public: QPointer<QObject> value; }; -// QTBUG-15695. +// QTBUG-15695. // Test setObjectOwnership(CppOwnership) works even when there is no QQmlData void tst_qqmlecmascript::cppOwnershipReturnValue() { @@ -3911,7 +3907,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) { QV4::Scope scope(v4); QV4::ScopedArrayObject scripts(scope, ctxt->importedScripts); QV4::ScopedValue qml(scope); - for (quint32 i = 0; i < scripts->arrayLength(); ++i) { + for (quint32 i = 0; i < scripts->getLength(); ++i) { QQmlContextData *scriptContext, *newContext; qml = scripts->getIndexed(i); @@ -4216,6 +4212,20 @@ void tst_qqmlecmascript::importScripts() engine.setImportPathList(importPathList); } +void tst_qqmlecmascript::importCreationContext() +{ + QQmlComponent component(&engine, testFileUrl("jsimport/creationContext.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + bool success = object->property("success").toBool(); + if (!success) { + QSignalSpy readySpy(object.data(), SIGNAL(loaded())); + readySpy.wait(); + } + success = object->property("success").toBool(); + QVERIFY(success); +} + void tst_qqmlecmascript::scarceResources_other() { /* These tests require knowledge of state, since we test values after @@ -5628,7 +5638,7 @@ void tst_qqmlecmascript::assignSequenceTypes() } } -// Test that assigning a null object works +// Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qqmlecmascript::nullObjectBinding() { @@ -6070,6 +6080,9 @@ void tst_qqmlecmascript::signalHandlers() QMetaObject::invokeMethod(o, "testAliasSignalHandler", Q_RETURN_ARG(QVariant, result)); QCOMPARE(result.toBool(), true); + QMetaObject::invokeMethod(o, "testSignalWithClosureArgument", Q_RETURN_ARG(QVariant, result)); + QCOMPARE(result.toBool(), true); + delete o; } @@ -6276,7 +6289,7 @@ void tst_qqmlecmascript::aliasBindingsAssignCorrectly() // Test bindings assigned to alias properties override a binding on the target (QTBUG-13719) void tst_qqmlecmascript::aliasBindingsOverrideTarget() { - { + { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml")); QObject *o = component.create(); QVERIFY(o != 0); diff --git a/tests/auto/qml/qqmlengine/qqmlengine.pro b/tests/auto/qml/qqmlengine/qqmlengine.pro index fd8c463742..e84512fae3 100644 --- a/tests/auto/qml/qqmlengine/qqmlengine.pro +++ b/tests/auto/qml/qqmlengine/qqmlengine.pro @@ -4,7 +4,7 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) -SOURCES += tst_qqmlengine.cpp +SOURCES += tst_qqmlengine.cpp QT += core-private gui-private qml-private network testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp index 44fbb0a982..c3d8a1502c 100644 --- a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp +++ b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp @@ -203,7 +203,7 @@ void tst_qqmlerror::debug() error.setLine(92); error.setColumn(13); - QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error "); + QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error"); qWarning() << error; } diff --git a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp index 793da64734..2d7e0a8594 100644 --- a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp +++ b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp @@ -63,7 +63,7 @@ void tst_qqmlglobal::initTestCase() void tst_qqmlglobal::colorProviderWarning() { - const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set! "); + const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set!"); QTest::ignoreMessage(QtWarningMsg, expected.data()); QQml_colorProvider(); } diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp index 0cd4360e67..0c8424aaba 100644 --- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp +++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp @@ -486,7 +486,7 @@ void tst_qqmlinstruction::dump() } QStringList expect; - expect + expect << "Index\tOperation\t\tData1\tData2\tData3\tComments" << "-------------------------------------------------------------------------------" << "0\t\tINIT\t\t\t0\t3\t-1\t-1" @@ -500,7 +500,7 @@ void tst_qqmlinstruction::dump() << "8\t\tSTORE_INTEGER\t\t5\t9" << "9\t\tSTORE_BOOL\t\t6\ttrue" << "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" - << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\") " + << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\")" << "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" << "13\t\tSTORE_DATE\t\t10\t9" << "14\t\tSTORE_TIME\t\t11" diff --git a/tests/auto/qml/qqmllanguage/data/NestedAlias.qml b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml index 7d49b0ac98..3606836e96 100644 --- a/tests/auto/qml/qqmllanguage/data/NestedAlias.qml +++ b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml @@ -7,8 +7,8 @@ QtObject { property alias a: object2.a o1: QtObject { id: object1 } - o2: QtObject { - id: object2 + o2: QtObject { + id: object2 property int a: 1923 } } diff --git a/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml index 947f14811f..6b589fb612 100644 --- a/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml +++ b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml @@ -3,6 +3,6 @@ import QtQuick 2.0 MyQmlObject { property int a: Math.max(10, 9) - property int b: 11 + property int b: 11 Component.onCompleted: console.log("Completed " + a + " " + b); } diff --git a/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml index 11fb9d9578..a172d94a9e 100644 --- a/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml +++ b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml @@ -3,6 +3,6 @@ import QtQuick 2.0 MyQmlObject { property int a: Math.max(10, 9) - property int b: 11 + property int b: 11 Component.onDestruction: console.log("Destruction " + a + " " + b); } diff --git a/tests/auto/qml/qqmllanguage/data/alias.4.qml b/tests/auto/qml/qqmllanguage/data/alias.4.qml index bd6a769367..da6c6e7898 100644 --- a/tests/auto/qml/qqmllanguage/data/alias.4.qml +++ b/tests/auto/qml/qqmllanguage/data/alias.4.qml @@ -1,6 +1,6 @@ import Test 1.0 Alias2 { - enumAlias: MyTypeObject.EnumVal2 + enumAlias: MyTypeObject.EnumVal2 } diff --git a/tests/auto/qml/qqmllanguage/data/alias.5.qml b/tests/auto/qml/qqmllanguage/data/alias.5.qml index cee2a88cf7..ccd47658e0 100644 --- a/tests/auto/qml/qqmllanguage/data/alias.5.qml +++ b/tests/auto/qml/qqmllanguage/data/alias.5.qml @@ -4,7 +4,7 @@ import Test 1.0 QtObject { property alias otherAlias: otherObject - property variant other + property variant other other: MyQmlObject { id: otherObject value: 10 diff --git a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml index 4d54bc83c1..c91cf581b3 100644 --- a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml +++ b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml @@ -15,7 +15,7 @@ MyTypeObject { floatProperty: 8.5 colorProperty: "red" dateProperty: "1982-11-25" - timeProperty: "11:11:32" + timeProperty: "11:11:32" dateTimeProperty: "2009-05-12T13:22:01" pointProperty: "99,13" pointFProperty: "-10.1,12.3" diff --git a/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml index 31d17fd55f..fc878170cf 100644 --- a/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml +++ b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml @@ -13,10 +13,10 @@ MyContainer { children: [ QtObject { property int index: 2 - }, + }, QtObject { property int index: 3 - } + } ] QtObject { diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml index 6f822ba157..319e1f5bc5 100644 --- a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml +++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.0 import QtQuick 2.0 as Qt47 Qt.QtObject { diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml index 5d072b160a..d4c77f1432 100644 --- a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml +++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml @@ -8,6 +8,6 @@ QtObject { objectProperty2: QtObject {} property MyComponent myComponentProperty - property MyComponent myComponentProperty2 + property MyComponent myComponentProperty2 myComponentProperty2: MyComponent {} } diff --git a/tests/auto/qml/qqmllanguage/data/interfaceQList.qml b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml index c87dfae785..2e968e4fea 100644 --- a/tests/auto/qml/qqmllanguage/data/interfaceQList.qml +++ b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml @@ -1,6 +1,6 @@ import Test 1.0 MyContainer { - qlistInterfaces: [ + qlistInterfaces: [ MyQmlObject {}, MyQmlObject {} ] diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt index fee5050743..d5e26cd48f 100644 --- a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt +++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt @@ -1 +1 @@ -5:15:Not an attached property name +5:15:Expected type name diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml index fa46b8242a..d61dbd76d0 100644 --- a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.0 QtObject { property variant o; diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml index 3e516738d6..23f6c6353b 100644 --- a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml +++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.0 QtObject { property int o; diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml index 5b08608862..b1610f7b4f 100644 --- a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml @@ -1,4 +1,4 @@ import Test 1.0 -MyQmlObject { - something: 1 + 1 +MyQmlObject { + something: 1 + 1 } diff --git a/tests/auto/qml/qqmllanguage/data/onCompleted.qml b/tests/auto/qml/qqmllanguage/data/onCompleted.qml index 89e6777f8a..6de38d7aab 100644 --- a/tests/auto/qml/qqmllanguage/data/onCompleted.qml +++ b/tests/auto/qml/qqmllanguage/data/onCompleted.qml @@ -10,7 +10,7 @@ MyTypeObject { objectProperty: OnCompletedType { qmlobjectProperty: MyQmlObject { id: nestedObject - property int b: 10 + property int b: 10 Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b) } } diff --git a/tests/auto/qml/qqmllanguage/data/onDestruction.qml b/tests/auto/qml/qqmllanguage/data/onDestruction.qml index 7d6da260b4..4eb5771943 100644 --- a/tests/auto/qml/qqmllanguage/data/onDestruction.qml +++ b/tests/auto/qml/qqmllanguage/data/onDestruction.qml @@ -10,7 +10,7 @@ MyTypeObject { objectProperty: OnDestructionType { qmlobjectProperty: MyQmlObject { id: nestedObject - property int b: 10 + property int b: 10 Component.onDestruction: console.log("Destruction " + a + " " + nestedObject.b) } } diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt index d857a0440e..b8c34042be 100644 --- a/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt +++ b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt @@ -1 +1 @@ -3:5:Invalid property assignment: "readOnlyString" is a read-only property +3:21:Invalid property assignment: "readOnlyString" is a read-only property diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt index f8a776f9a0..0197f30142 100644 --- a/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt +++ b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt @@ -1 +1 @@ -4:40:Cannot assign multiple values to a script property +4:23:Cannot assign multiple values to a script property diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 4a4ab3b81a..98a803a594 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -126,6 +126,26 @@ QByteArray CustomBindingParser::compile(const QList<QQmlCustomParserProperty> &p return result; } +QByteArray CustomBindingParser::compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings) +{ + QByteArray result; + QDataStream ds(&result, QIODevice::WriteOnly); + + ds << bindings.count(); + for (int i = 0; i < bindings.count(); ++i) { + const QV4::CompiledData::Binding *binding = bindings.at(i); + ds << qmlUnit->header.stringAt(binding->propertyNameIndex); + + Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script); + int bindingId = bindingIdentifier(binding); + ds << bindingId; + + ds << binding->location.line; + } + + return result; +} + void CustomBindingParser::setCustomData(QObject *object, const QByteArray &data) { CustomBinding *customBinding = qobject_cast<CustomBinding*>(object); diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h index a968d9a25a..0416258075 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.h +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -59,7 +59,7 @@ QVariant myCustomVariantTypeConverter(const QString &data); -class MyInterface +class MyInterface { public: MyInterface() : id(913) {} @@ -719,6 +719,7 @@ class MyCustomParserTypeParser : public QQmlCustomParser { public: QByteArray compile(const QList<QQmlCustomParserProperty> &) { return QByteArray(); } + QByteArray compile(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &) { return QByteArray(); } void setCustomData(QObject *, const QByteArray &) {} }; @@ -1090,6 +1091,7 @@ public: class CustomBindingParser : public QQmlCustomParser { virtual QByteArray compile(const QList<QQmlCustomParserProperty> &properties); + virtual QByteArray compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings); virtual void setCustomData(QObject *object, const QByteArray &data); }; diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 6a577ec91c..0a40e2cde2 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -487,11 +487,11 @@ void tst_qqmllanguage::errors_data() QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; - QTest::newRow("incorrectCase") << "incorrectCase.qml" + QTest::newRow("incorrectCase") << "incorrectCase.qml" #if defined(Q_OS_MAC) || defined(Q_OS_WIN32) - << "incorrectCase.errors.insensitive.txt" + << "incorrectCase.errors.insensitive.txt" #else - << "incorrectCase.errors.sensitive.txt" + << "incorrectCase.errors.sensitive.txt" #endif << false; @@ -524,7 +524,7 @@ void tst_qqmllanguage::errors() QQmlComponent component(&engine, testFileUrl(file)); - if(create) { + if (create) { QObject *object = component.create(); QVERIFY(object == 0); } @@ -612,7 +612,7 @@ void tst_qqmllanguage::assignQmlComponent() QCOMPARE(child->property("y"), QVariant(11)); } -// Test literal assignment to all the basic types +// Test literal assignment to all the basic types void tst_qqmllanguage::assignBasicTypes() { QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml")); @@ -1170,7 +1170,7 @@ void tst_qqmllanguage::idProperty() MyContainer *object = qobject_cast<MyContainer *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->getChildren()->count(), 1); - MyTypeObject *child = + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); QVERIFY(child != 0); QCOMPARE(child->id(), QString("myObjectId")); @@ -1361,12 +1361,12 @@ void tst_qqmllanguage::propertyValueSource() QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); foreach (QObject *child, allChildren) { - if (qobject_cast<QQmlPropertyValueSource *>(child)) + if (qobject_cast<QQmlPropertyValueSource *>(child)) valueSources.append(child); } QCOMPARE(valueSources.count(), 1); - MyPropertyValueSource *valueSource = + MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); QVERIFY(valueSource != 0); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); @@ -1382,12 +1382,12 @@ void tst_qqmllanguage::propertyValueSource() QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); foreach (QObject *child, allChildren) { - if (qobject_cast<QQmlPropertyValueSource *>(child)) + if (qobject_cast<QQmlPropertyValueSource *>(child)) valueSources.append(child); } QCOMPARE(valueSources.count(), 1); - MyPropertyValueSource *valueSource = + MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); QVERIFY(valueSource != 0); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); @@ -1510,7 +1510,7 @@ void tst_qqmllanguage::aliasProperties() QVERIFY(object != 0); // Read through alias - MyQmlObject *v = + MyQmlObject *v = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); QVERIFY(v != 0); QCOMPARE(v->value(), 10); @@ -1519,7 +1519,7 @@ void tst_qqmllanguage::aliasProperties() MyQmlObject *v2 = new MyQmlObject(); v2->setParent(object); object->setProperty("aliasObject", qVariantFromValue(v2)); - MyQmlObject *v3 = + MyQmlObject *v3 = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); QVERIFY(v3 != 0); QCOMPARE(v3, v2); @@ -1592,7 +1592,7 @@ void tst_qqmllanguage::aliasProperties() QCOMPARE(object->property("a").toInt(), 1923); } - // Ptr Alias Cleanup - check that aliases to ptr types return 0 + // Ptr Alias Cleanup - check that aliases to ptr types return 0 // if the object aliased to is removed { QQmlComponent component(&engine, testFileUrl("alias.7.qml")); @@ -1846,7 +1846,7 @@ void tst_qqmllanguage::scriptString() } } -// Check that default property assignments are correctly spliced into explicit +// Check that default property assignments are correctly spliced into explicit // property assignments void tst_qqmllanguage::defaultPropertyListOrder() { @@ -2993,7 +2993,7 @@ void tst_qqmllanguage::remoteLoadCrash() QQmlComponent component(&engine); component.setData("import QtQuick 2.0; Text {}", QUrl("http://127.0.0.1:14448/remoteLoadCrash.qml")); - while (component.isLoading()) + while (component.isLoading()) QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents, 50); QObject *o = component.create(); diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index d5e85f478d..143164841f 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -1725,11 +1725,11 @@ void tst_qqmllistcompositor::changeDebug() void tst_qqmllistcompositor::groupDebug() { - QTest::ignoreMessage(QtDebugMsg, "Default "); + QTest::ignoreMessage(QtDebugMsg, "Default"); qDebug() << C::Default; - QTest::ignoreMessage(QtDebugMsg, "Cache "); + QTest::ignoreMessage(QtDebugMsg, "Cache"); qDebug() << C::Cache; - QTest::ignoreMessage(QtDebugMsg, "Group3 "); + QTest::ignoreMessage(QtDebugMsg, "Group3"); qDebug() << Selection; } diff --git a/tests/auto/qml/qqmllistmodel/data/multipleroles.qml b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml index 4a331e2b3e..cd4f1aca40 100644 --- a/tests/auto/qml/qqmllistmodel/data/multipleroles.qml +++ b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml @@ -2,12 +2,12 @@ import QtQuick 2.0 ListView { width: 100 height: 250 - delegate: Rectangle { + delegate: Rectangle { width: 100 height: 50 - color: black ? "black": "white" + color: black ? "black": "white" } - model: ListModel { + model: ListModel { objectName: "listModel" ListElement { black: false diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index d565ad557c..0eb38d92e6 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -117,6 +117,7 @@ private slots: void stringLocaleCompare_data(); void stringLocaleCompare(); + void localeAsCppProperty(); private: void addPropertyData(const QString &l); QVariant getProperty(QObject *obj, const QString &locale, const QString &property); @@ -1223,6 +1224,41 @@ void tst_qqmllocale::stringLocaleCompare() QCOMPARE(obj->property("comparison").toInt(), QString::localeAwareCompare(string1, string2)); } +class Calendar : public QObject +{ + Q_OBJECT + Q_PROPERTY(QLocale locale READ locale WRITE setLocale) +public: + Calendar() { + } + + QLocale locale() const { + return mLocale; + } + + void setLocale(const QLocale &locale) { + mLocale = locale; + } +private: + QLocale mLocale; +}; + +void tst_qqmllocale::localeAsCppProperty() +{ + QQmlComponent component(&engine); + qmlRegisterType<Calendar>("Test", 1, 0, "Calendar"); + component.setData("import QtQml 2.2\nimport Test 1.0\nCalendar { locale: Qt.locale('en_GB'); property var testLocale }", QUrl()); + QVERIFY(!component.isError()); + QTRY_VERIFY(component.isReady()); + + Calendar *item = qobject_cast<Calendar*>(component.create()); + QCOMPARE(item->property("locale").toLocale().name(), QLatin1String("en_GB")); + + QVariant localeVariant(QLocale("nb_NO")); + item->setProperty("testLocale", localeVariant); + QCOMPARE(item->property("testLocale").toLocale().name(), QLatin1String("nb_NO")); +} + class DateFormatter : public QObject { Q_OBJECT diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp index b1f83fcd6c..b0c7c5e81a 100644 --- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp +++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp @@ -329,11 +329,11 @@ void tst_QQmlMetaObject::method_data() << (QList<QByteArray>() << "int" << "bool" << "double") << (QList<QByteArray>() << "foo" << "bar" << "baz"); QTest::newRow("testSignal(variant foo, var bar)") << "signal.4.qml" - << "testSignal(QVariant,QVariant)" + << "testSignal(QVariant,QJSValue)" << QMetaMethod::Signal << int(QMetaType::Void) << "void" - << (QList<int>() << QMetaType::QVariant << QMetaType::QVariant) - << (QList<QByteArray>() << "QVariant" << "QVariant") + << (QList<int>() << QMetaType::QVariant << qMetaTypeId<QJSValue>()) + << (QList<QByteArray>() << "QVariant" << "QJSValue") << (QList<QByteArray>() << "foo" << "bar"); QTest::newRow("testSignal(color foo, date bar, url baz)") << "signal.5.qml" << "testSignal(QColor,QDateTime,QUrl)" diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp index 90023222d3..2c57129657 100644 --- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp +++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp @@ -139,7 +139,7 @@ void tst_qqmlmetatype::qmlParserStatusCast() QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1); QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1); - + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast(); QVERIFY(cast != -1); @@ -159,7 +159,7 @@ void tst_qqmlmetatype::qmlPropertyValueSourceCast() QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1); QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1); - + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast(); QVERIFY(cast != -1); @@ -179,7 +179,7 @@ void tst_qqmlmetatype::qmlPropertyValueInterceptorCast() QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1); QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1); - + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0); int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast(); QVERIFY(cast != -1); diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml index 97732d35d8..b13b2004c2 100644 --- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml +++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml @@ -5,7 +5,7 @@ Item { property bool test: false property bool test2: false - Bar { + Bar { id: bar } diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml index f09c29b5a8..563c0b28e3 100644 --- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml +++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml @@ -3,7 +3,7 @@ import QtQuick 2.0 Item { property bool test: false - Bar { + Bar { id: bar } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index a6d9fb5601..15be1fdbc0 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -44,6 +44,11 @@ #include <QtQml/qqmlcomponent.h> #include <QDebug> +#if defined(Q_OS_MAC) +// For _PC_CASE_SENSITIVE +#include <unistd.h> +#endif + #include "../../shared/testhttpserver.h" #include "../../shared/util.h" @@ -145,7 +150,7 @@ void tst_qqmlmoduleplugin::importsPlugin() QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations."); QQmlComponent component(&engine, testFileUrl(QStringLiteral("works.qml"))); foreach (QQmlError err, component.errors()) - qWarning() << err; + qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); QVERIFY(object != 0); diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 62b64a3ef1..669ae7d5ea 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -123,21 +123,21 @@ void tst_QQmlPropertyMap::insert() //inserting property names same with existing method(signal, slot, method) names is not allowed //QQmlPropertyMap has an invokable keys() method - QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. "); + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("keys"), 1); QVERIFY(map.keys().count() == 2); QVERIFY(!map.contains(QLatin1String("keys"))); QVERIFY(map.value(QLatin1String("keys")).isNull()); //QQmlPropertyMap has a deleteLater() slot - QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. "); + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("deleteLater"), 1); QVERIFY(map.keys().count() == 2); QVERIFY(!map.contains(QLatin1String("deleteLater"))); QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); //QQmlPropertyMap has an valueChanged() signal - QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. "); + QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("valueChanged"), 1); QVERIFY(map.keys().count() == 2); QVERIFY(!map.contains(QLatin1String("valueChanged"))); diff --git a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h index 86ac04317f..3b0c83c000 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h +++ b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h @@ -91,10 +91,10 @@ public: m_rect(2, 3, 109, 102), m_rectf(103.8, 99.2, 88.1, 77.6), m_rectfrect(2.0, 3.0, 109.0, 102.0), - m_vector2(32.88, 1.3), - m_vector(23.88, 3.1, 4.3), - m_vector4(54.2, 23.88, 3.1, 4.3), - m_quaternion(4.3, 54.2, 23.88, 3.1), + m_vector2(32.88f, 1.3f), + m_vector(23.88f, 3.1f, 4.3f), + m_vector4(54.2f, 23.88f, 3.1f, 4.3f), + m_quaternion(4.3f, 54.2f, 23.88f, 3.1f), m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) { m_font.setFamily("Arial"); diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml index 923922c55a..78d3bc0fbd 100644 --- a/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml @@ -10,7 +10,7 @@ Rectangle { property int myPixelSize: 12 property int myPixelSize2: 24 - + Text { id: other font.pixelSize: 6 diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml index 9804af4df6..725ba50a45 100644 --- a/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml @@ -10,7 +10,7 @@ Rectangle { property int myPixelSize: 12 property int myPixelSize2: 24 - + Text { id: other font.pixelSize: 6 diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml index b5bb7f8ccc..509fb39562 100644 --- a/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml @@ -10,7 +10,7 @@ Rectangle { property int myPixelSize: 12 property int myPixelSize2: 24 - + Text { id: other font.pixelSize: 6 diff --git a/tests/auto/qml/qqmlvaluetypes/testtypes.h b/tests/auto/qml/qqmlvaluetypes/testtypes.h index 3e5952f64d..b32afcb53a 100644 --- a/tests/auto/qml/qqmlvaluetypes/testtypes.h +++ b/tests/auto/qml/qqmlvaluetypes/testtypes.h @@ -95,10 +95,10 @@ public: m_rect(2, 3, 109, 102), m_rectf(103.8, 99.2, 88.1, 77.6), m_rectfrect(2.0, 3.0, 109.0, 102.0), - m_vector2(32.88, 1.3), - m_vector(23.88, 3.1, 4.3), - m_vector4(54.2, 23.88, 3.1, 4.3), - m_quaternion(4.3, 54.2, 23.88, 3.1), + m_vector2(32.88f, 1.3f), + m_vector(23.88f, 3.1f, 4.3f), + m_vector4(54.2f, 23.88f, 3.1f, 4.3f), + m_quaternion(4.3f, 54.2f, 23.88f, 3.1f), m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) { m_font.setFamily("Arial"); diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index 7c0507dce3..f109fb1fc0 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -468,7 +468,7 @@ void tst_qqmlvaluetypes::vector2d() QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88); QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3); - QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88, 1.3))); + QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88f, 1.3f))); delete object; } @@ -478,7 +478,7 @@ void tst_qqmlvaluetypes::vector2d() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->vector2(), QVector2D(-0.3, -12.9)); + QCOMPARE(object->vector2(), QVector2D(-0.3f, -12.9f)); delete object; } @@ -520,7 +520,7 @@ void tst_qqmlvaluetypes::vector3d() QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88); QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1); QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3); - QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3))); + QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88f, 3.1f, 4.3f))); delete object; } @@ -530,7 +530,7 @@ void tst_qqmlvaluetypes::vector3d() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4)); + QCOMPARE(object->vector(), QVector3D(-0.3f, -12.9f, 907.4f)); delete object; } @@ -574,7 +574,7 @@ void tst_qqmlvaluetypes::vector4d() QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); QCOMPARE((float)object->property("v_w").toDouble(), (float)4.3); - QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2, 23.88, 3.1, 4.3))); + QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2f, 23.88f, 3.1f, 4.3f))); delete object; } @@ -584,7 +584,7 @@ void tst_qqmlvaluetypes::vector4d() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->vector4(), QVector4D(-0.3, -12.9, 907.4, 88.5)); + QCOMPARE(object->vector4(), QVector4D(-0.3f, -12.9f, 907.4f, 88.5f)); delete object; } @@ -627,7 +627,7 @@ void tst_qqmlvaluetypes::quaternion() QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); - QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3, 54.2, 23.88, 3.1))); + QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3f, 54.2f, 23.88f, 3.1f))); delete object; } @@ -637,7 +637,7 @@ void tst_qqmlvaluetypes::quaternion() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->quaternion(), QQuaternion(88.5, -0.3, -12.9, 907.4)); + QCOMPARE(object->quaternion(), QQuaternion(88.5f, -0.3f, -12.9f, 907.4f)); delete object; } @@ -804,7 +804,7 @@ void tst_qqmlvaluetypes::font() // Test pixelSize and pointSize { QQmlComponent component(&engine, testFileUrl("font_write.3.qml")); - QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); + QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size."); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); @@ -814,7 +814,7 @@ void tst_qqmlvaluetypes::font() } { QQmlComponent component(&engine, testFileUrl("font_write.4.qml")); - QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); + QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size."); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); @@ -1184,10 +1184,10 @@ void tst_qqmlvaluetypes::cppClasses() CPP_TEST(QQmlSizeFValueType, QSizeF(-100.7, 18.2)); CPP_TEST(QQmlRectValueType, QRect(13, 39, 10928, 88)); CPP_TEST(QQmlRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); - CPP_TEST(QQuickVector2DValueType, QVector2D(19.7, 1002)); - CPP_TEST(QQuickVector3DValueType, QVector3D(18.2, 19.7, 1002)); - CPP_TEST(QQuickVector4DValueType, QVector4D(18.2, 19.7, 1002, 54)); - CPP_TEST(QQuickQuaternionValueType, QQuaternion(18.2, 19.7, 1002, 54)); + CPP_TEST(QQuickVector2DValueType, QVector2D(19.7f, 1002)); + CPP_TEST(QQuickVector3DValueType, QVector3D(18.2f, 19.7f, 1002)); + CPP_TEST(QQuickVector4DValueType, QVector4D(18.2f, 19.7f, 1002, 54)); + CPP_TEST(QQuickQuaternionValueType, QQuaternion(18.2f, 19.7f, 1002, 54)); CPP_TEST(QQuickMatrix4x4ValueType, QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); CPP_TEST(QQuickFontValueType, QFont("Helvetica")); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml b/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml index d5bb84ddc0..7fcbc9367a 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml @@ -15,7 +15,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - x.abort(); + x.abort(); if (x.readyState == XMLHttpRequest.UNSENT) readyState = true; @@ -23,7 +23,7 @@ QtObject { x.open("PUT", url); x.setRequestHeader("Accept-Language", "en-US"); - x.abort(); + x.abort(); x.open("GET", url); x.setRequestHeader("Accept-Language", "en-US"); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml index 4f58062a26..0a85c6b16f 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml @@ -15,7 +15,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - x.abort(); + x.abort(); if (x.readyState == XMLHttpRequest.UNSENT) readyState = true; diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/element.qml b/tests/auto/qml/qqmlxmlhttprequest/data/element.qml index 9b190f3a43..e0701d511a 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/element.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/element.qml @@ -115,8 +115,8 @@ QtObject { function checkXML(document) { - checkElement(document.documentElement, - document.documentElement.childNodes[0], + checkElement(document.documentElement, + document.documentElement.childNodes[0], document.documentElement.childNodes[1]); } diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml index 580688b835..a9066093d4 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml @@ -20,12 +20,12 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - try { - x.getResponseHeader("Test-Header"); - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - unsentException = true; - } + try { + x.getResponseHeader("Test-Header"); + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + unsentException = true; + } if (x.readyState == XMLHttpRequest.UNSENT) readyState = true; @@ -36,25 +36,25 @@ QtObject { if (x.readyState == XMLHttpRequest.OPENED) openedState = true; - try { - x.getResponseHeader("Test-Header"); - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - openedException = true; - } + try { + x.getResponseHeader("Test-Header"); + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + openedException = true; + } var headers = "connection: close\r\ncontent-type: text/html; charset=UTF-8\r\ntest-header: TestValue\r\nmultitest-header: TestValue, SecondTestValue\r\ncontent-length: 11"; // Test to the end x.onreadystatechange = function() { - if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { - headersReceivedState = true; + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headersReceivedState = true; - headersReceivedHeader = (x.getAllResponseHeaders() == headers); - } else if (x.readyState == XMLHttpRequest.DONE) { - doneState = headersReceivedState && true; + headersReceivedHeader = (x.getAllResponseHeaders() == headers); + } else if (x.readyState == XMLHttpRequest.DONE) { + doneState = headersReceivedState && true; - doneHeader = (x.getAllResponseHeaders() == headers); + doneHeader = (x.getAllResponseHeaders() == headers); dataOK = (x.responseText == "QML Rocks!\n"); } } diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml index 203967e539..0219d7b2fc 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml @@ -26,12 +26,12 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - try { - x.getResponseHeader("Test-Header"); - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - unsentException = true; - } + try { + x.getResponseHeader("Test-Header"); + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + unsentException = true; + } if (x.readyState == XMLHttpRequest.UNSENT) readyState = true; @@ -42,29 +42,29 @@ QtObject { if (x.readyState == XMLHttpRequest.OPENED) openedState = true; - try { - x.getResponseHeader("Test-Header"); - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - openedException = true; - } + try { + x.getResponseHeader("Test-Header"); + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + openedException = true; + } // Test to the end x.onreadystatechange = function() { - if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { - headersReceivedState = true; - - headersReceivedNullHeader = (x.getResponseHeader("Nonexistant-header") == ""); - headersReceivedValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue"); - headersReceivedMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue"); - headersReceivedCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == ""); - } else if (x.readyState == XMLHttpRequest.DONE) { - doneState = headersReceivedState && true; - - doneNullHeader = (x.getResponseHeader("Nonexistant-header") == ""); - doneValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue"); - doneMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue"); - doneCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == ""); + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headersReceivedState = true; + + headersReceivedNullHeader = (x.getResponseHeader("Nonexistant-header") == ""); + headersReceivedValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue"); + headersReceivedMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue"); + headersReceivedCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == ""); + } else if (x.readyState == XMLHttpRequest.DONE) { + doneState = headersReceivedState && true; + + doneNullHeader = (x.getResponseHeader("Nonexistant-header") == ""); + doneValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue"); + doneMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue"); + doneCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == ""); dataOK = (x.responseText == "QML Rocks!\n"); } } diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml b/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml index 5a4093b9f1..88207c19ca 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.0 QtObject { property bool readyState: false diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml index e5c7b74553..5b01caad39 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml @@ -5,7 +5,7 @@ QtObject { property bool dataOK: false property bool done: false - + Component.onCompleted: { var x = new XMLHttpRequest; x.open("GET", url); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml index 0894573ecc..cd6e1f99ad 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml @@ -5,7 +5,7 @@ QtObject { property bool dataOK: false property bool done: false - + Component.onCompleted: { var x = new XMLHttpRequest; x.open("GET", url); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml index 003d1954e9..c658feb5aa 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml @@ -5,7 +5,7 @@ QtObject { property bool dataOK: false property bool done: false - + Component.onCompleted: { var x = new XMLHttpRequest; x.open("GET", url); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml index 4e0caa7171..65ce90853d 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml @@ -19,7 +19,7 @@ QtObject { x.send(); try { - x.send() + x.send() } catch (e) { if (e.code == DOMException.INVALID_STATE_ERR) test = true; diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.qml b/tests/auto/qml/qqmlxmlhttprequest/data/status.qml index 5feac17711..22c45c099d 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/status.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.qml @@ -19,22 +19,22 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - try { - var a = x.status; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - unsentException = true; - } + try { + var a = x.status; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + unsentException = true; + } x.open("GET", url); x.setRequestHeader("Accept-Language", "en-US"); - try { - var a = x.status; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - openedException = true; - } + try { + var a = x.status; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + openedException = true; + } // Test to the end x.onreadystatechange = function() { @@ -65,11 +65,11 @@ QtObject { x.send() - try { - var a = x.status; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - sentException = true; - } + try { + var a = x.status; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + sentException = true; + } } } diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml index 3c74efc091..bf59a1e9f9 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml @@ -19,22 +19,22 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; - try { - var a = x.statusText; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - unsentException = true; - } + try { + var a = x.statusText; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + unsentException = true; + } x.open("GET", url); x.setRequestHeader("Accept-Language", "en-US"); - try { - var a = x.statusText; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - openedException = true; - } + try { + var a = x.statusText; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + openedException = true; + } // Test to the end x.onreadystatechange = function() { @@ -65,11 +65,11 @@ QtObject { x.send() - try { - var a = x.statusText; - } catch (e) { - if (e.code == DOMException.INVALID_STATE_ERR) - sentException = true; - } + try { + var a = x.statusText; + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + sentException = true; + } } } diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index 9c67e6e2e9..17becb3714 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -208,7 +208,7 @@ void tst_qqmlxmlhttprequest::instanceStateValues() QCOMPARE(object->property("done").toInt(), 4); } -// Test calling constructor +// Test calling constructor void tst_qqmlxmlhttprequest::constructor() { QQmlComponent component(&engine, testFileUrl("constructor.qml")); @@ -436,7 +436,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_sent() component.completeCreate(); QCOMPARE(object->property("test").toBool(), true); - + QTRY_VERIFY(object->property("dataOK").toBool() == true); } @@ -796,7 +796,7 @@ void tst_qqmlxmlhttprequest::statusText() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); QVERIFY(server.wait(testFileUrl("status.expect"), - replyUrl, + replyUrl, testFileUrl("testdocument.html"))); QQmlComponent component(&engine, testFileUrl("statusText.qml")); @@ -836,7 +836,7 @@ void tst_qqmlxmlhttprequest::responseText() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); QVERIFY(server.wait(testFileUrl("status.expect"), - replyUrl, + replyUrl, bodyUrl)); QQmlComponent component(&engine, testFileUrl("responseText.qml")); @@ -883,7 +883,7 @@ void tst_qqmlxmlhttprequest::nonUtf8() QMetaObject::invokeMethod(object.data(), "startRequest"); QTRY_VERIFY(object->property("dataOK").toBool() == true); - + QCOMPARE(object->property("responseText").toString(), responseText); if (!xmlRootNodeValue.isEmpty()) { @@ -980,10 +980,10 @@ void tst_qqmlxmlhttprequest::redirects() object->setProperty("expectedText", ""); component.completeCreate(); - for (int ii = 0; ii < 60; ++ii) { - if (object->property("done").toBool()) break; - QTest::qWait(50); - } + for (int ii = 0; ii < 60; ++ii) { + if (object->property("done").toBool()) break; + QTest::qWait(50); + } QVERIFY(object->property("done").toBool() == true); QCOMPARE(object->property("dataOK").toBool(), true); diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index 53df72d75f..73e8a283c7 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -137,8 +137,8 @@ void tst_qquickfolderlistmodel::basicProperties() QCOMPARE(flm->property("showDotAndDotDot").toBool(), false); QCOMPARE(flm->property("showOnlyReadable").toBool(), false); QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("basic.qml")); - QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String("dummy.qml")); - + QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String("dummy.qml")); + flm->setProperty("folder",QUrl::fromLocalFile("")); QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("")); } diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index 1530ce83e2..a799fc4fc4 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -187,7 +187,7 @@ void tst_QQuickWorkerScript::messaging_sendJsObject() waitForEchoMessage(worker); QVariant result = qVariantFromValue(false); - QVERIFY(QMetaObject::invokeMethod(worker, "compareLiteralResponse", Qt::DirectConnection, + QVERIFY(QMetaObject::invokeMethod(worker, "compareLiteralResponse", Qt::DirectConnection, Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, jsObject))); QVERIFY(result.toBool()); diff --git a/tests/auto/quick/qquickaccessible/data/checkbuttons.qml b/tests/auto/quick/qquickaccessible/data/checkbuttons.qml index 22cdad1377..8769c04095 100644 --- a/tests/auto/quick/qquickaccessible/data/checkbuttons.qml +++ b/tests/auto/quick/qquickaccessible/data/checkbuttons.qml @@ -6,6 +6,7 @@ Item { // button, not checkable Rectangle { + objectName: "button1" y: 20 width: 100; height: 20 Accessible.role : Accessible.Button @@ -13,34 +14,44 @@ Item { // button, checkable, not checked Rectangle { + objectName: "button2" y: 40 width: 100; height: 20 Accessible.role : Accessible.Button + Accessible.checkable: checkable + Accessible.checked: checked property bool checkable: true property bool checked: false } // button, checkable, checked Rectangle { + objectName: "button3" y: 60 width: 100; height: 20 Accessible.role : Accessible.Button + Accessible.checkable: checkable + Accessible.checked: checked property bool checkable: true property bool checked: true } // check box, checked Rectangle { + objectName: "checkbox1" y: 80 width: 100; height: 20 Accessible.role : Accessible.CheckBox + Accessible.checked: checked property bool checked: true } // check box, not checked Rectangle { + objectName: "checkbox2" y: 100 width: 100; height: 20 Accessible.role : Accessible.CheckBox + Accessible.checked: checked property bool checked: false } } diff --git a/tests/auto/quick/qquickaccessible/qquickaccessible.pro b/tests/auto/quick/qquickaccessible/qquickaccessible.pro index 6fc6011229..99c3834147 100644 --- a/tests/auto/quick/qquickaccessible/qquickaccessible.pro +++ b/tests/auto/quick/qquickaccessible/qquickaccessible.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qquickaccessible -QT += qml-private network quick-private testlib gui-private +QT += qml-private network quick-private testlib gui-private core-private macx:CONFIG -= app_bundle SOURCES += tst_qquickaccessible.cpp diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index 4bf568745b..54eb3509bd 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -44,6 +44,10 @@ #include "QtTest/qtestaccessible.h" #include <QtGui/qaccessible.h> +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformnativeinterface.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformaccessibility.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> @@ -96,6 +100,12 @@ public: tst_QQuickAccessible(); virtual ~tst_QQuickAccessible(); +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + private slots: void commonTests_data(); void commonTests(); @@ -116,6 +126,37 @@ tst_QQuickAccessible::~tst_QQuickAccessible() } +void tst_QQuickAccessible::initTestCase() +{ + QQmlDataTest::initTestCase(); + QTestAccessibility::initialize(); + QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); + pfIntegration->accessibility()->setActive(true); +} + +void tst_QQuickAccessible::cleanupTestCase() +{ + QTestAccessibility::cleanup(); +} + +void tst_QQuickAccessible::init() +{ + QTestAccessibility::clearEvents(); +} + +void tst_QQuickAccessible::cleanup() +{ + const EventList list = QTestAccessibility::events(); + if (!list.isEmpty()) { + qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), + QString(QTest::currentTestFunction()).toLatin1().constData()); + for (int i = 0; i < list.count(); ++i) + qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(), + qAccessibleEventString(list.at(i)->type()), list.at(i)->child()); + } + QTestAccessibility::clearEvents(); +} + void tst_QQuickAccessible::commonTests_data() { QTest::addColumn<QString>("accessibleRoleFileName"); @@ -141,50 +182,7 @@ void tst_QQuickAccessible::commonTests() QVERIFY(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"; - } + QTestAccessibility::clearEvents(); } void tst_QQuickAccessible::quickAttachedProperties() @@ -259,6 +257,7 @@ void tst_QQuickAccessible::quickAttachedProperties() } delete object; } + QTestAccessibility::clearEvents(); } @@ -309,6 +308,7 @@ void tst_QQuickAccessible::basicPropertiesTest() QCOMPARE(text2->indexOfChild(item), -1); delete window; + QTestAccessibility::clearEvents(); } QAccessibleInterface *topLevelChildAt(QAccessibleInterface *iface, int x, int y) @@ -374,6 +374,7 @@ void tst_QQuickAccessible::hitTest() QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201")); delete window; + QTestAccessibility::clearEvents(); } void tst_QQuickAccessible::checkableTest() @@ -381,6 +382,17 @@ void tst_QQuickAccessible::checkableTest() QScopedPointer<QQuickView> window(new QQuickView()); window->setSource(testFileUrl("checkbuttons.qml")); window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + + QQuickItem *contentItem = window->contentItem(); + QVERIFY(contentItem); + QQuickItem *rootItem = contentItem->childItems().first(); + QVERIFY(rootItem); + + // the window becomes active + QAccessible::State activatedChange; + activatedChange.active = true; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window.data()); QVERIFY(iface); @@ -391,9 +403,28 @@ void tst_QQuickAccessible::checkableTest() QVERIFY(!(button1->state().checked)); QVERIFY(!(button1->state().checkable)); + QVERIFY(button1->state().focusable); + QVERIFY(!button1->state().focused); + + QTestAccessibility::clearEvents(); + + // set properties + QQuickItem *button1item = qobject_cast<QQuickItem*>(rootItem->childItems().at(0)); + QVERIFY(button1item); + QCOMPARE(button1item->objectName(), QLatin1String("button1")); + button1item->forceActiveFocus(); + QVERIFY(button1->state().focusable); + QVERIFY(button1->state().focused); + + QAccessibleEvent focusEvent(button1item, QAccessible::Focus); + QVERIFY_EVENT(&focusEvent); + QAccessibleInterface *button2 = root->child(1); QVERIFY(!(button2->state().checked)); QVERIFY(button2->state().checkable); + QQuickItem *button2item = qobject_cast<QQuickItem*>(rootItem->childItems().at(1)); + QVERIFY(button2item); + QCOMPARE(button2item->objectName(), QLatin1String("button2")); QAccessibleInterface *button3 = root->child(2); QVERIFY(button3->state().checked); @@ -401,12 +432,28 @@ void tst_QQuickAccessible::checkableTest() QAccessibleInterface *checkBox1 = root->child(3); QCOMPARE(checkBox1->role(), QAccessible::CheckBox); - QVERIFY((checkBox1->state().checked)); + QVERIFY(checkBox1->state().checked); QVERIFY(checkBox1->state().checkable); + QQuickItem *checkbox1item = qobject_cast<QQuickItem*>(rootItem->childItems().at(3)); + QVERIFY(checkbox1item); + QCOMPARE(checkbox1item->objectName(), QLatin1String("checkbox1")); + + checkbox1item->setProperty("checked", false); + QVERIFY(!checkBox1->state().checked); + QAccessible::State checkState; + checkState.checked = true; + QAccessibleStateChangeEvent checkChanged(checkbox1item, checkState); + QVERIFY_EVENT(&checkChanged); + + checkbox1item->setProperty("checked", true); + QVERIFY(checkBox1->state().checked); + QVERIFY_EVENT(&checkChanged); QAccessibleInterface *checkBox2 = root->child(4); QVERIFY(!(checkBox2->state().checked)); QVERIFY(checkBox2->state().checkable); + + QTestAccessibility::clearEvents(); } QTEST_MAIN(tst_QQuickAccessible) diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 0377eaa71d..c1a223c30d 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -223,6 +223,10 @@ void tst_qquickanimatedimage::mirror_notRunning() screenshot = window.grabWindow(); screenshot.save("screen.png"); +#if defined(Q_OS_WIN) + // QTBUG-36717 + QSKIP("This test is failing in the CI system under mysterious circumstances"); +#endif QCOMPARE(screenshot, expected); // mirroring should not change the current frame or playing status diff --git a/tests/auto/quick/qquickanimations/data/runningTrueBug.qml b/tests/auto/quick/qquickanimations/data/runningTrueBug.qml index bec6fab368..b2e8afcf0f 100644 --- a/tests/auto/quick/qquickanimations/data/runningTrueBug.qml +++ b/tests/auto/quick/qquickanimations/data/runningTrueBug.qml @@ -26,5 +26,5 @@ Rectangle { duration: 1000 } } - } + } } diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index c6f4779819..21872a5528 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -470,6 +470,9 @@ void tst_qquickanimations::pathInterpolator() void tst_qquickanimations::pathInterpolatorBackwardJump() { +#ifdef Q_CC_MINGW + QSKIP("QTBUG-36290 - MinGW Animation tests are flaky."); +#endif { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("pathInterpolatorBack.qml")); diff --git a/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml b/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml new file mode 100644 index 0000000000..9cf22dc7a1 --- /dev/null +++ b/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + width: 400; height: 400 + + property alias animRunning: springAnim.running + + Rectangle { + objectName: "myRect" + color: "green" + width: 20; height: 20 + + property bool triggered: false + + onXChanged: { + if (!triggered && x > 50 && x < 80) { + triggered = true + x = x //set same value + } + } + + Behavior on x { + SpringAnimation { + id: springAnim + spring: 3 + damping: 0.2 + mass: .5 + } + } + } +} diff --git a/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml b/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml new file mode 100644 index 0000000000..db076bca9a --- /dev/null +++ b/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +Item { + width: 200 + height: 200 + + property int behaviorCount: 0 + + Rectangle { + id: myRect + objectName: "myRect" + width: 100 + height: 100 + Behavior on x { + ScriptAction { script: ++behaviorCount } + } + } +} diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index c40abbd55f..5deda2d96b 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -81,6 +81,7 @@ private slots: void delayedRegistration(); void startOnCompleted(); void multipleChangesToValueType(); + void currentValue(); }; void tst_qquickbehaviors::simpleBehavior() @@ -495,6 +496,59 @@ void tst_qquickbehaviors::multipleChangesToValueType() QTRY_COMPARE(text->property("font").value<QFont>(), value); } +//QTBUG-21549 +void tst_qquickbehaviors::currentValue() +{ + { + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("qtbug21549.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(item); + + QQuickRectangle *target = item->findChild<QQuickRectangle*>("myRect"); + QVERIFY(target); + + QCOMPARE(target->x(), qreal(0)); + + target->setProperty("x", 50); + QCOMPARE(item->property("behaviorCount").toInt(), 1); + QCOMPARE(target->x(), qreal(50)); + + target->setProperty("x", 50); + QCOMPARE(item->property("behaviorCount").toInt(), 1); + QCOMPARE(target->x(), qreal(50)); + + target->setX(100); + target->setProperty("x", 100); + QCOMPARE(item->property("behaviorCount").toInt(), 1); + QCOMPARE(target->x(), qreal(100)); + + delete item; + } + + { + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("qtbug21549-2.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(item); + + QQuickRectangle *target = item->findChild<QQuickRectangle*>("myRect"); + QVERIFY(target); + + QCOMPARE(target->x(), qreal(0)); + + target->setProperty("x", 100); + + // the spring animation should smoothly transition to the new value triggered + // in the QML (which should be between 50 and 80); + QTRY_COMPARE(item->property("animRunning").toBool(), true); + QTRY_COMPARE(item->property("animRunning").toBool(), false); + QVERIFY(target->x() > qreal(50) && target->x() < qreal(80)); + + delete item; + } +} + QTEST_MAIN(tst_qquickbehaviors) #include "tst_qquickbehaviors.moc" diff --git a/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml index bc11d349fa..e299147b36 100644 --- a/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml +++ b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 import QtTest 1.0 +import QtQuick.Window 2.1 TestCase { id:testCase @@ -10,10 +11,12 @@ TestCase { function cleanupTestCase() { wait(100) //wait for a short while to make sure no leaked textures } + function testData(type) { if (type === "2d") return [ { tag:"image threaded", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}}, + { tag:"image canvas invisible", properties:{visible: false, width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}}, // { tag:"image cooperative", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Cooperative}}, { tag:"image immediate", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Immediate}}, // { tag:"fbo cooperative", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Cooperative}}, diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml index f13039ad95..b92f6354a5 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml @@ -180,11 +180,20 @@ CanvasTestCase { tryCompare(c, "availableChangedCount", 1); //scene graph could be available immediately //in this case, we force waiting a short while until the init paint finished - tryCompare(c, "paintedCount", 1); + if (c.visible) { + tryCompare(c, "paintedCount", 1); + } else { + tryCompare(c, "paintedCount", 0); + } ctx.fillRect(0, 0, c.width, c.height); c.toDataURL(); - tryCompare(c, "paintedCount", 2); - tryCompare(c, "paintCount", 1); + if (c.visible) { + tryCompare(c, "paintCount", 1); + tryCompare(c, "paintedCount", 2); + } else { + tryCompare(c, "paintCount", 0); + tryCompare(c, "paintedCount", 1); + } c.destroy(); } function test_loadImage(row) { diff --git a/tests/auto/quick/qquickgridview/data/displayMargin.qml b/tests/auto/quick/qquickgridview/data/displayMargin.qml new file mode 100644 index 0000000000..1086b8defd --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/displayMargin.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 + +Item { + width: 400; height: 400 + + GridView { + id: view + anchors.top: header.bottom + anchors.bottom: footer.top + width: parent.width + + cellWidth: 50 + cellHeight: 25 + + cacheBuffer: 0 + displayMarginBeginning: 60 + displayMarginEnd: 60 + + model: 200 + delegate: Rectangle { + objectName: "delegate" + width: 50 + height: 25 + color: index % 2 ? "steelblue" : "lightsteelblue" + Text { + anchors.centerIn: parent + text: index + } + } + } + + Rectangle { + id: header + width: parent.width; height: 60 + color: "#80FF0000" + } + + Rectangle { + id: footer + anchors.bottom: parent.bottom + width: parent.width; height: 60 + color: "#80FF0000" + } +} diff --git a/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml b/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml index 2bfe7da78e..d1f8c31e1d 100644 --- a/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml +++ b/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml @@ -39,7 +39,7 @@ Rectangle { color: "lightsteelblue" } } - + GridView { id: grid objectName: "grid" diff --git a/tests/auto/quick/qquickgridview/data/propertychangestest.qml b/tests/auto/quick/qquickgridview/data/propertychangestest.qml index 97efbe78f5..af3126f2d4 100644 --- a/tests/auto/quick/qquickgridview/data/propertychangestest.qml +++ b/tests/auto/quick/qquickgridview/data/propertychangestest.qml @@ -6,7 +6,7 @@ Rectangle { id: delegate Item { id: wrapper - width: 180; height: 40; + width: 180; height: 40; Column { x: 5; y: 5 Text { text: '<b>Name:</b> ' + name } @@ -36,7 +36,7 @@ Rectangle { flow: GridView.LeftToRight } - data:[ + data:[ ListModel { id: listModel ListElement { @@ -65,5 +65,5 @@ Rectangle { } ] } - - + + diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index f1adb7858f..2ee98c6c61 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -207,6 +207,8 @@ private slots: void moved_topToBottom_RtL_BtT(); void moved_topToBottom_RtL_BtT_data(); + void displayMargin(); + private: QList<int> toIntList(const QVariantList &list); void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes); @@ -6307,6 +6309,43 @@ void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QLi } } +void tst_QQuickGridView::displayMargin() +{ + QQuickView *window = createView(); + window->setSource(testFileUrl("displayMargin.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>(); + QVERIFY(gridview != 0); + + QQuickItem *content = gridview->contentItem(); + QVERIFY(content != 0); + + QQuickItem *item0; + QQuickItem *item97; + + QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0)); + QCOMPARE(delegateVisible(item0), true); + + // the 97th item should be within the end margin + QVERIFY(item97 = findItem<QQuickItem>(content, "delegate", 96)); + QCOMPARE(delegateVisible(item97), true); + + // GridView staggers item creation, so the 118th item should be outside the end margin. + QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == 0); + + // the first delegate should still be within the begin margin + gridview->positionViewAtIndex(20, QQuickGridView::Beginning); + QCOMPARE(delegateVisible(item0), true); + + // the first delegate should now be outside the begin margin + gridview->positionViewAtIndex(36, QQuickGridView::Beginning); + QCOMPARE(delegateVisible(item0), false); + + delete window; +} + QTEST_MAIN(tst_QQuickGridView) #include "tst_qquickgridview.moc" diff --git a/tests/auto/quick/qquickimage/data/aspectratio.qml b/tests/auto/quick/qquickimage/data/aspectratio.qml index b26f0e1f04..a04a09d64e 100644 --- a/tests/auto/quick/qquickimage/data/aspectratio.qml +++ b/tests/auto/quick/qquickimage/data/aspectratio.qml @@ -1,6 +1,6 @@ import QtQuick 2.0 -Image { +Image { source: "heart.png" fillMode: Image.PreserveAspectFit; } diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index 3eea3c955c..48af48b17b 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -105,10 +105,10 @@ public: if (id == QLatin1String("no-such-file.png")) return QImage(); - int width = 100; + int width = 100; int height = 100; QImage image(width, height, QImage::Format_RGB32); - if (size) + if (size) *size = QSize(width, height); if (requestedSize.isValid()) image = image.scaled(requestedSize); @@ -142,10 +142,10 @@ public: if (id == QLatin1String("no-such-file.png")) return QPixmap(); - int width = 100; + int width = 100; int height = 100; QPixmap image(width, height); - if (size) + if (size) *size = QSize(width, height); if (requestedSize.isValid()) image = image.scaled(requestedSize); @@ -161,7 +161,7 @@ Q_DECLARE_METATYPE(TestQPixmapProvider*); QString tst_qquickimageprovider::newImageFileName() const { // need to generate new filenames each time or else images are loaded - // from cache and we won't get loading status changes when testing + // from cache and we won't get loading status changes when testing // async loading static int count = 0; return QString("image://test/image-%1.png").arg(count++); @@ -229,7 +229,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider) engine.addImageProvider("test", provider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; " + QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; " + (async ? "asynchronous: true; " : "") + properties + " }"; QQmlComponent component(&engine); diff --git a/tests/auto/quick/qquickitem/data/visualParentOwnership.qml b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml new file mode 100644 index 0000000000..644d14ba43 --- /dev/null +++ b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + Component { + id: factory + Item {} + } + + property Item keepAliveProperty; + + function createItemWithoutParent() { + return factory.createObject(/*parent*/ null); + } +} diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index ad3c4fc208..f4f2374183 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -49,6 +49,7 @@ #include <qpa/qwindowsysteminterface.h> #include <QDebug> #include <QTimer> +#include <QQmlEngine> #include "../../shared/util.h" class TestItem : public QQuickItem @@ -167,6 +168,8 @@ private slots: void acceptedMouseButtons(); + void visualParentOwnership(); + private: enum PaintOrderOp { @@ -1754,6 +1757,68 @@ void tst_qquickitem::acceptedMouseButtons() QCOMPARE(item.releaseCount, 3); } +static void gc(QQmlEngine &engine) +{ + engine.collectGarbage(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); +} + +void tst_qquickitem::visualParentOwnership() +{ + QQuickView view; + view.setSource(testFileUrl("visualParentOwnership.qml")); + + QQuickItem *root = qobject_cast<QQuickItem*>(view.rootObject()); + QVERIFY(root); + + QVariant newObject; + { + QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer<QQuickItem> newItem = qvariant_cast<QQuickItem*>(newObject); + QVERIFY(!newItem.isNull()); + + QVERIFY(!newItem->parent()); + QVERIFY(!newItem->parentItem()); + + newItem->setParentItem(root); + + gc(*view.engine()); + + QVERIFY(!newItem.isNull()); + newItem->setParentItem(0); + + gc(*view.engine()); + QVERIFY(newItem.isNull()); + } + { + QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer<QQuickItem> firstItem = qvariant_cast<QQuickItem*>(newObject); + QVERIFY(!firstItem.isNull()); + + firstItem->setParentItem(root); + + QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer<QQuickItem> secondItem = qvariant_cast<QQuickItem*>(newObject); + QVERIFY(!firstItem.isNull()); + + secondItem->setParentItem(firstItem); + + gc(*view.engine()); + + delete firstItem; + + root->setProperty("keepAliveProperty", newObject); + + gc(*view.engine()); + QVERIFY(!secondItem.isNull()); + + root->setProperty("keepAliveProperty", QVariant()); + + gc(*view.engine()); + QVERIFY(secondItem.isNull()); + } +} QTEST_MAIN(tst_qquickitem) diff --git a/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml b/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml index 518e76509e..25d6a526d2 100644 --- a/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml +++ b/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml @@ -9,7 +9,7 @@ Rectangle { Repeater { model: 1 - Rectangle { } + Rectangle { } } } } diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 8a4ed5ae4c..64795f9ebe 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -1972,6 +1972,8 @@ void tst_QQuickItem::transforms_data() QTest::addColumn<QTransform>("transform"); QTest::newRow("translate") << QByteArray("Translate { x: 10; y: 20 }") << QTransform(1,0,0,0,1,0,10,20,1); + QTest::newRow("matrix4x4") << QByteArray("Matrix4x4 { matrix: Qt.matrix4x4(1,0,0,10, 0,1,0,15, 0,0,1,0, 0,0,0,1) }") + << QTransform(1,0,0,0,1,0,10,15,1); QTest::newRow("rotation") << QByteArray("Rotation { angle: 90 }") << QTransform(0,1,0,-1,0,0,0,0,1); QTest::newRow("scale") << QByteArray("Scale { xScale: 1.5; yScale: -2 }") @@ -1985,7 +1987,7 @@ void tst_QQuickItem::transforms() QFETCH(QByteArray, qml); QFETCH(QTransform, transform); QQmlComponent component(&engine); - component.setData("import QtQuick 2.0\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); + component.setData("import QtQuick 2.4\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); QCOMPARE(item->itemTransform(0,0), transform); diff --git a/tests/auto/quick/qquicklistview/data/displayMargin.qml b/tests/auto/quick/qquicklistview/data/displayMargin.qml new file mode 100644 index 0000000000..fde48bc5b9 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/displayMargin.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 + +Item { + width: 400; height: 400 + + ListView { + id: view + anchors.top: header.bottom + anchors.bottom: footer.top + width: parent.width + + cacheBuffer: 0 + displayMarginBeginning: 60 + displayMarginEnd: 60 + + model: 100 + delegate: Rectangle { + objectName: "delegate" + width: parent.width + height: 25 + color: index % 2 ? "steelblue" : "lightsteelblue" + Text { + anchors.centerIn: parent + text: index + } + } + } + + Rectangle { + id: header + width: parent.width; height: 60 + color: "#80FF0000" + } + + Rectangle { + id: footer + anchors.bottom: parent.bottom + width: parent.width; height: 60 + color: "#80FF0000" + } +} diff --git a/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml b/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml index 4ccf3088b0..3d3885a5ca 100644 --- a/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml +++ b/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml @@ -39,7 +39,7 @@ Rectangle { color: "lightsteelblue" } } - + ListView { id: list objectName: "list" diff --git a/tests/auto/quick/qquicklistview/data/propertychangestest.qml b/tests/auto/quick/qquicklistview/data/propertychangestest.qml index 146f3f13b0..f269b4ab92 100644 --- a/tests/auto/quick/qquicklistview/data/propertychangestest.qml +++ b/tests/auto/quick/qquicklistview/data/propertychangestest.qml @@ -6,7 +6,7 @@ Rectangle { id: delegate Item { id: wrapper - width: 180; height: 40; + width: 180; height: 40; Column { x: 5; y: 5 Text { text: '<b>Name:</b> ' + name } @@ -38,7 +38,7 @@ Rectangle { snapMode: ListView.SnapToItem } - data:[ + data:[ ListModel { id: listModel ListElement { @@ -67,5 +67,5 @@ Rectangle { } ] } - - + + diff --git a/tests/auto/quick/qquicklistview/incrementalmodel.cpp b/tests/auto/quick/qquicklistview/incrementalmodel.cpp index 473d52eb28..3d4b716e6b 100644 --- a/tests/auto/quick/qquicklistview/incrementalmodel.cpp +++ b/tests/auto/quick/qquicklistview/incrementalmodel.cpp @@ -59,10 +59,10 @@ QVariant IncrementalModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); - + if (index.row() >= list.size() || index.row() < 0) return QVariant(); - + if (role == Qt::DisplayRole) return list.at(index.row()); return QVariant(); @@ -82,7 +82,7 @@ void IncrementalModel::fetchMore(const QModelIndex & /* index */) int itemsToFetch = qMin(5, remainder); beginInsertRows(QModelIndex(), count, count+itemsToFetch-1); - + count += itemsToFetch; endInsertRows(); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 97259e9fca..7d0b76ad63 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -215,6 +215,7 @@ private slots: void testProxyModelChangedAfterMove(); void typedModel(); + void displayMargin(); void highlightItemGeometryChanges(); @@ -7051,6 +7052,43 @@ void tst_QQuickListView::typedModel() QCOMPARE(listview->count(), 0); } +void tst_QQuickListView::displayMargin() +{ + QQuickView *window = createView(); + window->setSource(testFileUrl("displayMargin.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); + QVERIFY(listview != 0); + + QQuickItem *content = listview->contentItem(); + QVERIFY(content != 0); + + QQuickItem *item0; + QQuickItem *item14; + + QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0)); + QCOMPARE(delegateVisible(item0), true); + + // the 14th item should be within the end margin + QVERIFY(item14 = findItem<QQuickItem>(content, "delegate", 13)); + QCOMPARE(delegateVisible(item14), true); + + // the 15th item should be outside the end margin + QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == 0); + + // the first delegate should still be within the begin margin + listview->positionViewAtIndex(3, QQuickListView::Beginning); + QCOMPARE(delegateVisible(item0), true); + + // the first delegate should now be outside the begin margin + listview->positionViewAtIndex(4, QQuickListView::Beginning); + QCOMPARE(delegateVisible(item0), false); + + delete window; +} + void tst_QQuickListView::highlightItemGeometryChanges() { QQmlEngine engine; diff --git a/tests/auto/quick/qquickmousearea/data/dragproperties.qml b/tests/auto/quick/qquickmousearea/data/dragproperties.qml index d8d7b3bb6e..4e0dbe6277 100644 --- a/tests/auto/quick/qquickmousearea/data/dragproperties.qml +++ b/tests/auto/quick/qquickmousearea/data/dragproperties.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 Rectangle { id: whiteRect - width: 200 + width: 200 height: 200 color: "white" Rectangle { diff --git a/tests/auto/quick/qquickmousearea/data/dragreset.qml b/tests/auto/quick/qquickmousearea/data/dragreset.qml index 3259dcf87d..10039f1fcb 100644 --- a/tests/auto/quick/qquickmousearea/data/dragreset.qml +++ b/tests/auto/quick/qquickmousearea/data/dragreset.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 Rectangle { id: whiteRect - width: 200 + width: 200 height: 200 color: "white" Rectangle { diff --git a/tests/auto/quick/qquickpathview/data/propertychanges.qml b/tests/auto/quick/qquickpathview/data/propertychanges.qml index 09b309f86f..17d24f6606 100644 --- a/tests/auto/quick/qquickpathview/data/propertychanges.qml +++ b/tests/auto/quick/qquickpathview/data/propertychanges.qml @@ -6,7 +6,7 @@ Rectangle { id: myDelegate Item { id: wrapper - width: 180; height: 40; + width: 180; height: 40; opacity: PathView.opacity Column { x: 5; y: 5 @@ -46,7 +46,7 @@ Rectangle { } } - data:[ + data:[ ListModel { id: listModel ListElement { diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp index 5657ec44a8..2ecb3c4725 100644 --- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp +++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QtTest/QSignalSpy> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> @@ -54,6 +55,7 @@ public: private slots: void gradient(); + void antialiasing(); private: QQmlEngine engine; @@ -94,6 +96,61 @@ void tst_qquickrectangle::gradient() delete rect; } +void tst_qquickrectangle::antialiasing() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\n Rectangle {}", QUrl()); + QScopedPointer<QObject> object(component.create()); + QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(object.data()); + QVERIFY(rect); + + QSignalSpy spy(rect, SIGNAL(antialiasingChanged(bool))); + + QCOMPARE(rect->antialiasing(), false); + + rect->setAntialiasing(true); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 1); + + rect->setAntialiasing(true); + QCOMPARE(spy.count(), 1); + + rect->resetAntialiasing(); + QCOMPARE(rect->antialiasing(), false); + QCOMPARE(spy.count(), 2); + + rect->setRadius(5); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 3); + + rect->resetAntialiasing(); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 3); + + rect->setRadius(0); + QCOMPARE(rect->antialiasing(), false); + QCOMPARE(spy.count(), 4); + + rect->resetAntialiasing(); + QCOMPARE(rect->antialiasing(), false); + QCOMPARE(spy.count(), 4); + + rect->setRadius(5); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 5); + + rect->resetAntialiasing(); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 5); + + rect->setAntialiasing(false); + QCOMPARE(rect->antialiasing(), false); + QCOMPARE(spy.count(), 6); + + rect->resetAntialiasing(); + QCOMPARE(rect->antialiasing(), true); + QCOMPARE(spy.count(), 7); +} QTEST_MAIN(tst_qquickrectangle) diff --git a/tests/auto/quick/qquickrepeater/data/properties.qml b/tests/auto/quick/qquickrepeater/data/properties.qml index 035431c784..18d014f96d 100644 --- a/tests/auto/quick/qquickrepeater/data/properties.qml +++ b/tests/auto/quick/qquickrepeater/data/properties.qml @@ -1,11 +1,11 @@ import QtQuick 2.0 -Row { - Repeater { +Row { + Repeater { objectName: "repeater" model: 5 - Text { - text: "I'm item " + index - } + Text { + text: "I'm item " + index + } } } diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp index 705ee5cf46..650ce09dfa 100644 --- a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp +++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp @@ -192,6 +192,9 @@ void tst_qquicksmoothedanimation::valueSource() void tst_qquicksmoothedanimation::behavior() { +#ifdef Q_CC_MINGW + QSKIP("QTBUG-36290 - MinGW Animation tests are flaky."); +#endif QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("smoothedanimationBehavior.qml")); diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 4e9ceba2a2..a2e05ba883 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -86,7 +86,7 @@ const QChar tst_qquickstyledtext::disc(0x25e6); const QChar tst_qquickstyledtext::square(0x25a1); // For malformed input all we test is that we get the expected text and format out. -// +// void tst_qquickstyledtext::textOutput_data() { QTest::addColumn<QString>("input"); diff --git a/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml b/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml new file mode 100644 index 0000000000..6349f7a644 --- /dev/null +++ b/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + id: main + width: 200; height: 200 + + Text { + id: myText + objectName: "myText" + width: parent.width + font.family: "__Qt__Box__Engine__" + font.pixelSize: 14 + horizontalAlignment: Text.AlignHCenter + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + + onLineLaidOut: { + // do nothing + } + } +} diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 6a18323190..59806a8aec 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -101,6 +101,7 @@ private slots: void color(); void smooth(); void renderType(); + void antialiasing(); // QQuickFontValueType void weight(); @@ -126,6 +127,7 @@ private slots: void clipRect(); void lineLaidOut(); void lineLaidOutRelayout(); + void lineLaidOutHAlign(); void imgTagsBaseUrl_data(); void imgTagsBaseUrl(); @@ -901,6 +903,8 @@ void tst_qquicktext::hAlignImplicitWidth() { // HCenter Align text->setHAlign(QQuickText::AlignHCenter); + text->setText("Reset"); // set dummy string to force relayout once original text is set again + text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC"); QImage image = view.grabWindow(); const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image); const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image); @@ -911,6 +915,8 @@ void tst_qquicktext::hAlignImplicitWidth() { // Right Align text->setHAlign(QQuickText::AlignRight); + text->setText("Reset"); // set dummy string to force relayout once original text is set again + text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC"); QImage image = view.grabWindow(); const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image); const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image); @@ -1306,6 +1312,30 @@ void tst_qquicktext::renderType() QCOMPARE(spy.count(), 2); } +void tst_qquicktext::antialiasing() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\n Text {}", QUrl()); + QScopedPointer<QObject> object(component.create()); + QQuickText *text = qobject_cast<QQuickText *>(object.data()); + QVERIFY(text); + + QSignalSpy spy(text, SIGNAL(antialiasingChanged(bool))); + + QCOMPARE(text->antialiasing(), true); + + text->setAntialiasing(false); + QCOMPARE(text->antialiasing(), false); + QCOMPARE(spy.count(), 1); + + text->setAntialiasing(false); + QCOMPARE(spy.count(), 1); + + text->resetAntialiasing(); + QCOMPARE(text->antialiasing(), true); + QCOMPARE(spy.count(), 2); +} + void tst_qquicktext::weight() { { @@ -1913,6 +1943,7 @@ void tst_qquicktext::linkInteraction() QCOMPARE(test.hoveredLink, hoverEnterLink); QCOMPARE(textObject->hoveredLink(), hoverEnterLink); + QCOMPARE(textObject->linkAt(mousePosition.x(), mousePosition.y()), hoverEnterLink); for (int i = 1; i < mousePositions.count(); ++i) { mousePosition = mousePositions.at(i); @@ -1926,6 +1957,7 @@ void tst_qquicktext::linkInteraction() QCOMPARE(test.hoveredLink, hoverMoveLink); QCOMPARE(textObject->hoveredLink(), hoverMoveLink); + QCOMPARE(textObject->linkAt(mousePosition.x(), mousePosition.y()), hoverMoveLink); { QHoverEvent he(QEvent::HoverLeave, mousePosition, QPointF()); @@ -1938,6 +1970,7 @@ void tst_qquicktext::linkInteraction() QCOMPARE(test.clickedLink, clickedLink); QCOMPARE(test.hoveredLink, QString()); QCOMPARE(textObject->hoveredLink(), QString()); + QCOMPARE(textObject->linkAt(-1, -1), QString()); delete textObject; } @@ -2648,6 +2681,23 @@ void tst_qquicktext::lineLaidOutRelayout() delete window; } +void tst_qquicktext::lineLaidOutHAlign() +{ + QQuickView *window = createView(testFile("lineLayoutHAlign.qml")); + + QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); + QVERIFY(myText != 0); + + QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); + QVERIFY(textPrivate != 0); + + QCOMPARE(textPrivate->layout.lineCount(), 1); + + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().x() < 0.0); + + delete window; +} + void tst_qquicktext::imgTagsBaseUrl_data() { QTest::addColumn<QUrl>("src"); diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml index 043304d027..5deffe7d11 100644 --- a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml +++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml @@ -1,12 +1,12 @@ import QtQuick 2.0 Rectangle { width: 300; height: 300; color: "white" - resources: [ + resources: [ Component { id:cursorFail; FailItem { objectName: "delegateFail" } }, Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }, Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } } - ] + ] TextEdit { cursorDelegate: cursorFail cursorVisible: true diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml index a6556454fe..bff8ae435b 100644 --- a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml +++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml @@ -1,11 +1,11 @@ import QtQuick 2.0 Rectangle { width: 300; height: 300; color: "white" - resources: [ + resources: [ Component { id:cursorFail; FailItem { objectName: "delegateFail" } }, Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } } - ] + ] TextEdit { cursorDelegate: cursorFail cursorVisible: true diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml index 9429779a87..1cf1ed47f2 100644 --- a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml +++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml @@ -1,11 +1,11 @@ import QtQuick 2.0 Rectangle { width: 300; height: 300; color: "white" - resources: [ + resources: [ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }, Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } } - ] + ] TextEdit { cursorDelegate: cursorWait cursorVisible: true diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml index 69e498ef8d..d97a9a609a 100644 --- a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml +++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml @@ -1,10 +1,10 @@ import QtQuick 2.0 Rectangle { width: 300; height: 300; color: "white" - resources: [ + resources: [ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } } - ] + ] TextEdit { cursorDelegate: cursorWait text: "Hello" diff --git a/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml b/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml index dec3b978e7..5ec99198a4 100644 --- a/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml +++ b/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml @@ -1,6 +1,6 @@ import QtQuick 2.0 -TextEdit { +TextEdit { text: "Hello world!" inputMethodHints: Qt.ImhNoPredictiveText } diff --git a/tests/auto/quick/qquicktextedit/data/navigation.qml b/tests/auto/quick/qquicktextedit/data/navigation.qml index 0201c62b3c..7604c96adf 100644 --- a/tests/auto/quick/qquicktextedit/data/navigation.qml +++ b/tests/auto/quick/qquicktextedit/data/navigation.qml @@ -5,7 +5,7 @@ Rectangle { width: 800; height: 600; color: "blue" - Item { + Item { id: firstItem; KeyNavigation.right: input } @@ -18,7 +18,7 @@ Rectangle { text: "a" } Item { - id: lastItem + id: lastItem KeyNavigation.left: input } } diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index ff9554718b..e6a83b3338 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2393,12 +2393,14 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); + QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(hover.count(), 2); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); + QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); texteditObject->setReadOnly(true); @@ -2408,12 +2410,14 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); + QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); QTRY_COMPARE(spy.count(), 2); QTRY_COMPARE(hover.count(), 4); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); + QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); } void tst_qquicktextedit::cursorDelegate_data() @@ -2663,8 +2667,8 @@ void tst_qquicktextedit::delegateLoading_data() // import installed QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; - QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection "; - QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection"; + QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type"; } void tst_qquicktextedit::delegateLoading() diff --git a/tests/auto/quick/qquicktextinput/data/navigation.qml b/tests/auto/quick/qquicktextinput/data/navigation.qml index 3a7d07b3c7..8df0d151a7 100644 --- a/tests/auto/quick/qquicktextinput/data/navigation.qml +++ b/tests/auto/quick/qquicktextinput/data/navigation.qml @@ -5,7 +5,7 @@ Rectangle { width: 800; height: 600; color: "blue" - Item { + Item { id: firstItem; KeyNavigation.right: input } @@ -18,7 +18,7 @@ Rectangle { KeyNavigation.down: lastItem } Item { - id: lastItem + id: lastItem KeyNavigation.left: input } } diff --git a/tests/auto/quick/qquicktextinput/data/validators.qml b/tests/auto/quick/qquicktextinput/data/validators.qml index 0ba87e0592..b923f69801 100644 --- a/tests/auto/quick/qquicktextinput/data/validators.qml +++ b/tests/auto/quick/qquicktextinput/data/validators.qml @@ -25,5 +25,5 @@ Item { property bool acceptable: acceptableInput } } - + } diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 697dba182c..73abddb2c7 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -229,6 +229,8 @@ private slots: void maskCharacter_data(); void maskCharacter(); void fixup(); + void baselineOffset_data(); + void baselineOffset(); private: void simulateKey(QWindow *, int key); @@ -6358,6 +6360,95 @@ void tst_qquicktextinput::fixup() QCOMPARE(input->text(), QStringLiteral("ok")); } +typedef qreal (*ExpectedBaseline)(QQuickTextInput *item); +Q_DECLARE_METATYPE(ExpectedBaseline) + +static qreal expectedBaselineTop(QQuickTextInput *item) +{ + QFontMetricsF fm(item->font()); + return fm.ascent(); +} + +static qreal expectedBaselineBottom(QQuickTextInput *item) +{ + QFontMetricsF fm(item->font()); + return item->height() - item->contentHeight() + fm.ascent(); +} + +static qreal expectedBaselineCenter(QQuickTextInput *item) +{ + QFontMetricsF fm(item->font()); + return ((item->height() - item->contentHeight()) / 2) + fm.ascent(); +} + +static qreal expectedBaselineMultilineBottom(QQuickTextInput *item) +{ + QFontMetricsF fm(item->font()); + return item->height() - item->contentHeight() + fm.ascent(); +} + +void tst_qquicktextinput::baselineOffset_data() +{ + QTest::addColumn<QString>("text"); + QTest::addColumn<QByteArray>("bindings"); + QTest::addColumn<ExpectedBaseline>("expectedBaseline"); + QTest::addColumn<ExpectedBaseline>("expectedBaselineEmpty"); + + QTest::newRow("normal") + << "Typography" + << QByteArray() + << &expectedBaselineTop + << &expectedBaselineTop; + + QTest::newRow("top align") + << "Typography" + << QByteArray("height: 200; verticalAlignment: Text.AlignTop") + << &expectedBaselineTop + << &expectedBaselineTop; + + QTest::newRow("bottom align") + << "Typography" + << QByteArray("height: 200; verticalAlignment: Text.AlignBottom") + << &expectedBaselineBottom + << &expectedBaselineBottom; + + QTest::newRow("center align") + << "Typography" + << QByteArray("height: 200; verticalAlignment: Text.AlignVCenter") + << &expectedBaselineCenter + << &expectedBaselineCenter; + + QTest::newRow("multiline bottom aligned") + << "The quick brown fox jumps over the lazy dog" + << QByteArray("height: 200; width: 30; verticalAlignment: Text.AlignBottom; wrapMode: TextInput.WordWrap") + << &expectedBaselineMultilineBottom + << &expectedBaselineBottom; +} + +void tst_qquicktextinput::baselineOffset() +{ + QFETCH(QString, text); + QFETCH(QByteArray, bindings); + QFETCH(ExpectedBaseline, expectedBaseline); + QFETCH(ExpectedBaseline, expectedBaselineEmpty); + + QQmlComponent component(&engine); + component.setData( + "import QtQuick 2.0\n" + "TextInput {\n" + + bindings + "\n" + "}", QUrl()); + + QScopedPointer<QObject> object(component.create()); + QQuickTextInput *item = qobject_cast<QQuickTextInput *>(object.data()); + QVERIFY(item); + QCOMPARE(item->baselineOffset(), expectedBaselineEmpty(item)); + item->setText(text); + QCOMPARE(item->baselineOffset(), expectedBaseline(item)); + item->setText(QString()); + QCOMPARE(item->baselineOffset(), expectedBaselineEmpty(item)); +} + QTEST_MAIN(tst_qquicktextinput) #include "tst_qquicktextinput.moc" diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 02c00ff073..9b4fd2b32f 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -225,7 +225,7 @@ void tst_QQuickView::engine() QCOMPARE(view3->engine(), view4->engine()); delete view3; QVERIFY(!view4->engine()); - QTest::ignoreMessage(QtWarningMsg, "QQuickView: invalid qml engine. "); + QTest::ignoreMessage(QtWarningMsg, "QQuickView: invalid qml engine."); view4->setSource(QUrl()); QCOMPARE(view4->status(), QQuickView::Error); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 107d1d71f7..bdd70f6a6e 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -250,6 +250,18 @@ int TestTouchItem::mousePressNum = 0; int TestTouchItem::mouseMoveNum = 0; int TestTouchItem::mouseReleaseNum = 0; +class EventFilter : public QObject +{ +public: + bool eventFilter(QObject *watched, QEvent *event) { + Q_UNUSED(watched); + events.append(event->type()); + return false; + } + + QList<int> events; +}; + class ConstantUpdateItem : public QQuickItem { Q_OBJECT @@ -331,6 +343,10 @@ private slots: void crashWhenHoverItemDeleted(); + void qobjectEventFilter_touch(); + void qobjectEventFilter_key(); + void qobjectEventFilter_mouse(); + #ifndef QT_NO_CURSOR void cursor(); #endif @@ -923,6 +939,9 @@ void tst_qquickwindow::mouseFiltering() QTRY_COMPARE(middleItem->mousePressId, 1); QTRY_COMPARE(bottomItem->mousePressId, 2); QTRY_COMPARE(topItem->mousePressId, 3); + + // clean up mouse press state for the next tests + QTest::mouseRelease(window, Qt::LeftButton, 0, pos); } void tst_qquickwindow::qmlCreation() @@ -1560,6 +1579,84 @@ void tst_qquickwindow::crashWhenHoverItemDeleted() } } +// QTBUG-32004 +void tst_qquickwindow::qobjectEventFilter_touch() +{ + QQuickWindow window; + + window.resize(250, 250); + window.setPosition(100, 100); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + TestTouchItem *item = new TestTouchItem(window.contentItem()); + item->setSize(QSizeF(150, 150)); + + EventFilter eventFilter; + item->installEventFilter(&eventFilter); + + QPointF pos(10, 10); + + // press single point + QTest::touchEvent(&window, touchDevice).press(0, item->mapToScene(pos).toPoint(), &window); + + QCOMPARE(eventFilter.events.count(), 1); + QCOMPARE(eventFilter.events.first(), (int)QEvent::TouchBegin); +} + +// QTBUG-32004 +void tst_qquickwindow::qobjectEventFilter_key() +{ + QQuickWindow window; + + window.resize(250, 250); + window.setPosition(100, 100); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + TestTouchItem *item = new TestTouchItem(window.contentItem()); + item->setSize(QSizeF(150, 150)); + item->setFocus(true); + + EventFilter eventFilter; + item->installEventFilter(&eventFilter); + + QTest::keyPress(&window, Qt::Key_A); + + // NB: It may also receive some QKeyEvent(ShortcutOverride) which we're not interested in + QVERIFY(eventFilter.events.contains((int)QEvent::KeyPress)); + eventFilter.events.clear(); + + QTest::keyRelease(&window, Qt::Key_A); + + QVERIFY(eventFilter.events.contains((int)QEvent::KeyRelease)); +} + +// QTBUG-32004 +void tst_qquickwindow::qobjectEventFilter_mouse() +{ + QQuickWindow window; + + window.resize(250, 250); + window.setPosition(100, 100); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + TestTouchItem *item = new TestTouchItem(window.contentItem()); + item->setSize(QSizeF(150, 150)); + + EventFilter eventFilter; + item->installEventFilter(&eventFilter); + + QPoint point = item->mapToScene(QPointF(10, 10)).toPoint(); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point); + + QVERIFY(eventFilter.events.contains((int)QEvent::MouseButtonPress)); + + // clean up mouse press state for the next tests + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point); +} + QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" diff --git a/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp index 12ae3c273f..a3cfa0011a 100644 --- a/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp +++ b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp @@ -744,9 +744,9 @@ void tst_qquickxmllistmodel::noKeysValueChanges() QQmlComponent component(&engine, testFileUrl("roleKeys.qml")); QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create()); QVERIFY(model != 0); - + QString xml; - + xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics"); model->setProperty("xml",xml); QTRY_COMPARE(model->rowCount(), 2); @@ -820,11 +820,11 @@ void tst_qquickxmllistmodel::threading() QQmlComponent component(&engine, testFileUrl("roleKeys.qml")); QAbstractItemModel *m1 = qobject_cast<QAbstractItemModel *>(component.create()); - QVERIFY(m1 != 0); + QVERIFY(m1 != 0); QAbstractItemModel *m2 = qobject_cast<QAbstractItemModel *>(component.create()); - QVERIFY(m2 != 0); + QVERIFY(m2 != 0); QAbstractItemModel *m3 = qobject_cast<QAbstractItemModel *>(component.create()); - QVERIFY(m3 != 0); + QVERIFY(m3 != 0); for (int dataCount=0; dataCount<xmlDataCount; dataCount++) { diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index 7d1590e5f6..06338e09e2 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -57,18 +57,18 @@ public: QImage runTest(const QString &fileName) { - QQuickView view; - view.setSource(testFileUrl(fileName)); + QQuickView view(&outerWindow); view.setResizeMode(QQuickView::SizeViewToRootObject); - const QRect screenGeometry = view.screen()->availableGeometry(); - const QSize size = view.size(); - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - view.setFramePosition(screenGeometry.center() - offset); - view.showNormal(); + view.setSource(testFileUrl(fileName)); + view.setVisible(true); QTest::qWaitForWindowExposed(&view); return view.grabWindow(); } + //It is important for platforms that only are able to show fullscreen windows + //to have a container for the window that is painted on. + QQuickWindow outerWindow; + private slots: void renderOrder(); void messUpState(); @@ -187,6 +187,8 @@ tst_rendernode::tst_rendernode() { qmlRegisterType<ClearItem>("Test", 1, 0, "ClearItem"); qmlRegisterType<MessUpItem>("Test", 1, 0, "MessUpItem"); + outerWindow.showNormal(); + outerWindow.setGeometry(0,0,400,400); } static bool fuzzyCompareColor(QRgb x, QRgb y, QByteArray *errorMessage) diff --git a/tests/auto/quick/scenegraph/data/mipmap_large.png b/tests/auto/quick/scenegraph/data/mipmap_large.png Binary files differnew file mode 100644 index 0000000000..9cb0fc7de1 --- /dev/null +++ b/tests/auto/quick/scenegraph/data/mipmap_large.png diff --git a/tests/auto/quick/scenegraph/data/mipmap_small.png b/tests/auto/quick/scenegraph/data/mipmap_small.png Binary files differnew file mode 100644 index 0000000000..dc5216fb6c --- /dev/null +++ b/tests/auto/quick/scenegraph/data/mipmap_small.png diff --git a/tests/auto/quick/scenegraph/data/render_Mipmap.qml b/tests/auto/quick/scenegraph/data/render_Mipmap.qml new file mode 100644 index 0000000000..0a6195fc1f --- /dev/null +++ b/tests/auto/quick/scenegraph/data/render_Mipmap.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 + +/* + The test verifies that scaled down mipmapped images contains + colors from all pixels. + + #samples: 2 + PixelPos R G B Error-tolerance + #final: 0 0 0.33 0.33 0.33 0.1 + #final: 1 0 0.33 0.33 0.33 0.1 +*/ + +RenderTestBase +{ + Image { + x: 0 + y: 0 + transformOrigin: Item.TopLeft + source: "mipmap_small.png" + mipmap: true + smooth: false + scale: 1 / width; + } + + Image { + x: 1 + y: 0 + transformOrigin: Item.TopLeft + source: "mipmap_large.png" + mipmap: true + smooth: false + scale: 1 / width; + } + + onEnterFinalStage: finalStageComplete = true; +} diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 780d5a97db..af5acde5f3 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -326,6 +326,7 @@ void tst_SceneGraph::render_data() << "data/render_BreakOpacityBatch.qml" << "data/render_OutOfFloatRange.qml" << "data/render_StackingOrder.qml" + << "data/render_Mipmap.qml" ; QRegExp sampleCount("#samples: *(\\d+)"); diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp index 20df0c12f5..d3de584084 100644 --- a/tests/auto/shared/testhttpserver.cpp +++ b/tests/auto/shared/testhttpserver.cpp @@ -127,7 +127,7 @@ bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &bod QFile expectFile(expect.toLocalFile()); if (!expectFile.open(QIODevice::ReadOnly)) return false; - + QFile replyFile(reply.toLocalFile()); if (!replyFile.open(QIODevice::ReadOnly)) return false; @@ -325,7 +325,7 @@ void TestHTTPServer::serveGET(QTcpSocket *socket, const QByteArray &data) QByteArray total = dataCache[socket] + data; dataCache[socket] = total; - + if (total.contains("\n\r\n")) { bool close = true; @@ -342,7 +342,7 @@ void TestHTTPServer::serveGET(QTcpSocket *socket, const QByteArray &data) } dataCache.remove(socket); - if (close) + if (close) socket->disconnectFromHost(); } } diff --git a/tests/benchmarks/qml/binding/data/localproperty.txt b/tests/benchmarks/qml/binding/data/localproperty.txt index c7ca0efdb4..d1b1f4386a 100644 --- a/tests/benchmarks/qml/binding/data/localproperty.txt +++ b/tests/benchmarks/qml/binding/data/localproperty.txt @@ -1,5 +1,5 @@ import Test 1.0 -MyQmlObject { +MyQmlObject { result: ### } diff --git a/tests/benchmarks/qml/javascript/testtypes.h b/tests/benchmarks/qml/javascript/testtypes.h index 99781fc797..05b1c7ef9c 100644 --- a/tests/benchmarks/qml/javascript/testtypes.h +++ b/tests/benchmarks/qml/javascript/testtypes.h @@ -44,7 +44,7 @@ #include <QtCore/qobject.h> -class TestObject : public QObject +class TestObject : public QObject { Q_OBJECT Q_PROPERTY(int intValue READ intValue); @@ -58,7 +58,7 @@ public: private: QString m_string; -}; +}; void registerTypes(); diff --git a/tests/benchmarks/qml/painting/paintbenchmark.cpp b/tests/benchmarks/qml/painting/paintbenchmark.cpp index 1fc7813c04..672bed4c10 100644 --- a/tests/benchmarks/qml/painting/paintbenchmark.cpp +++ b/tests/benchmarks/qml/painting/paintbenchmark.cpp @@ -351,8 +351,8 @@ public: last = elapsed; } QPainter p(this); - p.fillRect(rect(), Qt::white); - p.setPen(Qt::black); + p.fillRect(rect(), Qt::white); + p.setPen(Qt::black); QTime drawTimer; drawTimer.start(); testFunc(p); diff --git a/tests/benchmarks/qml/qmltime/qmltime.cpp b/tests/benchmarks/qml/qmltime/qmltime.cpp index bae0b51824..d6b73ed5f4 100644 --- a/tests/benchmarks/qml/qmltime/qmltime.cpp +++ b/tests/benchmarks/qml/qmltime/qmltime.cpp @@ -111,10 +111,10 @@ void Timer::run(uint iterations) QObject *o = m_component->create(&context); QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) + if (m_willparent && go) go->setParentItem(&m_item); delete o; - + runTest(&context, iterations); } @@ -135,7 +135,7 @@ void Timer::runTest(QQmlContext *context, uint iterations) for (uint ii = 0; ii < iterations; ++ii) { QObject *o = m_component->create(context); QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) + if (m_willparent && go) go->setParentItem(&m_item); delete o; } diff --git a/tests/benchmarks/qml/qmltime/qmltime.pro b/tests/benchmarks/qml/qmltime/qmltime.pro index c151b8d10f..4e3e9471a4 100644 --- a/tests/benchmarks/qml/qmltime/qmltime.pro +++ b/tests/benchmarks/qml/qmltime/qmltime.pro @@ -4,6 +4,6 @@ TARGET = qmltime QT += qml widgets testlib macx:CONFIG -= app_bundle -SOURCES += qmltime.cpp +SOURCES += qmltime.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro b/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro index e71f16aecb..ce66e1e51f 100644 --- a/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro +++ b/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro @@ -4,7 +4,7 @@ TARGET = tst_qqmlmetaproperty QT += qml testlib macx:CONFIG -= app_bundle -SOURCES += tst_qqmlmetaproperty.cpp +SOURCES += tst_qqmlmetaproperty.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/benchmarks/qml/script/data/slot_complex.qml b/tests/benchmarks/qml/script/data/slot_complex.qml index 4e467da901..ffc9e2f98f 100644 --- a/tests/benchmarks/qml/script/data/slot_complex.qml +++ b/tests/benchmarks/qml/script/data/slot_complex.qml @@ -47,7 +47,7 @@ TestObject { var a = 1; while (n > 0) { a = a * n; - n--; + n--; } return a; } diff --git a/tests/manual/httpserver/httpserver.pro b/tests/manual/httpserver/httpserver.pro new file mode 100644 index 0000000000..2a6c32f1cf --- /dev/null +++ b/tests/manual/httpserver/httpserver.pro @@ -0,0 +1,13 @@ +QT = core network + +TARGET = httpserver +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +SERVER = $$PWD/../../auto/shared +INCLUDEPATH += $$SERVER + +SOURCES += main.cpp $$SERVER/testhttpserver.cpp +HEADERS += $$SERVER/testhttpserver.h diff --git a/tests/manual/httpserver/main.cpp b/tests/manual/httpserver/main.cpp new file mode 100644 index 0000000000..ea729547ce --- /dev/null +++ b/tests/manual/httpserver/main.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <testhttpserver.h> + +#include <QCoreApplication> +#include <QCommandLineParser> +#include <QCommandLineOption> +#include <QDebug> +#include <QDir> +#include <QFileInfo> + +#include <iostream> +#include <iterator> +#include <algorithm> + +inline std::wostream &operator<<(std::wostream &str, const QString &s) +{ +#ifdef Q_OS_WIN + str << reinterpret_cast<const wchar_t *>(s.utf16()); +#else + str << s.toStdWString(); +#endif + return str; +} + +enum { defaultPort = 14457 }; + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + QCoreApplication::setApplicationName("HttpServer"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + + QCommandLineParser commandLineParser; + commandLineParser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); + commandLineParser.setApplicationDescription(QStringLiteral("HTTP Test server")); + commandLineParser.addHelpOption(); + commandLineParser.addVersionOption(); + + QCommandLineOption portOption(QStringLiteral("p"), + QStringLiteral("Port (default: ") + QString::number(defaultPort) + QLatin1Char(')'), + QStringLiteral("port")); + + commandLineParser.addOption(portOption); + + commandLineParser.addPositionalArgument(QStringLiteral("[directory]"), + QStringLiteral("Directory to serve.")); + + commandLineParser.process(a); + + const QStringList args = commandLineParser.positionalArguments(); + if (args.size() != 1) + commandLineParser.showHelp(1); + + const QString directory = QDir::cleanPath(args.front()); + if (!QFileInfo(directory).isDir()) { + std::wcerr << '"' << QDir::toNativeSeparators(directory) << "\" is not a directory.\n"; + return -1; + } + + unsigned short port = defaultPort; + if (commandLineParser.isSet(portOption)) { + const QString portV = commandLineParser.value(portOption); + bool ok; + port = portV.toUShort(&ok); + if (!ok) { + std::wcerr << portV << " is not a valid port number.\n"; + return -1; + } + } + + std::wcout << "Serving \"" << QDir::toNativeSeparators(directory) + << "\":\n\n" << QDir(directory).entryList(QDir::Files).join(QLatin1Char('\n')) + << "\n\non http://localhost:" << port << '\n'; + + TestHTTPServer server(port); + server.serveDirectory(directory); + + return a.exec(); +} diff --git a/tests/manual/scenegraph_lancelot/data/text/text_sinhala.qml b/tests/manual/scenegraph_lancelot/data/text/text_sinhala.qml new file mode 100644 index 0000000000..e74b72da92 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_sinhala.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + Text { + anchors.fill: parent + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + font.family: "Arial" + font.pixelSize: 20 + text: "සිංහළ අකුරු අබලං" + } +} + + diff --git a/tests/manual/v4/TestExpectations b/tests/manual/v4/TestExpectations index 93a87f9ccc..49f107452a 100644 --- a/tests/manual/v4/TestExpectations +++ b/tests/manual/v4/TestExpectations @@ -2,6 +2,18 @@ # uses octal number 15.2.3.6-2-17-1 failing +# these fail after the update to Unicode 6.3. +# the reason is that u+180e changed type from whitespace to control +S9.3.1_A2 +S9.3.1_A3_T1 +S9.3.1_A3_T2 +S15.1.2.2_A2_T10 +S15.1.2.3_A2_T10 +15.5.4.20-3-2 +15.5.4.20-3-3 +15.5.4.20-3-4 +15.5.4.20-3-5 +15.5.4.20-3-6 10.4.3-1-106 failing 11.2.3-3_3 failing @@ -16,4 +28,4 @@ S15.2.4.4_A14 failing Sbp_12.5_A9_T3 failing Sbp_12.6.1_A13_T3 failing Sbp_12.6.2_A13_T3 failing -Sbp_12.6.4_A13_T3 failing
\ No newline at end of file +Sbp_12.6.4_A13_T3 failing diff --git a/tests/manual/v4/sparsearraytest.js b/tests/manual/v4/sparsearraytest.js new file mode 100644 index 0000000000..3d7adfe903 --- /dev/null +++ b/tests/manual/v4/sparsearraytest.js @@ -0,0 +1,55 @@ +var max +for (max = 2; max < 100; ++max) { + var arr = []; + // force a sparse array + Object.defineProperty(arr, "0", { + get: function () { + return 0; + }, + configurable: true + }); + var i; + var j; + for (i = 1; i < max; ++i) + arr[i] = i; + for (i = 1; i < max; i += 2) { + delete arr[i]; + for (j = 0; j < max; ++j) { + if (j <= i && (j %2)) { + if (arr[j] != undefined) + throw "err1" + } else { + if (arr[j] != j) + throw "err2" + } + } + } +} + +for (max = 2; max < 100; ++max) { + var arr = []; + // force a sparse array + Object.defineProperty(arr, "0", { + get: function () { + return 0; + }, + configurable: true + }); + + var i; + var j; + for (i = 1; i < max; ++i) + arr[i] = i; + for (i = 0; i < max; i += 2) { + delete arr[i]; + for (j = 0; j < max; ++j) { + if (j <= i && !(j %2)) { + if (arr[j] != undefined) + throw "err1 " + i + " " + j + " " + arr[j] + } else { + if (arr[j] != j) + throw "err2 " + j + } + } + } +} diff --git a/tests/manual/v4/test262.py b/tests/manual/v4/test262.py index dbc6049a1a..acd467ea23 100755 --- a/tests/manual/v4/test262.py +++ b/tests/manual/v4/test262.py @@ -162,9 +162,9 @@ def BuildOptions(): help="Print summary after running tests") result.add_option("--full-summary", default=False, action="store_true", help="Print summary and test output after running tests") - result.add_option("--strict_only", default=False, action="store_true", + result.add_option("--strict_only", default=False, action="store_true", help="Test only strict mode") - result.add_option("--non_strict_only", default=False, action="store_true", + result.add_option("--non_strict_only", default=False, action="store_true", help="Test only non-strict mode") result.add_option("--parallel", default=False, action="store_true", help="Run tests in parallel") @@ -174,7 +174,7 @@ def BuildOptions(): help="Update test expectations fail when a test passes that was expected to fail") # TODO: Once enough tests are made strict compat, change the default # to "both" - result.add_option("--unmarked_default", default="non_strict", + result.add_option("--unmarked_default", default="non_strict", help="default mode for tests of unspecified strictness") return result @@ -293,7 +293,7 @@ class TestCase(object): del testRecord["header"] del testRecord["commentary"] self.testRecord = testRecord; - + def GetName(self): return path.join(*self.name) @@ -570,8 +570,8 @@ def Main(): parser = BuildOptions() (options, args) = parser.parse_args() ValidateOptions(options) - test_suite = TestSuite(options.tests, - options.strict_only, + test_suite = TestSuite(options.tests, + options.strict_only, options.non_strict_only, options.unmarked_default, options.with_test_expectations) diff --git a/tests/manual/v4/v8-bench.js b/tests/manual/v4/v8-bench.js index baa6274136..41a04fa29a 100644 --- a/tests/manual/v4/v8-bench.js +++ b/tests/manual/v4/v8-bench.js @@ -4339,7 +4339,7 @@ function initRuntime() { tmp = tmp.replace(/\n/g, "<br />"); tmp = tmp.replace(/\t/g, "  "); return tmp; - + } document.write("<div id='stdout'></div>"); @@ -4865,7 +4865,7 @@ sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { } else // current.cdr == null break; } - + res += ")"; return res; @@ -5205,7 +5205,7 @@ function sc_reverseAppendBang(l1, l2) { } return res; } - + function sc_dualAppend(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; @@ -6639,7 +6639,7 @@ sc_Tokenizer.prototype.nextToken = function() { if (c === "(") return new sc_Token(14/*VECTOR_BEGIN*/); - + if (c === "\\") { // character var tmp = "" while (!isWhitespaceOrEOF(port.peekChar())) @@ -6684,7 +6684,7 @@ sc_Tokenizer.prototype.nextToken = function() { } else return new sc_Token(13/*ERROR*/, "bad #-pattern5"); } - + }; skipWhitespaceAndComments(); @@ -6763,7 +6763,7 @@ sc_Reader.prototype.read = function() { + " " + par.type; else return sc_reverseAppendBang(res, cdr); - + default: res = sc_cons(this.read(), res); @@ -6782,7 +6782,7 @@ sc_Reader.prototype.read = function() { case 2/*CLOSE_PAR*/: tokenizer.readToken(); return a; - + default: a.push(this.read()); } @@ -6794,7 +6794,7 @@ sc_Reader.prototype.read = function() { this.backref[nb] = tmp; return tmp; }; - + function readReference(nb) { if (nb in this.backref) return this.backref[nb]; |