diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
commit | c3601a8db91bc777ea859d6a796dfab6a218675e (patch) | |
tree | d2a4f6c83bec3cddcce020966cccac72be3aa04a /tests/auto | |
parent | 35794301d188b731a7b596d92fc632fff58586c0 (diff) | |
parent | 149f6afe321ce59aebe4ce2f9dddd1881d0ac22b (diff) |
Merge branch 'master' into animation-refactorwip/animation-refactor
Conflicts:
tests/auto/declarative/declarative.pro
Change-Id: Ie339be2989fac553d351f3077869f1847367b504
Diffstat (limited to 'tests/auto')
333 files changed, 2807 insertions, 1175 deletions
diff --git a/tests/auto/compilerwarnings/data/test_cpp.txt b/tests/auto/compilerwarnings/data/test_cpp.txt index d87fa839a3..372184fcdc 100644 --- a/tests/auto/compilerwarnings/data/test_cpp.txt +++ b/tests/auto/compilerwarnings/data/test_cpp.txt @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml b/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml index 7377d4584c..4a61f3291a 100644 --- a/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml +++ b/tests/auto/declarative/debugger/qdebugmessageservice/data/test.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -44,8 +44,8 @@ import QtQuick 2.0 Item { width: 360 height: 360 - Timer { - interval: 100; running: true; repeat: true - onTriggered: console.log("Timer") + Component.onCompleted: { + console.log("console.log") + console.count("console.count"); } } diff --git a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp index 62f89e9540..15fd0c597d 100644 --- a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp +++ b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -48,7 +48,7 @@ #include <QtCore/QString> #include <QtTest/QtTest> -const char *NORMALMODE = "-qmljsdebugger=port:3777"; +const char *NORMALMODE = "-qmljsdebugger=port:3777,block"; const char *QMLFILE = "test.qml"; class QDeclarativeDebugMsgClient; @@ -59,14 +59,16 @@ class tst_QDebugMessageService : public QDeclarativeDataTest public: tst_QDebugMessageService(); + void init(bool extendedOutput); + private slots: void initTestCase(); void cleanupTestCase(); - void init(); void cleanup(); void retrieveDebugOutput(); + void retrieveDebugOutputExtended(); private: QDeclarativeDebugProcess *m_process; @@ -74,6 +76,16 @@ private: QDeclarativeDebugConnection *m_connection; }; +struct LogEntry { + LogEntry(QtMsgType _type, QString _message) + : type(_type), message(_message) {} + + QtMsgType type; + QString message; + + QString toString() const { return QString::number(type) + ": " + message; } +}; + class QDeclarativeDebugMsgClient : public QDeclarativeDebugClient { Q_OBJECT @@ -83,6 +95,8 @@ public: { } + QList<LogEntry> logBuffer; + protected: //inherited from QDeclarativeDebugClient void statusChanged(Status status); @@ -91,9 +105,6 @@ protected: signals: void enabled(); void debugOutput(); - -public: - QByteArray debugMessage; }; void QDeclarativeDebugMsgClient::statusChanged(Status status) @@ -111,8 +122,17 @@ void QDeclarativeDebugMsgClient::messageReceived(const QByteArray &data) if (command == "MESSAGE") { int type; - ds >> type >> debugMessage; + QByteArray message; + ds >> type >> message; + QVERIFY(ds.atEnd()); + + QVERIFY(type >= QtDebugMsg); + QVERIFY(type <= QtFatalMsg); + + logBuffer << LogEntry((QtMsgType)type, QString::fromUtf8(message)); emit debugOutput(); + } else { + QFAIL("Unknown message"); } } @@ -140,12 +160,14 @@ void tst_QDebugMessageService::cleanupTestCase() delete m_connection; } -void tst_QDebugMessageService::init() +void tst_QDebugMessageService::init(bool extendedOutput) { m_connection = new QDeclarativeDebugConnection(); m_process = new QDeclarativeDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"); m_client = new QDeclarativeDebugMsgClient(m_connection); + if (extendedOutput) + m_process->setEnvironment(QProcess::systemEnvironment() << "QML_CONSOLE_EXTENDED=1"); m_process->start(QStringList() << QLatin1String(NORMALMODE) << QDeclarativeDataTest::instance()->testFile(QMLFILE)); if (!m_process->waitForSessionStart()) { QFAIL(QString("Could not launch app. Application output: \n%1").arg(m_process->output()).toAscii()); @@ -177,8 +199,42 @@ void tst_QDebugMessageService::cleanup() void tst_QDebugMessageService::retrieveDebugOutput() { - if (m_client->debugMessage.isEmpty()) + init(false); + + int maxTries = 2; + while ((m_client->logBuffer.size() < 2) + && (maxTries-- > 0)) QVERIFY(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(debugOutput()))); + + QCOMPARE(m_client->logBuffer.size(), 2); + + QCOMPARE(m_client->logBuffer.at(0).toString(), + LogEntry(QtDebugMsg, QLatin1String("console.log")).toString()); + QCOMPARE(m_client->logBuffer.at(1).toString(), + LogEntry(QtDebugMsg, QLatin1String("console.count: 1")).toString()); +} + +void tst_QDebugMessageService::retrieveDebugOutputExtended() +{ + init(true); + + int maxTries = 2; + while ((m_client->logBuffer.size() < 2) + && (maxTries-- > 0)) + QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(debugOutput())); + + QCOMPARE(m_client->logBuffer.size(), 2); + + const QString path = + QUrl::fromLocalFile(QDeclarativeDataTest::instance()->testFile(QMLFILE)).toString(); + + QString logMsg = QString::fromLatin1("console.log (%1:%2)").arg(path).arg(48); + QString countMsg = QString::fromLatin1("console.count: 1 (%1:%2)").arg(path).arg(49); + + QCOMPARE(m_client->logBuffer.at(0).toString(), + LogEntry(QtDebugMsg, logMsg).toString()); + QCOMPARE(m_client->logBuffer.at(1).toString(), + LogEntry(QtDebugMsg, countMsg).toString()); } QTEST_MAIN(tst_QDebugMessageService) diff --git a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 60411c8616..d8e25c4b91 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml index 2e2ceb75d9..13ed4b3101 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/breakpointRelocation.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml index e86519afb4..33ab40e0b0 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/changeBreakpoint.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml index eb0e54ff2b..2d96bfe800 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/condition.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml index af95caba30..7ef751ccdf 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/createComponent.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml index b523d6e1d0..5f8f007d86 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/exception.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml index a1b44ee76d..dff3951b3a 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/loadjsfile.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml index 5497e38642..d386fc8cad 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/oncompleted.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml index 6c95e47f73..fa67cfb46f 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/stepAction.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js index 88437a39da..1ba4f18405 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.js @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml index 9e0caa2634..150a3311c3 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/test.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml index 7c07101fa2..da48b86088 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/data/timer.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp index 4f1398cc52..192b475de6 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 590cdcf14c..9f31de56e5 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp index 108814da8d..dece1f52d0 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp b/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp index e861d830ae..83c092b8b0 100644 --- a/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp +++ b/tests/auto/declarative/debugger/qdeclarativeenginedebug/tst_qdeclarativeenginedebug.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp b/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp index 03f5a284d5..e13838cf8a 100644 --- a/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp +++ b/tests/auto/declarative/debugger/qdeclarativeinspector/app/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp b/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp index f650d51c8f..155faab050 100644 --- a/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp +++ b/tests/auto/declarative/debugger/qdeclarativeinspector/tst_qdeclarativeinspector.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index 0cc66bcf8e..f2fcb9fb89 100644 --- a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp index d4bea2fa89..80a8d0ce5a 100644 --- a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp +++ b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/shared/debugutil.cpp b/tests/auto/declarative/debugger/shared/debugutil.cpp index e986928fa1..de04c336bb 100644 --- a/tests/auto/declarative/debugger/shared/debugutil.cpp +++ b/tests/auto/declarative/debugger/shared/debugutil.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/debugger/shared/debugutil_p.h b/tests/auto/declarative/debugger/shared/debugutil_p.h index 0884b32a07..359c088dbf 100644 --- a/tests/auto/declarative/debugger/shared/debugutil_p.h +++ b/tests/auto/declarative/debugger/shared/debugutil_p.h @@ -3,7 +3,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 6e940bd684..7288da27ba 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -28,7 +28,6 @@ PUBLICTESTS += \ PRIVATETESTS += \ animation \ - qdeclarativeaccessibility \ qdeclarativebinding \ qdeclarativechangeset \ qdeclarativeconnection \ diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index ed87881698..37ef8880cc 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp index 637c7d908c..44b7f85af2 100644 --- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp +++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp index a102a9dd27..6d8870608b 100644 --- a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp +++ b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index 891d6ab6d4..ddf9254f66 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index 7a25f4414c..e91b035730 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeconsole/data/assert.qml b/tests/auto/declarative/qdeclarativeconsole/data/assert.qml new file mode 100644 index 0000000000..c623b1a007 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconsole/data/assert.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +QtObject { + property int q:1 + function assertFail() { + console.assert(0, "This will fail too") + } + + Component.onCompleted: { + var x = 12; + console.assert(x == 12, "This will pass"); + try { + console.assert(x < 12, "This will fail"); + } catch (e) { + console.log(e); + } + console.assert("x < 12", "This will pass too") + assertFail(); + console.assert(1) + } +} diff --git a/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml b/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml deleted file mode 100644 index 2692abb82e..0000000000 --- a/tests/auto/declarative/qdeclarativeconsole/data/consoleLog.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick 2.0 - -QtObject { - id: root - Component.onCompleted: { - var a = [1, 2] - var b = {a: "hello", d: 1 } - var c - var d = 12 - var e = function() { return 5;} - var f = true - var g = {toString: function() { throw new Error('toString'); }} - - - console.log("completed", "ok") - console.log("completed ok") - console.debug("completed ok") - console.warn("completed ok") - console.error("completed ok") - console.log(a) - console.log(b) - console.log(c) - console.log(d) - console.log(e) - console.log(f) - console.log(root) - console.log(g) - console.log(1, "pong!", new Object) - console.log(1, ["ping","pong"], new Object, 2) - console.log(exception) //This has to be at the end - } -} diff --git a/tests/auto/declarative/qdeclarativeconsole/data/exception.qml b/tests/auto/declarative/qdeclarativeconsole/data/exception.qml new file mode 100644 index 0000000000..d1a32be6bc --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconsole/data/exception.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +QtObject { + function exceptionFail() { + console.exception("Exception 2") + } + + Component.onCompleted: { + try { + console.exception("Exception 1") + } catch (e) { + console.log(e); + } + + exceptionFail(); + } +} diff --git a/tests/auto/declarative/qdeclarativeconsole/data/logging.qml b/tests/auto/declarative/qdeclarativeconsole/data/logging.qml new file mode 100644 index 0000000000..05c8be0096 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconsole/data/logging.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +import QtQuick 2.0 + +QtObject { + id:root + + function consoleCount() { + console.count("console.count", "Ignore additonal argument"); + console.count(); + } + + Component.onCompleted: { + console.debug("console.debug"); + console.log("console.log"); + console.info("console.info"); + console.warn("console.warn"); + console.error("console.error"); + + consoleCount(); + consoleCount(); + + var a = [1, 2]; + var b = {a: "hello", d: 1 }; + var c + var d = 12; + var e = function() { return 5;}; + var f = true; + var g = {toString: function() { throw new Error('toString'); }}; + + console.log(a); + console.log(b); + console.log(c); + console.log(d); + console.log(e); + console.log(f); + console.log(root); + console.log(g); + console.log(1, "pong!", new Object); + console.log(1, ["ping","pong"], new Object, 2); + + try { + console.log(exception); + } catch (e) { + return; + } + + throw ("console.log(exception) should have raised an exception"); + } +} diff --git a/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml b/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml new file mode 100644 index 0000000000..10184a7931 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconsole/data/profiling.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +QtObject { + Component.onCompleted: { + console.profile("profile1"); + console.time("timer1"); + console.timeEnd("timer1"); + console.profileEnd("profile1"); + } +} diff --git a/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml b/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml new file mode 100644 index 0000000000..152df77384 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconsole/data/tracing.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +// moving lines in here requires fixing tst_qdeclarativeconsole.cpp +QtObject { + id: root + + function tracing() + { + console.trace(); + } + + Component.onCompleted: { + tracing(); + } +} diff --git a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp index da725dd4e2..34b0f6582f 100644 --- a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp +++ b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -51,51 +51,110 @@ public: tst_qdeclarativeconsole() {} private slots: - void init(); - void consoleLogExtended(); + void logging(); + void tracing(); + void profiling(); + void assert(); + void exception(); private: QDeclarativeEngine engine; }; -void tst_qdeclarativeconsole::init() +void tst_qdeclarativeconsole::logging() { - qputenv("QML_CONSOLE_EXTENDED", QByteArray("1")); + QUrl testUrl = testFileUrl("logging.qml"); + + QTest::ignoreMessage(QtDebugMsg, "console.debug"); + QTest::ignoreMessage(QtDebugMsg, "console.log"); + QTest::ignoreMessage(QtDebugMsg, "console.info"); + QTest::ignoreMessage(QtWarningMsg, "console.warn"); + QTest::ignoreMessage(QtCriticalMsg, "console.error"); + + QTest::ignoreMessage(QtDebugMsg, "console.count: 1"); + QTest::ignoreMessage(QtDebugMsg, ": 1"); + QTest::ignoreMessage(QtDebugMsg, "console.count: 2"); + QTest::ignoreMessage(QtDebugMsg, ": 2"); + + QTest::ignoreMessage(QtDebugMsg, "[1,2]"); + QTest::ignoreMessage(QtDebugMsg, "Object"); + QTest::ignoreMessage(QtDebugMsg, "undefined"); + QTest::ignoreMessage(QtDebugMsg, "12"); + QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}"); + QTest::ignoreMessage(QtDebugMsg, "true"); + QTest::ignoreMessage(QtDebugMsg, "Object"); + QTest::ignoreMessage(QtDebugMsg, "Object"); + QTest::ignoreMessage(QtDebugMsg, "1 pong! Object"); + QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] Object 2"); + + QDeclarativeComponent component(&engine, testUrl); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +void tst_qdeclarativeconsole::tracing() +{ + QUrl testUrl = testFileUrl("tracing.qml"); + + QString trace1 = QString::fromLatin1("tracing (%1:%2:%3)\n").arg(testUrl.toString()).arg(50).arg(17); + QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(9); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); + + QDeclarativeComponent component(&engine, testUrl); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +void tst_qdeclarativeconsole::profiling() +{ + QUrl testUrl = testFileUrl("profiling.qml"); + + // profiling() + QTest::ignoreMessage(QtDebugMsg, "Profiling started."); + QTest::ignoreMessage(QtDebugMsg, "Profiling ended."); + + QDeclarativeComponent component(&engine, testUrl); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +void tst_qdeclarativeconsole::assert() +{ + QUrl testUrl = testFileUrl("assert.qml"); + + // assert() + QTest::ignoreMessage(QtCriticalMsg, "This will fail"); + QTest::ignoreMessage(QtCriticalMsg, "This will fail too"); + QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(17); + QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(59).arg(9); + QString trace3 = QString::fromLatin1("assertFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(47).arg(17); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3)); + + QDeclarativeComponent component(&engine, testUrl); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; } -void tst_qdeclarativeconsole::consoleLogExtended() +void tst_qdeclarativeconsole::exception() { - int startLineNumber = 15; - QUrl testUrl = testFileUrl("consoleLog.qml"); - const QString testUrlString = testUrl.toString(); - QString testString = QString(QLatin1String("completed ok (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++))); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++))); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++))); - QTest::ignoreMessage(QtWarningMsg, qPrintable(testString.arg(startLineNumber++))); - QTest::ignoreMessage(QtCriticalMsg, qPrintable(testString.arg(startLineNumber++))); - - QString testArray = QString(QLatin1String("[1,2] (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testArray.arg(startLineNumber++))); - QString testObject = QString(QLatin1String("Object (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++))); - QString testUndefined = QString(QLatin1String("undefined (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testUndefined.arg(startLineNumber++))); - QString testNumber = QString(QLatin1String("12 (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testNumber.arg(startLineNumber++))); - QString testFunction = QString(QLatin1String("function () { return 5;} (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testFunction.arg(startLineNumber++))); - QString testBoolean = QString(QLatin1String("true (%1:%2)")).arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testBoolean.arg(startLineNumber++))); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++))); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++))); - QString testMix = QString::fromLatin1("1 pong! Object (%1:%2)").arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++))); - testMix = QString::fromLatin1("1 [ping,pong] Object 2 (%1:%2)").arg(testUrlString); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++))); - - QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrlString); - QTest::ignoreMessage(QtWarningMsg, qPrintable(testException.arg(startLineNumber++))); + QUrl testUrl = testFileUrl("exception.qml"); + + // exception() + QTest::ignoreMessage(QtCriticalMsg, "Exception 1"); + QTest::ignoreMessage(QtCriticalMsg, "Exception 2"); + QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(51).arg(21); + QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(56).arg(9); + QString trace3 = QString::fromLatin1("exceptionFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(46).arg(17); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); + QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3)); QDeclarativeComponent component(&engine, testUrl); QObject *object = component.create(); diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index 961fedfae4..ee80c3502d 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp b/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp index 8f52a49500..3724f90bff 100644 --- a/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp +++ b/tests/auto/declarative/qdeclarativecpputils/tst_qdeclarativecpputils.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml new file mode 100644 index 0000000000..eeb0815f09 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/urlListProperty.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 +import Qt.test 1.0 + +Item { + // single url assignment to url list property + MySequenceConversionObject { + id: msco1 + objectName: "msco1" + } + + // single url binding to url list property + MySequenceConversionObject { + id: msco2 + objectName: "msco2" + urlListProperty: "http://qt-project.org/?get%3cDATA%3e"; + } + + // multiple url assignment to url list property + MySequenceConversionObject { + id: msco3 + objectName: "msco3" + } + + // multiple url binding to url list property + MySequenceConversionObject { + id: msco4 + objectName: "msco4" + urlListProperty: [ + "http://qt-project.org/?get%3cDATA%3e", + "http://qt-project.org/?get%3cDATA%3e" + ]; + } + + Component.onCompleted: { + msco1.urlListProperty = "http://qt-project.org/?get%3cDATA%3e"; + msco3.urlListProperty = [ + "http://qt-project.org/?get%3cDATA%3e", + "http://qt-project.org/?get%3cDATA%3e" + ]; + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml new file mode 100644 index 0000000000..0e8bdaec96 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/urlProperty.2.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import Qt.test 1.0 + +MyQmlObject { + property bool result + stringProperty: "http://example.org" + urlProperty: stringProperty + "/?get%3cDATA%3e" + value: urlProperty == stringProperty + "/?get%3cDATA%3e" + result: urlProperty == urlProperty +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 5d4f579194..7cfe05eae8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -127,7 +127,7 @@ static QJSValue readonly_script_api(QDeclarativeEngine *engine, QJSEngine *scrip // now freeze it so that it's read-only QJSValue freezeFunction = scriptEngine->evaluate("(function(obj) { return Object.freeze(obj); })"); - v = freezeFunction.call(QJSValue(), (QJSValueList() << v)); + v = freezeFunction.call(QJSValueList() << v); return v; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index e872f02ffa..f76e9d3773 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 5f1f44e278..7ac00b3abe 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -213,6 +213,8 @@ private slots: void aliasToCompositeElement(); void realToInt(); void urlProperty(); + void urlPropertyWithEncoding(); + void urlListPropertyWithEncoding(); void dynamicString(); void include(); void signalHandlers(); @@ -1217,12 +1219,15 @@ void tst_qdeclarativeecmascript::dynamicDestruction() QMetaObject::invokeMethod(object, "killOther"); QVERIFY(createdQmlObject); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(createdQmlObject); for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up if (createdQmlObject) { QTest::qWait(100); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); } } QVERIFY(!createdQmlObject); @@ -1230,8 +1235,8 @@ void tst_qdeclarativeecmascript::dynamicDestruction() QDeclarativeEngine::setObjectOwnership(object, QDeclarativeEngine::JavaScriptOwnership); QMetaObject::invokeMethod(object, "killMe"); QVERIFY(object); - QTest::qWait(0); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(!object); } @@ -1248,7 +1253,8 @@ void tst_qdeclarativeecmascript::dynamicDestruction() QMetaObject::invokeMethod(o, "destroy"); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0); @@ -1763,13 +1769,15 @@ void tst_qdeclarativeecmascript::dynamicCreationOwnership() QMetaObject::invokeMethod(object, "performGc"); } if (i % 10 == 0) { - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); } } delete object; } - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, expectedDtorCount); } @@ -2610,7 +2618,8 @@ void tst_qdeclarativeecmascript::ownership() engine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(own.object == 0); @@ -2628,7 +2637,8 @@ void tst_qdeclarativeecmascript::ownership() engine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(own.object != 0); @@ -2683,7 +2693,8 @@ void tst_qdeclarativeecmascript::cppOwnershipReturnValue() delete object; } - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(source.value != 0); } @@ -2711,7 +2722,8 @@ void tst_qdeclarativeecmascript::ownershipCustomReturnValue() } engine.collectGarbage(); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(source.value == 0); } @@ -3748,7 +3760,8 @@ void tst_qdeclarativeecmascript::propertyVarCpp() static void gc(QDeclarativeEngine &engine) { engine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); } void tst_qdeclarativeecmascript::propertyVarOwnership() @@ -3827,7 +3840,8 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); QVERIFY(rootObject != 0); QObject *childObject = rootObject->findChild<QObject*>("text"); @@ -3837,10 +3851,12 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership() QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject. QWeakPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. QVERIFY(!qobjectGuard.isNull()); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(!qobjectGuard.isNull()); QMetaObject::invokeMethod(object, "deassignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(qobjectGuard.isNull()); // should have been collected now. delete object; } @@ -3852,7 +3868,8 @@ void tst_qdeclarativeecmascript::propertyVarReparent() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); @@ -3873,13 +3890,15 @@ void tst_qdeclarativeecmascript::propertyVarReparent() // now reparent the "Image" object (currently, it has JS ownership) image->setParent(text); // shouldn't be collected after deassignVp now, since has a parent. QMetaObject::invokeMethod(text2, "deassignVp"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QCOMPARE(text->property("textCanary").toInt(), 11); QCOMPARE(text2->property("textCanary").toInt(), 22); QVERIFY(!imageGuard.isNull()); // should still be alive. QCOMPARE(image->property("imageCanary").toInt(), 13); // still able to access var properties QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2 - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(imageGuard.isNull()); // should now have been deleted, due to parent being deleted. delete object; } @@ -3893,7 +3912,8 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); @@ -3914,7 +3934,8 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext() // now reparent the "Image" object (currently, it has JS ownership) image->setParent(object); // reparented to base object. after deassignVarProp, the ctxt will be invalid. QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2 - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(!imageGuard.isNull()); // should still be alive. QVERIFY(!image->property("imageCanary").isValid()); // but varProperties won't be available (null context). delete object; @@ -3928,17 +3949,20 @@ void tst_qdeclarativeecmascript::propertyVarCircular() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QCOMPARE(object->property("canaryInt"), QVariant(5)); QVariant canaryResourceVariant = object->property("canaryResource"); QVERIFY(canaryResourceVariant.isValid()); QPixmap canaryResourcePixmap = canaryResourceVariant.value<QPixmap>(); canaryResourceVariant = QVariant(); // invalidate it to remove one copy of the pixmap from memory. QMetaObject::invokeMethod(object, "deassignCanaryResource"); // remove one copy of the pixmap from memory - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(!canaryResourcePixmap.isDetached()); // two copies extant - this and the propertyVar.vp.vp.vp.vp.memoryHog. QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QCOMPARE(object->property("canaryInt"), QVariant(2)); QCOMPARE(object->property("canaryResource"), QVariant(1)); QVERIFY(canaryResourcePixmap.isDetached()); // now detached, since orig copy was member of qdvmemo which was deleted. @@ -3953,7 +3977,8 @@ void tst_qdeclarativeecmascript::propertyVarCircular2() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); QVERIFY(rootObject != 0); QObject *childObject = rootObject->findChild<QObject*>("text"); @@ -3966,7 +3991,8 @@ void tst_qdeclarativeecmascript::propertyVarCircular2() QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QMetaObject::invokeMethod(object, "deassignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(rootObjectTracker.isNull()); // should have been collected QVERIFY(childObjectTracker.isNull()); // should have been collected delete object; @@ -3988,7 +4014,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); // we want to be able to track when the varProperties array of the last metaobject is disposed QObject *cco5 = object->property("varProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>(); QObject *ico5 = object->property("varProperty").value<QObject*>()->property("inheritanceVarProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>(); @@ -4011,7 +4038,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance() } // now we deassign the var prop, which should trigger collection of item subtrees. QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); // ensure that there are only weak handles to the underlying varProperties array remaining. gc(engine); QCOMPARE(propertyVarWeakRefCallbackCount, 2); // should have been called for both, since all refs should be weak. @@ -4030,7 +4058,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2() QObject *object = component.create(); QVERIFY(object != 0); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); QVERIFY(rootObject != 0); QObject *childObject = rootObject->findChild<QObject*>("text"); @@ -4049,7 +4078,8 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2() QCOMPARE(childObject->property("textCanary").toInt(), 10); } QMetaObject::invokeMethod(object, "deassignCircular"); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::processEvents(); QVERIFY(propertyVarWeakRefCallbackCount == 1); // should have been collected now. delete object; } @@ -4134,7 +4164,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 0); // second has JS ownership, kept alive by first's reference delete object; hrmEngine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -4153,7 +4184,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 2); // both should be cleaned up, since circular references shouldn't keep alive. delete object; hrmEngine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -4181,7 +4213,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 0); // due to reference from first to second, second shouldn't be collected. delete object; hrmEngine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -4212,7 +4245,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 2); // despite circular references, both will be collected. delete object; hrmEngine.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -4250,13 +4284,15 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() second2->setParent(0); QDeclarativeEngine::setObjectOwnership(second2, QDeclarativeEngine::JavaScriptOwnership); gc(engine); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 0); // due to reference from first1 to second2, second2 shouldn't be collected. delete object1; delete object2; hrmEngine1.collectGarbage(); hrmEngine2.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 6); } @@ -4303,13 +4339,15 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() QDeclarativeEngine::setObjectOwnership(first2, QDeclarativeEngine::JavaScriptOwnership); QDeclarativeEngine::setObjectOwnership(second2, QDeclarativeEngine::JavaScriptOwnership); gc(engine); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 4); // circular references shouldn't keep them alive. delete object1; delete object2; hrmEngine1.collectGarbage(); hrmEngine2.collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 6); } @@ -4361,7 +4399,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement() delete object1; delete object2; hrmEngine1->collectGarbage(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QCOMPARE(dtorCount, 6); delete hrmEngine1; } @@ -5519,6 +5558,42 @@ void tst_qdeclarativeecmascript::urlProperty() } } +void tst_qdeclarativeecmascript::urlPropertyWithEncoding() +{ + { + QDeclarativeComponent component(&engine, testFileUrl("urlProperty.2.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + object->setStringProperty("http://qt-project.org"); + QUrl encoded; + encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); + QCOMPARE(object->urlProperty(), encoded); + QCOMPARE(object->value(), 0); // Interpreting URL as string yields canonicalised version + QCOMPARE(object->property("result").toBool(), true); + } +} + +void tst_qdeclarativeecmascript::urlListPropertyWithEncoding() +{ + { + QDeclarativeComponent component(&engine, testFileUrl("urlListProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1")); + MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2")); + MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); + MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); + QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0); + QUrl encoded; + encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); + QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded)); + QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded)); + QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << encoded << encoded)); + QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << encoded << encoded)); + delete object; + } +} + void tst_qdeclarativeecmascript::dynamicString() { QDeclarativeComponent component(&engine, testFileUrl("dynamicString.qml")); diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 8de3ee1f1e..1f9a13d444 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp index 7d2754f995..0045d1f7d4 100644 --- a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp +++ b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp index dec8be560c..f56f9d96df 100644 --- a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp +++ b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp index 3c0291d81e..e7406de6a5 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index e438885dbf..f968f82e07 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp b/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp index d9bb9837a8..f5aac96a47 100644 --- a/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeincubator/testtypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeincubator/testtypes.h b/tests/auto/declarative/qdeclarativeincubator/testtypes.h index ec75b4410c..ba6c2b8d14 100644 --- a/tests/auto/declarative/qdeclarativeincubator/testtypes.h +++ b/tests/auto/declarative/qdeclarativeincubator/testtypes.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp index 2520b10af8..1d553e9e7e 100644 --- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp +++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -421,7 +421,8 @@ void tst_qdeclarativeincubator::clearDuringCompletion() QPointer<QObject> srt = SelfRegisteringType::me(); incubator.clear(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(incubator.isNull()); QVERIFY(srt.isNull()); } @@ -458,7 +459,8 @@ void tst_qdeclarativeincubator::objectDeletionAfterInit() delete incubator.obj; incubator.clear(); - QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QVERIFY(incubator.isNull()); } diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp index 2af72996f1..279e9fca29 100644 --- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -175,7 +175,7 @@ void tst_qdeclarativeinfo::types() qmlInfo(0) << QByteArray("Qt"); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true"); - qmlInfo(0) << QBool(true); + qmlInfo(0) << bool(true); //### do we actually want QUrl to show up in the output? //### why the extra space at the end? @@ -212,7 +212,7 @@ void tst_qdeclarativeinfo::chaining() << QUrl("http://qt.nokia.com") << ref << QByteArray("Qt") - << QBool(true) + << bool(true) << QString ("Quick"); } diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index c7e8f4e636..6cb836c6d3 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml index 2313499d19..28a340128d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml @@ -22,7 +22,7 @@ MyTypeObject { variantProperty: "Hello World!" vectorProperty: "10,1,2.2" vector4Property: "10,1,2.2,2.3" - urlProperty: "main.qml" + urlProperty: "main.qml?with%3cencoded%3edata" objectProperty: MyTypeObject { intProperty: 8 } } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml new file mode 100644 index 0000000000..eaba98ecd2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.1.qml @@ -0,0 +1,12 @@ +import com.nokia.PureJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml new file mode 100644 index 0000000000..578ca47ea5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.10.qml @@ -0,0 +1,16 @@ +import com.nokia.PureJsModule 1.0 as PJM +import com.nokia.PureJsModule 1.0 as AnotherName +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM.FirstAPI.greeting() == "Hello") && + (PJM.FirstAPI.major == 1) && + (PJM.FirstAPI.minor == 0) && + (AnotherName.FirstAPI.greeting() == "Hello") && + (AnotherName.FirstAPI.major == 1) && + (AnotherName.FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml new file mode 100644 index 0000000000..dd3d65c5dd --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.2.qml @@ -0,0 +1,12 @@ +import com.nokia.VersionedOnlyJsModule 9.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((SomeAPI.greeting() == "Hey hey hey") && + (SomeAPI.major == 9) && + (SomeAPI.minor == 0)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml new file mode 100644 index 0000000000..f59d445a56 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.3.qml @@ -0,0 +1,16 @@ +import com.nokia.PureJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0) && + (SecondAPI.greeting() == "Howdy") && + (SecondAPI.major == 1) && + (SecondAPI.minor == 5)) + + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml new file mode 100644 index 0000000000..e7b74bac0a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.4.qml @@ -0,0 +1,15 @@ +import com.nokia.PureJsModule 1.6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Good news, everybody!") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 6) && + (SecondAPI.greeting() == "Howdy") && + (SecondAPI.major == 1) && + (SecondAPI.minor == 5)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt new file mode 100644 index 0000000000..10dbc80297 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.errors.txt @@ -0,0 +1 @@ +1:1:module "com.nokia.VersionedOnlyJsModule" is not installed diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml new file mode 100644 index 0000000000..a9ec20c72b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.5.qml @@ -0,0 +1,6 @@ +import com.nokia.VersionedOnlyJsModule 1.0 +import QtQuick 2.0 + +Item { + property bool test: false +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt new file mode 100644 index 0000000000..41c99702a2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.errors.txt @@ -0,0 +1 @@ +2:1:"com.nokia.VersionedOnlyJsModule" is ambiguous. diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml new file mode 100644 index 0000000000..6c4eb89551 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.6.qml @@ -0,0 +1,13 @@ +import com.nokia.VersionedOnlyJsModule 9.0 +import com.nokia.VersionedOnlyJsModule 9.0 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((SomeAPI.greeting() == "Hey hey hey") && + (SomeAPI.major == 9) && + (SomeAPI.minor == 0)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt new file mode 100644 index 0000000000..56bc4c548f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.errors.txt @@ -0,0 +1 @@ +2:1:"com.nokia.PureJsModule" is ambiguous. diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml new file mode 100644 index 0000000000..5523a158bd --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.7.qml @@ -0,0 +1,13 @@ +import com.nokia.PureJsModule 1.0 +import com.nokia.PureJsModule 1.6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((FirstAPI.greeting() == "Hello") && + (FirstAPI.major == 1) && + (FirstAPI.minor == 0)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml new file mode 100644 index 0000000000..4ddedc31a8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.8.qml @@ -0,0 +1,15 @@ +import com.nokia.PureJsModule 1.5 as PJM +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM.FirstAPI.greeting() == "Hello") && + (PJM.FirstAPI.major == 1) && + (PJM.FirstAPI.minor == 0) && + (PJM.SecondAPI.greeting() == "Howdy") && + (PJM.SecondAPI.major == 1) && + (PJM.SecondAPI.minor == 5)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml new file mode 100644 index 0000000000..351164ba41 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importJs.9.qml @@ -0,0 +1,19 @@ +import com.nokia.PureJsModule 1.5 as PJM_1_5 +import com.nokia.PureJsModule 1.6 as PJM_1_6 +import QtQuick 2.0 + +Item { + property bool test: false + + Component.onCompleted: { + test = ((PJM_1_5.FirstAPI.greeting() == "Hello") && + (PJM_1_5.FirstAPI.major == 1) && + (PJM_1_5.FirstAPI.minor == 0) && + (PJM_1_5.SecondAPI.greeting() == "Howdy") && + (PJM_1_5.SecondAPI.major == 1) && + (PJM_1_5.SecondAPI.minor == 5) && + (PJM_1_6.FirstAPI.greeting() == "Good news, everybody!") && + (PJM_1_6.FirstAPI.major == 1) && + (PJM_1_6.FirstAPI.minor == 6)) + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt new file mode 100644 index 0000000000..eff7c0e6c4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.errors.txt @@ -0,0 +1 @@ +1:1:Expected a qualified name id diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.errors.txt index 4bcc948e92..4bcc948e92 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.errors.txt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.qml index 427827ca89..427827ca89 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.2.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt new file mode 100644 index 0000000000..fdce1abf06 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.errors.txt @@ -0,0 +1 @@ +3:5:Expected type name diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml new file mode 100644 index 0000000000..65e93ed55d --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.3.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Foo.foo { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt new file mode 100644 index 0000000000..3b90f573a2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.errors.txt @@ -0,0 +1 @@ +3:1:Bar.Item - Bar is not a namespace diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml new file mode 100644 index 0000000000..ba4c8ae1f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.4.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Bar.Item { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt new file mode 100644 index 0000000000..4bcc948e92 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.errors.txt @@ -0,0 +1 @@ +1:1:Expected type name diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml new file mode 100644 index 0000000000..658b72d9f2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.1.qml @@ -0,0 +1,2 @@ +item { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt new file mode 100644 index 0000000000..fdce1abf06 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.errors.txt @@ -0,0 +1 @@ +3:5:Expected type name diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml new file mode 100644 index 0000000000..9c83238282 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 as Foo + +Foo.item { +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt new file mode 100644 index 0000000000..208df2b84a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.errors.txt @@ -0,0 +1 @@ +5:9:Expected type name diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml new file mode 100644 index 0000000000..2f7027081e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.3.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 as Foo + +Foo.Item { + + Foo.item { + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt new file mode 100644 index 0000000000..3b90f573a2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.errors.txt @@ -0,0 +1 @@ +3:1:Bar.Item - Bar is not a namespace diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml new file mode 100644 index 0000000000..ba4c8ae1f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidTypeName.4.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 as Foo + +Bar.Item { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js new file mode 100644 index 0000000000..c7b3c8b6ca --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.1.6.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 6 + +function greeting() { return "Good news, everybody!" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js new file mode 100644 index 0000000000..b90033eeb4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/FirstAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 0 + +function greeting() { return "Hello" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js new file mode 100644 index 0000000000..b802477cb6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/SecondAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 5 + +function greeting() { return "Howdy" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir new file mode 100644 index 0000000000..083afb051c --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule.1.6/qmldir @@ -0,0 +1,3 @@ +FirstAPI 1.0 FirstAPI.js +FirstAPI 1.6 FirstAPI.1.6.js +SecondAPI 1.5 SecondAPI.js diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js new file mode 100644 index 0000000000..b90033eeb4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/FirstAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 0 + +function greeting() { return "Hello" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js new file mode 100644 index 0000000000..b802477cb6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/SecondAPI.js @@ -0,0 +1,5 @@ +var major = 1 +var minor = 5 + +function greeting() { return "Howdy" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir new file mode 100644 index 0000000000..5c3acebd39 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/PureJsModule/qmldir @@ -0,0 +1,2 @@ +FirstAPI 1.0 FirstAPI.js +SecondAPI 1.5 SecondAPI.js diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js new file mode 100644 index 0000000000..efac613fc2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/SomeAPI.js @@ -0,0 +1,5 @@ +var major = 9 +var minor = 0 + +function greeting() { return "Hey hey hey" } + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir new file mode 100644 index 0000000000..5c1b182028 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/VersionedOnlyJsModule.9.0/qmldir @@ -0,0 +1 @@ +SomeAPI 9.0 SomeAPI.js diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 78c49f97a6..7b25784041 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index ccbd32930f..b76c0c36aa 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index ff5de84a28..ff956ec182 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -159,6 +159,8 @@ private slots: void importsOrder_data(); void importsOrder(); void importIncorrectCase(); + void importJs_data(); + void importJs(); void qmlAttachedPropertiesObjectMethod(); void customOnProperty(); @@ -179,21 +181,17 @@ private: void testType(const QString& qml, const QString& type, const QString& error); }; -#define VERIFY_ERRORS(errorfile) \ - if (!errorfile) { \ - if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ - qWarning() << "Unexpected Errors:" << component.errors(); \ - QVERIFY(!component.isError()); \ - QVERIFY(component.errors().isEmpty()); \ - } else { \ +#define DETERMINE_ERRORS(errorfile,expected,actual)\ + QList<QByteArray> expected; \ + QList<QByteArray> actual; \ + do { \ QFile file(testdata(QLatin1String(errorfile))); \ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \ QByteArray data = file.readAll(); \ file.close(); \ - QList<QByteArray> expected = data.split('\n'); \ + expected = data.split('\n'); \ expected.removeAll(QByteArray("")); \ QList<QDeclarativeError> errors = component.errors(); \ - QList<QByteArray> actual; \ for (int ii = 0; ii < errors.count(); ++ii) { \ const QDeclarativeError &error = errors.at(ii); \ QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ @@ -201,6 +199,16 @@ private: error.description().toUtf8(); \ actual << errorStr; \ } \ + } while (false); + +#define VERIFY_ERRORS(errorfile) \ + if (!errorfile) { \ + if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ + qWarning() << "Unexpected Errors:" << component.errors(); \ + QVERIFY(!component.isError()); \ + QVERIFY(component.errors().isEmpty()); \ + } else { \ + DETERMINE_ERRORS(errorfile,actual,expected);\ if (qgetenv("DEBUG") != "" && expected != actual) \ qWarning() << "Expected:" << expected << "Actual:" << actual; \ if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ @@ -417,7 +425,6 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false; QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false; - QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false; QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false; QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false; QTest::newRow("enumTypes") << "enumTypes.qml" << "enumTypes.errors.txt" << false; @@ -442,6 +449,16 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false; QTest::newRow("metaobjectRevision.3") << "metaobjectRevision.3.qml" << "metaobjectRevision.3.errors.txt" << false; + QTest::newRow("invalidRoot.1") << "invalidRoot.1.qml" << "invalidRoot.1.errors.txt" << false; + QTest::newRow("invalidRoot.2") << "invalidRoot.2.qml" << "invalidRoot.2.errors.txt" << false; + QTest::newRow("invalidRoot.3") << "invalidRoot.3.qml" << "invalidRoot.3.errors.txt" << false; + QTest::newRow("invalidRoot.4") << "invalidRoot.4.qml" << "invalidRoot.4.errors.txt" << false; + + QTest::newRow("invalidTypeName.1") << "invalidTypeName.1.qml" << "invalidTypeName.1.errors.txt" << false; + QTest::newRow("invalidTypeName.2") << "invalidTypeName.2.qml" << "invalidTypeName.2.errors.txt" << false; + QTest::newRow("invalidTypeName.3") << "invalidTypeName.3.qml" << "invalidTypeName.3.errors.txt" << false; + QTest::newRow("invalidTypeName.4") << "invalidTypeName.4.qml" << "invalidTypeName.4.errors.txt" << false; + QTest::newRow("Major version isolation") << "majorVersionIsolation.qml" << "majorVersionIsolation.errors.txt" << false; } @@ -571,7 +588,9 @@ void tst_qdeclarativelanguage::assignBasicTypes() QCOMPARE(object->variantProperty(), QVariant("Hello World!")); QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3)); - QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); + QUrl encoded; + encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); + QCOMPARE(object->urlProperty(), component.url().resolved(encoded)); QVERIFY(object->objectProperty() != 0); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); QVERIFY(child != 0); @@ -1912,6 +1931,89 @@ void tst_qdeclarativelanguage::importIncorrectCase() QCOMPARE(errors.at(0).description(), expectedError); } +void tst_qdeclarativelanguage::importJs_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("errorFile"); + QTest::addColumn<bool>("performTest"); + + QTest::newRow("defaultVersion") + << "importJs.1.qml" + << "importJs.1.errors.txt" + << true; + + QTest::newRow("specifiedVersion") + << "importJs.2.qml" + << "importJs.2.errors.txt" + << true; + + QTest::newRow("excludeExcessiveVersion") + << "importJs.3.qml" + << "importJs.3.errors.txt" + << false; + + QTest::newRow("includeAppropriateVersion") + << "importJs.4.qml" + << "importJs.4.errors.txt" + << true; + + QTest::newRow("noDefaultVersion") + << "importJs.5.qml" + << "importJs.5.errors.txt" + << false; + + QTest::newRow("repeatImportFails") + << "importJs.6.qml" + << "importJs.6.errors.txt" + << false; + + QTest::newRow("multipleVersionImportFails") + << "importJs.7.qml" + << "importJs.7.errors.txt" + << false; + + QTest::newRow("namespacedImport") + << "importJs.8.qml" + << "importJs.8.errors.txt" + << true; + + QTest::newRow("namespacedVersionedImport") + << "importJs.9.qml" + << "importJs.9.errors.txt" + << true; + + QTest::newRow("namespacedRepeatImport") + << "importJs.10.qml" + << "importJs.10.errors.txt" + << true; +} + +void tst_qdeclarativelanguage::importJs() +{ + QFETCH(QString, file); + QFETCH(QString, errorFile); + QFETCH(bool, performTest); + + QDeclarativeComponent component(&engine, TEST_FILE(file)); + + { + DETERMINE_ERRORS(errorFile.toLatin1().constData(),expected,actual); + QCOMPARE(expected.size(), actual.size()); + for (int i = 0; i < expected.size(); ++i) + { + size_t compareLen = std::min(expected.at(i).length(), actual.at(i).length()); + QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen)); + } + } + + if (performTest) { + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toBool(),true); + delete object; + } +} + void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() { QObject object; diff --git a/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp b/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp index 508648a136..6a9c7872c8 100644 --- a/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp +++ b/tests/auto/declarative/qdeclarativelistcompositor/tst_qdeclarativelistcompositor.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 90ffec2432..cfae97aa4d 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 407b9794b6..186dd9f11a 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp index 254bbb74c8..cf29d56abd 100644 --- a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp +++ b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 85d4c51208..b4daebd63b 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp index 4774c32995..95ca4f2165 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp index 271c59e5ca..68ac9dcfbf 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp index f023963b55..94f905282d 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp index 2da3c82cac..0fa78c0a90 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp index 427bf64895..382209aaf1 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp index 1b5a9d8569..4b8cb6a4a0 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp index 8397dbf399..a405049446 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index b52d2d0f1c..d1dcfcba26 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp b/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp index 173a5008d4..211d678156 100644 --- a/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp +++ b/tests/auto/declarative/qdeclarativeparser/tst_qdeclarativeparser.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml b/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml new file mode 100644 index 0000000000..a9e51c1255 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeproperty/data/assignEmptyVariantMap.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + Component.onCompleted: { o.variantMap = {}; } +} diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index bf927a74fc..a4d6b09083 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -41,6 +41,7 @@ #include <qtest.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeproperty.h> #include <QtDeclarative/private/qdeclarativeproperty_p.h> #include <private/qdeclarativebinding_p.h> @@ -49,6 +50,7 @@ #include <QtCore/qdir.h> #include "../../shared/util.h" +#include <QDebug> class MyQmlObject : public QObject { Q_OBJECT @@ -120,10 +122,17 @@ private slots: //writeToReadOnly(); + void urlHandling_data(); + void urlHandling(); + + void variantMapHandling_data(); + void variantMapHandling(); + // Bugs void crashOnValueProperty(); void aliasPropertyBindings(); void noContext(); + void assignEmptyVariantMap(); void copy(); private: @@ -184,6 +193,7 @@ class PropertyObject : public QObject Q_PROPERTY(QRect rectProperty READ rectProperty) Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty) Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(QVariantMap variantMap READ variantMap WRITE setVariantMap) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject) @@ -201,6 +211,9 @@ public: QUrl url() { return m_url; } void setUrl(const QUrl &u) { m_url = u; } + QVariantMap variantMap() const { return m_variantMap; } + void setVariantMap(const QVariantMap &variantMap) { m_variantMap = variantMap; } + int resettableProperty() const { return m_resetProperty; } void setResettableProperty(int r) { m_resetProperty = r; } void resetProperty() { m_resetProperty = 9; } @@ -209,6 +222,7 @@ public: void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } MyQmlObject *qmlObject() { return &m_qmlObject; } + signals: void clicked(); void oddlyNamedNotifySignal(); @@ -217,6 +231,7 @@ private: int m_resetProperty; QRect m_rect; QUrl m_url; + QVariantMap m_variantMap; int m_propertyWithNotify; MyQmlObject m_qmlObject; }; @@ -1192,6 +1207,32 @@ void tst_qdeclarativeproperty::write() QCOMPARE(o.url(), result); } + // VariantMap-property + QVariantMap vm; + vm.insert("key", "value"); + + { + PropertyObject o; + QDeclarativeProperty p(&o, "variantMap"); + + QCOMPARE(p.write(vm), true); + QCOMPARE(o.variantMap(), vm); + + QDeclarativeProperty p2(&o, "variantMap", engine.rootContext()); + + QCOMPARE(p2.write(vm), true); + QCOMPARE(o.variantMap(), vm); + } + { // static + PropertyObject o; + + QCOMPARE(QDeclarativeProperty::write(&o, "variantMap", vm), true); + QCOMPARE(o.variantMap(), vm); + + QCOMPARE(QDeclarativeProperty::write(&o, "variantMap", vm, engine.rootContext()), true); + QCOMPARE(o.variantMap(), vm); + } + // Attached property { QDeclarativeComponent component(&engine); @@ -1315,7 +1356,6 @@ void tst_qdeclarativeproperty::writeObjectToList() QCOMPARE(list.at(0), qobject_cast<QObject*>(object)); } -Q_DECLARE_METATYPE(QList<QObject *>); void tst_qdeclarativeproperty::writeListToList() { QDeclarativeComponent containerComponent(&engine); @@ -1338,6 +1378,163 @@ void tst_qdeclarativeproperty::writeListToList() QCOMPARE(container->children()->size(), 1);*/ } +void tst_qdeclarativeproperty::urlHandling_data() +{ + QTest::addColumn<QByteArray>("input"); + QTest::addColumn<QString>("scheme"); + QTest::addColumn<QString>("path"); + QTest::addColumn<QByteArray>("encoded"); + + QTest::newRow("unspecifiedFile") + << QByteArray("main.qml") + << QString("") + << QString("main.qml") + << QByteArray("main.qml"); + + QTest::newRow("specifiedFile") + << QByteArray("file:///main.qml") + << QString("file") + << QString("/main.qml") + << QByteArray("file:///main.qml"); + + QTest::newRow("httpFile") + << QByteArray("http://www.example.com/main.qml") + << QString("http") + << QString("/main.qml") + << QByteArray("http://www.example.com/main.qml"); + + QTest::newRow("pathFile") + << QByteArray("http://www.example.com/resources/main.qml") + << QString("http") + << QString("/resources/main.qml") + << QByteArray("http://www.example.com/resources/main.qml"); + + QTest::newRow("encodableName") + << QByteArray("http://www.example.com/main file.qml") + << QString("http") + << QString("/main file.qml") + << QByteArray("http://www.example.com/main%20file.qml"); + + QTest::newRow("preencodedName") + << QByteArray("http://www.example.com/resources%7cmain%20file.qml") + << QString("http") + << QString("/resources|main file.qml") + << QByteArray("http://www.example.com/resources%7cmain%20file.qml"); + + QTest::newRow("encodableQuery") + << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now working?") + << QString("http") + << QString("/main.qml") + << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working?"); + + QTest::newRow("preencodedQuery") + << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now working%3f") + << QString("http") + << QString("/main.qml") + << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now%20working%3f"); + + QTest::newRow("encodableFragment") + << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000|volume+50%") + << QString("http") + << QString("/main.qml") + << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume+50%25"); + + QTest::newRow("preencodedFragment") + << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%") + << QString("http") + << QString("/main.qml") + << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%25"); +} + +void tst_qdeclarativeproperty::urlHandling() +{ + QFETCH(QByteArray, input); + QFETCH(QString, scheme); + QFETCH(QString, path); + QFETCH(QByteArray, encoded); + + QString inputString(QString::fromUtf8(input)); + + { + PropertyObject o; + QDeclarativeProperty p(&o, "url"); + + // Test url written as QByteArray + QCOMPARE(p.write(input), true); + QUrl byteArrayResult(o.url()); + + QCOMPARE(byteArrayResult.scheme(), scheme); + QCOMPARE(byteArrayResult.path(), path); + QCOMPARE(byteArrayResult.toEncoded(), encoded); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "url"); + + // Test url written as QString + QCOMPARE(p.write(inputString), true); + QUrl stringResult(o.url()); + + QCOMPARE(stringResult.scheme(), scheme); + QCOMPARE(stringResult.path(), path); + QCOMPARE(stringResult.toEncoded(), encoded); + } +} + +void tst_qdeclarativeproperty::variantMapHandling_data() +{ + QTest::addColumn<QVariantMap>("vm"); + + // Object literals + { + QVariantMap m; + QTest::newRow("{}") << m; + } + { + QVariantMap m; + m["a"] = QVariantMap(); + QTest::newRow("{ a:{} }") << m; + } + { + QVariantMap m, m2; + m2["b"] = 10; + m2["c"] = 20; + m["a"] = m2; + QTest::newRow("{ a:{b:10, c:20} }") << m; + } + { + QVariantMap m; + m["a"] = 10; + m["b"] = QVariantList() << 20 << 30; + QTest::newRow("{ a:10, b:[20, 30]}") << m; + } + + // Cyclic objects + { + QVariantMap m; + m["p"] = QVariantMap(); + QTest::newRow("var o={}; o.p=o") << m; + } + { + QVariantMap m; + m["p"] = 123; + m["q"] = QVariantMap(); + QTest::newRow("var o={}; o.p=123; o.q=o") << m; + } +} + +void tst_qdeclarativeproperty::variantMapHandling() +{ + QFETCH(QVariantMap, vm); + + PropertyObject o; + QDeclarativeProperty p(&o, "variantMap"); + + QCOMPARE(p.write(vm), true); + QCOMPARE(o.variantMap(), vm); +} + void tst_qdeclarativeproperty::crashOnValueProperty() { QDeclarativeEngine *engine = new QDeclarativeEngine; @@ -1488,6 +1685,29 @@ void tst_qdeclarativeproperty::noContext() delete b; } +void tst_qdeclarativeproperty::assignEmptyVariantMap() +{ + PropertyObject o; + + QVariantMap map; + map.insert("key", "value"); + o.setVariantMap(map); + QCOMPARE(o.variantMap().count(), 1); + QCOMPARE(o.variantMap().isEmpty(), false); + + QDeclarativeContext context(&engine); + context.setContextProperty("o", &o); + + QDeclarativeComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml")); + QObject *obj = component.create(&context); + QVERIFY(obj); + + QCOMPARE(o.variantMap().count(), 0); + QCOMPARE(o.variantMap().isEmpty(), true); + + delete obj; +} + void tst_qdeclarativeproperty::initTestCase() { QDeclarativeDataTest::initTestCase(); diff --git a/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp b/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp index 01bad382a3..11867191c9 100644 --- a/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp +++ b/tests/auto/declarative/qdeclarativepropertycache/tst_qdeclarativepropertycache.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index a0c903c93f..0946538ca5 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeqt/data/console.qml b/tests/auto/declarative/qdeclarativeqt/data/console.qml deleted file mode 100644 index 634239c31f..0000000000 --- a/tests/auto/declarative/qdeclarativeqt/data/console.qml +++ /dev/null @@ -1,36 +0,0 @@ -import QtQuick 2.0 - -QtObject { - id: root - Component.onCompleted: { - var a = [1, 2] - var b = {a: "hello", d: 1 } - var c - var d = 12 - var e = function() { return 5;} - var f = true - var g = {toString: function() { throw new Error('toString'); }} - - console.profile("profile1") - console.time("timer1") - console.log("completed", "ok") - console.log("completed ok") - console.debug("completed ok") - console.warn("completed ok") - console.error("completed ok") - console.log(a) - console.log(b) - console.log(c) - console.log(d) - console.log(e) - console.log(f) - console.log(root) - console.log(g) - console.log(1, "pong!", new Object) - console.log(1, ["ping","pong"], new Object, 2) - console.trace() - console.timeEnd("timer1") - console.profileEnd("profile1") - console.log(exception) //This has to be at the end - } -} diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 6a03af503f..18283f0f3c 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -78,7 +78,6 @@ private slots: void createComponent(); void createComponent_pragmaLibrary(); void createQmlObject(); - void console(); void dateTimeConversion(); void dateTimeFormatting(); void dateTimeFormatting_data(); @@ -453,40 +452,6 @@ void tst_qdeclarativeqt::createQmlObject() delete object; } -void tst_qdeclarativeqt::console() -{ - QUrl testUrl = testFileUrl("console.qml"); - QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrl.toString()).arg(34); - QString testTrace = QString(QLatin1String("onCompleted (%1:%2:%3)\n")).arg(testUrl.toString()).arg(31).arg(17); - QTest::ignoreMessage(QtDebugMsg, qPrintable(testTrace)); - QTest::ignoreMessage(QtDebugMsg, "Profiling started."); - QTest::ignoreMessage(QtDebugMsg, "Profiling ended."); - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QTest::ignoreMessage(QtWarningMsg, "completed ok"); - QTest::ignoreMessage(QtCriticalMsg, "completed ok"); - - QTest::ignoreMessage(QtDebugMsg, "[1,2]"); - QTest::ignoreMessage(QtDebugMsg, "Object"); - QTest::ignoreMessage(QtDebugMsg, "undefined"); - QTest::ignoreMessage(QtDebugMsg, "12"); - QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}"); - QTest::ignoreMessage(QtDebugMsg, "true"); - QTest::ignoreMessage(QtDebugMsg, "Object"); - QTest::ignoreMessage(QtDebugMsg, "Object"); - QTest::ignoreMessage(QtDebugMsg, "1 pong! Object"); - QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] Object 2"); - - - QTest::ignoreMessage(QtWarningMsg, qPrintable(testException)); - - - QDeclarativeComponent component(&engine, testUrl); - QObject *object = component.create(); - QVERIFY(object != 0); - delete object; -} void tst_qdeclarativeqt::dateTimeConversion() { diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp index 47202c5029..f7392f47e7 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp +++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp index 063a772187..fd7515068b 100644 --- a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp +++ b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp index abe3039c3a..faa6cf2b07 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index b705356475..42f160fc75 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 69e64bd675..6e7aca96e8 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 05325997d5..857f13eb4d 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 490557faf5..70090091eb 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp index 4b41765a58..f3bf3157d5 100644 --- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -436,7 +436,7 @@ void tst_QJSEngine::newFunction() { QScriptValue fun = eng.newFunction(myFunction); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); QCOMPARE(fun.scriptClass(), (QScriptClass*)0); // a prototype property is automatically constructed @@ -449,11 +449,11 @@ void tst_QJSEngine::newFunction() } // prototype should be Function.prototype QCOMPARE(fun.prototype().isValid(), true); - QCOMPARE(fun.prototype().isFunction(), true); + QCOMPARE(fun.prototype().isCallable(), true); QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true); QCOMPARE(fun.call().isNull(), true); - QCOMPARE(fun.construct().isObject(), true); + QCOMPARE(fun.callAsConstructor().isObject(), true); } } @@ -462,7 +462,7 @@ void tst_QJSEngine::newFunctionWithArg() QScriptEngine eng; { QScriptValue fun = eng.newFunction(myFunctionWithVoidArg, (void*)this); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QCOMPARE(fun.scriptClass(), (QScriptClass*)0); // a prototype property is automatically constructed { @@ -474,11 +474,11 @@ void tst_QJSEngine::newFunctionWithArg() } // prototype should be Function.prototype QCOMPARE(fun.prototype().isValid(), true); - QCOMPARE(fun.prototype().isFunction(), true); + QCOMPARE(fun.prototype().isCallable(), true); QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true); QCOMPARE(fun.call().isNull(), true); - QCOMPARE(fun.construct().isObject(), true); + QCOMPARE(fun.callAsConstructor().isObject(), true); } } @@ -489,11 +489,11 @@ void tst_QJSEngine::newFunctionWithProto() QScriptValue proto = eng.newObject(); QScriptValue fun = eng.newFunction(myFunction, proto); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); // internal prototype should be Function.prototype QCOMPARE(fun.prototype().isValid(), true); - QCOMPARE(fun.prototype().isFunction(), true); + QCOMPARE(fun.prototype().isCallable(), true); QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true); // public prototype should be the one we passed QCOMPARE(fun.property("prototype").strictlyEquals(proto), true); @@ -502,30 +502,30 @@ void tst_QJSEngine::newFunctionWithProto() QCOMPARE(proto.propertyFlags("constructor"), QScriptValue::SkipInEnumeration); QCOMPARE(fun.call().isNull(), true); - QCOMPARE(fun.construct().isObject(), true); + QCOMPARE(fun.callAsConstructor().isObject(), true); } // whether the return value is correct { QScriptValue fun = eng.newFunction(myFunctionThatReturns); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); QScriptValue result = fun.call(); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 42); + QCOMPARE(result.toInt(), 42); } // whether the return value is assigned to the correct engine { QScriptValue fun = eng.newFunction(myFunctionThatReturnsWithoutEngine); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); QScriptValue result = fun.call(); QCOMPARE(result.engine(), &eng); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 1024); + QCOMPARE(result.toInt(), 1024); } // whether the return value is undefined when returning a value with wrong engine { @@ -533,7 +533,7 @@ void tst_QJSEngine::newFunctionWithProto() QScriptValue fun = eng.newFunction(myFunctionThatReturnsWrongEngine, reinterpret_cast<void *>(&wrongEngine)); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); QTest::ignoreMessage(QtWarningMsg, "QScriptValue::call(): Value from different engine returned from native function, returning undefined value instead."); @@ -547,24 +547,24 @@ void tst_QJSEngine::newFunctionWithProto() QScriptValue fun = eng.newFunction(sumFunction); QCOMPARE(fun.isValid(), true); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.isObject(), true); QScriptValue result = fun.call(); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 0); + QCOMPARE(result.toInt(), 0); result = fun.call(QScriptValue(), QScriptValueList() << 1); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 1); + QCOMPARE(result.toInt(), 1); result = fun.call(QScriptValue(), QScriptValueList() << 1 << 2 << 3); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 6); + QCOMPARE(result.toInt(), 6); result = fun.call(QScriptValue(), QScriptValueList() << 1 << 2 << 3 << 4); QCOMPARE(result.isNumber(), true); - QCOMPARE(result.toInt32(), 10); + QCOMPARE(result.toInt(), 10); } } #endif @@ -575,7 +575,7 @@ void tst_QJSEngine::newObject() QJSValue object = eng.newObject(); QCOMPARE(object.isValid(), true); QCOMPARE(object.isObject(), true); - QCOMPARE(object.isFunction(), false); + QCOMPARE(object.isCallable(), false); // ###FIXME: No QScriptClass QCOMPARE(object.scriptClass(), (QScriptClass*)0); // prototype should be Object.prototype QCOMPARE(object.prototype().isValid(), true); @@ -590,7 +590,7 @@ void tst_QJSEngine::newArray() QCOMPARE(array.isValid(), true); QCOMPARE(array.isArray(), true); QCOMPARE(array.isObject(), true); - QVERIFY(!array.isFunction()); + QVERIFY(!array.isCallable()); // ###FIXME: No QScriptClass QCOMPARE(array.scriptClass(), (QScriptClass*)0); // prototype should be Array.prototype QCOMPARE(array.prototype().isValid(), true); @@ -604,27 +604,27 @@ void tst_QJSEngine::newArray_HooliganTask218092() { QJSValue ret = eng.evaluate("[].splice(0, 0, 'a')"); QVERIFY(ret.isArray()); - QCOMPARE(ret.property("length").toInt32(), 0); + QCOMPARE(ret.property("length").toInt(), 0); } { QJSValue ret = eng.evaluate("['a'].splice(0, 1, 'b')"); QVERIFY(ret.isArray()); - QCOMPARE(ret.property("length").toInt32(), 1); + QCOMPARE(ret.property("length").toInt(), 1); } { QJSValue ret = eng.evaluate("['a', 'b'].splice(0, 1, 'c')"); QVERIFY(ret.isArray()); - QCOMPARE(ret.property("length").toInt32(), 1); + QCOMPARE(ret.property("length").toInt(), 1); } { QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(0, 2, 'd')"); QVERIFY(ret.isArray()); - QCOMPARE(ret.property("length").toInt32(), 2); + QCOMPARE(ret.property("length").toInt(), 2); } { QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(1, 2, 'd', 'e', 'f')"); QVERIFY(ret.isArray()); - QCOMPARE(ret.property("length").toInt32(), 2); + QCOMPARE(ret.property("length").toInt(), 2); } } @@ -639,15 +639,15 @@ void tst_QJSEngine::newArray_HooliganTask233836() { QJSValue ret = eng.newArray(0xFFFFFFFF); QEXPECT_FAIL("", "The maximum length of arrays is defined by v8 currently and differs from QtScript", Abort); - QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF)); + QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF)); ret.setProperty(0xFFFFFFFF, 123); - QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF)); + QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF)); QVERIFY(ret.property(0xFFFFFFFF).isNumber()); - QCOMPARE(ret.property(0xFFFFFFFF).toInt32(), 123); + QCOMPARE(ret.property(0xFFFFFFFF).toInt(), 123); ret.setProperty(123, 456); - QCOMPARE(ret.property("length").toUInt32(), uint(0xFFFFFFFF)); + QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF)); QVERIFY(ret.property(123).isNumber()); - QCOMPARE(ret.property(123).toInt32(), 456); + QCOMPARE(ret.property(123).toInt(), 456); } } @@ -658,12 +658,12 @@ void tst_QJSEngine::newVariant() QJSValue opaque = eng.newVariant(QVariant()); QCOMPARE(opaque.isValid(), true); QCOMPARE(opaque.isVariant(), true); - QVERIFY(!opaque.isFunction()); + QVERIFY(!opaque.isCallable()); QCOMPARE(opaque.isObject(), true); QCOMPARE(opaque.prototype().isValid(), true); QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue); QCOMPARE(opaque.prototype().isVariant(), true); - QVERIFY(opaque.property("valueOf").call(opaque).isUndefined()); + QVERIFY(opaque.property("valueOf").callWithInstance(opaque).isUndefined()); } } @@ -734,15 +734,15 @@ void tst_QJSEngine::newVariant_valueOfToString() QJSEngine eng; { QJSValue object = eng.newVariant(QVariant(123)); - QJSValue value = object.property("valueOf").call(object); + QJSValue value = object.property("valueOf").callWithInstance(object); QVERIFY(value.isNumber()); - QCOMPARE(value.toInt32(), 123); + QCOMPARE(value.toInt(), 123); QCOMPARE(object.toString(), QString::fromLatin1("123")); QCOMPARE(object.toVariant().toString(), object.toString()); } { QJSValue object = eng.newVariant(QVariant(QString::fromLatin1("hello"))); - QJSValue value = object.property("valueOf").call(object); + QJSValue value = object.property("valueOf").callWithInstance(object); QVERIFY(value.isString()); QCOMPARE(value.toString(), QString::fromLatin1("hello")); QCOMPARE(object.toString(), QString::fromLatin1("hello")); @@ -750,7 +750,7 @@ void tst_QJSEngine::newVariant_valueOfToString() } { QJSValue object = eng.newVariant(QVariant(false)); - QJSValue value = object.property("valueOf").call(object); + QJSValue value = object.property("valueOf").callWithInstance(object); QVERIFY(value.isBool()); QCOMPARE(value.toBool(), false); QCOMPARE(object.toString(), QString::fromLatin1("false")); @@ -758,7 +758,7 @@ void tst_QJSEngine::newVariant_valueOfToString() } { QJSValue object = eng.newVariant(QVariant(QPoint(10, 20))); - QJSValue value = object.property("valueOf").call(object); + QJSValue value = object.property("valueOf").callWithInstance(object); QVERIFY(value.isObject()); QVERIFY(value.strictlyEquals(object)); QCOMPARE(object.toString(), QString::fromLatin1("QVariant(QPoint)")); @@ -802,7 +802,7 @@ void tst_QJSEngine::newRegExp() QCOMPARE(rexp.isValid(), true); QCOMPARE(rexp.isRegExp(), true); QCOMPARE(rexp.isObject(), true); - QVERIFY(rexp.isFunction()); // in JSC, RegExp objects are callable + QVERIFY(rexp.isCallable()); // in JSC, RegExp objects are callable // prototype should be RegExp.prototype QCOMPARE(rexp.prototype().isValid(), true); QCOMPARE(rexp.prototype().isObject(), true); @@ -830,18 +830,18 @@ void tst_QJSEngine::jsRegExp() QCOMPARE(r.toString(), QString::fromLatin1("/foo/gim")); QJSValue rxCtor = eng.globalObject().property("RegExp"); - QJSValue r2 = rxCtor.call(QJSValue(), QJSValueList() << r); + QJSValue r2 = rxCtor.call(QJSValueList() << r); QVERIFY(r2.isRegExp()); QVERIFY(r2.strictlyEquals(r)); - QJSValue r3 = rxCtor.call(QJSValue(), QJSValueList() << r << "gim"); + QJSValue r3 = rxCtor.call(QJSValueList() << r << "gim"); QVERIFY(r3.isError()); QVERIFY(r3.toString().contains(QString::fromLatin1("TypeError"))); // Cannot supply flags when constructing one RegExp from another - QJSValue r4 = rxCtor.call(QJSValue(), QJSValueList() << "foo" << "gim"); + QJSValue r4 = rxCtor.call(QJSValueList() << "foo" << "gim"); QVERIFY(r4.isRegExp()); - QJSValue r5 = rxCtor.construct(QJSValueList() << r); + QJSValue r5 = rxCtor.callAsConstructor(QJSValueList() << r); QVERIFY(r5.isRegExp()); QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim")); // In JSC, constructing a RegExp from another produces the same identical object. @@ -849,7 +849,7 @@ void tst_QJSEngine::jsRegExp() QVERIFY(!r5.strictlyEquals(r)); QEXPECT_FAIL("", "V8 and jsc ignores invalid flags", Continue); //https://bugs.webkit.org/show_bug.cgi?id=41614 - QJSValue r6 = rxCtor.construct(QJSValueList() << "foo" << "bar"); + QJSValue r6 = rxCtor.callAsConstructor(QJSValueList() << "foo" << "bar"); QVERIFY(r6.isError()); // QVERIFY(r6.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag @@ -865,15 +865,15 @@ void tst_QJSEngine::jsRegExp() QVERIFY(r8.isRegExp()); QCOMPARE(r8.toString(), QString::fromLatin1("/foo/gim")); - QJSValue r9 = rxCtor.construct(); + QJSValue r9 = rxCtor.callAsConstructor(); QVERIFY(r9.isRegExp()); QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/")); - QJSValue r10 = rxCtor.construct(QJSValueList() << "" << "gim"); + QJSValue r10 = rxCtor.callAsConstructor(QJSValueList() << "" << "gim"); QVERIFY(r10.isRegExp()); QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim")); - QJSValue r11 = rxCtor.construct(QJSValueList() << "{1.*}" << "g"); + QJSValue r11 = rxCtor.callAsConstructor(QJSValueList() << "{1.*}" << "g"); QVERIFY(r11.isRegExp()); QCOMPARE(r11.toString(), QString::fromLatin1("/{1.*}/g")); } @@ -887,7 +887,7 @@ void tst_QJSEngine::newDate() QCOMPARE(date.isValid(), true); QCOMPARE(date.isDate(), true); QCOMPARE(date.isObject(), true); - QVERIFY(!date.isFunction()); + QVERIFY(!date.isCallable()); // prototype should be Date.prototype QCOMPARE(date.prototype().isValid(), true); QCOMPARE(date.prototype().isDate(), true); @@ -951,7 +951,7 @@ void tst_QJSEngine::newQObject() QCOMPARE(qobject.isQObject(), true); QCOMPARE(qobject.isObject(), true); QCOMPARE(qobject.toQObject(), (QObject *)this); - QVERIFY(!qobject.isFunction()); + QVERIFY(!qobject.isCallable()); // prototype should be QObject.prototype QCOMPARE(qobject.prototype().isValid(), true); QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue); @@ -1179,7 +1179,7 @@ static QScriptValue myConstructor(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue instanceofJS(const QScriptValue &inst, const QScriptValue &ctor) { return inst.engine()->evaluate("(function(inst, ctor) { return inst instanceof ctor; })") - .call(QScriptValue(), QScriptValueList() << inst << ctor); + .call(QScriptValueList() << inst << ctor); } void tst_QJSEngine::newQMetaObject() @@ -1195,27 +1195,27 @@ void tst_QJSEngine::newQMetaObject() QCOMPARE(qclass.isValid(), true); QCOMPARE(qclass.isQMetaObject(), true); QCOMPARE(qclass.toQMetaObject(), &QObject::staticMetaObject); - QCOMPARE(qclass.isFunction(), true); + QCOMPARE(qclass.isCallable(), true); QVERIFY(qclass.property("prototype").isObject()); QCOMPARE(qclass2.isValid(), true); QCOMPARE(qclass2.isQMetaObject(), true); QCOMPARE(qclass2.toQMetaObject(), &QWidget::staticMetaObject); - QCOMPARE(qclass2.isFunction(), true); + QCOMPARE(qclass2.isCallable(), true); QVERIFY(qclass2.property("prototype").isObject()); // prototype should be QMetaObject.prototype QCOMPARE(qclass.prototype().isObject(), true); QCOMPARE(qclass2.prototype().isObject(), true); - QScriptValue instance = qclass.construct(); + QScriptValue instance = qclass.callAsConstructor(); QCOMPARE(instance.isQObject(), true); QCOMPARE(instance.toQObject()->metaObject(), qclass.toQMetaObject()); QEXPECT_FAIL("", "FIXME: newQMetaObject not implemented properly yet", Abort); QVERIFY(instance.instanceOf(qclass)); QVERIFY(instanceofJS(instance, qclass).strictlyEquals(true)); - QScriptValue instance2 = qclass2.construct(); + QScriptValue instance2 = qclass2.callAsConstructor(); QCOMPARE(instance2.isQObject(), true); QCOMPARE(instance2.toQObject()->metaObject(), qclass2.toQMetaObject()); QVERIFY(instance2.instanceOf(qclass2)); @@ -1225,7 +1225,7 @@ void tst_QJSEngine::newQMetaObject() QScriptValueList args; args << instance; - QScriptValue instance3 = qclass.construct(args); + QScriptValue instance3 = qclass.callAsConstructor(args); QCOMPARE(instance3.isQObject(), true); QCOMPARE(instance3.toQObject()->parent(), instance.toQObject()); QVERIFY(instance3.instanceOf(qclass)); @@ -1272,7 +1272,7 @@ void tst_QJSEngine::newQMetaObject() QVERIFY(instanceofJS(ret, qclass).strictlyEquals(false)); } { - QScriptValue ret = qclass3.construct(); + QScriptValue ret = qclass3.callAsConstructor(); QVERIFY(ret.isObject()); QVERIFY(ret.property("isCalledAsConstructor").isBool()); QVERIFY(ret.property("isCalledAsConstructor").toBool()); @@ -1283,14 +1283,14 @@ void tst_QJSEngine::newQMetaObject() } // subclassing - qclass2.setProperty("prototype", qclass.construct()); - QVERIFY(qclass2.construct().instanceOf(qclass)); - QVERIFY(instanceofJS(qclass2.construct(), qclass).strictlyEquals(true)); + qclass2.setProperty("prototype", qclass.callAsConstructor()); + QVERIFY(qclass2.callAsConstructor().instanceOf(qclass)); + QVERIFY(instanceofJS(qclass2.callAsConstructor(), qclass).strictlyEquals(true)); // with meta-constructor QScriptValue qclass4 = eng.newQMetaObject(&QObject::staticMetaObject); { - QScriptValue inst = qclass4.construct(); + QScriptValue inst = qclass4.callAsConstructor(); QVERIFY(inst.isQObject()); QVERIFY(inst.toQObject() != 0); QCOMPARE(inst.toQObject()->parent(), (QObject*)0); @@ -1300,7 +1300,7 @@ void tst_QJSEngine::newQMetaObject() QVERIFY(instanceofJS(inst, qclass3).strictlyEquals(false)); } { - QScriptValue inst = qclass4.construct(QScriptValueList() << eng.newQObject(this)); + QScriptValue inst = qclass4.callAsConstructor(QScriptValueList() << eng.newQObject(this)); QVERIFY(inst.isQObject()); QVERIFY(inst.toQObject() != 0); QCOMPARE(inst.toQObject()->parent(), (QObject*)this); @@ -1322,7 +1322,7 @@ void tst_QJSEngine::newActivationObject() QCOMPARE(act.isValid(), true); QEXPECT_FAIL("", "", Continue); QCOMPARE(act.isObject(), true); - QVERIFY(!act.isFunction()); + QVERIFY(!act.isCallable()); QScriptValue v(&eng, 123); act.setProperty("prop", v); QEXPECT_FAIL("", "", Continue); @@ -1357,7 +1357,7 @@ void tst_QJSEngine::getSetGlobalObject() glob = eng.globalObject(); QCOMPARE(glob.isValid(), true); QCOMPARE(glob.isObject(), true); - QVERIFY(!glob.isFunction()); + QVERIFY(!glob.isCallable()); QVERIFY(eng.currentContext()->thisObject().strictlyEquals(glob)); QVERIFY(eng.currentContext()->activationObject().strictlyEquals(glob)); QEXPECT_FAIL("", "FIXME: Do we really want to enforce this? ECMA standard says that it is implementation dependent, skipping for now", Continue); @@ -1401,7 +1401,7 @@ void tst_QJSEngine::getSetGlobalObject() { QScriptValue ret = obj.property("foo"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } QVERIFY(!obj.property("bar").isValid()); @@ -1409,7 +1409,7 @@ void tst_QJSEngine::getSetGlobalObject() { QScriptValue ret = obj.property("bar"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 456); + QCOMPARE(ret.toInt(), 456); } QVERIFY(!obj.property("baz").isValid()); @@ -1417,7 +1417,7 @@ void tst_QJSEngine::getSetGlobalObject() { QScriptValue ret = obj.property("baz"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 789); + QCOMPARE(ret.toInt(), 789); } { @@ -1437,8 +1437,8 @@ void tst_QJSEngine::getSetGlobalObject() //the custom global object have an interceptor QVERIFY(eng.evaluate("this.__defineGetter__('oof', function() { return this.bar; })").isUndefined()); QVERIFY(eng.evaluate("this.__defineSetter__('oof', function(v) { this.bar = v; })").isUndefined()); - QVERIFY(eng.evaluate("this.__lookupGetter__('oof')").isFunction()); - QVERIFY(eng.evaluate("this.__lookupSetter__('oof')").isFunction()); + QVERIFY(eng.evaluate("this.__lookupGetter__('oof')").isCallable()); + QVERIFY(eng.evaluate("this.__lookupSetter__('oof')").isCallable()); eng.evaluate("oof = 123"); QVERIFY(eng.evaluate("oof").equals(obj.property("bar"))); @@ -1478,65 +1478,65 @@ void tst_QJSEngine::globalObjectProperties() QVERIFY(global.property("undefined").isUndefined()); QCOMPARE(global.propertyFlags("undefined"), QJSValue::SkipInEnumeration | QJSValue::Undeletable); - QVERIFY(global.property("eval").isFunction()); + QVERIFY(global.property("eval").isCallable()); QCOMPARE(global.propertyFlags("eval"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("parseInt").isFunction()); + QVERIFY(global.property("parseInt").isCallable()); QCOMPARE(global.propertyFlags("parseInt"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("parseFloat").isFunction()); + QVERIFY(global.property("parseFloat").isCallable()); QCOMPARE(global.propertyFlags("parseFloat"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("isNaN").isFunction()); + QVERIFY(global.property("isNaN").isCallable()); QCOMPARE(global.propertyFlags("isNaN"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("isFinite").isFunction()); + QVERIFY(global.property("isFinite").isCallable()); QCOMPARE(global.propertyFlags("isFinite"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("decodeURI").isFunction()); + QVERIFY(global.property("decodeURI").isCallable()); QCOMPARE(global.propertyFlags("decodeURI"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("decodeURIComponent").isFunction()); + QVERIFY(global.property("decodeURIComponent").isCallable()); QCOMPARE(global.propertyFlags("decodeURIComponent"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("encodeURI").isFunction()); + QVERIFY(global.property("encodeURI").isCallable()); QCOMPARE(global.propertyFlags("encodeURI"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("encodeURIComponent").isFunction()); + QVERIFY(global.property("encodeURIComponent").isCallable()); QCOMPARE(global.propertyFlags("encodeURIComponent"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Object").isFunction()); + QVERIFY(global.property("Object").isCallable()); QCOMPARE(global.propertyFlags("Object"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Function").isFunction()); + QVERIFY(global.property("Function").isCallable()); QCOMPARE(global.propertyFlags("Function"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Array").isFunction()); + QVERIFY(global.property("Array").isCallable()); QCOMPARE(global.propertyFlags("Array"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("String").isFunction()); + QVERIFY(global.property("String").isCallable()); QCOMPARE(global.propertyFlags("String"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Boolean").isFunction()); + QVERIFY(global.property("Boolean").isCallable()); QCOMPARE(global.propertyFlags("Boolean"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Number").isFunction()); + QVERIFY(global.property("Number").isCallable()); QCOMPARE(global.propertyFlags("Number"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Date").isFunction()); + QVERIFY(global.property("Date").isCallable()); QCOMPARE(global.propertyFlags("Date"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("RegExp").isFunction()); + QVERIFY(global.property("RegExp").isCallable()); QCOMPARE(global.propertyFlags("RegExp"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("Error").isFunction()); + QVERIFY(global.property("Error").isCallable()); QCOMPARE(global.propertyFlags("Error"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("EvalError").isFunction()); + QVERIFY(global.property("EvalError").isCallable()); QCOMPARE(global.propertyFlags("EvalError"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("RangeError").isFunction()); + QVERIFY(global.property("RangeError").isCallable()); QCOMPARE(global.propertyFlags("RangeError"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("ReferenceError").isFunction()); + QVERIFY(global.property("ReferenceError").isCallable()); QCOMPARE(global.propertyFlags("ReferenceError"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("SyntaxError").isFunction()); + QVERIFY(global.property("SyntaxError").isCallable()); QCOMPARE(global.propertyFlags("SyntaxError"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("TypeError").isFunction()); + QVERIFY(global.property("TypeError").isCallable()); QCOMPARE(global.propertyFlags("TypeError"), QJSValue::SkipInEnumeration); - QVERIFY(global.property("URIError").isFunction()); + QVERIFY(global.property("URIError").isCallable()); QCOMPARE(global.propertyFlags("URIError"), QJSValue::SkipInEnumeration); QVERIFY(global.property("Math").isObject()); - QVERIFY(!global.property("Math").isFunction()); + QVERIFY(!global.property("Math").isCallable()); QCOMPARE(global.propertyFlags("Math"), QJSValue::SkipInEnumeration); } @@ -1684,12 +1684,12 @@ void tst_QJSEngine::customGlobalObjectWithPrototype() } { QScriptValue ret = engine.evaluate("print"); - QVERIFY(ret.isFunction()); + QVERIFY(ret.isCallable()); QVERIFY(ret.strictlyEquals(wrap.property("print"))); } { QScriptValue ret = engine.evaluate("this.print"); - QVERIFY(ret.isFunction()); + QVERIFY(ret.isCallable()); QVERIFY(ret.strictlyEquals(wrap.property("print"))); } { @@ -1710,7 +1710,7 @@ void tst_QJSEngine::customGlobalObjectWithPrototype() global.setPrototype(anotherProto); { QScriptValue ret = engine.evaluate("print"); - QVERIFY(ret.isFunction()); + QVERIFY(ret.isCallable()); QVERIFY(ret.strictlyEquals(wrap.property("print"))); } { @@ -1746,7 +1746,7 @@ void tst_QJSEngine::customGlobalObjectWithPrototype() } { QScriptValue ret = engine.evaluate("print"); - QVERIFY(ret.isFunction()); + QVERIFY(ret.isCallable()); QVERIFY(ret.strictlyEquals(global.property("print"))); } QVERIFY(!anotherProto.property("print").isValid()); @@ -2215,7 +2215,7 @@ void tst_QJSEngine::nestedEvaluate() } // From QScriptValue::call() { - QScriptValue result = fun.call(eng.evaluate("p = { id:'foo' }") , QScriptValueList() ); + QScriptValue result = fun.callWithInstance(eng.evaluate("p = { id:'foo' }") , QScriptValueList() ); QCOMPARE(result.property("local_bar").toString(), QString("local")); QCOMPARE(result.property("thisObjectIdBefore").toString(), QString("foo")); QCOMPARE(result.property("thisObjectIdAfter").toString(), QString("foo")); @@ -2352,8 +2352,8 @@ static QJSValue fooToScriptValue(QJSEngine *eng, const Foo &foo) static void fooFromScriptValue(const QJSValue &value, Foo &foo) { - foo.x = value.property("x").toInt32(); - foo.y = value.property("y").toInt32(); + foo.x = value.property("x").toInt(); + foo.y = value.property("y").toInt(); } static QJSValue fooToScriptValueV2(QJSEngine *eng, const Foo &foo) @@ -2363,7 +2363,7 @@ static QJSValue fooToScriptValueV2(QJSEngine *eng, const Foo &foo) static void fooFromScriptValueV2(const QJSValue &value, Foo &foo) { - foo.x = value.toInt32(); + foo.x = value.toInt(); } Q_DECLARE_METATYPE(QLinkedList<QString>) @@ -2498,7 +2498,7 @@ void tst_QJSEngine::valueConversion_sequence() lst << QLatin1String("foo") << QLatin1String("bar"); QScriptValue lstVal = eng.toScriptValue(lst); QCOMPARE(lstVal.isArray(), true); - QCOMPARE(lstVal.property("length").toInt32(), 2); + QCOMPARE(lstVal.property("length").toInt(), 2); QCOMPARE(lstVal.property("0").isString(), true); QCOMPARE(lstVal.property("0").toString(), QLatin1String("foo")); QCOMPARE(lstVal.property("1").isString(), true); @@ -2517,14 +2517,14 @@ void tst_QJSEngine::valueConversion_sequence() QStack<int> second; second << 99999;lst << second; QScriptValue lstVal = eng.toScriptValue(lst); QCOMPARE(lstVal.isArray(), true); - QCOMPARE(lstVal.property("length").toInt32(), 2); + QCOMPARE(lstVal.property("length").toInt(), 2); QCOMPARE(lstVal.property("0").isArray(), true); - QCOMPARE(lstVal.property("0").property("length").toInt32(), 2); - QCOMPARE(lstVal.property("0").property("0").toInt32(), first.at(0)); - QCOMPARE(lstVal.property("0").property("1").toInt32(), first.at(1)); + QCOMPARE(lstVal.property("0").property("length").toInt(), 2); + QCOMPARE(lstVal.property("0").property("0").toInt(), first.at(0)); + QCOMPARE(lstVal.property("0").property("1").toInt(), first.at(1)); QCOMPARE(lstVal.property("1").isArray(), true); - QCOMPARE(lstVal.property("1").property("length").toInt32(), 1); - QCOMPARE(lstVal.property("1").property("0").toInt32(), second.at(0)); + QCOMPARE(lstVal.property("1").property("length").toInt(), 1); + QCOMPARE(lstVal.property("1").property("0").toInt(), second.at(0)); QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("0")), first); QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("1")), second); QCOMPARE(qscriptvalue_cast<QLinkedList<QStack<int> > >(lstVal), lst); @@ -2552,10 +2552,10 @@ void tst_QJSEngine::valueConversion_sequence() lst << 1 << 2 << 3; QScriptValue val = eng.toScriptValue(lst); QVERIFY(val.isArray()); - QCOMPARE(val.property("length").toInt32(), lst.size()); - QCOMPARE(val.property(0).toInt32(), lst.at(0)); - QCOMPARE(val.property(1).toInt32(), lst.at(1)); - QCOMPARE(val.property(2).toInt32(), lst.at(2)); + QCOMPARE(val.property("length").toInt(), lst.size()); + QCOMPARE(val.property(0).toInt(), lst.at(0)); + QCOMPARE(val.property(1).toInt(), lst.at(1)); + QCOMPARE(val.property(2).toInt(), lst.at(2)); QCOMPARE(qscriptvalue_cast<QList<int> >(val), lst); } @@ -2564,7 +2564,7 @@ void tst_QJSEngine::valueConversion_sequence() lst << this; QScriptValue val = eng.toScriptValue(lst); QVERIFY(val.isArray()); - QCOMPARE(val.property("length").toInt32(), lst.size()); + QCOMPARE(val.property("length").toInt(), lst.size()); QCOMPARE(val.property(0).toQObject(), (QObject *)this); QCOMPARE(qscriptvalue_cast<QObjectList>(val), lst); @@ -2689,37 +2689,37 @@ void tst_QJSEngine::valueConversion_basic2() { QJSValue val = eng.toScriptValue(uint(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(qulonglong(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(float(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(short(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(ushort(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(char(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } { QJSValue val = eng.toScriptValue(uchar(123)); QVERIFY(val.isNumber()); - QCOMPARE(val.toInt32(), 123); + QCOMPARE(val.toInt(), 123); } } @@ -2896,7 +2896,7 @@ static QScriptValue recurse(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue recurse2(QScriptContext *ctx, QScriptEngine *eng) { Q_UNUSED(eng); - return ctx->callee().construct(); + return ctx->callee().callAsConstructor(); } void tst_QJSEngine::infiniteRecursion() @@ -2920,7 +2920,7 @@ void tst_QJSEngine::infiniteRecursion() } { QScriptValue fun = eng.newFunction(recurse2); - QScriptValue ret = fun.construct(); + QScriptValue ret = fun.callAsConstructor(); QCOMPARE(ret.isError(), true); QCOMPARE(ret.toString(), stackOverflowError); } @@ -2977,7 +2977,7 @@ void tst_QJSEngine::castWithPrototypeChain() Zoo zoo; QScriptValue scriptZoo = eng.newQObject(&zoo); QScriptValue toBaz = scriptZoo.property("toBaz"); - QVERIFY(toBaz.isFunction()); + QVERIFY(toBaz.isCallable()); // no relation between Bar and Baz's proto --> casting fails { @@ -2986,7 +2986,7 @@ void tst_QJSEngine::castWithPrototypeChain() } { - QScriptValue ret = toBaz.call(scriptZoo, QScriptValueList() << baz2Value); + QScriptValue ret = toBaz.callWithInstance(scriptZoo, QScriptValueList() << baz2Value); QVERIFY(ret.isError()); QCOMPARE(ret.toString(), QLatin1String("TypeError: incompatible type of argument(s) in call to toBaz(); candidates were\n toBaz(Bar*)")); } @@ -3008,7 +3008,7 @@ void tst_QJSEngine::castWithPrototypeChain() } { - QScriptValue ret = toBaz.call(scriptZoo, QScriptValueList() << baz2Value); + QScriptValue ret = toBaz.callWithInstance(scriptZoo, QScriptValueList() << baz2Value); QEXPECT_FAIL("", "Cannot convert Baz* to Bar*", Continue); QVERIFY(!ret.isError()); QEXPECT_FAIL("", "Cannot convert Baz* to Bar*", Continue); @@ -3236,7 +3236,7 @@ void tst_QJSEngine::processEventsWhileRunning_function() QCOMPARE(eng.processEventsInterval(), 100); if (x) script.call(); - else script.construct(); + else script.callAsConstructor(); QVERIFY(!eng.hasUncaughtException()); QVERIFY(receiver.received); @@ -3353,13 +3353,13 @@ void tst_QJSEngine::stacktrace() // FIXME? it is not standard. //QCOMPARE(result.property("fileName").toString(), fileName); - //QCOMPARE(result.property("lineNumber").toInt32(), 9); + //QCOMPARE(result.property("lineNumber").toInt(), 9); QJSValue stack = result.property("stack"); // FIXME? it is not standard. // QVERIFY(stack.isArray()); - //QCOMPARE(stack.property("length").toInt32(), 7); + //QCOMPARE(stack.property("length").toInt(), 7); QJSValueIterator it(stack); int counter = 5; @@ -3373,7 +3373,7 @@ void tst_QJSEngine::stacktrace() QJSValue callee = frame.property("arguments").property("callee"); QVERIFY(callee.strictlyEquals(eng.globalObject().property("foo"))); QCOMPARE(obj.property("functionName").toString(), QString("foo")); - int line = obj.property("lineNumber").toInt32(); + int line = obj.property("lineNumber").toInt(); if (counter == 5) QCOMPARE(line, 9); else @@ -3467,7 +3467,7 @@ void tst_QJSEngine::automaticSemicolonInsertion() { QJSValue ret = eng.evaluate("{ 1\n2 } 3"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } { QJSValue ret = eng.evaluate("for (a; b\n)"); @@ -3482,7 +3482,7 @@ void tst_QJSEngine::automaticSemicolonInsertion() eng.evaluate("c = 2; b = 1"); QJSValue ret = eng.evaluate("a = b\n++c"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } { QJSValue ret = eng.evaluate("if (a > b)\nelse c = d"); @@ -3494,7 +3494,7 @@ void tst_QJSEngine::automaticSemicolonInsertion() eng.evaluate("b = 1; d = 2; e = 3"); QJSValue ret = eng.evaluate("a = b + c\n(d + e).foo()"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 6); + QCOMPARE(ret.toInt(), 6); } { QJSValue ret = eng.evaluate("throw\n1"); @@ -3504,7 +3504,7 @@ void tst_QJSEngine::automaticSemicolonInsertion() { QJSValue ret = eng.evaluate("a = Number(1)\n++a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 2); + QCOMPARE(ret.toInt(), 2); } // "a semicolon is never inserted automatically if the semicolon @@ -3513,31 +3513,31 @@ void tst_QJSEngine::automaticSemicolonInsertion() eng.evaluate("a = 123"); QJSValue ret = eng.evaluate("if (0)\n ++a; a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { eng.evaluate("a = 123"); QJSValue ret = eng.evaluate("if (0)\n --a; a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { eng.evaluate("a = 123"); QJSValue ret = eng.evaluate("if ((0))\n ++a; a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { eng.evaluate("a = 123"); QJSValue ret = eng.evaluate("if ((0))\n --a; a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { eng.evaluate("a = 123"); QJSValue ret = eng.evaluate("if (0\n)\n ++a; a"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { eng.evaluate("a = 123"); @@ -3552,83 +3552,83 @@ void tst_QJSEngine::automaticSemicolonInsertion() { QJSValue ret = eng.evaluate("n = 0; for (i = 0; i < 10; ++i)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } { QJSValue ret = eng.evaluate("n = 30; for (i = 0; i < 10; ++i)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 20); + QCOMPARE(ret.toInt(), 20); } { QJSValue ret = eng.evaluate("n = 0; for (var i = 0; i < 10; ++i)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } { QJSValue ret = eng.evaluate("n = 30; for (var i = 0; i < 10; ++i)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 20); + QCOMPARE(ret.toInt(), 20); } { QJSValue ret = eng.evaluate("n = 0; i = 0; while (i++ < 10)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } { QJSValue ret = eng.evaluate("n = 30; i = 0; while (i++ < 10)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 20); + QCOMPARE(ret.toInt(), 20); } { QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (i in o)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } { QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (i in o)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 6); + QCOMPARE(ret.toInt(), 6); } { QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (var i in o)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } { QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (var i in o)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 6); + QCOMPARE(ret.toInt(), 6); } { QJSValue ret = eng.evaluate("o = { n: 3 }; n = 5; with (o)\n ++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 5); + QCOMPARE(ret.toInt(), 5); } { QJSValue ret = eng.evaluate("o = { n: 3 }; n = 10; with (o)\n --n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } { QJSValue ret = eng.evaluate("n = 5; i = 0; do\n ++n; while (++i < 10); n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 15); + QCOMPARE(ret.toInt(), 15); } { QJSValue ret = eng.evaluate("n = 20; i = 0; do\n --n; while (++i < 10); n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } { QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n++n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 2); + QCOMPARE(ret.toInt(), 2); } { QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n--n; n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 0); + QCOMPARE(ret.toInt(), 0); } { @@ -3753,7 +3753,7 @@ void tst_QJSEngine::abortEvaluation() case EventReceiver3::Number: QVERIFY(!eng.hasUncaughtException()); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 1234); + QCOMPARE(ret.toInt(), 1234); break; case EventReceiver3::String: QVERIFY(!eng.hasUncaughtException()); @@ -3796,7 +3796,7 @@ void tst_QJSEngine::abortEvaluation_tryCatch() case EventReceiver3::Number: QVERIFY(!eng.hasUncaughtException()); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 1234); + QCOMPARE(ret.toInt(), 1234); break; case EventReceiver3::String: QVERIFY(!eng.hasUncaughtException()); @@ -3953,7 +3953,7 @@ void tst_QJSEngine::printFunctionWithCustomHandler() // This behavior is not documented. QJSEngine eng; QtMsgHandler oldHandler = qInstallMsgHandler(myMsgHandler); - QVERIFY(eng.globalObject().property("print").isFunction()); + QVERIFY(eng.globalObject().property("print").isCallable()); theMessageType = QtSystemMsg; QVERIFY(theMessage.isEmpty()); @@ -4002,7 +4002,7 @@ void tst_QJSEngine::errorConstructors() QVERIFY(ret.toString().startsWith(name)); //QTBUG-6138: JSC doesn't assign lineNumber when errors are not thrown QEXPECT_FAIL("", "we have no more lineNumber property ", Continue); - QCOMPARE(ret.property("lineNumber").toInt32(), i+2); + QCOMPARE(ret.property("lineNumber").toInt(), i+2); } } } @@ -4021,7 +4021,7 @@ void tst_QJSEngine::argumentsProperty_globalContext() { QJSValue ret = eng.evaluate("arguments"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); + QCOMPARE(ret.toInt(), 10); } QVERIFY(eng.evaluate("delete arguments").toBool()); QVERIFY(!eng.globalObject().property("arguments").isValid()); @@ -4034,7 +4034,7 @@ void tst_QJSEngine::argumentsProperty_JS() eng.evaluate("o = { arguments: 123 }"); QJSValue ret = eng.evaluate("with (o) { arguments; }"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } { QJSEngine eng; @@ -4043,7 +4043,7 @@ void tst_QJSEngine::argumentsProperty_JS() // appears like a local variable, and it can be replaced. QJSValue ret = eng.evaluate("(function() { arguments = 456; return arguments; })()"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 456); + QCOMPARE(ret.toInt(), 456); QVERIFY(!eng.globalObject().property("arguments").isValid()); } } @@ -4066,7 +4066,7 @@ void tst_QJSEngine::argumentsProperty_evaluateInNativeFunction() eng.globalObject().setProperty("fun", eng.newFunction(argumentsProperty_fun)); QScriptValue result = eng.evaluate("fun(18)"); QVERIFY(result.isNumber()); - QCOMPARE(result.toInt32(), 200+18); + QCOMPARE(result.toInt(), 200+18); } #endif @@ -4135,7 +4135,7 @@ void tst_QJSEngine::jsNumberClass() QCOMPARE(ret.toNumber(), qreal(456)); } - QVERIFY(proto.property("toString").isFunction()); + QVERIFY(proto.property("toString").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).toString()"); QVERIFY(ret.isString()); @@ -4151,31 +4151,31 @@ void tst_QJSEngine::jsNumberClass() QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("7b")); } - QVERIFY(proto.property("toLocaleString").isFunction()); + QVERIFY(proto.property("toLocaleString").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).toLocaleString()"); QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("123")); } - QVERIFY(proto.property("valueOf").isFunction()); + QVERIFY(proto.property("valueOf").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).valueOf()"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toNumber(), qreal(123)); } - QVERIFY(proto.property("toExponential").isFunction()); + QVERIFY(proto.property("toExponential").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).toExponential()"); QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("1.23e+2")); } - QVERIFY(proto.property("toFixed").isFunction()); + QVERIFY(proto.property("toFixed").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).toFixed()"); QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("123")); } - QVERIFY(proto.property("toPrecision").isFunction()); + QVERIFY(proto.property("toPrecision").isCallable()); { QJSValue ret = eng.evaluate("new Number(123).toPrecision()"); QVERIFY(ret.isString()); @@ -4339,19 +4339,19 @@ void tst_QJSEngine::jsFunctionDeclarationAsStatement() "}"); QVERIFY(!eng.globalObject().property("bar").isValid()); QVERIFY(!eng.globalObject().property("baz").isValid()); - QVERIFY(eng.evaluate("foo").isFunction()); + QVERIFY(eng.evaluate("foo").isCallable()); { QJSValue ret = eng.evaluate("foo('bar')"); - QVERIFY(ret.isFunction()); - QJSValue ret2 = ret.call(QJSValue()); + QVERIFY(ret.isCallable()); + QJSValue ret2 = ret.call(); QCOMPARE(ret2.toString(), QString::fromLatin1("bar")); QVERIFY(!eng.globalObject().property("bar").isValid()); QVERIFY(!eng.globalObject().property("baz").isValid()); } { QJSValue ret = eng.evaluate("foo('baz')"); - QVERIFY(ret.isFunction()); - QJSValue ret2 = ret.call(QJSValue()); + QVERIFY(ret.isCallable()); + QJSValue ret2 = ret.call(); QCOMPARE(ret2.toString(), QString::fromLatin1("baz")); QVERIFY(!eng.globalObject().property("bar").isValid()); QVERIFY(!eng.globalObject().property("baz").isValid()); @@ -4367,7 +4367,7 @@ void tst_QJSEngine::stringObjects() // in C++ { QJSValue obj = QJSValue(&eng, str).toObject(); - QCOMPARE(obj.property("length").toInt32(), str.length()); + QCOMPARE(obj.property("length").toInt(), str.length()); QCOMPARE(obj.propertyFlags("length"), QJSValue::PropertyFlags(QJSValue::Undeletable | QJSValue::SkipInEnumeration | QJSValue::ReadOnly)); for (int i = 0; i < str.length(); ++i) { QString pname = QString::number(i); @@ -4406,11 +4406,11 @@ void tst_QJSEngine::stringObjects() QJSValue ret3 = eng.evaluate("s[-1] = 123; s[-1]"); QVERIFY(ret3.isNumber()); - QCOMPARE(ret3.toInt32(), 123); + QCOMPARE(ret3.toInt(), 123); QJSValue ret4 = eng.evaluate("s[s.length] = 456; s[s.length]"); QVERIFY(ret4.isNumber()); - QCOMPARE(ret4.toInt32(), 456); + QCOMPARE(ret4.toInt(), 456); QJSValue ret5 = eng.evaluate("delete s[0]"); QVERIFY(ret5.isBool()); @@ -4434,15 +4434,15 @@ void tst_QJSEngine::jsStringPrototypeReplaceBugs() { QJSValue ret = eng.evaluate("replace_args = []; \"a a a\".replace(/(a)/g, function() { replace_args.push(arguments); }); replace_args"); QVERIFY(ret.isArray()); - int len = ret.property("length").toInt32(); + int len = ret.property("length").toInt(); QCOMPARE(len, 3); for (int i = 0; i < len; ++i) { QJSValue args = ret.property(i); - QCOMPARE(args.property("length").toInt32(), 4); + QCOMPARE(args.property("length").toInt(), 4); QCOMPARE(args.property(0).toString(), QString::fromLatin1("a")); // matched string QCOMPARE(args.property(1).toString(), QString::fromLatin1("a")); // capture QVERIFY(args.property(2).isNumber()); - QCOMPARE(args.property(2).toInt32(), i*2); // index of match + QCOMPARE(args.property(2).toInt(), i*2); // index of match QCOMPARE(args.property(3).toString(), QString::fromLatin1("a a a")); } } @@ -4604,7 +4604,7 @@ void tst_QJSEngine::jsContinueInSwitch() " }\n" "}; j"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } // for - switch - case - default - continue { @@ -4617,7 +4617,7 @@ void tst_QJSEngine::jsContinueInSwitch() " }\n" "}; j"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } // switch - for - continue { @@ -4628,7 +4628,7 @@ void tst_QJSEngine::jsContinueInSwitch() " }\n" "}; i\n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 100000); + QCOMPARE(ret.toInt(), 100000); } // switch - switch - continue { @@ -4646,7 +4646,7 @@ void tst_QJSEngine::jsContinueInSwitch() " }\n" "}; j"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 1); + QCOMPARE(ret.toInt(), 1); } // switch - for - switch - continue { @@ -4660,7 +4660,7 @@ void tst_QJSEngine::jsContinueInSwitch() " }\n" "}; i\n"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 100000); + QCOMPARE(ret.toInt(), 100000); } } @@ -4673,7 +4673,7 @@ void tst_QJSEngine::jsShadowReadOnlyPrototypeProperty() // just seems weird -- and non-compliant. Adopt the JSC behavior instead. QJSEngine eng; QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber()); - QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt32(), 123); + QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt(), 123); QVERIFY(eng.evaluate("o.hasOwnProperty('length')").toBool()); } @@ -4948,7 +4948,7 @@ void tst_QJSEngine::jsThrowInsideWithStatement() " }" "}"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); QVERIFY(eng.hasUncaughtException()); } { @@ -5045,8 +5045,8 @@ void tst_QJSEngine::reentrancy_typeConversion() QScriptValue fooVal = qScriptValueFromValue(&eng1, foo); QVERIFY(fooVal.isObject()); QVERIFY(!fooVal.isVariant()); - QCOMPARE(fooVal.property("x").toInt32(), 12); - QCOMPARE(fooVal.property("y").toInt32(), 34); + QCOMPARE(fooVal.property("x").toInt(), 12); + QCOMPARE(fooVal.property("y").toInt(), 34); fooVal.setProperty("x", 56); fooVal.setProperty("y", 78); @@ -5084,7 +5084,7 @@ void tst_QJSEngine::reentrancy_globalObjectProperties() QVERIFY(!eng2.globalObject().property("a").isValid()); eng2.evaluate("a = 20"); QVERIFY(eng2.globalObject().property("a").isNumber()); - QCOMPARE(eng1.globalObject().property("a").toInt32(), 10); + QCOMPARE(eng1.globalObject().property("a").toInt(), 10); } void tst_QJSEngine::reentrancy_Array() @@ -5182,22 +5182,22 @@ void tst_QJSEngine::jsIncDecNonObjectProperty() { QJSValue ret = eng.evaluate("var a = 'ciao'; a.length++"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 4); + QCOMPARE(ret.toInt(), 4); } { QJSValue ret = eng.evaluate("var a = 'ciao'; a.length--"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 4); + QCOMPARE(ret.toInt(), 4); } { QJSValue ret = eng.evaluate("var a = 'ciao'; ++a.length"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 5); + QCOMPARE(ret.toInt(), 5); } { QJSValue ret = eng.evaluate("var a = 'ciao'; --a.length"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 3); + QCOMPARE(ret.toInt(), 3); } } @@ -5215,13 +5215,13 @@ void tst_QJSEngine::installTranslatorFunctions() QVERIFY(!global.property("String").property("prototype").property("arg").isValid()); eng.installTranslatorFunctions(); - QVERIFY(global.property("qsTranslate").isFunction()); - QVERIFY(global.property("QT_TRANSLATE_NOOP").isFunction()); - QVERIFY(global.property("qsTr").isFunction()); - QVERIFY(global.property("QT_TR_NOOP").isFunction()); - QVERIFY(global.property("qsTrId").isFunction()); - QVERIFY(global.property("QT_TRID_NOOP").isFunction()); - QVERIFY(global.property("String").property("prototype").property("arg").isFunction()); + QVERIFY(global.property("qsTranslate").isCallable()); + QVERIFY(global.property("QT_TRANSLATE_NOOP").isCallable()); + QVERIFY(global.property("qsTr").isCallable()); + QVERIFY(global.property("QT_TR_NOOP").isCallable()); + QVERIFY(global.property("qsTrId").isCallable()); + QVERIFY(global.property("QT_TRID_NOOP").isCallable()); + QVERIFY(global.property("String").property("prototype").property("arg").isCallable()); { QScriptValue ret = eng.evaluate("qsTr('foo')"); @@ -5418,7 +5418,7 @@ void tst_QJSEngine::translateScript_crossScript() static QScriptValue callQsTr(QScriptContext *ctx, QScriptEngine *eng) { - return eng->globalObject().property("qsTr").call(ctx->thisObject(), ctx->argumentsObject()); + return eng->globalObject().property("qsTr").callWithInstance(ctx->thisObject(), ctx->argumentsObject()); } void tst_QJSEngine::translateScript_callQsTrFromNative() @@ -5459,7 +5459,7 @@ void tst_QJSEngine::translateScript_callQsTrFromCpp() // There is no context, but it shouldn't crash QCOMPARE(engine.globalObject().property("qsTr").call( - QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One")); + QScriptValueList() << "One").toString(), QString::fromLatin1("One")); } void tst_QJSEngine::translateWithInvalidArgs_data() @@ -5689,7 +5689,7 @@ void tst_QJSEngine::functionScopes() { // top-level functions have only the global object in their scope QScriptValue fun = eng.evaluate("(function() {})"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QEXPECT_FAIL("", "QScriptValue::scope() is internal, not implemented", Abort); QVERIFY(fun.scope().isObject()); QVERIFY(fun.scope().strictlyEquals(eng.globalObject())); @@ -5697,31 +5697,31 @@ void tst_QJSEngine::functionScopes() } { QScriptValue fun = eng.globalObject().property("Object"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); // native built-in functions don't have scope QVERIFY(!fun.scope().isValid()); } { // closure QScriptValue fun = eng.evaluate("(function(arg) { var foo = arg; return function() { return foo; }; })(123)"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); { QScriptValue ret = fun.call(); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } QScriptValue scope = fun.scope(); QVERIFY(scope.isObject()); { QScriptValue ret = scope.property("foo"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable); } { QScriptValue ret = scope.property("arg"); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); QCOMPARE(scope.propertyFlags("arg"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); } @@ -5729,7 +5729,7 @@ void tst_QJSEngine::functionScopes() { QScriptValue ret = fun.call(); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 456); + QCOMPARE(ret.toInt(), 456); } scope = scope.scope(); @@ -5751,7 +5751,7 @@ static QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *) static QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng) { QScriptValue act = ctx->activationObject(); - act.setProperty("count", ctx->argument(0).toInt32()); + act.setProperty("count", ctx->argument(0).toInt()); QScriptValue result = eng->newFunction(counter_inner); result.setScope(act); return result; @@ -5760,7 +5760,7 @@ static QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng) static QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng) { QScriptValue act = ctx->activationObject(); - act.setProperty("count", ctx->argument(0).toInt32()); + act.setProperty("count", ctx->argument(0).toInt()); return eng->evaluate("(function() { return count++; })"); } @@ -5769,23 +5769,23 @@ void tst_QJSEngine::nativeFunctionScopes() QScriptEngine eng; { QScriptValue fun = eng.newFunction(counter); - QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123); - QVERIFY(cnt.isFunction()); + QScriptValue cnt = fun.call(QScriptValueList() << 123); + QVERIFY(cnt.isCallable()); { QScriptValue ret = cnt.call(); QVERIFY(ret.isNumber()); QEXPECT_FAIL("", "QScriptValue::setScope not implemented", Continue); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } } { QScriptValue fun = eng.newFunction(counter_hybrid); - QScriptValue cnt = fun.call(QScriptValue(), QScriptValueList() << 123); - QVERIFY(cnt.isFunction()); + QScriptValue cnt = fun.call(QScriptValueList() << 123); + QVERIFY(cnt.isCallable()); { QScriptValue ret = cnt.call(); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } } @@ -5917,15 +5917,15 @@ void tst_QJSEngine::evaluateProgram_closure() QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })"); QVERIFY(!program.isNull()); QScriptValue createCounter = eng.evaluate(program); - QVERIFY(createCounter.isFunction()); + QVERIFY(createCounter.isCallable()); QScriptValue counter = createCounter.call(); - QVERIFY(counter.isFunction()); + QVERIFY(counter.isCallable()); { QScriptValue ret = counter.call(); QVERIFY(ret.isNumber()); } QScriptValue counter2 = createCounter.call(); - QVERIFY(counter2.isFunction()); + QVERIFY(counter2.isCallable()); QVERIFY(!counter2.equals(counter)); { QScriptValue ret = counter2.call(); @@ -5941,7 +5941,7 @@ void tst_QJSEngine::evaluateProgram_executeLater() { QScriptValue fun = eng.newFunction(createProgram); QScriptProgram program = qscriptvalue_cast<QScriptProgram>( - fun.call(QScriptValue(), QScriptValueList() << "a + 1")); + fun.call(QScriptValueList() << "a + 1")); QVERIFY(!program.isNull()); eng.globalObject().setProperty("a", QScriptValue()); { @@ -5954,7 +5954,7 @@ void tst_QJSEngine::evaluateProgram_executeLater() QScriptValue ret = eng.evaluate(program); QVERIFY(!ret.isError()); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } } } @@ -6039,7 +6039,7 @@ void tst_QJSEngine::promoteThisObjectToQObjectInConstructor() QVERIFY(object.isQObject()); QVERIFY(object.toQObject() != 0); QVERIFY(object.property("objectName").isString()); - QVERIFY(object.property("deleteLater").isFunction()); + QVERIFY(object.property("deleteLater").isCallable()); } #endif @@ -6089,10 +6089,10 @@ void tst_QJSEngine::qRegExpInport() QCOMPARE(rexp.isValid(), true); QCOMPARE(rexp.isRegExp(), true); - QVERIFY(rexp.isFunction()); + QVERIFY(rexp.isCallable()); QJSValue func = eng.evaluate("(function(string, regexp) { return string.match(regexp); })"); - QJSValue result = func.call(QJSValue(), QJSValueList() << string << rexp); + QJSValue result = func.call(QJSValueList() << string << rexp); rx.indexIn(string); for (int i = 0; i <= rx.captureCount(); i++) { @@ -6139,7 +6139,7 @@ void tst_QJSEngine::dateConversionJSQt() QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0)); QDateTime qtDate = jsDate.toDateTime(); QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); - QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString(); jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000") if (qtUTCDateStr != jsUTCDateStr) QFAIL(qPrintable(jsDate.toString())); @@ -6153,7 +6153,7 @@ void tst_QJSEngine::dateConversionQtJS() QJSEngine eng; for (int i = 0; i < 8000; ++i) { QJSValue jsDate = eng.newDate(qtDate); - QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString(); jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000") QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); if (jsUTCDateStr != qtUTCDateStr) @@ -6168,7 +6168,7 @@ static QScriptValue createAnotherEngine(QScriptContext *, QScriptEngine *) QScriptEngine eng; eng.evaluate("function foo(x, y) { return x + y; }" ); eng.evaluate("hello = 5; world = 6" ); - return eng.evaluate("foo(hello,world)").toInt32(); + return eng.evaluate("foo(hello,world)").toInt(); } @@ -6177,10 +6177,10 @@ void tst_QJSEngine::reentrency() QScriptEngine eng; eng.globalObject().setProperty("foo", eng.newFunction(createAnotherEngine)); eng.evaluate("function bar() { return foo(); } hello = 9; function getHello() { return hello; }"); - QCOMPARE(eng.evaluate("foo() + getHello() + foo()").toInt32(), 5+6 + 9 + 5+6); - QCOMPARE(eng.evaluate("foo").call().toInt32(), 5+6); - QCOMPARE(eng.evaluate("hello").toInt32(), 9); - QCOMPARE(eng.evaluate("foo() + hello").toInt32(), 5+6+9); + QCOMPARE(eng.evaluate("foo() + getHello() + foo()").toInt(), 5+6 + 9 + 5+6); + QCOMPARE(eng.evaluate("foo").call().toInt(), 5+6); + QCOMPARE(eng.evaluate("hello").toInt(), 9); + QCOMPARE(eng.evaluate("foo() + hello").toInt(), 5+6+9); } #endif @@ -6331,7 +6331,7 @@ void tst_QJSEngine::newFixedStaticScopeObject() } QScriptValue fun = eng.evaluate("(function() { return foo; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); eng.popContext(); // Function's scope chain persists after popContext(). QVERIFY(fun.call().equals(scope.property("foo"))); @@ -6423,7 +6423,7 @@ void tst_QJSEngine::newGrowingStaticScopeObject() // Function declarations will create properties on the scope. eng.evaluate("function fun() { return baz; }"); - QVERIFY(scope.property("fun").isFunction()); + QVERIFY(scope.property("fun").isCallable()); QVERIFY(scope.property("fun").call().equals(scope.property("baz"))); // Demonstrate the limitation of a growable static scope: Once a function that @@ -6431,7 +6431,7 @@ void tst_QJSEngine::newGrowingStaticScopeObject() // to the scope later. { QScriptValue fun = eng.evaluate("(function() { return futureProperty; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QVERIFY(fun.call().toString().contains(QString::fromLatin1("ReferenceError"))); scope.setProperty("futureProperty", "added after the function was compiled"); // If scope were dynamic, this would return the new property. @@ -6456,13 +6456,13 @@ void tst_QJSEngine::scriptValueFromQMetaObject() QCOMPARE(meta.toQMetaObject(), &QScriptEngine::staticMetaObject); // Because of missing Q_SCRIPT_DECLARE_QMETAOBJECT() for QScriptEngine. QEXPECT_FAIL("", "FIXME: because construct never returns invalid values", Continue); - QVERIFY(!meta.construct().isValid()); + QVERIFY(!meta.callAsConstructor().isValid()); } { QScriptValue meta = eng.scriptValueFromQMetaObject<QStandardItemModel>(); QVERIFY(meta.isQMetaObject()); QCOMPARE(meta.toQMetaObject(), &QStandardItemModel::staticMetaObject); - QScriptValue obj = meta.construct(QScriptValueList() << eng.newQObject(&eng)); + QScriptValue obj = meta.callAsConstructor(QScriptValueList() << eng.newQObject(&eng)); QVERIFY(obj.isQObject()); QStandardItemModel *model = qobject_cast<QStandardItemModel*>(obj.toQObject()); QVERIFY(model != 0); @@ -6476,17 +6476,17 @@ void tst_QJSEngine::functionPrototypeExtensions() // QJS adds connect and disconnect properties to Function.prototype. QJSEngine eng; QJSValue funProto = eng.globalObject().property("Function").property("prototype"); - QVERIFY(funProto.isFunction()); - QVERIFY(funProto.property("connect").isFunction()); + QVERIFY(funProto.isCallable()); + QVERIFY(funProto.property("connect").isCallable()); QCOMPARE(funProto.propertyFlags("connect"), QJSValue::SkipInEnumeration); - QVERIFY(funProto.property("disconnect").isFunction()); + QVERIFY(funProto.property("disconnect").isCallable()); QCOMPARE(funProto.propertyFlags("disconnect"), QJSValue::SkipInEnumeration); // No properties should appear in for-in statements. QJSValue props = eng.evaluate("props = []; for (var p in Function.prototype) props.push(p); props"); QVERIFY(!eng.hasUncaughtException()); QVERIFY(props.isArray()); - QCOMPARE(props.property("length").toInt32(), 0); + QCOMPARE(props.property("length").toInt(), 0); } class ThreadedTestEngine : public QThread { diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp index 5a9ccc521c..52e47732ae 100644 --- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -123,7 +123,7 @@ void tst_QJSValue::ctor_int() { QJSValue v(int(0x43211234)); QVERIFY(v.isNumber()); - QCOMPARE(v.toInt32(), 0x43211234); + QCOMPARE(v.toInt(), 0x43211234); } { QJSValue v(int(1)); @@ -153,7 +153,7 @@ void tst_QJSValue::ctor_uint() { QJSValue v(uint(0x43211234)); QVERIFY(v.isNumber()); - QCOMPARE(v.toUInt32(), uint(0x43211234)); + QCOMPARE(v.toUInt(), uint(0x43211234)); } { QJSValue v(uint(1)); @@ -818,271 +818,271 @@ void tst_QJSValue::toInteger() QCOMPARE(inv.toInteger(), 0.0); } -void tst_QJSValue::toInt32() +void tst_QJSValue::toInt() { QJSEngine eng; { QJSValue zer0 = QJSValue(&eng, 0.0); - QCOMPARE(zer0.toInt32(), 0); + QCOMPARE(zer0.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(zer0), 0); QJSValue number = QJSValue(&eng, 123.0); - QCOMPARE(number.toInt32(), 123); + QCOMPARE(number.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number), 123); QJSValue number2 = QJSValue(&eng, qSNaN()); - QCOMPARE(number2.toInt32(), 0); + QCOMPARE(number2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number2), 0); QJSValue number3 = QJSValue(&eng, +qInf()); - QCOMPARE(number3.toInt32(), 0); + QCOMPARE(number3.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number3), 0); QJSValue number3_2 = QJSValue(&eng, -qInf()); - QCOMPARE(number3_2.toInt32(), 0); + QCOMPARE(number3_2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0); QJSValue number4 = QJSValue(&eng, 0.5); - QCOMPARE(number4.toInt32(), 0); + QCOMPARE(number4.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number4), 0); QJSValue number5 = QJSValue(&eng, 123.5); - QCOMPARE(number5.toInt32(), 123); + QCOMPARE(number5.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number5), 123); QJSValue number6 = QJSValue(&eng, -456.5); - QCOMPARE(number6.toInt32(), -456); + QCOMPARE(number6.toInt(), -456); QCOMPARE(qjsvalue_cast<qint32>(number6), -456); QJSValue str = QJSValue(&eng, QLatin1String("123.0")); - QCOMPARE(str.toInt32(), 123); + QCOMPARE(str.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(str), 123); QJSValue str2 = QJSValue(&eng, QLatin1String("NaN")); - QCOMPARE(str2.toInt32(), 0); + QCOMPARE(str2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str2), 0); QJSValue str3 = QJSValue(&eng, QLatin1String("Infinity")); - QCOMPARE(str3.toInt32(), 0); + QCOMPARE(str3.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str3), 0); QJSValue str3_2 = QJSValue(&eng, QLatin1String("-Infinity")); - QCOMPARE(str3_2.toInt32(), 0); + QCOMPARE(str3_2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0); QJSValue str4 = QJSValue(&eng, QLatin1String("0.5")); - QCOMPARE(str4.toInt32(), 0); + QCOMPARE(str4.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str4), 0); QJSValue str5 = QJSValue(&eng, QLatin1String("123.5")); - QCOMPARE(str5.toInt32(), 123); + QCOMPARE(str5.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(str5), 123); QJSValue str6 = QJSValue(&eng, QLatin1String("-456.5")); - QCOMPARE(str6.toInt32(), -456); + QCOMPARE(str6.toInt(), -456); QCOMPARE(qjsvalue_cast<qint32>(str6), -456); } // V2 constructors { QJSValue zer0 = QJSValue(0.0); - QCOMPARE(zer0.toInt32(), 0); + QCOMPARE(zer0.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(zer0), 0); QJSValue number = QJSValue(123.0); - QCOMPARE(number.toInt32(), 123); + QCOMPARE(number.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number), 123); QJSValue number2 = QJSValue(qSNaN()); - QCOMPARE(number2.toInt32(), 0); + QCOMPARE(number2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number2), 0); QJSValue number3 = QJSValue(+qInf()); - QCOMPARE(number3.toInt32(), 0); + QCOMPARE(number3.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number3), 0); QJSValue number3_2 = QJSValue(-qInf()); - QCOMPARE(number3_2.toInt32(), 0); + QCOMPARE(number3_2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0); QJSValue number4 = QJSValue(0.5); - QCOMPARE(number4.toInt32(), 0); + QCOMPARE(number4.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number4), 0); QJSValue number5 = QJSValue(123.5); - QCOMPARE(number5.toInt32(), 123); + QCOMPARE(number5.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number5), 123); QJSValue number6 = QJSValue(-456.5); - QCOMPARE(number6.toInt32(), -456); + QCOMPARE(number6.toInt(), -456); QCOMPARE(qjsvalue_cast<qint32>(number6), -456); QJSValue number7 = QJSValue(0x43211234); - QCOMPARE(number7.toInt32(), 0x43211234); + QCOMPARE(number7.toInt(), 0x43211234); QJSValue str = QJSValue("123.0"); - QCOMPARE(str.toInt32(), 123); + QCOMPARE(str.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(str), 123); QJSValue str2 = QJSValue("NaN"); - QCOMPARE(str2.toInt32(), 0); + QCOMPARE(str2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str2), 0); QJSValue str3 = QJSValue("Infinity"); - QCOMPARE(str3.toInt32(), 0); + QCOMPARE(str3.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str3), 0); QJSValue str3_2 = QJSValue("-Infinity"); - QCOMPARE(str3_2.toInt32(), 0); + QCOMPARE(str3_2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0); QJSValue str4 = QJSValue("0.5"); - QCOMPARE(str4.toInt32(), 0); + QCOMPARE(str4.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(str4), 0); QJSValue str5 = QJSValue("123.5"); - QCOMPARE(str5.toInt32(), 123); + QCOMPARE(str5.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(str5), 123); QJSValue str6 = QJSValue("-456.5"); - QCOMPARE(str6.toInt32(), -456); + QCOMPARE(str6.toInt(), -456); QCOMPARE(qjsvalue_cast<qint32>(str6), -456); } QJSValue inv; - QCOMPARE(inv.toInt32(), 0); + QCOMPARE(inv.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(inv), 0); } -void tst_QJSValue::toUInt32() +void tst_QJSValue::toUInt() { QJSEngine eng; { - QJSValue zer0 = QJSValue(&eng, 0.0); - QCOMPARE(zer0.toUInt32(), quint32(0)); + QJSValue zer0 = eng.toScriptValue(0.0); + QCOMPARE(zer0.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0)); - QJSValue number = QJSValue(&eng, 123.0); - QCOMPARE(number.toUInt32(), quint32(123)); + QJSValue number = eng.toScriptValue(123.0); + QCOMPARE(number.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123)); - QJSValue number2 = QJSValue(&eng, qSNaN()); - QCOMPARE(number2.toUInt32(), quint32(0)); + QJSValue number2 = eng.toScriptValue(qSNaN()); + QCOMPARE(number2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0)); - QJSValue number3 = QJSValue(&eng, +qInf()); - QCOMPARE(number3.toUInt32(), quint32(0)); + QJSValue number3 = eng.toScriptValue(+qInf()); + QCOMPARE(number3.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0)); - QJSValue number3_2 = QJSValue(&eng, -qInf()); - QCOMPARE(number3_2.toUInt32(), quint32(0)); + QJSValue number3_2 = eng.toScriptValue(-qInf()); + QCOMPARE(number3_2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0)); - QJSValue number4 = QJSValue(&eng, 0.5); - QCOMPARE(number4.toUInt32(), quint32(0)); + QJSValue number4 = eng.toScriptValue(0.5); + QCOMPARE(number4.toUInt(), quint32(0)); - QJSValue number5 = QJSValue(&eng, 123.5); - QCOMPARE(number5.toUInt32(), quint32(123)); + QJSValue number5 = eng.toScriptValue(123.5); + QCOMPARE(number5.toUInt(), quint32(123)); - QJSValue number6 = QJSValue(&eng, -456.5); - QCOMPARE(number6.toUInt32(), quint32(-456)); + QJSValue number6 = eng.toScriptValue(-456.5); + QCOMPARE(number6.toUInt(), quint32(-456)); QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456)); - QJSValue str = QJSValue(&eng, QLatin1String("123.0")); - QCOMPARE(str.toUInt32(), quint32(123)); + QJSValue str = eng.toScriptValue(QString::fromLatin1("123.0")); + QCOMPARE(str.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123)); - QJSValue str2 = QJSValue(&eng, QLatin1String("NaN")); - QCOMPARE(str2.toUInt32(), quint32(0)); + QJSValue str2 = eng.toScriptValue(QString::fromLatin1("NaN")); + QCOMPARE(str2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0)); - QJSValue str3 = QJSValue(&eng, QLatin1String("Infinity")); - QCOMPARE(str3.toUInt32(), quint32(0)); + QJSValue str3 = eng.toScriptValue(QString::fromLatin1("Infinity")); + QCOMPARE(str3.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0)); - QJSValue str3_2 = QJSValue(&eng, QLatin1String("-Infinity")); - QCOMPARE(str3_2.toUInt32(), quint32(0)); + QJSValue str3_2 = eng.toScriptValue(QString::fromLatin1("-Infinity")); + QCOMPARE(str3_2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0)); - QJSValue str4 = QJSValue(&eng, QLatin1String("0.5")); - QCOMPARE(str4.toUInt32(), quint32(0)); + QJSValue str4 = eng.toScriptValue(QString::fromLatin1("0.5")); + QCOMPARE(str4.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0)); - QJSValue str5 = QJSValue(&eng, QLatin1String("123.5")); - QCOMPARE(str5.toUInt32(), quint32(123)); + QJSValue str5 = eng.toScriptValue(QString::fromLatin1("123.5")); + QCOMPARE(str5.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123)); - QJSValue str6 = QJSValue(&eng, QLatin1String("-456.5")); - QCOMPARE(str6.toUInt32(), quint32(-456)); + QJSValue str6 = eng.toScriptValue(QString::fromLatin1("-456.5")); + QCOMPARE(str6.toUInt(), quint32(-456)); QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456)); } // V2 constructors { QJSValue zer0 = QJSValue(0.0); - QCOMPARE(zer0.toUInt32(), quint32(0)); + QCOMPARE(zer0.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0)); QJSValue number = QJSValue(123.0); - QCOMPARE(number.toUInt32(), quint32(123)); + QCOMPARE(number.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123)); QJSValue number2 = QJSValue(qSNaN()); - QCOMPARE(number2.toUInt32(), quint32(0)); + QCOMPARE(number2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0)); QJSValue number3 = QJSValue(+qInf()); - QCOMPARE(number3.toUInt32(), quint32(0)); + QCOMPARE(number3.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0)); QJSValue number3_2 = QJSValue(-qInf()); - QCOMPARE(number3_2.toUInt32(), quint32(0)); + QCOMPARE(number3_2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0)); QJSValue number4 = QJSValue(0.5); - QCOMPARE(number4.toUInt32(), quint32(0)); + QCOMPARE(number4.toUInt(), quint32(0)); QJSValue number5 = QJSValue(123.5); - QCOMPARE(number5.toUInt32(), quint32(123)); + QCOMPARE(number5.toUInt(), quint32(123)); QJSValue number6 = QJSValue(-456.5); - QCOMPARE(number6.toUInt32(), quint32(-456)); + QCOMPARE(number6.toUInt(), quint32(-456)); QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456)); QJSValue number7 = QJSValue(0x43211234); - QCOMPARE(number7.toUInt32(), quint32(0x43211234)); + QCOMPARE(number7.toUInt(), quint32(0x43211234)); QJSValue str = QJSValue(QLatin1String("123.0")); - QCOMPARE(str.toUInt32(), quint32(123)); + QCOMPARE(str.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123)); QJSValue str2 = QJSValue(QLatin1String("NaN")); - QCOMPARE(str2.toUInt32(), quint32(0)); + QCOMPARE(str2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0)); QJSValue str3 = QJSValue(QLatin1String("Infinity")); - QCOMPARE(str3.toUInt32(), quint32(0)); + QCOMPARE(str3.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0)); QJSValue str3_2 = QJSValue(QLatin1String("-Infinity")); - QCOMPARE(str3_2.toUInt32(), quint32(0)); + QCOMPARE(str3_2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0)); QJSValue str4 = QJSValue(QLatin1String("0.5")); - QCOMPARE(str4.toUInt32(), quint32(0)); + QCOMPARE(str4.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0)); QJSValue str5 = QJSValue(QLatin1String("123.5")); - QCOMPARE(str5.toUInt32(), quint32(123)); + QCOMPARE(str5.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123)); QJSValue str6 = QJSValue(QLatin1String("-456.5")); - QCOMPARE(str6.toUInt32(), quint32(-456)); + QCOMPARE(str6.toUInt(), quint32(-456)); QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456)); } QJSValue inv; - QCOMPARE(inv.toUInt32(), quint32(0)); + QCOMPARE(inv.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(inv), quint32(0)); } @@ -1340,7 +1340,7 @@ void tst_QJSValue::toVariant() listIn << 123 << "hello"; QJSValue array = qScriptValueFromValue(&eng, listIn); QVERIFY(array.isArray()); - QCOMPARE(array.property("length").toInt32(), 2); + QCOMPARE(array.property("length").toInt(), 2); QVariant ret = array.toVariant(); QCOMPARE(ret.type(), QVariant::List); QVariantList listOut = ret.toList(); @@ -1350,8 +1350,8 @@ void tst_QJSValue::toVariant() // round-trip conversion QJSValue array2 = qScriptValueFromValue(&eng, ret); QVERIFY(array2.isArray()); - QCOMPARE(array2.property("length").toInt32(), array.property("length").toInt32()); - for (int i = 0; i < array.property("length").toInt32(); ++i) + QCOMPARE(array2.property("length").toInt(), array.property("length").toInt()); + for (int i = 0; i < array.property("length").toInt(); ++i) QVERIFY(array2.property(i).strictlyEquals(array.property(i))); } #endif @@ -1530,7 +1530,7 @@ void tst_QJSValue::toObject() { QJSValue tmp = eng.toObject(number); QVERIFY(tmp.isObject()); - QCOMPARE(tmp.toInt32(), number.toInt32()); + QCOMPARE(tmp.toInt(), number.toInt()); } QVERIFY(number.isNumber()); @@ -1698,7 +1698,7 @@ void tst_QJSValue::isError_propertiesOfGlobalObject() QJSEngine eng; for (int i = 0; i < errors.size(); ++i) { QJSValue ctor = eng.globalObject().property(errors.at(i)); - QVERIFY(ctor.isFunction()); + QVERIFY(ctor.isCallable()); QVERIFY(ctor.property("prototype").isError()); } } @@ -1792,6 +1792,101 @@ static QJSValue getSet__proto__(QScriptContext *ctx, QScriptEngine *) } #endif +void tst_QJSValue::hasProperty_basic() +{ + QJSEngine eng; + QJSValue obj = eng.newObject(); + QVERIFY(obj.hasProperty("hasOwnProperty")); // inherited from Object.prototype + QVERIFY(!obj.hasOwnProperty("hasOwnProperty")); + + QVERIFY(!obj.hasProperty("foo")); + QVERIFY(!obj.hasOwnProperty("foo")); + obj.setProperty("foo", 123); + QVERIFY(obj.hasProperty("foo")); + QVERIFY(obj.hasOwnProperty("foo")); + + QVERIFY(!obj.hasProperty("bar")); + QVERIFY(!obj.hasOwnProperty("bar")); +} + +void tst_QJSValue::hasProperty_globalObject() +{ + QJSEngine eng; + QJSValue global = eng.globalObject(); + QVERIFY(global.hasProperty("Math")); + QVERIFY(global.hasOwnProperty("Math")); + QVERIFY(!global.hasProperty("NoSuchStandardProperty")); + QVERIFY(!global.hasOwnProperty("NoSuchStandardProperty")); + + QVERIFY(!global.hasProperty("foo")); + QVERIFY(!global.hasOwnProperty("foo")); + global.setProperty("foo", 123); + QVERIFY(global.hasProperty("foo")); + QVERIFY(global.hasOwnProperty("foo")); +} + +void tst_QJSValue::hasProperty_changePrototype() +{ + QJSEngine eng; + QJSValue obj = eng.newObject(); + QJSValue proto = eng.newObject(); + obj.setPrototype(proto); + + QVERIFY(!obj.hasProperty("foo")); + QVERIFY(!obj.hasOwnProperty("foo")); + proto.setProperty("foo", 123); + QVERIFY(obj.hasProperty("foo")); + QVERIFY(!obj.hasOwnProperty("foo")); + + obj.setProperty("foo", 456); // override prototype property + QVERIFY(obj.hasProperty("foo")); + QVERIFY(obj.hasOwnProperty("foo")); +} + +void tst_QJSValue::deleteProperty_basic() +{ + QJSEngine eng; + QJSValue obj = eng.newObject(); + // deleteProperty() behavior matches JS delete operator + QVERIFY(obj.deleteProperty("foo")); + + obj.setProperty("foo", 123); + QVERIFY(obj.deleteProperty("foo")); + QVERIFY(!obj.hasOwnProperty("foo")); +} + +void tst_QJSValue::deleteProperty_globalObject() +{ + QJSEngine eng; + QJSValue global = eng.globalObject(); + // deleteProperty() behavior matches JS delete operator + QVERIFY(global.deleteProperty("foo")); + + global.setProperty("foo", 123); + QVERIFY(global.deleteProperty("foo")); + QVERIFY(!global.hasProperty("foo")); + + QVERIFY(global.deleteProperty("Math")); + QVERIFY(!global.hasProperty("Math")); + + QVERIFY(!global.deleteProperty("NaN")); // read-only + QVERIFY(global.hasProperty("NaN")); +} + +void tst_QJSValue::deleteProperty_inPrototype() +{ + QJSEngine eng; + QJSValue obj = eng.newObject(); + QJSValue proto = eng.newObject(); + obj.setPrototype(proto); + + proto.setProperty("foo", 123); + QVERIFY(obj.hasProperty("foo")); + // deleteProperty() behavior matches JS delete operator + QVERIFY(obj.deleteProperty("foo")); + QVERIFY(obj.hasProperty("foo")); +} + void tst_QJSValue::getSetProperty_HooliganTask162051() { QJSEngine eng; @@ -2102,9 +2197,9 @@ void tst_QJSValue::getSetProperty_gettersAndSettersChange() eng.globalObject().setProperty("object", object); QJSValue res = eng.evaluate("object.x = 89; var a = object.foo; object.foo = 65; a"); - QCOMPARE(res.toInt32(), 89); - QCOMPARE(object.property("x").toInt32(), 65); - QCOMPARE(object.property("foo").toInt32(), 65); + QCOMPARE(res.toInt(), 89); + QCOMPARE(object.property("x").toInt(), 65); + QCOMPARE(object.property("foo").toInt(), 65); #endif } @@ -2119,13 +2214,13 @@ void tst_QJSValue::getSetProperty_array() array.setProperty(0, num); QCOMPARE(array.property(0).toNumber(), num.toNumber()); QCOMPARE(array.property("0").toNumber(), num.toNumber()); - QCOMPARE(array.property("length").toUInt32(), quint32(1)); + QCOMPARE(array.property("length").toUInt(), quint32(1)); array.setProperty(1, str); QCOMPARE(array.property(1).toString(), str.toString()); QCOMPARE(array.property("1").toString(), str.toString()); - QCOMPARE(array.property("length").toUInt32(), quint32(2)); + QCOMPARE(array.property("length").toUInt(), quint32(2)); array.setProperty("length", QJSValue(&eng, 1)); - QCOMPARE(array.property("length").toUInt32(), quint32(1)); + QCOMPARE(array.property("length").toUInt(), quint32(1)); QCOMPARE(array.property(1).isValid(), false); } @@ -2487,7 +2582,7 @@ void tst_QJSValue::getSetScope() { QJSValue ret = object2.property("foo", QJSValue::ResolveScope); QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); + QCOMPARE(ret.toInt(), 123); } QJSValue inv; @@ -2721,18 +2816,18 @@ void tst_QJSValue::call_function() { QJSEngine eng; QJSValue fun = eng.evaluate("(function() { return 1; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QJSValue result = fun.call(); QVERIFY(result.isNumber()); - QCOMPARE(result.toInt32(), 1); + QCOMPARE(result.toInt(), 1); } void tst_QJSValue::call_object() { QJSEngine eng; QJSValue Object = eng.evaluate("Object"); - QCOMPARE(Object.isFunction(), true); - QJSValue result = Object.call(Object); + QCOMPARE(Object.isCallable(), true); + QJSValue result = Object.callWithInstance(Object); QCOMPARE(result.isObject(), true); } @@ -2742,10 +2837,10 @@ void tst_QJSValue::call_newObjects() // test that call() doesn't construct new objects QJSValue Number = eng.evaluate("Number"); QJSValue Object = eng.evaluate("Object"); - QCOMPARE(Object.isFunction(), true); + QCOMPARE(Object.isCallable(), true); QJSValueList args; args << QJSValue(&eng, 123); - QJSValue result = Number.call(Object, args); + QJSValue result = Number.callWithInstance(Object, args); QCOMPARE(result.strictlyEquals(args.at(0)), true); } @@ -2754,10 +2849,10 @@ void tst_QJSValue::call_this() QJSEngine eng; // test that correct "this" object is used QJSValue fun = eng.evaluate("(function() { return this; })"); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QJSValue numberObject = QJSValue(&eng, 123.0).toObject(); - QJSValue result = fun.call(numberObject); + QJSValue result = fun.callWithInstance(numberObject); QCOMPARE(result.isObject(), true); QCOMPARE(result.toNumber(), 123.0); } @@ -2768,15 +2863,15 @@ void tst_QJSValue::call_arguments() // test that correct arguments are passed QJSValue fun = eng.evaluate("(function() { return arguments[0]; })"); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); { - QJSValue result = fun.call(eng.undefinedValue()); + QJSValue result = fun.callWithInstance(eng.undefinedValue()); QCOMPARE(result.isUndefined(), true); } { QJSValueList args; args << QJSValue(&eng, 123.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 123.0); } @@ -2784,7 +2879,7 @@ void tst_QJSValue::call_arguments() { QJSValueList args; args << QJSValue(123.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 123.0); } @@ -2792,7 +2887,7 @@ void tst_QJSValue::call_arguments() { QJSValue args = eng.newArray(); args.setProperty(0, 123); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QVERIFY(result.isNumber()); QCOMPARE(result.toNumber(), 123.0); } @@ -2804,12 +2899,12 @@ void tst_QJSValue::call() QJSEngine eng; { QJSValue fun = eng.evaluate("(function() { return arguments[1]; })"); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); { QJSValueList args; args << QJSValue(&eng, 123.0) << QJSValue(&eng, 456.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 456.0); } @@ -2818,7 +2913,7 @@ void tst_QJSValue::call() QJSValue args = eng.newArray(); args.setProperty(0, 123); args.setProperty(1, 456); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QVERIFY(result.isNumber()); QCOMPARE(result.toNumber(), 456.0); } @@ -2826,7 +2921,7 @@ void tst_QJSValue::call() } { QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })"); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QVERIFY(!eng.hasUncaughtException()); { @@ -2843,7 +2938,7 @@ void tst_QJSValue::call() { QJSValueList args; args << QJSValue(&eng, 123.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QVERIFY(!eng.hasUncaughtException()); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 123.0); @@ -2852,7 +2947,7 @@ void tst_QJSValue::call() { QJSValueList args; args << QJSValue(123.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 123.0); } @@ -2860,7 +2955,7 @@ void tst_QJSValue::call() { QJSValue args = eng.newArray(); args.setProperty(0, 123); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QVERIFY(result.isNumber()); QCOMPARE(result.toNumber(), 123.0); } @@ -2871,7 +2966,7 @@ void tst_QJSValue::call() { QJSValueList args; args << QJSValue(&eng, 123.0); - QJSValue result = fun.call(eng.undefinedValue(), args); + QJSValue result = fun.callWithInstance(eng.undefinedValue(), args); QVERIFY(!eng.hasUncaughtException()); QCOMPARE(result.isNumber(), true); QCOMPARE(result.toNumber(), 123.0); @@ -2890,7 +2985,7 @@ void tst_QJSValue::call_invalidArguments() { QJSValueList args; args << QJSValue(); - QJSValue ret = fun.call(QJSValue(), args); + QJSValue ret = fun.callWithInstance(args); QVERIFY(!eng.hasUncaughtException()); QCOMPARE(ret.isValid(), true); QCOMPARE(ret.isUndefined(), true); @@ -2901,7 +2996,7 @@ void tst_QJSValue::call_invalidArguments() { QJSValueList args; args << QJSValue(); - QJSValue ret = fun.call(QJSValue(), args); + QJSValue ret = fun.call(args); QCOMPARE(ret.isValid(), true); QCOMPARE(ret.isUndefined(), true); } @@ -2911,7 +3006,7 @@ void tst_QJSValue::call_invalidArguments() { QJSValueList args; args << QJSValue() << QJSValue(); - QJSValue ret = fun.call(QJSValue(), args); + QJSValue ret = fun.call(args); QCOMPARE(ret.isValid(), true); QCOMPARE(ret.isNumber(), true); QCOMPARE(qIsNaN(ret.toNumber()), true); @@ -2940,25 +3035,25 @@ void tst_QJSValue::call_twoEngines() QJSValue object = eng.evaluate("Object"); QJSEngine otherEngine; QJSValue fun = otherEngine.evaluate("(function() { return 1; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QTest::ignoreMessage(QtWarningMsg, "JSValue can't be rassigned to an another engine."); QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: " "cannot call function with thisObject created in " "a different engine"); - QCOMPARE(fun.call(object).isValid(), false); + QCOMPARE(fun.callWithInstance(object).isValid(), false); QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: " "cannot call function with argument created in " "a different engine"); - QCOMPARE(fun.call(QJSValue(), QJSValueList() << QJSValue(&eng, 123)).isValid(), false); + QCOMPARE(fun.call(QJSValueList() << QJSValue(&eng, 123)).isValid(), false); { QJSValue fun = eng.evaluate("Object"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QJSEngine eng2; QJSValue objectInDifferentEngine = eng2.newObject(); QJSValueList args; args << objectInDifferentEngine; QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: cannot call function with argument created in a different engine"); - fun.call(QJSValue(), args); + fun.call(args); } } @@ -2967,7 +3062,7 @@ void tst_QJSValue::call_array() #if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API QScriptEngine eng; QJSValue fun = eng.evaluate("(function() { return arguments; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QJSValue array = eng.newArray(3); array.setProperty(0, QJSValue(&eng, 123.0)); array.setProperty(1, QJSValue(&eng, 456.0)); @@ -3069,18 +3164,18 @@ void tst_QJSValue::construct_nonFunction_data() void tst_QJSValue::construct_nonFunction() { QFETCH(QJSValue, value); - QVERIFY(!value.construct().isValid()); + QVERIFY(!value.callAsConstructor().isValid()); } void tst_QJSValue::construct_simple() { QJSEngine eng; QJSValue fun = eng.evaluate("(function () { this.foo = 123; })"); - QVERIFY(fun.isFunction()); - QJSValue ret = fun.construct(); + QVERIFY(fun.isCallable()); + QJSValue ret = fun.callAsConstructor(); QVERIFY(ret.isObject()); QVERIFY(ret.instanceOf(fun)); - QCOMPARE(ret.property("foo").toInt32(), 123); + QCOMPARE(ret.property("foo").toInt(), 123); } void tst_QJSValue::construct_newObjectJS() @@ -3088,11 +3183,11 @@ void tst_QJSValue::construct_newObjectJS() QJSEngine eng; // returning a different object overrides the default-constructed one QJSValue fun = eng.evaluate("(function () { return { bar: 456 }; })"); - QVERIFY(fun.isFunction()); - QJSValue ret = fun.construct(); + QVERIFY(fun.isCallable()); + QJSValue ret = fun.callAsConstructor(); QVERIFY(ret.isObject()); QVERIFY(!ret.instanceOf(fun)); - QCOMPARE(ret.property("bar").toInt32(), 456); + QCOMPARE(ret.property("bar").toInt(), 456); } #if 0 // FIXME: no c-style callbacks @@ -3100,20 +3195,20 @@ void tst_QJSValue::construct_undefined() { QScriptEngine eng; QJSValue fun = eng.newFunction(ctorReturningUndefined); - QJSValue ret = fun.construct(); + QJSValue ret = fun.callAsConstructor(); QVERIFY(ret.isObject()); QVERIFY(ret.instanceOf(fun)); - QCOMPARE(ret.property("foo").toInt32(), 123); + QCOMPARE(ret.property("foo").toInt(), 123); } void tst_QJSValue::construct_newObjectCpp() { QScriptEngine eng; QJSValue fun = eng.newFunction(ctorReturningNewObject); - QJSValue ret = fun.construct(); + QJSValue ret = fun.callAsConstructor(); QVERIFY(ret.isObject()); QVERIFY(!ret.instanceOf(fun)); - QCOMPARE(ret.property("bar").toInt32(), 456); + QCOMPARE(ret.property("bar").toInt(), 456); } #endif @@ -3121,10 +3216,10 @@ void tst_QJSValue::construct_arg() { QJSEngine eng; QJSValue Number = eng.evaluate("Number"); - QCOMPARE(Number.isFunction(), true); + QCOMPARE(Number.isCallable(), true); QJSValueList args; args << QJSValue(&eng, 123); - QJSValue ret = Number.construct(args); + QJSValue ret = Number.callAsConstructor(args); QCOMPARE(ret.isObject(), true); QCOMPARE(ret.toNumber(), args.at(0).toNumber()); } @@ -3134,9 +3229,9 @@ void tst_QJSValue::construct_proto() QJSEngine eng; // test that internal prototype is set correctly QJSValue fun = eng.evaluate("(function() { return this.__proto__; })"); - QCOMPARE(fun.isFunction(), true); + QCOMPARE(fun.isCallable(), true); QCOMPARE(fun.property("prototype").isObject(), true); - QJSValue ret = fun.construct(); + QJSValue ret = fun.callAsConstructor(); QCOMPARE(fun.property("prototype").strictlyEquals(ret), true); } @@ -3145,8 +3240,8 @@ void tst_QJSValue::construct_returnInt() QJSEngine eng; // test that we return the new object even if a non-object value is returned from the function QJSValue fun = eng.evaluate("(function() { return 123; })"); - QCOMPARE(fun.isFunction(), true); - QJSValue ret = fun.construct(); + QCOMPARE(fun.isCallable(), true); + QJSValue ret = fun.callAsConstructor(); QCOMPARE(ret.isObject(), true); } @@ -3154,8 +3249,8 @@ void tst_QJSValue::construct_throw() { QJSEngine eng; QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })"); - QCOMPARE(fun.isFunction(), true); - QJSValue ret = fun.construct(); + QCOMPARE(fun.isCallable(), true); + QJSValue ret = fun.callAsConstructor(); QCOMPARE(ret.isError(), true); QCOMPARE(eng.hasUncaughtException(), true); QVERIFY(ret.strictlyEquals(eng.uncaughtException())); @@ -3166,13 +3261,13 @@ void tst_QJSValue::construct() { QScriptEngine eng; QJSValue fun = eng.evaluate("(function() { return arguments; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); QJSValue array = eng.newArray(3); array.setProperty(0, QJSValue(&eng, 123.0)); array.setProperty(1, QJSValue(&eng, 456.0)); array.setProperty(2, QJSValue(&eng, 789.0)); // construct with single array object as arguments - QJSValue ret = fun.construct(array); + QJSValue ret = fun.callAsConstructor(array); QVERIFY(!eng.hasUncaughtException()); QVERIFY(ret.isValid()); QVERIFY(ret.isObject()); @@ -3180,25 +3275,25 @@ void tst_QJSValue::construct() QCOMPARE(ret.property(1).strictlyEquals(array.property(1)), true); QCOMPARE(ret.property(2).strictlyEquals(array.property(2)), true); // construct with arguments object as arguments - QJSValue ret2 = fun.construct(ret); + QJSValue ret2 = fun.callAsConstructor(ret); QCOMPARE(ret2.property(0).strictlyEquals(ret.property(0)), true); QCOMPARE(ret2.property(1).strictlyEquals(ret.property(1)), true); QCOMPARE(ret2.property(2).strictlyEquals(ret.property(2)), true); // construct with null as arguments - QJSValue ret3 = fun.construct(eng.nullValue()); + QJSValue ret3 = fun.callAsConstructor(eng.nullValue()); QCOMPARE(ret3.isError(), false); QCOMPARE(ret3.property("length").isNumber(), true); QCOMPARE(ret3.property("length").toNumber(), 0.0); // construct with undefined as arguments - QJSValue ret4 = fun.construct(eng.undefinedValue()); + QJSValue ret4 = fun.callAsConstructor(eng.undefinedValue()); QCOMPARE(ret4.isError(), false); QCOMPARE(ret4.property("length").isNumber(), true); QCOMPARE(ret4.property("length").toNumber(), 0.0); // construct with something else as arguments - QJSValue ret5 = fun.construct(QJSValue(&eng, 123.0)); + QJSValue ret5 = fun.callAsConstructor(QJSValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); // construct with a non-array object as arguments - QJSValue ret6 = fun.construct(eng.globalObject()); + QJSValue ret6 = fun.callAsConstructor(eng.globalObject()); QVERIFY(ret6.isError()); QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array")); } @@ -3210,20 +3305,20 @@ void tst_QJSValue::construct_twoEngines() QJSEngine otherEngine; QJSValue ctor = engine.evaluate("(function (a, b) { this.foo = 123; })"); QJSValue arg(&otherEngine, 124567); - QTest::ignoreMessage(QtWarningMsg, "QJSValue::construct() failed: cannot construct function with argument created in a different engine"); - QVERIFY(!ctor.construct(QJSValueList() << arg).isValid()); - QTest::ignoreMessage(QtWarningMsg, "QJSValue::construct() failed: cannot construct function with argument created in a different engine"); - QVERIFY(!ctor.construct(QJSValueList() << arg << otherEngine.newObject()).isValid()); + QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine"); + QVERIFY(!ctor.callAsConstructor(QJSValueList() << arg).isValid()); + QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine"); + QVERIFY(!ctor.callAsConstructor(QJSValueList() << arg << otherEngine.newObject()).isValid()); } void tst_QJSValue::construct_constructorThrowsPrimitive() { QJSEngine eng; QJSValue fun = eng.evaluate("(function() { throw 123; })"); - QVERIFY(fun.isFunction()); + QVERIFY(fun.isCallable()); // construct(QJSValueList) { - QJSValue ret = fun.construct(); + QJSValue ret = fun.callAsConstructor(); QVERIFY(ret.isNumber()); QCOMPARE(ret.toNumber(), 123.0); QVERIFY(eng.hasUncaughtException()); @@ -3233,7 +3328,7 @@ void tst_QJSValue::construct_constructorThrowsPrimitive() #if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API // construct(QJSValue) { - QJSValue ret = fun.construct(eng.newArray()); + QJSValue ret = fun.callAsConstructor(eng.newArray()); QVERIFY(ret.isNumber()); QCOMPARE(ret.toNumber(), 123.0); QVERIFY(eng.hasUncaughtException()); @@ -3443,17 +3538,17 @@ void tst_QJSValue::equals() QVERIFY(!qobj2.equals(obj2)); // compares the QObject pointers QJSValue compareFun = eng.evaluate("(function(a, b) { return a == b; })"); - QVERIFY(compareFun.isFunction()); + QVERIFY(compareFun.isCallable()); { - QJSValue ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj2); + QJSValue ret = compareFun.call(QJSValueList() << qobj1 << qobj2); QVERIFY(ret.isBool()); - ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj3); + ret = compareFun.call(QJSValueList() << qobj1 << qobj3); QVERIFY(ret.isBool()); QVERIFY(!ret.toBool()); - ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << qobj4); + ret = compareFun.call(QJSValueList() << qobj1 << qobj4); QVERIFY(ret.isBool()); QVERIFY(!ret.toBool()); - ret = compareFun.call(QJSValue(), QJSValueList() << qobj1 << obj1); + ret = compareFun.call(QJSValueList() << qobj1 << obj1); QVERIFY(ret.isBool()); QVERIFY(!ret.toBool()); } @@ -3897,7 +3992,7 @@ void tst_QJSValue::prettyPrinter() QFETCH(QString, expected); QJSEngine eng; QJSValue val = eng.evaluate("(" + function + ")"); - QVERIFY(val.isFunction()); + QVERIFY(val.isCallable()); QString actual = val.toString(); int count = qMin(actual.size(), expected.size()); // qDebug() << actual << expected; @@ -3945,7 +4040,7 @@ void tst_QJSValue::valueOfWithClosure() { QJSValue obj = eng.evaluate("o = {}; (function(foo) { o.valueOf = function() { return foo; } })(123); o"); QVERIFY(obj.isObject()); - QCOMPARE(obj.toInt32(), 123); + QCOMPARE(obj.toInt(), 123); } // toString() { @@ -4023,6 +4118,12 @@ void tst_QJSValue::nestedObjectToVariant_data() // Object literals { QVariantMap m; + QTest::newRow("{}") + << QString::fromLatin1("({})") + << QVariant(m); + } + { + QVariantMap m; m["a"] = QVariantMap(); QTest::newRow("{ a:{} }") << QString::fromLatin1("({ a:{} })") diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h index 2e11832f07..b6e6f51079 100644 --- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h +++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -86,8 +86,8 @@ private slots: void toBoolean(); void toBool(); void toInteger(); - void toInt32(); - void toUInt32(); + void toInt(); + void toUInt(); void toUInt16(); void toVariant(); void toQObject_nonQObject_data(); @@ -113,6 +113,14 @@ private slots: void equals(); void strictlyEquals(); + void hasProperty_basic(); + void hasProperty_globalObject(); + void hasProperty_changePrototype(); + + void deleteProperty_basic(); + void deleteProperty_globalObject(); + void deleteProperty_inPrototype(); + void getSetPrototype_cyclicPrototype(); void getSetPrototype_evalCyclicPrototype(); void getSetPrototype_eval(); diff --git a/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp index d8a490f694..58c380057d 100644 --- a/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp +++ b/tests/auto/declarative/qjsvalueiterator/tst_qjsvalueiterator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -173,7 +173,7 @@ void tst_QJSValueIterator::iterateArray() // Iterate thru array properties. Note that the QJSValueIterator doesn't guarantee // any order on the iteration! - int length = array.property("length").toInt32(); + int length = array.property("length").toInt(); QCOMPARE(length, propertyNames.size()); bool iteratedThruLength = false; @@ -187,7 +187,7 @@ void tst_QJSValueIterator::iterateArray() const QString name = it.name(); if (name == QString::fromLatin1("length")) { QVERIFY(it.value().isNumber()); - QCOMPARE(it.value().toInt32(), length); + QCOMPARE(it.value().toInt(), length); QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration."); iteratedThruLength = true; continue; @@ -220,7 +220,7 @@ void tst_QJSValueIterator::iterateArray() const QString name = it.name(); if (name == QString::fromLatin1("length")) { QVERIFY(it.value().isNumber()); - QCOMPARE(it.value().toInt32(), length); + QCOMPARE(it.value().toInt(), length); QCOMPARE(it.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable); QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration."); iteratedThruLength = true; @@ -255,7 +255,7 @@ void tst_QJSValueIterator::iterateArray() const QString name = it2.name(); if (name == QString::fromLatin1("length")) { QVERIFY(it2.value().isNumber()); - QCOMPARE(it2.value().toInt32(), length); + QCOMPARE(it2.value().toInt(), length); QCOMPARE(it2.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable); QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration."); iteratedThruLength = true; @@ -286,7 +286,7 @@ void tst_QJSValueIterator::iterateString() QVERIFY(str.isString()); QJSValue obj = str.toObject(); QVERIFY(obj.property("length").isNumber()); - int length = obj.property("length").toInt32(); + int length = obj.property("length").toInt(); QCOMPARE(length, 4); QJSValueIterator it(obj); @@ -299,7 +299,7 @@ void tst_QJSValueIterator::iterateString() if (name == QString::fromLatin1("length")) { QVERIFY(it.value().isNumber()); - QCOMPARE(it.value().toInt32(), length); + QCOMPARE(it.value().toInt(), length); QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration."); iteratedThruLength = true; continue; @@ -324,7 +324,7 @@ void tst_QJSValueIterator::iterateString() if (name == QString::fromLatin1("length")) { QVERIFY(it.value().isNumber()); - QCOMPARE(it.value().toInt32(), length); + QCOMPARE(it.value().toInt(), length); QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration."); iteratedThruLength = true; continue; diff --git a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp index 69ec0cb199..4663bed78f 100644 --- a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp +++ b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -103,6 +103,7 @@ void tst_qmlmin::initTestCase() invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/insertedSemicolon.1.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml"; + invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.1.qml"; invalidFiles << "tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml"; invalidFiles << "tests/auto/declarative/qdeclarativeecmascript/data/qtbug_22843.js"; invalidFiles << "tests/auto/declarative/qdeclarativeecmascript/data/qtbug_22843.library.js"; diff --git a/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp index 5970fd406e..8b24b4eff6 100644 --- a/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp +++ b/tests/auto/declarative/qmlplugindump/tst_qmlplugindump.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/runall.sh b/tests/auto/declarative/runall.sh index 710d7504bb..7e17aca0c1 100755 --- a/tests/auto/declarative/runall.sh +++ b/tests/auto/declarative/runall.sh @@ -4,7 +4,7 @@ ## ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) +## Contact: http://www.qt-project.org/ ## ## This file is part of the test suite of the Qt Toolkit. ## diff --git a/tests/auto/declarative/v4/testtypes.cpp b/tests/auto/declarative/v4/testtypes.cpp index edf31b2893..64326e6341 100644 --- a/tests/auto/declarative/v4/testtypes.cpp +++ b/tests/auto/declarative/v4/testtypes.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/v4/testtypes.h b/tests/auto/declarative/v4/testtypes.h index 0d4d8d764b..161304df16 100644 --- a/tests/auto/declarative/v4/testtypes.h +++ b/tests/auto/declarative/v4/testtypes.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp index 852d36ec80..3d54f078e8 100644 --- a/tests/auto/declarative/v4/tst_v4.cpp +++ b/tests/auto/declarative/v4/tst_v4.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/headersclean/tst_headersclean.cpp b/tests/auto/headersclean/tst_headersclean.cpp index 5f8a90086e..59225108ec 100644 --- a/tests/auto/headersclean/tst_headersclean.cpp +++ b/tests/auto/headersclean/tst_headersclean.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickage/data/jump.qml b/tests/auto/particles/qquickage/data/jump.qml index 0e78b2acbc..9dab4d369a 100644 --- a/tests/auto/particles/qquickage/data/jump.qml +++ b/tests/auto/particles/qquickage/data/jump.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickage/data/kill.qml b/tests/auto/particles/qquickage/data/kill.qml index c632372580..992517f125 100644 --- a/tests/auto/particles/qquickage/data/kill.qml +++ b/tests/auto/particles/qquickage/data/kill.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickage/data/onceoff.qml b/tests/auto/particles/qquickage/data/onceoff.qml index 8261873775..66b68f683e 100644 --- a/tests/auto/particles/qquickage/data/onceoff.qml +++ b/tests/auto/particles/qquickage/data/onceoff.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickage/data/sustained.qml b/tests/auto/particles/qquickage/data/sustained.qml index 5c29799259..6cd2382ce5 100644 --- a/tests/auto/particles/qquickage/data/sustained.qml +++ b/tests/auto/particles/qquickage/data/sustained.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickage/tst_qquickage.cpp b/tests/auto/particles/qquickage/tst_qquickage.cpp index 43350168a6..a0fac6b641 100644 --- a/tests/auto/particles/qquickage/tst_qquickage.cpp +++ b/tests/auto/particles/qquickage/tst_qquickage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickangleddirection/data/basic.qml b/tests/auto/particles/qquickangleddirection/data/basic.qml index 44da88d1d9..3d10e3f848 100644 --- a/tests/auto/particles/qquickangleddirection/data/basic.qml +++ b/tests/auto/particles/qquickangleddirection/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp index e3469ae083..66bd49b0d9 100644 --- a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp +++ b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcumulativedirection/data/basic.qml b/tests/auto/particles/qquickcumulativedirection/data/basic.qml index e7bdf7b420..570e0588de 100644 --- a/tests/auto/particles/qquickcumulativedirection/data/basic.qml +++ b/tests/auto/particles/qquickcumulativedirection/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp index 55aee82480..784836acfe 100644 --- a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp +++ b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcustomaffector/data/basic.qml b/tests/auto/particles/qquickcustomaffector/data/basic.qml index 3012a2a0e3..33677cc0b7 100644 --- a/tests/auto/particles/qquickcustomaffector/data/basic.qml +++ b/tests/auto/particles/qquickcustomaffector/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcustomaffector/data/move.qml b/tests/auto/particles/qquickcustomaffector/data/move.qml index 9d9635ad9a..0b5e725230 100644 --- a/tests/auto/particles/qquickcustomaffector/data/move.qml +++ b/tests/auto/particles/qquickcustomaffector/data/move.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp index 176d9161e8..01f629af94 100644 --- a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp +++ b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcustomparticle/data/basic.qml b/tests/auto/particles/qquickcustomparticle/data/basic.qml index 74275fcc6e..dd87a5f930 100644 --- a/tests/auto/particles/qquickcustomparticle/data/basic.qml +++ b/tests/auto/particles/qquickcustomparticle/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp index f82028ed8f..087e0350cd 100644 --- a/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp +++ b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickellipseextruder/data/basic.qml b/tests/auto/particles/qquickellipseextruder/data/basic.qml index 164954a1e9..21e0aa2455 100644 --- a/tests/auto/particles/qquickellipseextruder/data/basic.qml +++ b/tests/auto/particles/qquickellipseextruder/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp index 21a032b160..ddaa04ee62 100644 --- a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp +++ b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickfriction/data/basic.qml b/tests/auto/particles/qquickfriction/data/basic.qml index 262626dcfa..ecec97569e 100644 --- a/tests/auto/particles/qquickfriction/data/basic.qml +++ b/tests/auto/particles/qquickfriction/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickfriction/data/threshold.qml b/tests/auto/particles/qquickfriction/data/threshold.qml index 6463b9b859..23f2353c52 100644 --- a/tests/auto/particles/qquickfriction/data/threshold.qml +++ b/tests/auto/particles/qquickfriction/data/threshold.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp index 51dc9fc5fa..7cdfac5185 100644 --- a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp +++ b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickgravity/data/basic.qml b/tests/auto/particles/qquickgravity/data/basic.qml index 4f008ebaa3..b3bda7023c 100644 --- a/tests/auto/particles/qquickgravity/data/basic.qml +++ b/tests/auto/particles/qquickgravity/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp index 1319f40374..c581fa1587 100644 --- a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp +++ b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickgroupgoal/data/basic.qml b/tests/auto/particles/qquickgroupgoal/data/basic.qml index af10535f1f..feb333c3f5 100644 --- a/tests/auto/particles/qquickgroupgoal/data/basic.qml +++ b/tests/auto/particles/qquickgroupgoal/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp index 3979e111ea..c0d32bcaaf 100644 --- a/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp +++ b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/data/basic.qml b/tests/auto/particles/qquickimageparticle/data/basic.qml index 290f0a8736..714f42dec9 100644 --- a/tests/auto/particles/qquickimageparticle/data/basic.qml +++ b/tests/auto/particles/qquickimageparticle/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/data/colorVariance.qml b/tests/auto/particles/qquickimageparticle/data/colorVariance.qml new file mode 100644 index 0000000000..714644f50d --- /dev/null +++ b/tests/auto/particles/qquickimageparticle/data/colorVariance.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + color: "black" + width: 320 + height: 320 + + ParticleSystem { + id: sys + objectName: "system" + anchors.fill: parent + + ImageParticle { + source: "../../shared/star.png" + alpha: 0.5 + color: "#000000" + redVariation: 0.5 + greenVariation: 0.25 + blueVariation: 0.125 + alphaVariation: 0.25 + } + + Emitter{ + //0,0 position + size: 32 + emitRate: 1000 + lifeSpan: 500 + } + } +} diff --git a/tests/auto/particles/qquickimageparticle/data/colored.qml b/tests/auto/particles/qquickimageparticle/data/colored.qml index 9762f26d67..8d10d86ce0 100644 --- a/tests/auto/particles/qquickimageparticle/data/colored.qml +++ b/tests/auto/particles/qquickimageparticle/data/colored.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/data/deformed.qml b/tests/auto/particles/qquickimageparticle/data/deformed.qml index a97c6dd1f0..d6ce2392ca 100644 --- a/tests/auto/particles/qquickimageparticle/data/deformed.qml +++ b/tests/auto/particles/qquickimageparticle/data/deformed.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/data/sprite.qml b/tests/auto/particles/qquickimageparticle/data/sprite.qml index a96fef5b94..9fba4908aa 100644 --- a/tests/auto/particles/qquickimageparticle/data/sprite.qml +++ b/tests/auto/particles/qquickimageparticle/data/sprite.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/data/tabled.qml b/tests/auto/particles/qquickimageparticle/data/tabled.qml index 105435e073..cfdb8f7f8e 100644 --- a/tests/auto/particles/qquickimageparticle/data/tabled.qml +++ b/tests/auto/particles/qquickimageparticle/data/tabled.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp index b58a0b4970..19baf19c17 100644 --- a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp +++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -51,10 +51,12 @@ class tst_qquickimageparticle : public QObject Q_OBJECT public: tst_qquickimageparticle(); + ~tst_qquickimageparticle(); private slots: void test_basic(); void test_colored(); + void test_colorVariance(); void test_deformed(); void test_tabled(); void test_sprite(); @@ -63,6 +65,12 @@ private slots: tst_qquickimageparticle::tst_qquickimageparticle() { QUnifiedTimer::instance()->setConsistentTiming(true); + setenv("QML_PARTICLES_DEBUG","please",0);//QQuickImageParticle has several debug statements, with possible pointer dereferences +} + +tst_qquickimageparticle::~tst_qquickimageparticle() +{ + unsetenv("QML_PARTICLES_DEBUG"); } void tst_qquickimageparticle::test_basic() @@ -153,6 +161,51 @@ void tst_qquickimageparticle::test_colored() } +void tst_qquickimageparticle::test_colorVariance() +{ + QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/colorVariance.qml", 600); + QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); + ensureAnimTime(600, system->m_animation); + + QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10)); + foreach (QQuickParticleData *d, system->groupData[0]->data) { + if (d->t == -1) + continue; //Particle data unused + + QCOMPARE(d->x, 0.f); + QCOMPARE(d->y, 0.f); + QCOMPARE(d->vx, 0.f); + QCOMPARE(d->vy, 0.f); + QCOMPARE(d->ax, 0.f); + QCOMPARE(d->ay, 0.f); + QCOMPARE(d->lifeSpan, 0.5f); + QCOMPARE(d->size, 32.f); + QCOMPARE(d->endSize, 32.f); + QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0))); + QVERIFY(d->color.r < 128); + QVERIFY(d->color.g < 64); + QVERIFY(d->color.b < 32); + QVERIFY(d->color.a >= 64); + QVERIFY(d->color.a < 192); + QCOMPARE(d->xx, 1.0f); + QCOMPARE(d->xy, 0.0f); + QCOMPARE(d->yy, 1.0f); + QCOMPARE(d->yx, 0.0f); + QCOMPARE(d->rotation, 0.0f); + QCOMPARE(d->rotationSpeed, 0.0f); + QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->animX, 0.0f); + QCOMPARE(d->animY, 0.0f); + QCOMPARE(d->animWidth, 1.0f); + QCOMPARE(d->animHeight, 1.0f); + QCOMPARE(d->frameDuration, 1.0f); + QCOMPARE(d->frameCount, 1.0f); + QCOMPARE(d->animT, -1.0f); + } + delete view; +} + + void tst_qquickimageparticle::test_deformed() { QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/deformed.qml", 600); diff --git a/tests/auto/particles/qquickitemparticle/data/basic.qml b/tests/auto/particles/qquickitemparticle/data/basic.qml index 3ab099d0ce..2ea25f6946 100644 --- a/tests/auto/particles/qquickitemparticle/data/basic.qml +++ b/tests/auto/particles/qquickitemparticle/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp index c72c4533ab..3aa600d3a9 100644 --- a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp +++ b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicklineextruder/data/basic.qml b/tests/auto/particles/qquicklineextruder/data/basic.qml index e5046cbb7f..9edf05b55d 100644 --- a/tests/auto/particles/qquicklineextruder/data/basic.qml +++ b/tests/auto/particles/qquicklineextruder/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp index e34e340c7a..c425e4ddb2 100644 --- a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp +++ b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickmaskextruder/data/basic.qml b/tests/auto/particles/qquickmaskextruder/data/basic.qml index 396773119b..452a956d26 100644 --- a/tests/auto/particles/qquickmaskextruder/data/basic.qml +++ b/tests/auto/particles/qquickmaskextruder/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp index a7f6e6d3d8..1450a4db7f 100644 --- a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp +++ b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickparticlegroup/data/basic.qml b/tests/auto/particles/qquickparticlegroup/data/basic.qml index d9f5271c1c..5143ea31c6 100644 --- a/tests/auto/particles/qquickparticlegroup/data/basic.qml +++ b/tests/auto/particles/qquickparticlegroup/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp index 36de6861d9..65676aff37 100644 --- a/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp +++ b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickparticlesystem/data/basic.qml b/tests/auto/particles/qquickparticlesystem/data/basic.qml index 290f0a8736..714f42dec9 100644 --- a/tests/auto/particles/qquickparticlesystem/data/basic.qml +++ b/tests/auto/particles/qquickparticlesystem/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp index 831afb220d..1783bcafe4 100644 --- a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp +++ b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickpointattractor/data/basic.qml b/tests/auto/particles/qquickpointattractor/data/basic.qml index 4cc3de9d35..eb247fe292 100644 --- a/tests/auto/particles/qquickpointattractor/data/basic.qml +++ b/tests/auto/particles/qquickpointattractor/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp index a54733b33f..dd2bf22cfc 100644 --- a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp +++ b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickpointdirection/data/basic.qml b/tests/auto/particles/qquickpointdirection/data/basic.qml index ed86c4013c..2453055abb 100644 --- a/tests/auto/particles/qquickpointdirection/data/basic.qml +++ b/tests/auto/particles/qquickpointdirection/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp index 0607bf8a3c..084c685d76 100644 --- a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp +++ b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickrectangleextruder/data/basic.qml b/tests/auto/particles/qquickrectangleextruder/data/basic.qml index b3020394bc..bfdd7e01e9 100644 --- a/tests/auto/particles/qquickrectangleextruder/data/basic.qml +++ b/tests/auto/particles/qquickrectangleextruder/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp index 3589c103c3..46480f996e 100644 --- a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp +++ b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickspritegoal/data/basic.qml b/tests/auto/particles/qquickspritegoal/data/basic.qml index 65b6ef7ad4..b8385dcdda 100644 --- a/tests/auto/particles/qquickspritegoal/data/basic.qml +++ b/tests/auto/particles/qquickspritegoal/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp index 6816b19c6a..33b4f43270 100644 --- a/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp +++ b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicktargetdirection/data/basic.qml b/tests/auto/particles/qquicktargetdirection/data/basic.qml index 2152b34217..fa8d58503a 100644 --- a/tests/auto/particles/qquicktargetdirection/data/basic.qml +++ b/tests/auto/particles/qquicktargetdirection/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp index 1953685c30..bb89a0119a 100644 --- a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp +++ b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicktrailemitter/data/basic.qml b/tests/auto/particles/qquicktrailemitter/data/basic.qml index 04252558f9..24e354a3f0 100644 --- a/tests/auto/particles/qquicktrailemitter/data/basic.qml +++ b/tests/auto/particles/qquicktrailemitter/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp index 6440677365..f484da34d8 100644 --- a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp +++ b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickturbulence/data/basic.qml b/tests/auto/particles/qquickturbulence/data/basic.qml index a45522ef7c..9815a3ac4d 100644 --- a/tests/auto/particles/qquickturbulence/data/basic.qml +++ b/tests/auto/particles/qquickturbulence/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp index f8b838f120..bc7fc2bacd 100644 --- a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp +++ b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickwander/data/basic.qml b/tests/auto/particles/qquickwander/data/basic.qml index b8ecc10d56..636dcb0fe1 100644 --- a/tests/auto/particles/qquickwander/data/basic.qml +++ b/tests/auto/particles/qquickwander/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/qquickwander/tst_qquickwander.cpp b/tests/auto/particles/qquickwander/tst_qquickwander.cpp index 17583ae7fc..d1bc91403a 100644 --- a/tests/auto/particles/qquickwander/tst_qquickwander.cpp +++ b/tests/auto/particles/qquickwander/tst_qquickwander.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/particles/shared/particlestestsshared.h b/tests/auto/particles/shared/particlestestsshared.h index e96363b97e..81b1b31c1b 100644 --- a/tests/auto/particles/shared/particlestestsshared.h +++ b/tests/auto/particles/shared/particlestestsshared.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmldevtools/compile/tst_compile.cpp b/tests/auto/qmldevtools/compile/tst_compile.cpp index fe66cb3b45..a523aeb044 100644 --- a/tests/auto/qmldevtools/compile/tst_compile.cpp +++ b/tests/auto/qmldevtools/compile/tst_compile.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/borderimage/InvalidSciFile.qml b/tests/auto/qmltest/borderimage/InvalidSciFile.qml index 6ccf08559a..5ead99b3bc 100644 --- a/tests/auto/qmltest/borderimage/InvalidSciFile.qml +++ b/tests/auto/qmltest/borderimage/InvalidSciFile.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/borderimage/tst_borderimage.qml b/tests/auto/qmltest/borderimage/tst_borderimage.qml index e8e9c238c8..27cb75fd30 100644 --- a/tests/auto/qmltest/borderimage/tst_borderimage.qml +++ b/tests/auto/qmltest/borderimage/tst_borderimage.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/buttonclick/Button.qml b/tests/auto/qmltest/buttonclick/Button.qml index 5c21ac8552..7322c944c5 100644 --- a/tests/auto/qmltest/buttonclick/Button.qml +++ b/tests/auto/qmltest/buttonclick/Button.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/buttonclick/tst_buttonclick.qml b/tests/auto/qmltest/buttonclick/tst_buttonclick.qml index 249c668a17..85fadde0ae 100644 --- a/tests/auto/qmltest/buttonclick/tst_buttonclick.qml +++ b/tests/auto/qmltest/buttonclick/tst_buttonclick.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/createbenchmark/item.qml b/tests/auto/qmltest/createbenchmark/item.qml index a9e5672f1e..0ccc0f12f3 100644 --- a/tests/auto/qmltest/createbenchmark/item.qml +++ b/tests/auto/qmltest/createbenchmark/item.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml b/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml index a4ffb683d9..c1543f27e6 100644 --- a/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml +++ b/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/events/tst_events.qml b/tests/auto/qmltest/events/tst_events.qml index e3d0b13579..8dcafaab8f 100644 --- a/tests/auto/qmltest/events/tst_events.qml +++ b/tests/auto/qmltest/events/tst_events.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/events/tst_wheel.qml b/tests/auto/qmltest/events/tst_wheel.qml index 1e1a7b2965..bc5a1b4df6 100644 --- a/tests/auto/qmltest/events/tst_wheel.qml +++ b/tests/auto/qmltest/events/tst_wheel.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/qdeclarativebinding/tst_binding.qml b/tests/auto/qmltest/qdeclarativebinding/tst_binding.qml index f9d80a2ef0..2223e5b1ee 100644 --- a/tests/auto/qmltest/qdeclarativebinding/tst_binding.qml +++ b/tests/auto/qmltest/qdeclarativebinding/tst_binding.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/qdeclarativebinding/tst_binding2.qml b/tests/auto/qmltest/qdeclarativebinding/tst_binding2.qml index 1e55d0ae66..a2b21d6053 100644 --- a/tests/auto/qmltest/qdeclarativebinding/tst_binding2.qml +++ b/tests/auto/qmltest/qdeclarativebinding/tst_binding2.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/selftests/tst_compare.qml b/tests/auto/qmltest/selftests/tst_compare.qml index 2aa46724a4..fe6baf07c6 100644 --- a/tests/auto/qmltest/selftests/tst_compare.qml +++ b/tests/auto/qmltest/selftests/tst_compare.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml index 6f766efd08..546c43ad84 100644 --- a/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml +++ b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/selftests/tst_selftests.qml b/tests/auto/qmltest/selftests/tst_selftests.qml index 3da615d8c2..0623a1016d 100644 --- a/tests/auto/qmltest/selftests/tst_selftests.qml +++ b/tests/auto/qmltest/selftests/tst_selftests.qml @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp index a1e8c039e4..635f035398 100644 --- a/tests/auto/qmltest/tst_qmltest.cpp +++ b/tests/auto/qmltest/tst_qmltest.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/examples/tst_examples.cpp b/tests/auto/qtquick1/examples/tst_examples.cpp index 6c1bfd9f39..93ddce4874 100644 --- a/tests/auto/qtquick1/examples/tst_examples.cpp +++ b/tests/auto/qtquick1/examples/tst_examples.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp b/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp index 356c924c40..e6a905d321 100644 --- a/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp +++ b/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/qtquick1/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 3e6908fb88..bd8c0b13b5 100644 --- a/tests/auto/qtquick1/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/qtquick1/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/qtquick1/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 7dd51c05d5..86c185c079 100644 --- a/tests/auto/qtquick1/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/qtquick1/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 17d89f1f21..3209a8490b 100644 --- a/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/qtquick1/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/qtquick1/qdeclarativeapplication/tst_qdeclarativeapplication.cpp index 222f06fdec..939eaeed2d 100644 --- a/tests/auto/qtquick1/qdeclarativeapplication/tst_qdeclarativeapplication.cpp +++ b/tests/auto/qtquick1/qdeclarativeapplication/tst_qdeclarativeapplication.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index ae9eebf98f..0fc82df3e7 100644 --- a/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp index 87787c12f5..558e9db228 100644 --- a/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp +++ b/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 720d5197ad..8e59b5b9e0 100644 --- a/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/qtquick1/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index 810835ddb6..299d4b870a 100644 --- a/tests/auto/qtquick1/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/qtquick1/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/qtquick1/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 417ec26236..31b9ec6fc8 100644 --- a/tests/auto/qtquick1/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/qtquick1/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/qtquick1/qdeclarativeflipable/tst_qdeclarativeflipable.cpp index 0c5fb64407..bbb0f427a7 100644 --- a/tests/auto/qtquick1/qdeclarativeflipable/tst_qdeclarativeflipable.cpp +++ b/tests/auto/qtquick1/qdeclarativeflipable/tst_qdeclarativeflipable.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/qtquick1/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp index 9e2b9becb2..b2984610a4 100644 --- a/tests/auto/qtquick1/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp +++ b/tests/auto/qtquick1/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/qtquick1/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index ad39112485..6c0a3956fe 100644 --- a/tests/auto/qtquick1/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/qtquick1/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/qtquick1/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7b3a1b435d..f198510ad5 100644 --- a/tests/auto/qtquick1/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/qtquick1/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/qtquick1/qdeclarativeimage/tst_qdeclarativeimage.cpp index 76e2e23faa..2196157064 100644 --- a/tests/auto/qtquick1/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/qtquick1/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/qtquick1/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 21e41333af..39ca8c71d8 100644 --- a/tests/auto/qtquick1/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/qtquick1/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp index 00c3157be7..6f3e7c9a41 100644 --- a/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp b/tests/auto/qtquick1/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp index 2c539525b6..819892f3f8 100644 --- a/tests/auto/qtquick1/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp +++ b/tests/auto/qtquick1/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/qtquick1/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 01be05ad37..2fcdbd5805 100644 --- a/tests/auto/qtquick1/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/qtquick1/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.cpp b/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.cpp index 1ebb4dc544..075170efb0 100644 --- a/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.cpp +++ b/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.h b/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.h index 09a2bbd11a..168dee8c5e 100644 --- a/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.h +++ b/tests/auto/qtquick1/qdeclarativelistview/incrementalmodel.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp index cb3d791732..c5d8e167a8 100644 --- a/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/qtquick1/qdeclarativeloader/tst_qdeclarativeloader.cpp index cfb8534b24..80ed072760 100644 --- a/tests/auto/qtquick1/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/qtquick1/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/qtquick1/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index fc6a26d4d6..e9b81a18bd 100644 --- a/tests/auto/qtquick1/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/qtquick1/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeparticles/tst_qdeclarativeparticles.cpp b/tests/auto/qtquick1/qdeclarativeparticles/tst_qdeclarativeparticles.cpp index 552b8676fe..c4230bb492 100644 --- a/tests/auto/qtquick1/qdeclarativeparticles/tst_qdeclarativeparticles.cpp +++ b/tests/auto/qtquick1/qdeclarativeparticles/tst_qdeclarativeparticles.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/qtquick1/qdeclarativepathview/tst_qdeclarativepathview.cpp index 9b3ac2323f..87d4825014 100644 --- a/tests/auto/qtquick1/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/qtquick1/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/qtquick1/qdeclarativepincharea/tst_qdeclarativepincharea.cpp index 1af73f9025..3cb34689a9 100644 --- a/tests/auto/qtquick1/qdeclarativepincharea/tst_qdeclarativepincharea.cpp +++ b/tests/auto/qtquick1/qdeclarativepincharea/tst_qdeclarativepincharea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/qtquick1/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index dbfad1c4ad..d1a887a02c 100644 --- a/tests/auto/qtquick1/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/qtquick1/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/qtquick1/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 92398f95ee..146dca8a5b 100644 --- a/tests/auto/qtquick1/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/qtquick1/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/qtquick1/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp index 02dfd68aea..aa558375b5 100644 --- a/tests/auto/qtquick1/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp +++ b/tests/auto/qtquick1/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp b/tests/auto/qtquick1/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp index a91abd0bea..9a9a7d2751 100644 --- a/tests/auto/qtquick1/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp +++ b/tests/auto/qtquick1/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp index 3c0766d262..5ff889e6cd 100644 --- a/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/qtquick1/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 41a6e5da5a..d005b90d7d 100644 --- a/tests/auto/qtquick1/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/qtquick1/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp index fa49cd8595..e33eac9b67 100644 --- a/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 39ca3cf5fd..df9417f349 100644 --- a/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 8355525314..56ae68ae8e 100644 --- a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/qtquick1/qdeclarativetimer/tst_qdeclarativetimer.cpp index d92034462b..38cab4522c 100644 --- a/tests/auto/qtquick1/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/qtquick1/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/qtquick1/qdeclarativeview/tst_qdeclarativeview.cpp index d3287fc3c5..a00df3a46a 100644 --- a/tests/auto/qtquick1/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/qtquick1/qdeclarativeview/tst_qdeclarativeview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/qtquick1/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index c76f89833b..03ac0d2b11 100644 --- a/tests/auto/qtquick1/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/qtquick1/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/qtquick1/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index c249be75c5..704636fe90 100644 --- a/tests/auto/qtquick1/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/qtquick1/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/qtquick1/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index d8d6d27c56..3b12ceff64 100644 --- a/tests/auto/qtquick1/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/examples/tst_examples.cpp b/tests/auto/qtquick2/examples/tst_examples.cpp index 5672cb4658..006ebddbb6 100644 --- a/tests/auto/qtquick2/examples/tst_examples.cpp +++ b/tests/auto/qtquick2/examples/tst_examples.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/geometry/tst_geometry.cpp b/tests/auto/qtquick2/geometry/tst_geometry.cpp index 23e37dae2f..a947de2268 100644 --- a/tests/auto/qtquick2/geometry/tst_geometry.cpp +++ b/tests/auto/qtquick2/geometry/tst_geometry.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the Qt scene graph research project. ** diff --git a/tests/auto/qtquick2/nodes/tst_nodestest.cpp b/tests/auto/qtquick2/nodes/tst_nodestest.cpp index 7aaff3fe91..ce9848e0aa 100644 --- a/tests/auto/qtquick2/nodes/tst_nodestest.cpp +++ b/tests/auto/qtquick2/nodes/tst_nodestest.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the Qt scene graph research project. ** diff --git a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 683f1c7603..b2c07526ff 100644 --- a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp index edf206acdc..7047321557 100644 --- a/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp +++ b/tests/auto/qtquick2/qdeclarativeapplication/tst_qdeclarativeapplication.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index e512f6c5c1..26a73d3bca 100644 --- a/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/qtquick2/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 39e9fa3389..39606a7775 100644 --- a/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/qtquick2/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp index c2682358b3..655b2541cb 100644 --- a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp +++ b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 596ac3d337..95a06c81bf 100644 --- a/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/qtquick2/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp index 3243c6ff8a..16a0c1ac27 100644 --- a/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp +++ b/tests/auto/qtquick2/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp b/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp index 77778a677c..eae7d9db65 100644 --- a/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp +++ b/tests/auto/qtquick2/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp index 4d5df12e0b..6edd61af09 100644 --- a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp index a0fe195f2e..a64caafcc8 100644 --- a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp +++ b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 9177107d16..1de6267a93 100644 --- a/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/qtquick2/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp index b7045a1317..61500c617a 100644 --- a/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/qtquick2/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 35c0bba717..d4a2246538 100644 --- a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml b/tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml index 22cdad1377..22cdad1377 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/data/checkbuttons.qml +++ b/tests/auto/qtquick2/qquickaccessible/data/checkbuttons.qml diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml b/tests/auto/qtquick2/qquickaccessible/data/hittest.qml index 52b652e233..e6ce8b1882 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/data/hittest.qml +++ b/tests/auto/qtquick2/qquickaccessible/data/hittest.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml b/tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml index df19231703..df19231703 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/data/pushbutton.qml +++ b/tests/auto/qtquick2/qquickaccessible/data/pushbutton.qml diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml b/tests/auto/qtquick2/qquickaccessible/data/statictext.qml index a0821cfc4d..a0821cfc4d 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/data/statictext.qml +++ b/tests/auto/qtquick2/qquickaccessible/data/statictext.qml diff --git a/tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml b/tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml index 937686974b..937686974b 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/data/widgets/TextRect.qml +++ b/tests/auto/qtquick2/qquickaccessible/data/widgets/TextRect.qml diff --git a/tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro b/tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro index ee93c10da2..dc32316e28 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/qdeclarativeaccessibility.pro +++ b/tests/auto/qtquick2/qquickaccessible/qquickaccessible.pro @@ -1,23 +1,19 @@ CONFIG += testcase -TARGET = tst_qdeclarativeaccessibility -QT += declarative-private network qtquick1-private testlib +TARGET = tst_qquickaccessible +QT += declarative-private network quick-private testlib macx:CONFIG -= app_bundle -SOURCES += tst_qdeclarativeaccessibility.cpp +SOURCES += tst_qquickaccessible.cpp include (../../shared/util.pri) +OTHER_FILES += data/checkbuttons.qml +OTHER_FILES += data/hittest.qml OTHER_FILES += data/pushbutton.qml OTHER_FILES += data/statictext.qml -symbian: { - importFiles.files = data - importFiles.path = . - DEPLOYMENT += importFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +DEFINES += SRCDIR=\\\"$$PWD\\\" CONFIG += parallel_test @@ -27,6 +23,3 @@ wince*: { DEPLOYMENT += accessneeded } - - - diff --git a/tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp b/tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp index 0688edf698..d2967a1453 100644 --- a/tests/auto/declarative/qdeclarativeaccessibility/tst_qdeclarativeaccessibility.cpp +++ b/tests/auto/qtquick2/qquickaccessible/tst_qquickaccessible.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -45,100 +45,18 @@ #include <QtGui/qaccessible.h> -#include <QtQuick1/qdeclarativeview.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativeproperty.h> -#include <private/qdeclarativeaccessibleattached_p.h> +#include <QtQuick/private/qquickaccessibleattached_p.h> #include "../../shared/util.h" typedef QSharedPointer<QAccessibleInterface> QAI; - -static inline bool verifyChild(QWidget *child, QAccessibleInterface *iface, - int index, const QRect &domain) -{ - if (!child) { - qWarning("tst_QAccessibility::verifyChild: null pointer to child."); - return false; - } - - if (!iface) { - qWarning("tst_QAccessibility::verifyChild: null pointer to interface."); - return false; - } - - // Verify that we get a valid QAccessibleInterface for the child. - QAccessibleInterface *childInterface = QAccessible::queryAccessibleInterface(child); - if (!childInterface) { - qWarning("tst_QAccessibility::verifyChild: Failed to retrieve interface for child."); - return false; - } - - // QAccessibleInterface::indexOfChild(): - // Verify that indexOfChild() returns an index equal to the index passed in - int indexFromIndexOfChild = iface->indexOfChild(childInterface); - delete childInterface; - if (indexFromIndexOfChild != index) { - qWarning("tst_QAccessibility::verifyChild (indexOfChild()):"); - qWarning() << "Expected:" << index; - qWarning() << "Actual: " << indexFromIndexOfChild; - return false; - } - - // Navigate to child, compare its object and role with the interface from queryAccessibleInterface(child). - QAccessibleInterface *navigatedChildInterface = iface->child(index - 1); - if (navigatedChildInterface == 0) - return false; - - const QRect rectFromInterface = navigatedChildInterface->rect(); - delete navigatedChildInterface; - - // QAccessibleInterface::childAt(): - // Calculate global child position and check that the interface - // returns the correct index for that position. - QPoint globalChildPos = child->mapToGlobal(QPoint(0, 0)); - QAccessibleInterface *childAtInterface = iface->childAt(globalChildPos.x(), globalChildPos.y()); - if (!childAtInterface) { - qWarning("tst_QAccessibility::verifyChild (childAt()):"); - qWarning() << "Expected:" << childInterface; - qWarning() << "Actual: no child"; - return false; - } - if (childAtInterface->object() != childInterface->object()) { - qWarning("tst_QAccessibility::verifyChild (childAt()):"); - qWarning() << "Expected:" << childInterface; - qWarning() << "Actual: " << childAtInterface; - return false; - } - delete childInterface; - delete childAtInterface; - - // Verify that the child is within its domain. - if (!domain.contains(rectFromInterface)) { - qWarning("tst_QAccessibility::verifyChild: Child is not within its domain."); - return false; - } - - return true; -} - -static inline int indexOfChild(QAccessibleInterface *parentInterface, QWidget *childWidget) -{ - if (!parentInterface || !childWidget) - return -1; - QAccessibleInterface *childInterface = QAccessible::queryAccessibleInterface(childWidget); - if (!childInterface) - return -1; - int index = parentInterface->indexOfChild(childInterface); - delete childInterface; - return index; -} - #define EXPECT(cond) \ do { \ if (!errorAt && !(cond)) { \ @@ -166,15 +84,6 @@ static int verifyHierarchy(QAccessibleInterface *iface) EXPECT(iface->object() == parent->object()); delete parent; - // navigate Sibling... -// if (middleChild) { -// entry = if2->navigate(QAccessible::Sibling, middle, &if3); -// EXPECT(entry == 0 && if3->object() == middleChild->object()); -// if (entry == 0) -// delete if3; -// EXPECT(iface->indexOfChild(middleChild) == middle); -// } - // verify children... if (!errorAt) errorAt = verifyHierarchy(if2); @@ -189,12 +98,12 @@ static int verifyHierarchy(QAccessibleInterface *iface) //TESTED_FILES= -class tst_QDeclarativeAccessibility : public QDeclarativeDataTest +class tst_QQuickAccessible : public QDeclarativeDataTest { Q_OBJECT public: - tst_QDeclarativeAccessibility(); - virtual ~tst_QDeclarativeAccessibility(); + tst_QQuickAccessible(); + virtual ~tst_QQuickAccessible(); private slots: void commonTests_data(); @@ -206,17 +115,17 @@ private slots: void checkableTest(); }; -tst_QDeclarativeAccessibility::tst_QDeclarativeAccessibility() +tst_QQuickAccessible::tst_QQuickAccessible() { } -tst_QDeclarativeAccessibility::~tst_QDeclarativeAccessibility() +tst_QQuickAccessible::~tst_QQuickAccessible() { } -void tst_QDeclarativeAccessibility::commonTests_data() +void tst_QQuickAccessible::commonTests_data() { QTest::addColumn<QString>("accessibleRoleFileName"); @@ -224,7 +133,7 @@ void tst_QDeclarativeAccessibility::commonTests_data() QTest::newRow("PushButton") << SRCDIR "/data/pushbutton.qml"; } -void tst_QDeclarativeAccessibility::commonTests() +void tst_QQuickAccessible::commonTests() { QFETCH(QString, accessibleRoleFileName); @@ -288,17 +197,17 @@ QString eventName(const int ev) } } -void tst_QDeclarativeAccessibility::declarativeAttachedProperties() +void tst_QQuickAccessible::declarativeAttachedProperties() { { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import QtQuick 1.1\nItem {\n" + component.setData("import QtQuick 2.0\nItem {\n" "}", QUrl()); QObject *object = component.create(); QVERIFY(object != 0); - QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object); + QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QCOMPARE(attachedObject, static_cast<QObject*>(0)); delete object; } @@ -306,20 +215,20 @@ void tst_QDeclarativeAccessibility::declarativeAttachedProperties() // Attached property { QObject parent; - QDeclarativeAccessibleAttached *attachedObj = new QDeclarativeAccessibleAttached(&parent); + QQuickAccessibleAttached *attachedObj = new QQuickAccessibleAttached(&parent); attachedObj->name(); QVariant pp = attachedObj->property("name"); QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import QtQuick 1.1\nItem {\n" + component.setData("import QtQuick 2.0\nItem {\n" "Accessible.role: Accessible.Button\n" "}", QUrl()); QObject *object = component.create(); QVERIFY(object != 0); - QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object); + QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); if (attachedObject) { QVariant p = attachedObject->property("role"); @@ -337,7 +246,7 @@ void tst_QDeclarativeAccessibility::declarativeAttachedProperties() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import QtQuick 1.1\nItem {\n" + component.setData("import QtQuick 2.0\nItem {\n" "Accessible.role: Accessible.Button\n" "Accessible.name: \"Donald\"\n" "Accessible.description: \"Duck\"\n" @@ -345,7 +254,7 @@ void tst_QDeclarativeAccessibility::declarativeAttachedProperties() QObject *object = component.create(); QVERIFY(object != 0); - QObject *attachedObject = QDeclarativeAccessibleAttached::attachedProperties(object); + QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); if (attachedObject) { QVariant p = attachedObject->property("role"); @@ -363,7 +272,7 @@ void tst_QDeclarativeAccessibility::declarativeAttachedProperties() } -void tst_QDeclarativeAccessibility::basicPropertiesTest() +void tst_QQuickAccessible::basicPropertiesTest() { QAI app = QAI(QAccessible::queryAccessibleInterface(qApp)); QCOMPARE(app->childCount(), 0); @@ -425,7 +334,7 @@ QAI topLevelChildAt(QAccessibleInterface *iface, int x, int y) return child; } -void tst_QDeclarativeAccessibility::hitTest() +void tst_QQuickAccessible::hitTest() { QQuickView *canvas = new QQuickView; canvas->setSource(testFileUrl("hittest.qml")); @@ -471,7 +380,7 @@ void tst_QDeclarativeAccessibility::hitTest() delete canvas; } -void tst_QDeclarativeAccessibility::checkableTest() +void tst_QQuickAccessible::checkableTest() { QQuickView *canvas = new QQuickView(); canvas->setSource(testFileUrl("checkbuttons.qml")); @@ -496,6 +405,6 @@ void tst_QDeclarativeAccessibility::checkableTest() QVERIFY(!(checkBox2->state().checked)); } -QTEST_MAIN(tst_QDeclarativeAccessibility) +QTEST_MAIN(tst_QQuickAccessible) -#include "tst_qdeclarativeaccessibility.moc" +#include "tst_qquickaccessible.moc" diff --git a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp index 9725390e47..01e982f0db 100644 --- a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp +++ b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -482,7 +482,7 @@ void tst_qquickanchors::crash1() { QUrl source(testFileUrl("crash1.qml")); - QString expect = source.toString() + ":3:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column"; + QString expect = source.toString() + ":3:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); diff --git a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp index 417dd085b8..62592c1d25 100644 --- a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp index 24442a985d..3360ad97df 100644 --- a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp b/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp index 1a2eb832f2..78bf989047 100644 --- a/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp +++ b/tests/auto/qtquick2/qquickcanvas/tst_qquickcanvas.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp b/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp index 56db225b39..a620ff9b4a 100644 --- a/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp +++ b/tests/auto/qtquick2/qquickcanvasitem/tst_qquickcanvasitem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp b/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp index 9163df6c62..dd5cb229ec 100644 --- a/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/qtquick2/qquickdrag/tst_qquickdrag.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp index f8a081ff21..36b0beeb30 100644 --- a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp index 5281565220..a90870ce80 100644 --- a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp b/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp index 41f8284c22..a30980f251 100644 --- a/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp +++ b/tests/auto/qtquick2/qquickflipable/tst_qquickflipable.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp index 18c89f6371..a306a57ef9 100644 --- a/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/qtquick2/qquickfocusscope/tst_qquickfocusscope.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp index a83d8a2d08..0a6e41fc5e 100644 --- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -467,7 +467,7 @@ void tst_QQuickGridView::inserted_more() // check visibleItems.first() is in correct position QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0); QVERIFY(item0); - QCOMPARE(item0->y(), itemsOffsetAfterMove); + QCOMPARE(item0->y(), 0.0); QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; @@ -840,6 +840,7 @@ void tst_QQuickGridView::removed_more() QFETCH(int, removeIndex); QFETCH(int, removeCount); QFETCH(qreal, itemsOffsetAfterMove); + QFETCH(QString, firstVisible); QQuickText *name; QQuickText *number; @@ -868,22 +869,20 @@ void tst_QQuickGridView::removed_more() model.removeItems(removeIndex, removeCount); QTRY_COMPARE(gridview->property("count").toInt(), model.count()); - // check visibleItems.first() is in correct position - QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0); -// qApp->exec(); - QVERIFY(item0); - QCOMPARE(item0->y(), itemsOffsetAfterMove); - + QString firstName; int firstVisibleIndex = -1; QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); for (int i=0; i<items.count(); i++) { if (items[i]->y() >= contentY) { QDeclarativeExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); + QDeclarativeExpression en(qmlContext(items[i]), items[i], "name"); + firstName = en.evaluate().toString(); break; } } QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); + QCOMPARE(firstName, firstVisible); // Confirm items positioned correctly and indexes correct int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -911,21 +910,27 @@ void tst_QQuickGridView::removed_more_data() QTest::addColumn<int>("removeIndex"); QTest::addColumn<int>("removeCount"); QTest::addColumn<qreal>("itemsOffsetAfterMove"); + QTest::addColumn<QString>("firstVisible"); QTest::newRow("remove 1, before visible items") << 120.0 // show 6-23 << 3 << 1 - << 0.0; + << 0.0 << "Item7"; QTest::newRow("remove multiple, all before visible items") << 120.0 << 1 << 3 - << 60.0; // removed top row, slide down by 1 row + << 60.0 << "Item6"; // removed top row, slide down by 1 row QTest::newRow("remove multiple, all before visible items, remove item 0") << 120.0 << 0 << 4 - << 60.0; // removed top row, slide down by 1 row + << 60.0 << "Item7"; // removed top row, slide down by 1 row + + QTest::newRow("remove multiple rows, all before visible items") + << 240.0 // show 12-29 + << 1 << 7 + << 120.0 << "Item13"; // remove 3,4,5 before the visible pos, first row moves down to just before the visible pos, @@ -933,80 +938,80 @@ void tst_QQuickGridView::removed_more_data() QTest::newRow("remove multiple, mix of items from before and within visible items") << 120.0 << 3 << 5 - << 60.0; // adjust for the 1 row removed before the visible + << 60.0 << "Item8"; // adjust for the 1 row removed before the visible QTest::newRow("remove multiple, mix of items from before and within visible items, remove item 0") << 120.0 << 0 << 8 - << 60.0 * 2; // adjust for the 2 rows removed before the visible + << 60.0 * 2 << "Item8"; // adjust for the 2 rows removed before the visible QTest::newRow("remove 1, from start of visible, content at start") << 0.0 << 0 << 1 - << 0.0; + << 0.0 << "Item1"; QTest::newRow("remove multiple, from start of visible, content at start") << 0.0 << 0 << 3 - << 0.0; + << 0.0 << "Item3"; QTest::newRow("remove 1, from start of visible, content not at start") << 120.0 // show 6-23 << 4 << 1 - << 0.0; + << 0.0 << "Item7"; QTest::newRow("remove multiple, from start of visible, content not at start") << 120.0 // show 6-23 << 4 << 3 - << 0.0; + << 0.0 << "Item9"; QTest::newRow("remove 1, from middle of visible, content at start") << 0.0 << 10 << 1 - << 0.0; + << 0.0 << "Item0"; QTest::newRow("remove multiple, from middle of visible, content at start") << 0.0 << 10 << 5 - << 0.0; + << 0.0 << "Item0"; QTest::newRow("remove 1, from middle of visible, content not at start") << 120.0 // show 6-23 << 10 << 1 - << 0.0; + << 0.0 << "Item6"; QTest::newRow("remove multiple, from middle of visible, content not at start") << 120.0 // show 6-23 << 10 << 5 - << 0.0; + << 0.0 << "Item6"; QTest::newRow("remove 1, after visible, content at start") << 0.0 << 16 << 1 - << 0.0; + << 0.0 << "Item0"; QTest::newRow("remove multiple, after visible, content at start") << 0.0 << 16 << 5 - << 0.0; + << 0.0 << "Item0"; QTest::newRow("remove 1, after visible, content not at start") << 120.0 // show 6-23 << 16+4 << 1 - << 0.0; + << 0.0 << "Item6"; QTest::newRow("remove multiple, after visible, content not at start") << 120.0 // show 6-23 << 16+4 << 5 - << 0.0; + << 0.0 << "Item6"; QTest::newRow("remove multiple, mix of items from within and after visible items") << 120.0 // show 6-23 << 20 << 5 - << 0.0; + << 0.0 << "Item6"; } void tst_QQuickGridView::addOrRemoveBeforeVisible() @@ -1040,6 +1045,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() gridview->setCurrentIndex(0); qApp->processEvents(); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // scroll down until item 0 is no longer drawn // (bug not triggered if we just move using content y, since that doesn't @@ -1091,7 +1097,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible_data() QTest::addColumn<qreal>("newTopContentY"); QTest::newRow("add") << true << -60.0; - QTest::newRow("remove") << false << 0.0; + QTest::newRow("remove") << false << -60.0; } void tst_QQuickGridView::clear() @@ -1134,11 +1140,6 @@ void tst_QQuickGridView::clear() void tst_QQuickGridView::moved() { - if (QTest::currentDataTag() == QLatin1String("move 1 forwards, from non-visible -> visible") - || QTest::currentDataTag() == QLatin1String("move 1 forwards, from non-visible -> visible (move first item)")) { - QSKIP("QTBUG-23455"); - } - QFETCH(qreal, contentY); QFETCH(int, from); QFETCH(int, to); @@ -1222,13 +1223,11 @@ void tst_QQuickGridView::moved_data() << 1 << 8 << 1 << 0.0; - // skipped QTBUG-23455 QTest::newRow("move 1 forwards, from non-visible -> visible") << 120.0 // show 6-23 << 1 << 23 << 1 << 0.0; - // skipped QTBUG-23455 QTest::newRow("move 1 forwards, from non-visible -> visible (move first item)") << 120.0 // // show 6-23 << 0 << 6 << 1 @@ -1301,6 +1300,26 @@ void tst_QQuickGridView::moved_data() << 0 << 6 << 3 << 60.0; // top row moved and shifted to below 3rd row, all items should shift down by 1 row + QTest::newRow("move multiple forwards, mix of non-visible/visible") + << 120.0 + << 3 << 16 << 6 + << 60.0; // top two rows removed, third row is now the first visible + + QTest::newRow("move multiple forwards, to bottom of view") + << 0.0 + << 5 << 13 << 5 + << 0.0; + + QTest::newRow("move multiple forwards, to bottom of view, first row -> last") + << 0.0 + << 0 << 15 << 3 + << 0.0; + + QTest::newRow("move multiple forwards, to bottom of view, content y not 0") + << 120.0 + << 5+4 << 13+4 << 5 + << 0.0; + QTest::newRow("move multiple forwards, from visible -> non-visible") << 0.0 << 1 << 16 << 3 @@ -3175,6 +3194,41 @@ void tst_QQuickGridView::resizeViewAndRepaint() gridview->setHeight(100); QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10)); + // Ensure we handle -ve sizes + gridview->setHeight(-100); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 3); + + gridview->setCacheBuffer(120); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 9); + + // ensure items in cache become visible + gridview->setHeight(120); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 15); + + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); + QCOMPARE(item->isVisible(), i < 9); // inside view visible, outside not visible + } + + // ensure items outside view become invisible + gridview->setHeight(60); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 12); + + itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); + QCOMPARE(item->isVisible(), i < 6); // inside view visible, outside not visible + } + delete canvas; } diff --git a/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp b/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp index e68c1157c9..c54f5e2b24 100644 --- a/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/qtquick2/qquickimage/tst_qquickimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -693,7 +693,8 @@ void tst_qquickimage::imageCrash_QTBUG_22125() // shouldn't crash when deleting cancelled QDeclarativePixmapReplys. QTest::qWait(520); // Delay mode delays for 500 ms. - qApp->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); } /* diff --git a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp index 7e32816599..dccf055ae8 100644 --- a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -66,9 +66,23 @@ protected: virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; } virtual void mousePressEvent(QMouseEvent *event) { event->accept(); ++pressCount; } virtual void mouseReleaseEvent(QMouseEvent *event) { event->accept(); ++releaseCount; } + virtual void touchEvent(QTouchEvent *event) { event->accept(); } virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; } }; +class TestCanvas: public QQuickCanvas +{ +public: + TestCanvas() + : QQuickCanvas() + {} + + virtual bool event(QEvent *event) + { + return QQuickCanvas::event(event); + } +}; + class TestPolishItem : public QQuickItem { Q_OBJECT @@ -124,6 +138,7 @@ private slots: void enabled(); void mouseGrab(); + void touchEventAccept(); void polishOutsideAnimation(); void polishOnCompleted(); @@ -862,6 +877,31 @@ void tst_qquickitem::mouseGrab() delete canvas; } +void tst_qquickitem::touchEventAccept() +{ + TestCanvas *canvas = new TestCanvas; + canvas->resize(100, 100); + canvas->show(); + + TestItem *item = new TestItem; + item->setSize(QSizeF(100, 100)); + item->setParentItem(canvas->rootItem()); + + static QTouchDevice* device = new QTouchDevice; + device->setType(QTouchDevice::TouchScreen); + QWindowSystemInterface::registerTouchDevice(device); + + QTouchEvent *event = new QTouchEvent(QEvent::TouchBegin, device); + + bool accepted = canvas->event(event); + + QVERIFY(accepted && event->isAccepted()); + + delete event; + delete item; + delete canvas; +} + void tst_qquickitem::polishOutsideAnimation() { QQuickCanvas *canvas = new QQuickCanvas; diff --git a/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml b/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml index 9d88d9df1d..282dbab9dd 100644 --- a/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml +++ b/tests/auto/qtquick2/qquickitem2/data/mapCoordinates.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp index 556f629618..0060dc7d3e 100644 --- a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp index 767926df98..c4bd7c12d8 100644 --- a/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/qtquick2/qquickitemlayer/tst_qquickitemlayer.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp b/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp index 452be57aa6..f950134848 100644 --- a/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp +++ b/tests/auto/qtquick2/qquicklistview/incrementalmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquicklistview/incrementalmodel.h b/tests/auto/qtquick2/qquicklistview/incrementalmodel.h index 09a2bbd11a..168dee8c5e 100644 --- a/tests/auto/qtquick2/qquicklistview/incrementalmodel.h +++ b/tests/auto/qtquick2/qquicklistview/incrementalmodel.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index ccdc49e00f..0fa6348026 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -1359,6 +1359,7 @@ void tst_QQuickListView::moved(const QUrl &source) QQuickListView *listview = findItem<QQuickListView>(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); QTRY_VERIFY(contentItem != 0); @@ -1496,6 +1497,26 @@ void tst_QQuickListView::moved_data() << 0 << 5 << 3 << 20.0 * 3; // moving 3 from above the content y should adjust y positions accordingly + QTest::newRow("move multiple forwards, mix of non-visible/visible") + << 40.0 + << 1 << 16 << 2 + << 20.0; // item 1,2 are removed, item 3 is now first visible + + QTest::newRow("move multiple forwards, to bottom of view") + << 0.0 + << 5 << 13 << 3 + << 0.0; + + QTest::newRow("move multiple forwards, to bottom of view, first->last") + << 0.0 + << 0 << 13 << 3 + << 0.0; + + QTest::newRow("move multiple forwards, to bottom of view, content y not 0") + << 80.0 + << 5+4 << 13+4 << 3 + << 0.0; + QTest::newRow("move multiple forwards, from visible -> non-visible") << 0.0 << 1 << 16 << 3 @@ -1940,8 +1961,8 @@ void tst_QQuickListView::spacing() QTRY_VERIFY(listview->spacing() == 10); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 11); + for (int i = 0; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QTRY_VERIFY(item); @@ -1951,8 +1972,8 @@ void tst_QQuickListView::spacing() listview->setSpacing(0); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() >= 16); + for (int i = 0; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QTRY_VERIFY(item); @@ -2243,7 +2264,7 @@ void tst_QQuickListView::sectionsPositioning() model.modifyItem(2, "Three", "aaa"); model.modifyItem(3, "Four", "aaa"); model.modifyItem(4, "Five", "aaa"); - QTest::qWait(300); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->currentSection(), QString("aaa")); @@ -2254,8 +2275,7 @@ void tst_QQuickListView::sectionsPositioning() QTRY_COMPARE(item->y(), qreal(i*20*6)); } - topItem = findVisibleChild(contentItem, "sect_aaa"); // section header - QVERIFY(topItem); + QTRY_VERIFY(topItem = findVisibleChild(contentItem, "sect_aaa")); // section header QCOMPARE(topItem->y(), 10.); // remove section boundary @@ -3576,6 +3596,7 @@ void tst_QQuickListView::resizeView() ctxt->setContextProperty("testObject", testObject); canvas->setSource(testFileUrl("listviewtest.qml")); + canvas->show(); qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(canvas->rootObject(), "list"); @@ -3602,6 +3623,40 @@ void tst_QQuickListView::resizeView() QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); QCOMPARE(heightRatio.toReal(), 0.25); + // Ensure we handle -ve sizes + listview->setHeight(-100); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 1); + + listview->setCacheBuffer(200); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 11); + + // ensure items in cache become visible + listview->setHeight(200); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 21); + + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + QCOMPARE(item->isVisible(), i < 11); // inside view visible, outside not visible + } + + // ensure items outside view become invisible + listview->setHeight(100); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 16); + + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + QCOMPARE(item->isVisible(), i < 6); // inside view visible, outside not visible + } + delete canvas; delete testObject; } diff --git a/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp b/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp index 74144d5348..c9880751d6 100644 --- a/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/qtquick2/qquickloader/tst_qquickloader.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -762,7 +762,8 @@ void tst_QQuickLoader::deleteComponentCrash() QCOMPARE(loader->item()->objectName(), QLatin1String("blue")); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - qApp->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); QVERIFY(loader->source() == testFileUrl("BlueRect.qml")); diff --git a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp index 27f3f0abc7..bfbb6b22ae 100644 --- a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 837c31f073..0a0f69448d 100644 --- a/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/qtquick2/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp index 8c6dd19e5b..213d6609c0 100644 --- a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp index 53d7c2c2ce..1974c389e0 100644 --- a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp index 441c343927..5fa0c7f665 100644 --- a/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/qtquick2/qquickpositioners/tst_qquickpositioners.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -1206,14 +1206,14 @@ void tst_qquickpositioners::test_conflictinganchors() component.setData("import QtQuick 2.0\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); + QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.")); warningMessage.clear(); delete item; component.setData("import QtQuick 2.0\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); + QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.")); warningMessage.clear(); delete item; @@ -1227,14 +1227,14 @@ void tst_qquickpositioners::test_conflictinganchors() component.setData("import QtQuick 2.0\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); + QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function.")); warningMessage.clear(); delete item; component.setData("import QtQuick 2.0\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); + QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function.")); warningMessage.clear(); delete item; @@ -1248,27 +1248,27 @@ void tst_qquickpositioners::test_conflictinganchors() component.setData("import QtQuick 2.0\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); + QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function.")); warningMessage.clear(); delete item; component.setData("import QtQuick 2.0\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); + QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function.")); warningMessage.clear(); delete item; component.setData("import QtQuick 2.0\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); + QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function.")); delete item; component.setData("import QtQuick 2.0\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); + QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function.")); qInstallMsgHandler(oldMsgHandler); delete item; } @@ -1444,7 +1444,8 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() row->metaObject()->invokeMethod(row, "destroySubRect"); - qApp->processEvents(QEventLoop::DeferredDeletion); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::processEvents(); QTRY_VERIFY(rect1->property("index").toInt() == 1); QTRY_VERIFY(rect1->property("firstItem").toBool() == false); diff --git a/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp index ba93a62ed5..eb8a3ab226 100644 --- a/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/qtquick2/qquickrepeater/tst_qquickrepeater.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickscreen/data/screen.qml b/tests/auto/qtquick2/qquickscreen/data/screen.qml index 971975f892..780b22f23d 100644 --- a/tests/auto/qtquick2/qquickscreen/data/screen.qml +++ b/tests/auto/qtquick2/qquickscreen/data/screen.qml @@ -6,6 +6,6 @@ Item { height: 100 property int w: Window.Screen.width property int h: Window.Screen.height - property int curOrientation: Window.Screen.currentOrientation + property int curOrientation: Window.Screen.orientation property int priOrientation: Window.Screen.primaryOrientation } diff --git a/tests/auto/qtquick2/qquickscreen/qquickscreen.pro b/tests/auto/qtquick2/qquickscreen/qquickscreen.pro index 9e84512264..6d0a5e1650 100644 --- a/tests/auto/qtquick2/qquickscreen/qquickscreen.pro +++ b/tests/auto/qtquick2/qquickscreen/qquickscreen.pro @@ -7,4 +7,4 @@ include (../../shared/util.pri) macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private declarative-private testlib +QT += core-private gui-private declarative-private testlib quick-private diff --git a/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp b/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp index 2d455911b2..fdb27302ae 100644 --- a/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp +++ b/tests/auto/qtquick2/qquickscreen/tst_qquickscreen.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -68,7 +68,7 @@ void tst_qquickscreen::basicProperties() QCOMPARE(screen->size().width(), root->property("w").toInt()); QCOMPARE(screen->size().height(), root->property("h").toInt()); - QCOMPARE(int(screen->currentOrientation()), root->property("curOrientation").toInt()); + QCOMPARE(int(screen->orientation()), root->property("curOrientation").toInt()); QCOMPARE(int(screen->primaryOrientation()), root->property("priOrientation").toInt()); } diff --git a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp index 3287b8ccdb..d08281933d 100644 --- a/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp +++ b/tests/auto/qtquick2/qquickshadereffect/tst_qquickshadereffect.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -89,52 +89,8 @@ private: OpacityPresent = 0x08, PropertyPresent = 0x10 }; - - static void installMsgHandler(); - static void uninstallMsgHandler(); - static void msgHandler(QtMsgType type, const char *msg); - static void expectWarning(const char *msg); - - static QtMsgHandler originalMsgHandler; - static QByteArray actualWarnings; - static QByteArray expectedWarnings; }; -QtMsgHandler tst_qquickshadereffect::originalMsgHandler = 0; -QByteArray tst_qquickshadereffect::actualWarnings; -QByteArray tst_qquickshadereffect::expectedWarnings; - -void tst_qquickshadereffect::installMsgHandler() -{ - Q_ASSERT(originalMsgHandler == 0); - originalMsgHandler = qInstallMsgHandler(msgHandler); - actualWarnings.clear(); - expectedWarnings.clear(); -} - -void tst_qquickshadereffect::uninstallMsgHandler() -{ - Q_ASSERT(originalMsgHandler != 0); - qInstallMsgHandler(originalMsgHandler); - originalMsgHandler = 0; - QCOMPARE(QString(actualWarnings), QString(expectedWarnings)); // QString for sensible output. -} - -void tst_qquickshadereffect::msgHandler(QtMsgType type, const char *msg) -{ - Q_ASSERT(originalMsgHandler != 0); - if (type == QtWarningMsg) - actualWarnings.append(msg).append('\n'); - originalMsgHandler(type, msg); -} - -void tst_qquickshadereffect::expectWarning(const char *msg) -{ - Q_ASSERT(originalMsgHandler != 0); - expectedWarnings.append(msg).append('\n'); - QTest::ignoreMessage(QtWarningMsg, msg); -} - tst_qquickshadereffect::tst_qquickshadereffect() { } @@ -295,21 +251,20 @@ void tst_qquickshadereffect::lookThroughShaderCode() TestShaderEffect item; QVERIFY(!item.isConnected(SIGNAL(dummyChanged()))); // Nothing connected yet. - installMsgHandler(); + QString expected; if ((presenceFlags & VertexPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Vertex\'."); + expected += "Warning: Missing reference to \'qt_Vertex\'.\n"; if ((presenceFlags & TexCoordPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_MultiTexCoord0\'."); + expected += "Warning: Missing reference to \'qt_MultiTexCoord0\'.\n"; if ((presenceFlags & MatrixPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Matrix\'."); + expected += "Warning: Missing reference to \'qt_Matrix\'.\n"; if ((presenceFlags & OpacityPresent) == 0) - expectWarning("QQuickShaderEffect: Missing reference to \'qt_Opacity\'."); + expected += "Warning: Missing reference to \'qt_Opacity\'.\n"; item.setVertexShader(vertexShader); item.setFragmentShader(fragmentShader); item.ensureCompleted(); - - uninstallMsgHandler(); + QCOMPARE(item.parseLog(), expected); // If the uniform was successfully parsed, the notify signal has been connected to an update slot. QCOMPARE(item.isConnected(SIGNAL(dummyChanged())), (presenceFlags & PropertyPresent) != 0); diff --git a/tests/auto/qtquick2/qquickspriteimage/data/advance.qml b/tests/auto/qtquick2/qquickspriteimage/data/advance.qml new file mode 100644 index 0000000000..5029786849 --- /dev/null +++ b/tests/auto/qtquick2/qquickspriteimage/data/advance.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + color: "black" + width: 320 + height: 320 + + SpriteImage { + objectName: "sprite" + sprites: [Sprite { + name: "firstState" + source: "squarefacesprite.png" + frames: 3 + duration: -1 + to: {"secondState":1} + }, Sprite { + name: "secondState" + source: "squarefacesprite.png" + frames: 6 + duration: -1 + } ] + width: 160 + height: 160 + } +} diff --git a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml b/tests/auto/qtquick2/qquickspriteimage/data/basic.qml index c68d2e0779..7cdd4ead32 100644 --- a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml +++ b/tests/auto/qtquick2/qquickspriteimage/data/basic.qml @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp b/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp index d46a5c42cb..f7b27cf069 100644 --- a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp +++ b/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -51,6 +51,7 @@ public: private slots: void test_properties(); + void test_framerateAdvance();//Separate codepath for QQuickSpriteEngine }; void tst_qquickspriteimage::test_properties() @@ -76,6 +77,22 @@ void tst_qquickspriteimage::test_properties() delete canvas; } +void tst_qquickspriteimage::test_framerateAdvance() +{ + QQuickView *canvas = new QQuickView(0); + + canvas->setSource(testFileUrl("advance.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QVERIFY(canvas->rootObject()); + QQuickSpriteImage* sprite = canvas->rootObject()->findChild<QQuickSpriteImage*>("sprite"); + QVERIFY(sprite); + + QTRY_COMPARE(sprite->currentSprite(), QLatin1String("secondState")); + delete canvas; +} + QTEST_MAIN(tst_qquickspriteimage) #include "tst_qquickspriteimage.moc" diff --git a/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml b/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml new file mode 100644 index 0000000000..8de7364d08 --- /dev/null +++ b/tests/auto/qtquick2/qquicktext/data/embeddedImagesLocalRelative.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Text { + textFormat: Text.RichText + text: "<img src='exists.png'>" + baseUrl: "http/" +} diff --git a/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml b/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml new file mode 100644 index 0000000000..cee19740f9 --- /dev/null +++ b/tests/auto/qtquick2/qquicktext/data/embeddedImagesRemoteRelative.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Text { + textFormat: Text.RichText + text: "<img src='exists.png'>" + baseUrl: "http://127.0.0.1:14453/text.html" +} diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index 0e8eab18be..a2c4afd668 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QtTest/QSignalSpy> #include <QTextDocument> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> @@ -74,6 +75,7 @@ private slots: void alignments_data(); void alignments(); + void baseUrl(); void embeddedImages_data(); void embeddedImages(); @@ -1281,6 +1283,32 @@ void tst_qquicktext::clickLink() } } +void tst_qquicktext::baseUrl() +{ + QUrl localUrl("file:///tests/text.qml"); + QUrl remoteUrl("http://qt.nokia.com/test.qml"); + + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import QtQuick 2.0\n Text {}", localUrl); + QQuickText *textObject = qobject_cast<QQuickText *>(textComponent.create()); + + QCOMPARE(textObject->baseUrl(), localUrl); + + QSignalSpy spy(textObject, SIGNAL(baseUrlChanged())); + + textObject->setBaseUrl(localUrl); + QCOMPARE(textObject->baseUrl(), localUrl); + QCOMPARE(spy.count(), 0); + + textObject->setBaseUrl(remoteUrl); + QCOMPARE(textObject->baseUrl(), remoteUrl); + QCOMPARE(spy.count(), 1); + + textObject->resetBaseUrl(); + QCOMPARE(textObject->baseUrl(), localUrl); + QCOMPARE(spy.count(), 2); +} + void tst_qquicktext::embeddedImages_data() { QTest::addColumn<QUrl>("qmlfile"); @@ -1288,9 +1316,11 @@ void tst_qquicktext::embeddedImages_data() QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << ""; QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml") << testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + testFileUrl("http/notexists.png").toString(); + QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << ""; QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << ""; QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml") << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found"; + QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << ""; } void tst_qquicktext::embeddedImages() diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml new file mode 100644 index 0000000000..150f7bd898 --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocal.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='http/exists.png'>" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml new file mode 100644 index 0000000000..067b6d72da --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalError.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='http/notexists.png'>" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml new file mode 100644 index 0000000000..200ded196d --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesLocalRelative.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='exists.png'>" + baseUrl: "http/" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml new file mode 100644 index 0000000000..a823882692 --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemote.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='http://127.0.0.1:42332/exists.png'>" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml new file mode 100644 index 0000000000..c6172b68dc --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteError.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='http://127.0.0.1:42332/notexists.png'>" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml new file mode 100644 index 0000000000..ee39e089ea --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/embeddedImagesRemoteRelative.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +TextEdit { + textFormat: TextEdit.RichText + text: "<img src='exists.png'>" + baseUrl: "http://127.0.0.1:42332/text.html" +} diff --git a/tests/auto/qtquick2/qquicktextedit/data/http/exists.png b/tests/auto/qtquick2/qquicktextedit/data/http/exists.png Binary files differnew file mode 100644 index 0000000000..399bd0b1d9 --- /dev/null +++ b/tests/auto/qtquick2/qquicktextedit/data/http/exists.png diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp index 40dc438c15..1d63145b2f 100644 --- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -51,6 +51,7 @@ #include <QtGui/qguiapplication.h> #include <private/qquicktextedit_p.h> #include <private/qquicktextedit_p_p.h> +#include <private/qquicktext_p_p.h> #include <QFontMetrics> #include <QtQuick/QQuickView> #include <QDir> @@ -97,6 +98,7 @@ public: tst_qquicktextedit(); private slots: + void cleanup(); void text(); void width(); void wrap(); @@ -173,6 +175,10 @@ private slots: void undo_keypressevents_data(); void undo_keypressevents(); + void baseUrl(); + void embeddedImages(); + void embeddedImages_data(); + void emptytags_QTBUG_22058(); private: @@ -296,6 +302,13 @@ tst_qquicktextedit::tst_qquicktextedit() // } +void tst_qquicktextedit::cleanup() +{ + // ensure not even skipped tests with custom input context leave it dangling + QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel()); + inputPanelPrivate->testContext = 0; +} + void tst_qquicktextedit::text() { { @@ -616,6 +629,10 @@ void tst_qquicktextedit::hAlign() void tst_qquicktextedit::hAlign_RightToLeft() { + PlatformInputContext platformInputContext; + QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel()); + inputPanelPrivate->testContext = &platformInputContext; + QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextEdit *textEdit = canvas.rootObject()->findChild<QQuickTextEdit*>("text"); QVERIFY(textEdit != 0); @@ -716,24 +733,40 @@ void tst_qquicktextedit::hAlign_RightToLeft() // empty text with implicit alignment follows the system locale-based // keyboard input direction from qApp->inputPanel()->inputDirection textEdit->setText(""); - QCOMPARE(textEdit->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ? - QQuickTextEdit::AlignLeft : QQuickTextEdit::AlignRight); - if (qApp->inputPanel()->inputDirection() == Qt::LeftToRight) - QVERIFY(textEdit->positionToRectangle(0).x() < canvas.width()/2); - else - QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2); - textEdit->setHAlign(QQuickTextEdit::AlignRight); + platformInputContext.setInputDirection(Qt::LeftToRight); + QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight); + QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas.width()/2); + + QSignalSpy cursorRectangleSpy(textEdit, SIGNAL(cursorRectangleChanged())); + + platformInputContext.setInputDirection(Qt::RightToLeft); + QCOMPARE(cursorRectangleSpy.count(), 1); + QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft); QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2); - // alignment of TextEdit with no text set to it - QString componentStr = "import QtQuick 2.0\nTextEdit {}"; - QDeclarativeComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); - QCOMPARE(textObject->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ? - QQuickTextEdit::AlignLeft : QQuickTextEdit::AlignRight); - delete textObject; + // set input direction while having content + platformInputContext.setInputDirection(Qt::LeftToRight); + textEdit->setText("a"); + textEdit->setCursorPosition(1); + platformInputContext.setInputDirection(Qt::RightToLeft); + QTest::keyClick(&canvas, Qt::Key_Backspace); + QVERIFY(textEdit->text().isEmpty()); + QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); + QVERIFY(textEdit->cursorRectangle().left() > canvas.width()/2); + + // input direction changed while not having focus + platformInputContext.setInputDirection(Qt::LeftToRight); + textEdit->setFocus(false); + platformInputContext.setInputDirection(Qt::RightToLeft); + textEdit->setFocus(true); + QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); + QVERIFY(textEdit->cursorRectangle().left() > canvas.width()/2); + + textEdit->setHAlign(QQuickTextEdit::AlignRight); + QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2); } void tst_qquicktextedit::vAlign() @@ -2077,7 +2110,7 @@ void tst_qquicktextedit::textInput() QVERIFY(edit->hasActiveFocus() == true); // test that input method event is committed and change signal is emitted - QSignalSpy spy(edit, SIGNAL(textChanged(QString))); + QSignalSpy spy(edit, SIGNAL(textChanged())); QInputMethodEvent event; event.setCommitString( "Hello world!", 0, 0); QGuiApplication::sendEvent(qGuiApp->inputPanel()->inputItem(), &event); @@ -2804,7 +2837,7 @@ void tst_qquicktextedit::insert() QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged())); QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged())); QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged())); - QSignalSpy textSpy(textEdit, SIGNAL(textChanged(QString))); + QSignalSpy textSpy(textEdit, SIGNAL(textChanged())); QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged())); textEdit->insert(insertPosition, insertText); @@ -3049,7 +3082,7 @@ void tst_qquicktextedit::remove() QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged())); QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged())); QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged())); - QSignalSpy textSpy(textEdit, SIGNAL(textChanged(QString))); + QSignalSpy textSpy(textEdit, SIGNAL(textChanged())); QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged())); textEdit->remove(removeStart, removeEnd); @@ -3626,6 +3659,76 @@ void tst_qquicktextedit::undo_keypressevents() QVERIFY(textEdit->text().isEmpty()); } +void tst_qquicktextedit::baseUrl() +{ + QUrl localUrl("file:///tests/text.qml"); + QUrl remoteUrl("http://qt.nokia.com/test.qml"); + + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import QtQuick 2.0\n TextEdit {}", localUrl); + QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit *>(textComponent.create()); + + QCOMPARE(textObject->baseUrl(), localUrl); + + QSignalSpy spy(textObject, SIGNAL(baseUrlChanged())); + + textObject->setBaseUrl(localUrl); + QCOMPARE(textObject->baseUrl(), localUrl); + QCOMPARE(spy.count(), 0); + + textObject->setBaseUrl(remoteUrl); + QCOMPARE(textObject->baseUrl(), remoteUrl); + QCOMPARE(spy.count(), 1); + + textObject->resetBaseUrl(); + QCOMPARE(textObject->baseUrl(), localUrl); + QCOMPARE(spy.count(), 2); +} + +void tst_qquicktextedit::embeddedImages_data() +{ + QTest::addColumn<QUrl>("qmlfile"); + QTest::addColumn<QString>("error"); + QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << ""; + QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml") + << testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML TextEdit: Cannot open: " + testFileUrl("http/notexists.png").toString(); + QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << ""; + QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << ""; + QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml") + << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML TextEdit: Error downloading http://127.0.0.1:42332/notexists.png - server replied: Not found"; + QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << ""; +} + +void tst_qquicktextedit::embeddedImages() +{ + QFETCH(QUrl, qmlfile); + QFETCH(QString, error); + + TestHTTPServer server(42332); + server.serveDirectory(testFile("http")); + + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toLatin1()); + + QDeclarativeComponent textComponent(&engine, qmlfile); + QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); + + QVERIFY(textObject != 0); + QTRY_COMPARE(QQuickTextEditPrivate::get(textObject)->document->resourcesLoading(), 0); + + QPixmap pm(testFile("http/exists.png")); + if (error.isEmpty()) { + QCOMPARE(textObject->width(), double(pm.width())); + QCOMPARE(textObject->height(), double(pm.height())); + } else { + QVERIFY(16 != pm.width()); // check test is effective + QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon + QCOMPARE(textObject->height(), 16.0); + } + + delete textObject; +} + void tst_qquicktextedit::emptytags_QTBUG_22058() { QQuickView canvas(testFileUrl("qtbug-22058.qml")); diff --git a/tests/auto/qtquick2/qquicktextinput/data/validators.qml b/tests/auto/qtquick2/qquicktextinput/data/validators.qml index 0a074ce7dc..0ba87e0592 100644 --- a/tests/auto/qtquick2/qquicktextinput/data/validators.qml +++ b/tests/auto/qtquick2/qquicktextinput/data/validators.qml @@ -4,19 +4,26 @@ Item { property variant intInput: intInput property variant dblInput: dblInput property variant strInput: strInput + property variant unvalidatedInput: unvalidatedInput width: 800; height: 600; Column{ TextInput { id: intInput; + property bool acceptable: acceptableInput validator: IntValidator{top: 11; bottom: 2} } TextInput { id: dblInput; + property bool acceptable: acceptableInput validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation} } TextInput { id: strInput; + property bool acceptable: acceptableInput validator: RegExpValidator { regExp: /[a-zA-z]{2,4}/ } } + TextInput { id: unvalidatedInput + property bool acceptable: acceptableInput + } } } diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp index e97756f330..a4b1b1c4bd 100644 --- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -1219,6 +1219,10 @@ void tst_qquicktextinput::horizontalAlignment() void tst_qquicktextinput::horizontalAlignment_RightToLeft() { + PlatformInputContext platformInputContext; + QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel()); + inputPanelPrivate->testContext = &platformInputContext; + QQuickView canvas(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextInput *textInput = canvas.rootObject()->findChild<QQuickTextInput*>("text"); QVERIFY(textInput != 0); @@ -1314,26 +1318,42 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() // empty text with implicit alignment follows the system locale-based // keyboard input direction from QInputPanel::inputDirection() textInput->setText(""); - QCOMPARE(textInput->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ? - QQuickTextInput::AlignLeft : QQuickTextInput::AlignRight); - if (qApp->inputPanel()->inputDirection() == Qt::LeftToRight) { - QCOMPARE(textInputPrivate->boundingRect.left() - textInputPrivate->hscroll, qreal(0)); - } else { - QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1); - QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1); - } - textInput->setHAlign(QQuickTextInput::AlignRight); + platformInputContext.setInputDirection(Qt::LeftToRight); + QVERIFY(qApp->inputPanel()->inputDirection() == Qt::LeftToRight); + QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft); + QCOMPARE(textInputPrivate->boundingRect.left() - textInputPrivate->hscroll, qreal(0)); + + QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged())); + platformInputContext.setInputDirection(Qt::RightToLeft); + QVERIFY(qApp->inputPanel()->inputDirection() == Qt::RightToLeft); + QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1); + + // set input direction while having content + platformInputContext.setInputDirection(Qt::LeftToRight); + textInput->setText("a"); + platformInputContext.setInputDirection(Qt::RightToLeft); + QTest::keyClick(&canvas, Qt::Key_Backspace); + QVERIFY(textInput->text().isEmpty()); QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1); QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1); - QString componentStr = "import QtQuick 2.0\nTextInput {}"; - QDeclarativeComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create()); - QCOMPARE(textObject->hAlign(), qApp->inputPanel()->inputDirection() == Qt::LeftToRight ? - QQuickTextInput::AlignLeft : QQuickTextInput::AlignRight); - delete textObject; + // input direction changed while not having focus + platformInputContext.setInputDirection(Qt::LeftToRight); + textInput->setFocus(false); + platformInputContext.setInputDirection(Qt::RightToLeft); + textInput->setFocus(true); + QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1); + + textInput->setHAlign(QQuickTextInput::AlignRight); + QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll >= textInput->width() - 1); + QVERIFY(textInputPrivate->boundingRect.right() - textInputPrivate->hscroll <= textInput->width() + 1); } void tst_qquicktextinput::verticalAlignment() @@ -1553,139 +1573,217 @@ void tst_qquicktextinput::validators() QQuickTextInput *intInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("intInput"))); QVERIFY(intInput); + QSignalSpy intSpy(intInput, SIGNAL(acceptableInputChanged())); intInput->setFocus(true); QTRY_VERIFY(intInput->hasActiveFocus()); + QCOMPARE(intInput->hasAcceptableInput(), false); + QCOMPARE(intInput->property("acceptable").toBool(), false); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(intInput->text(), QLatin1String("1")); QCOMPARE(intInput->hasAcceptableInput(), false); + QCOMPARE(intInput->property("acceptable").toBool(), false); + QCOMPARE(intSpy.count(), 0); QTest::keyPress(&canvas, Qt::Key_2); QTest::keyRelease(&canvas, Qt::Key_2, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(intInput->text(), QLatin1String("1")); QCOMPARE(intInput->hasAcceptableInput(), false); + QCOMPARE(intInput->property("acceptable").toBool(), false); + QCOMPARE(intSpy.count(), 0); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); + QCOMPARE(intInput->property("acceptable").toBool(), true); + QCOMPARE(intSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_0); QTest::keyRelease(&canvas, Qt::Key_0, Qt::NoModifier ,10); QTest::qWait(50); QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); + QCOMPARE(intInput->property("acceptable").toBool(), true); + QCOMPARE(intSpy.count(), 1); QQuickTextInput *dblInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("dblInput"))); - QTRY_VERIFY(dblInput); + QVERIFY(dblInput); + QSignalSpy dblSpy(dblInput, SIGNAL(acceptableInputChanged())); dblInput->setFocus(true); QVERIFY(dblInput->hasActiveFocus() == true); + QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 0); QTest::keyPress(&canvas, Qt::Key_2); QTest::keyRelease(&canvas, Qt::Key_2, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblInput->property("acceptable").toBool(), true); + QCOMPARE(dblSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_Period); QTest::keyRelease(&canvas, Qt::Key_Period, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblInput->property("acceptable").toBool(), true); + QCOMPARE(dblSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblInput->property("acceptable").toBool(), true); + QCOMPARE(dblSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblInput->property("acceptable").toBool(), true); + QCOMPARE(dblSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblInput->property("acceptable").toBool(), true); + QCOMPARE(dblSpy.count(), 1); // Ensure the validator doesn't prevent characters being removed. dblInput->setValidator(intInput->validator()); QCOMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_Backspace); QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); // Once unacceptable input is in anything goes until it reaches an acceptable state again. QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_Backspace); QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_Backspace); QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_Backspace); QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_Backspace); QTest::keyRelease(&canvas, Qt::Key_Backspace, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); + QCOMPARE(dblInput->property("acceptable").toBool(), false); + QCOMPARE(dblSpy.count(), 2); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QCOMPARE(dblInput->text(), QLatin1String("11")); + QCOMPARE(dblInput->property("acceptable").toBool(), true); QCOMPARE(dblInput->hasAcceptableInput(), true); + QCOMPARE(dblSpy.count(), 3); QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("strInput"))); - QTRY_VERIFY(strInput); + QVERIFY(strInput); + QSignalSpy strSpy(strInput, SIGNAL(acceptableInputChanged())); strInput->setFocus(true); QVERIFY(strInput->hasActiveFocus() == true); + QCOMPARE(strInput->hasAcceptableInput(), false); + QCOMPARE(strInput->property("acceptable").toBool(), false); QTest::keyPress(&canvas, Qt::Key_1); QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("")); QCOMPARE(strInput->hasAcceptableInput(), false); + QCOMPARE(strInput->property("acceptable").toBool(), false); + QCOMPARE(strSpy.count(), 0); QTest::keyPress(&canvas, Qt::Key_A); QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("a")); QCOMPARE(strInput->hasAcceptableInput(), false); + QCOMPARE(strInput->property("acceptable").toBool(), false); + QCOMPARE(strSpy.count(), 0); QTest::keyPress(&canvas, Qt::Key_A); QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("aa")); QCOMPARE(strInput->hasAcceptableInput(), true); + QCOMPARE(strInput->property("acceptable").toBool(), true); + QCOMPARE(strSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_A); QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("aaa")); QCOMPARE(strInput->hasAcceptableInput(), true); + QCOMPARE(strInput->property("acceptable").toBool(), true); + QCOMPARE(strSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_A); QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); + QCOMPARE(strInput->property("acceptable").toBool(), true); + QCOMPARE(strSpy.count(), 1); QTest::keyPress(&canvas, Qt::Key_A); QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); QTest::qWait(50); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); + QCOMPARE(strInput->property("acceptable").toBool(), true); + QCOMPARE(strSpy.count(), 1); + + QQuickTextInput *unvalidatedInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("unvalidatedInput"))); + QVERIFY(unvalidatedInput); + QSignalSpy unvalidatedSpy(unvalidatedInput, SIGNAL(acceptableInputChanged())); + unvalidatedInput->setFocus(true); + QVERIFY(unvalidatedInput->hasActiveFocus() == true); + QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); + QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); + QTest::keyPress(&canvas, Qt::Key_1); + QTest::keyRelease(&canvas, Qt::Key_1, Qt::NoModifier ,10); + QTest::qWait(50); + QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1")); + QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); + QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); + QCOMPARE(unvalidatedSpy.count(), 0); + QTest::keyPress(&canvas, Qt::Key_A); + QTest::keyRelease(&canvas, Qt::Key_A, Qt::NoModifier ,10); + QTest::qWait(50); + QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1a")); + QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); + QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); + QCOMPARE(unvalidatedSpy.count(), 0); } void tst_qquicktextinput::inputMethods() diff --git a/tests/auto/qtquick2/qquickview/tst_qquickview.cpp b/tests/auto/qtquick2/qquickview/tst_qquickview.cpp index 69052108cf..0b575c67a1 100644 --- a/tests/auto/qtquick2/qquickview/tst_qquickview.cpp +++ b/tests/auto/qtquick2/qquickview/tst_qquickview.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 96fd85b63b..d9a429cd9b 100644 --- a/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/qtquick2/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -1147,9 +1147,9 @@ template <int N> void tst_qquickvisualdatamodel::groups_verify( QCOMPARE(evaluate<bool>(delegate, "test6"), vMember[i]); QCOMPARE(evaluate<int>(delegate, "test7") , sIndex[i]); QCOMPARE(evaluate<bool>(delegate, "test8"), sMember[i]); - QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("items") , QBool(true)); - QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("visible") , QBool(vMember[i])); - QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("selected"), QBool(sMember[i])); + QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("items") , bool(true)); + QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("visible") , bool(vMember[i])); + QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("selected"), bool(sMember[i])); } failed = false; } diff --git a/tests/auto/qtquick2/qtquick2.pro b/tests/auto/qtquick2/qtquick2.pro index 0756ddf9ca..8b8c5c9b9e 100644 --- a/tests/auto/qtquick2/qtquick2.pro +++ b/tests/auto/qtquick2/qtquick2.pro @@ -24,6 +24,7 @@ PRIVATETESTS += \ !contains(QT_CONFIG,xmlpatterns):PRIVATETESTS -= qdeclarativexmllistmodel QUICKTESTS = \ + qquickaccessible \ qquickanchors \ qquickanimatedimage \ qquickborderimage \ diff --git a/tests/auto/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h index db5083725b..e2ababa5d8 100644 --- a/tests/auto/shared/platforminputcontext.h +++ b/tests/auto/shared/platforminputcontext.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -48,7 +48,7 @@ public: PlatformInputContext() : m_visible(false), m_action(QInputPanel::Click), m_cursorPosition(0), m_invokeActionCallCount(0), m_showInputPanelCallCount(0), m_hideInputPanelCallCount(0), - m_updateCallCount(0) + m_updateCallCount(0), m_direction(Qt::LeftToRight) { } @@ -77,6 +77,25 @@ public: m_updateCallCount++; } + virtual QLocale locale() const + { + if (m_direction == Qt::RightToLeft) + return QLocale(QLocale::Arabic); + else + return QLocale(QLocale::English); + } + + virtual Qt::LayoutDirection inputDirection() const + { + return m_direction; + } + + void setInputDirection(Qt::LayoutDirection direction) { + m_direction = direction; + emitLocaleChanged(); + emitInputDirectionChanged(inputDirection()); + } + void clear() { m_cursorPosition = 0; m_invokeActionCallCount = 0; @@ -93,4 +112,5 @@ public: int m_showInputPanelCallCount; int m_hideInputPanelCallCount; int m_updateCallCount; + Qt::LayoutDirection m_direction; }; diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp index 67f03c2073..c349d90316 100644 --- a/tests/auto/shared/testhttpserver.cpp +++ b/tests/auto/shared/testhttpserver.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/shared/testhttpserver.h b/tests/auto/shared/testhttpserver.h index 52412db25d..8d15630eab 100644 --- a/tests/auto/shared/testhttpserver.h +++ b/tests/auto/shared/testhttpserver.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp index 796baea828..6870fe38f8 100644 --- a/tests/auto/shared/util.cpp +++ b/tests/auto/shared/util.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h index c7c2a434c3..36c6c99fb0 100644 --- a/tests/auto/shared/util.h +++ b/tests/auto/shared/util.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** |