diff options
Diffstat (limited to 'tests/auto')
240 files changed, 1325 insertions, 1771 deletions
diff --git a/tests/auto/particles/qquickage/qquickage.pro b/tests/auto/particles/qquickage/qquickage.pro index 3fffb28f31..557daac86f 100644 --- a/tests/auto/particles/qquickage/qquickage.pro +++ b/tests/auto/particles/qquickage/qquickage.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro index 4533f94388..b813b64a3c 100644 --- a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro +++ b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro index ba4a6ba9d9..145bffd3b3 100644 --- a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro +++ b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro index 9442a29fb9..01a831ca9c 100644 --- a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro +++ b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro index 48e7303f86..d02b45457a 100644 --- a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro +++ b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquickcustomparticle SOURCES += tst_qquickcustomparticle.cpp macx:CONFIG -= app_bundle @@ -9,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro index 324b980e78..a1d79daca7 100644 --- a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro +++ b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickfriction/qquickfriction.pro b/tests/auto/particles/qquickfriction/qquickfriction.pro index b90b31ece2..8a15dee4c4 100644 --- a/tests/auto/particles/qquickfriction/qquickfriction.pro +++ b/tests/auto/particles/qquickfriction/qquickfriction.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickgravity/qquickgravity.pro b/tests/auto/particles/qquickgravity/qquickgravity.pro index 07c9eba314..899d58ed38 100644 --- a/tests/auto/particles/qquickgravity/qquickgravity.pro +++ b/tests/auto/particles/qquickgravity/qquickgravity.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro index 31b6fa5457..3236231f14 100644 --- a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro +++ b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private testlib quick-private quickparticles-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro index 271b2ec57c..cf0f81f0ff 100644 --- a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro +++ b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro @@ -7,4 +7,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro index 7db55d29e9..8c39fc9736 100644 --- a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro +++ b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquickitemparticle SOURCES += tst_qquickitemparticle.cpp macx:CONFIG -= app_bundle @@ -9,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro index 85e98f3cd4..2ccc5b3765 100644 --- a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro +++ b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro index d83006e523..cf63196539 100644 --- a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro +++ b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro index 3d98e5f3bd..06febb3825 100644 --- a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro +++ b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro index d3aeaecdca..f076d6f0c0 100644 --- a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro +++ b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro index 60b1c1fc7f..2d2c4f375d 100644 --- a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro +++ b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro index e61527a11d..8174e52964 100644 --- a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro +++ b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro index a8b2c1ca95..add9981d0b 100644 --- a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro +++ b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro index eb127c5fc2..f5a5f745bd 100644 --- a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro +++ b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private testlib quick-private quickparticles-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro index 9fe6747378..e8c5c2d33d 100644 --- a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro +++ b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro index 1cb792eff2..2f54e13000 100644 --- a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro +++ b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickturbulence/qquickturbulence.pro b/tests/auto/particles/qquickturbulence/qquickturbulence.pro index 2db3d54e4c..8758a5203b 100644 --- a/tests/auto/particles/qquickturbulence/qquickturbulence.pro +++ b/tests/auto/particles/qquickturbulence/qquickturbulence.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/particles/qquickwander/qquickwander.pro b/tests/auto/particles/qquickwander/qquickwander.pro index 41171645a2..58da3f39d8 100644 --- a/tests/auto/particles/qquickwander/qquickwander.pro +++ b/tests/auto/particles/qquickwander/qquickwander.pro @@ -8,4 +8,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private quickparticles-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro b/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro index f63a437c54..f7ba4c275c 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro +++ b/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase macx:CONFIG -= app_bundle TARGET = tst_qabstractanimationjob QT = core-private qml-private testlib SOURCES = tst_qabstractanimationjob.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro b/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro index 136999ce13..0c52094bfd 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro +++ b/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase macx:CONFIG -= app_bundle TARGET = tst_qanimationgroupjob QT = core-private qml-private testlib SOURCES = tst_qanimationgroupjob.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro b/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro index 2cc057cb90..982aafbfe7 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test macx:CONFIG -= app_bundle TARGET = tst_qparallelanimationgroupjob QT = core-private gui qml-private testlib gui-private SOURCES = tst_qparallelanimationgroupjob.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro b/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro index 7102096384..b80bb0c55c 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro +++ b/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test macx:CONFIG -= app_bundle TARGET = tst_qpauseanimationjob QT = core-private gui-private qml-private testlib SOURCES = tst_qpauseanimationjob.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro b/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro index eda764cedd..370d33607b 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase macx:CONFIG -= app_bundle TARGET = tst_qsequentialanimationgroupjob QT = core-private qml-private testlib SOURCES = tst_qsequentialanimationgroupjob.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro index 6b47801720..ccb2d71c53 100644 --- a/tests/auto/qml/debugger/debugger.pro +++ b/tests/auto/qml/debugger/debugger.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs PUBLICTESTS += \ + qdebugmessageservice \ qqmlenginedebugservice \ qqmldebugjs \ qqmlinspector \ @@ -14,7 +15,8 @@ PUBLICTESTS += \ PRIVATETESTS += \ qqmldebugclient \ qqmldebuglocal \ - qqmldebugservice + qqmldebugservice \ + qv4debugger SUBDIRS += $$PUBLICTESTS diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro index 0d6484f8e6..6c729ab235 100644 --- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro +++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qdebugmessageservice QT += qml network testlib gui-private core-private -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qdebugmessageservice.cpp @@ -12,4 +12,3 @@ include(../shared/debugutil.pri) TESTDATA = data/* OTHER_FILES += data/test.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp index d0801dd4ee..75c301f958 100644 --- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp +++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp @@ -31,14 +31,17 @@ ** ****************************************************************************/ -#include "qqmldebugclient.h" - //QQmlDebugTest #include "debugutil_p.h" #include "../../../shared/util.h" -#include <QtCore/QString> -#include <QtTest/QtTest> +#include <private/qqmldebugclient_p.h> +#include <private/qqmldebugconnection_p.h> +#include <private/qpacket_p.h> + +#include <QtCore/qstring.h> +#include <QtCore/qlibraryinfo.h> +#include <QtTest/qtest.h> const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block"; const char *QMLFILE = "test.qml"; @@ -76,15 +79,19 @@ struct LogEntry { int line; QString file; QString function; + QString category; - QString toString() const { return QString::number(type) + ": " + message; } + QString toString() const + { + return QString::number(type) + ": " + message + " (" + category + ")"; + } }; bool operator==(const LogEntry &t1, const LogEntry &t2) { return t1.type == t2.type && t1.message == t2.message && t1.line == t2.line && t1.file == t2.file - && t1.function == t2.function; + && t1.function == t2.function && t1.category == t2.category; } class QQmlDebugMsgClient : public QQmlDebugClient @@ -117,7 +124,7 @@ void QQmlDebugMsgClient::stateChanged(State state) void QQmlDebugMsgClient::messageReceived(const QByteArray &data) { - QDataStream ds(data); + QPacket ds(connection()->currentDataStreamVersion(), data); QByteArray command; ds >> command; @@ -126,17 +133,21 @@ void QQmlDebugMsgClient::messageReceived(const QByteArray &data) QByteArray message; QByteArray file; QByteArray function; + QByteArray category; + qint64 timestamp; int line; - ds >> type >> message >> file >> line >> function; + ds >> type >> message >> file >> line >> function >> category >> timestamp; QVERIFY(ds.atEnd()); QVERIFY(type >= QtDebugMsg); QVERIFY(type <= QtFatalMsg); + QVERIFY(timestamp > 0); LogEntry entry((QtMsgType)type, QString::fromUtf8(message)); entry.line = line; entry.file = QString::fromUtf8(file); entry.function = QString::fromUtf8(function); + entry.category = QString::fromUtf8(category); logBuffer << entry; emit debugOutput(); } else { @@ -212,23 +223,20 @@ void tst_QDebugMessageService::retrieveDebugOutput() { init(); - int maxTries = 2; - while ((m_client->logBuffer.size() < 2) - || (maxTries-- > 0)) - QQmlDebugTest::waitForSignal(m_client, SIGNAL(debugOutput()), 1000); - - QVERIFY(m_client->logBuffer.size() >= 2); + QTRY_VERIFY(m_client->logBuffer.size() >= 2); const QString path = QUrl::fromLocalFile(QQmlDataTest::instance()->testFile(QMLFILE)).toString(); LogEntry entry1(QtDebugMsg, QLatin1String("console.log")); - entry1.line = 48; + entry1.line = 40; entry1.file = path; entry1.function = QLatin1String("onCompleted"); + entry1.category = QLatin1String("qml"); LogEntry entry2(QtDebugMsg, QLatin1String("console.count: 1")); - entry2.line = 49; + entry2.line = 41; entry2.file = path; entry2.function = QLatin1String("onCompleted"); + entry2.category = QLatin1String("default"); QVERIFY(m_client->logBuffer.contains(entry1)); QVERIFY(m_client->logBuffer.contains(entry2)); diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro index 716d8f0be9..a7c0fa7f8e 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro @@ -1,12 +1,10 @@ CONFIG += testcase TARGET = tst_qpacketprotocol -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qpacketprotocol.cpp INCLUDEPATH += ../shared include(../shared/debugutil.pri) -CONFIG += parallel_test QT += qml network testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index db9e621d54..b68cc5d6c9 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -38,7 +38,8 @@ #include <QDebug> #include <QBuffer> -#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h" +#include <private/qpacketprotocol_p.h> +#include <private/qpacket_p.h> #include "debugutil_p.h" @@ -55,18 +56,10 @@ private slots: void init(); void cleanup(); - void maximumPacketSize(); - void setMaximumPacketSize(); - void setMaximumPacketSize_data(); void send(); - void send_data(); void packetsAvailable(); void packetsAvailable_data(); - void clear(); void read(); - void device(); - - void tst_QPacket_clear(); }; void tst_QPacketProtocol::init() @@ -95,65 +88,26 @@ void tst_QPacketProtocol::cleanup() delete m_server; } -void tst_QPacketProtocol::maximumPacketSize() -{ - QPacketProtocol p(m_client); - QCOMPARE(p.maximumPacketSize(), 0x7FFFFFFF); -} - -void tst_QPacketProtocol::setMaximumPacketSize() -{ - QFETCH(qint32, size); - QFETCH(qint32, expected); - - QPacketProtocol out(m_serverConn); - QCOMPARE(out.setMaximumPacketSize(size), expected); -} - -void tst_QPacketProtocol::setMaximumPacketSize_data() -{ - QTest::addColumn<int>("size"); - QTest::addColumn<int>("expected"); - - QTest::newRow("invalid") << qint32(sizeof(qint32) - 1) << qint32(0x7FFFFFFF); - QTest::newRow("still invalid") << qint32(sizeof(qint32)) << qint32(0x7FFFFFFF); - QTest::newRow("valid") << qint32(sizeof(qint32) + 1) << qint32(sizeof(qint32) + 1); -} - void tst_QPacketProtocol::send() { - QFETCH(bool, useAutoSend); - QPacketProtocol in(m_client); QPacketProtocol out(m_serverConn); QByteArray ba; int num; - if (useAutoSend) { - out.send() << "Hello world" << 123; - } else { - QPacket packet; - packet << "Hello world" << 123; - out.send(packet); - } + QPacket packet(QDataStream::Qt_DefaultCompiledVersion); + packet << "Hello world" << 123; + out.send(packet.data()); QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); - QPacket p = in.read(); + QPacket p(QDataStream::Qt_DefaultCompiledVersion, in.read()); p >> ba >> num; QCOMPARE(ba, QByteArray("Hello world") + '\0'); QCOMPARE(num, 123); } -void tst_QPacketProtocol::send_data() -{ - QTest::addColumn<bool>("useAutoSend"); - - QTest::newRow("auto send") << true; - QTest::newRow("no auto send") << false; -} - void tst_QPacketProtocol::packetsAvailable() { QFETCH(int, packetCount); @@ -164,8 +118,11 @@ void tst_QPacketProtocol::packetsAvailable() QCOMPARE(out.packetsAvailable(), qint64(0)); QCOMPARE(in.packetsAvailable(), qint64(0)); - for (int i=0; i<packetCount; i++) - out.send() << "Hello"; + for (int i=0; i<packetCount; i++) { + QPacket packet(QDataStream::Qt_DefaultCompiledVersion); + packet << "Hello"; + out.send(packet.data()); + } QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); QCOMPARE(in.packetsAvailable(), qint64(packetCount)); @@ -180,19 +137,6 @@ void tst_QPacketProtocol::packetsAvailable_data() QTest::newRow("10") << 10; } -void tst_QPacketProtocol::clear() -{ - QPacketProtocol in(m_client); - QPacketProtocol out(m_serverConn); - - out.send() << 123; - out.send() << 456; - QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); - - in.clear(); - QVERIFY(in.read().isEmpty()); -} - void tst_QPacketProtocol::read() { QPacketProtocol in(m_client); @@ -200,61 +144,30 @@ void tst_QPacketProtocol::read() QVERIFY(in.read().isEmpty()); - out.send() << 123; - out.send() << 456; + QPacket packet(QDataStream::Qt_DefaultCompiledVersion); + packet << 123; + out.send(packet.data()); + + QPacket packet2(QDataStream::Qt_DefaultCompiledVersion); + packet2 << 456; + out.send(packet2.data()); QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); int num; - QPacket p1 = in.read(); - QVERIFY(!p1.isEmpty()); + QPacket p1(QDataStream::Qt_DefaultCompiledVersion, in.read()); + QVERIFY(!p1.atEnd()); p1 >> num; QCOMPARE(num, 123); - QPacket p2 = in.read(); - QVERIFY(!p2.isEmpty()); + QPacket p2(QDataStream::Qt_DefaultCompiledVersion, in.read()); + QVERIFY(!p2.atEnd()); p2 >> num; QCOMPARE(num, 456); QVERIFY(in.read().isEmpty()); } -void tst_QPacketProtocol::device() -{ - QPacketProtocol p(m_client); - QCOMPARE(p.device(), m_client); -} - -void tst_QPacketProtocol::tst_QPacket_clear() -{ - QPacketProtocol protocol(m_client); - - QPacket packet; - - packet << "Hello world!" << 123; - protocol.send(packet); - - packet.clear(); - QVERIFY(packet.isEmpty()); - packet << "Goodbyte world!" << 789; - protocol.send(packet); - - QByteArray ba; - int num; - QPacketProtocol in(m_serverConn); - QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); - - QPacket p1 = in.read(); - p1 >> ba >> num; - QCOMPARE(ba, QByteArray("Hello world!") + '\0'); - QCOMPARE(num, 123); - - QPacket p2 = in.read(); - p2 >> ba >> num; - QCOMPARE(ba, QByteArray("Goodbyte world!") + '\0'); - QCOMPARE(num, 789); -} - QTEST_MAIN(tst_QPacketProtocol) #include "tst_qpacketprotocol.moc" diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro index ad431d4871..622b373692 100644 --- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro +++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmldebugclient -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle HEADERS += ../shared/qqmldebugtestservice.h @@ -15,4 +15,3 @@ DEFINES += QT_QML_DEBUG_NO_WARNING CONFIG += qml_debug QT += qml-private testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp index 6fc6c6a914..1bf03dbdee 100644 --- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp +++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp @@ -30,19 +30,20 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> - -#include <QtQml/qqmlengine.h> #include "debugutil_p.h" #include "qqmldebugtestservice.h" #include <private/qqmldebugconnector_p.h> +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> +#include <QtNetwork/qhostaddress.h> +#include <QtQml/qqmlengine.h> #define PORT 13770 #define STR_PORT "13770" @@ -68,10 +69,20 @@ private slots: void tst_QQmlDebugClient::initTestCase() { QQmlDebugConnector::setPluginKey(QLatin1String("QQmlDebugServer")); + QQmlDebugConnector::setServices(QStringList() + << QStringLiteral("tst_QQmlDebugClient::handshake()")); QTest::ignoreMessage(QtWarningMsg, "QML debugger: Cannot set plugin key after loading the plugin."); m_service = new QQmlDebugTestService("tst_QQmlDebugClient::handshake()"); + + foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT); QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData()); QQmlDebuggingEnabler::startTcpDebugServer(PORT); @@ -144,7 +155,9 @@ void tst_QQmlDebugClient::parallelConnect() QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Another client is already connected."); // will connect & immediately disconnect connection2.connectToHost("127.0.0.1", PORT); - QTRY_COMPARE(connection2.state(), QAbstractSocket::UnconnectedState); + QTest::ignoreMessage(QtWarningMsg, "QQmlDebugConnection: Did not get handshake answer in time"); + QVERIFY(!connection2.waitForConnected(1000)); + QVERIFY(!connection2.isConnected()); QVERIFY(m_conn->isConnected()); } @@ -155,7 +168,6 @@ void tst_QQmlDebugClient::sequentialConnect() m_conn->close(); QVERIFY(!m_conn->isConnected()); - QCOMPARE(m_conn->state(), QAbstractSocket::UnconnectedState); // Make sure that the disconnect is actually delivered to the server QTest::qWait(100); diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp index 98ef590317..27a64842e9 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp @@ -31,18 +31,20 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QtCore/QProcess> -#include <QtCore/QTimer> -#include <QtCore/QFileInfo> -#include <QtCore/QDir> -#include <QtCore/QMutex> -#include <QtCore/QLibraryInfo> - #include "debugutil_p.h" -#include "qqmldebugclient.h" #include "../../../shared/util.h" +#include <private/qqmldebugclient_p.h> +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtCore/qprocess.h> +#include <QtCore/qtimer.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdir.h> +#include <QtCore/qmutex.h> +#include <QtCore/qlibraryinfo.h> + class tst_QQmlDebuggingEnabler : public QQmlDataTest { Q_OBJECT @@ -53,13 +55,14 @@ private slots: void initTestCase(); void cleanupTestCase(); void cleanup(); - void qmlscene(); - void qmlsceneBlock(); + void qmlscene_data(); + void qmlscene(); + void custom_data(); void custom(); - void customBlock(); private: + void data(); QQmlDebugProcess *process; QQmlDebugConnection *connection; QTime t; @@ -142,24 +145,92 @@ void tst_QQmlDebuggingEnabler::cleanup() connection = 0; } -void tst_QQmlDebuggingEnabler::qmlscene() +void tst_QQmlDebuggingEnabler::data() { - QVERIFY(init(false, true, 5555, 5565)); + QTest::addColumn<bool>("blockMode"); + QTest::addColumn<QStringList>("services"); + + QTest::newRow("noblock,all") << false << QStringList(); + QTest::newRow("block,all") << true << QStringList(); + QTest::newRow("noblock,debugger") << false << QQmlDebuggingEnabler::debuggerServices(); + QTest::newRow("block,debugger") << true << QQmlDebuggingEnabler::debuggerServices(); + QTest::newRow("noblock,inspector") << false << QQmlDebuggingEnabler::inspectorServices(); + QTest::newRow("block,inspector") << true << QQmlDebuggingEnabler::inspectorServices(); + QTest::newRow("noblock,profiler") << false << QQmlDebuggingEnabler::profilerServices(); + QTest::newRow("block,profiler") << true << QQmlDebuggingEnabler::profilerServices(); + QTest::newRow("noblock,debugger+inspector") + << false << QQmlDebuggingEnabler::debuggerServices() + + QQmlDebuggingEnabler::inspectorServices(); + QTest::newRow("block,debugger+inspector") + << true << QQmlDebuggingEnabler::debuggerServices() + + QQmlDebuggingEnabler::inspectorServices(); + } -void tst_QQmlDebuggingEnabler::qmlsceneBlock() +void tst_QQmlDebuggingEnabler::qmlscene_data() { - QVERIFY(init(true, true, 5555, 5565)); + data(); } -void tst_QQmlDebuggingEnabler::custom() +void tst_QQmlDebuggingEnabler::qmlscene() { - QVERIFY(init(false, false, 5555, 5565)); + QFETCH(bool, blockMode); + QFETCH(QStringList, services); + + connection = new QQmlDebugConnection(); + QList<QQmlDebugClient *> clients = QQmlDebugTest::createOtherClients(connection); + process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", + this); + process->setMaximumBindErrors(1); + process->start(QStringList() + << QString::fromLatin1("-qmljsdebugger=port:5555,5565%1%2%3") + .arg(blockMode ? QLatin1String(",block") : QString()) + .arg(services.isEmpty() ? QString() : QString::fromLatin1(",services:")) + .arg(services.isEmpty() ? QString() : services.join(",")) + << testFile(QLatin1String("test.qml"))); + + QVERIFY(process->waitForSessionStart()); + connection->connectToHost("127.0.0.1", process->debugPort()); + QVERIFY(connection->waitForConnected()); + foreach (QQmlDebugClient *client, clients) + QCOMPARE(client->state(), (services.isEmpty() || services.contains(client->name())) ? + QQmlDebugClient::Enabled : QQmlDebugClient::Unavailable); +} + +void tst_QQmlDebuggingEnabler::custom_data() +{ + data(); } -void tst_QQmlDebuggingEnabler::customBlock() +void tst_QQmlDebuggingEnabler::custom() { - QVERIFY(init(true, false, 5555, 5565)); + QFETCH(bool, blockMode); + QFETCH(QStringList, services); + const int portFrom = 5555; + const int portTo = 5565; + + connection = new QQmlDebugConnection(); + QList<QQmlDebugClient *> clients = QQmlDebugTest::createOtherClients(connection); + process = new QQmlDebugProcess(QCoreApplication::applicationDirPath() + + QLatin1String("/qqmldebuggingenablerserver"), this); + process->setMaximumBindErrors(portTo - portFrom); + + QStringList args; + if (blockMode) + args << QLatin1String("-block"); + + args << QString::number(portFrom) << QString::number(portTo); + if (!services.isEmpty()) + args << QLatin1String("-services") << services; + + process->start(args); + + QVERIFY(process->waitForSessionStart()); + connection->connectToHost("127.0.0.1", process->debugPort()); + QVERIFY(connection->waitForConnected()); + foreach (QQmlDebugClient *client, clients) + QCOMPARE(client->state(), (services.isEmpty() || services.contains(client->name())) ? + QQmlDebugClient::Enabled : QQmlDebugClient::Unavailable); } QTEST_MAIN(tst_QQmlDebuggingEnabler) diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp index bddece6452..f4fef7ff16 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp @@ -31,8 +31,10 @@ ** ****************************************************************************/ -#include "debugutil_p.h" -#include <QtCore/QCoreApplication> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qlibraryinfo.h> +#include <QtQml/qqmldebug.h> +#include <QtQml/qqmlengine.h> int main(int argc, char *argv[]) { @@ -54,6 +56,9 @@ int main(int argc, char *argv[]) portTo = arguments.takeFirst().toInt(); } + if (arguments.size() && arguments.takeFirst() == QLatin1String("-services")) + QQmlDebuggingEnabler::setServices(arguments); + if (!portFrom || !portTo) qFatal("Port range has to be specified."); diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro index fdd9ce8f11..a40ff6978b 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro @@ -3,7 +3,7 @@ osx:CONFIG -= app_bundle CONFIG -= debug_and_release_target INCLUDEPATH += ../../shared SOURCES += qqmldebuggingenablerserver.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING +DEFINES += QT_QML_DEBUG_NO_WARNING DESTDIR = ../qqmldebuggingenabler diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro index fb06df9c99..bd6debcea1 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro @@ -1,24 +1,4 @@ -CONFIG += testcase -TARGET = tst_qqmldebugjs -QT += qml testlib gui-private core-private -macx:CONFIG -= app_bundle +TEMPLATE = subdirs +SUBDIRS = qqmldebugjs qqmldebugjsserver -SOURCES += tst_qqmldebugjs.cpp - -INCLUDEPATH += ../shared -include(../../../shared/util.pri) -include(../shared/debugutil.pri) - -TESTDATA = data/* - -OTHER_FILES += data/test.qml data/test.js \ - data/timer.qml \ - data/exception.qml \ - data/oncompleted.qml \ - data/loadjsfile.qml \ - data/condition.qml \ - data/changeBreakpoint.qml \ - data/stepAction.qml \ - data/breakpointRelocation.qml \ - data/createComponent.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +qqmldebugjs.depends = qqmldebugjsserver diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml index 55663b7983..55663b7983 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml index 1bd9191334..1bd9191334 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml index 2f9b3aceb2..2f9b3aceb2 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml index 53b1f52745..53b1f52745 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml index d0fa4e715c..d0fa4e715c 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml index 9fc75d251f..9fc75d251f 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml index 6f32af39ad..6f32af39ad 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml index b858fdf942..b858fdf942 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml index b9ee1380aa..b9ee1380aa 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.js b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js index ca25e9baf7..ca25e9baf7 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/test.js +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml index 5a7fa718f2..5a7fa718f2 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/test.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml index 1fee24a1fa..1fee24a1fa 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro new file mode 100644 index 0000000000..79e772c1ee --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro @@ -0,0 +1,24 @@ +CONFIG += testcase +TARGET = tst_qqmldebugjs +QT += qml testlib gui-private core-private +CONFIG -= debug_and_release_target +osx:CONFIG -= app_bundle + +SOURCES += tst_qqmldebugjs.cpp + +INCLUDEPATH += ../../shared +include(../../../../shared/util.pri) +include(../../shared/debugutil.pri) + +TESTDATA = data/* + +OTHER_FILES += data/test.qml data/test.js \ + data/timer.qml \ + data/exception.qml \ + data/oncompleted.qml \ + data/loadjsfile.qml \ + data/condition.qml \ + data/changeBreakpoint.qml \ + data/stepAction.qml \ + data/breakpointRelocation.qml \ + data/createComponent.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp index 7dbe35807d..e0451466ef 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp @@ -31,19 +31,22 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QtCore/QProcess> -#include <QtCore/QTimer> -#include <QtCore/QFileInfo> -#include <QtCore/QDir> -#include <QtCore/QMutex> -#include <QtCore/QLibraryInfo> -#include <QtQml/QJSEngine> - //QQmlDebugTest #include "debugutil_p.h" -#include "qqmldebugclient.h" -#include "../../../shared/util.h" +#include "../../../../shared/util.h" + +#include <private/qqmldebugclient_p.h> +#include <private/qqmldebugconnection_p.h> +#include <private/qpacket_p.h> + +#include <QtTest/qtest.h> +#include <QtCore/qprocess.h> +#include <QtCore/qtimer.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdir.h> +#include <QtCore/qmutex.h> +#include <QtCore/qlibraryinfo.h> +#include <QtQml/qjsengine.h> #if defined (Q_OS_WINCE) #undef IN @@ -159,7 +162,7 @@ class tst_QQmlDebugJS : public QQmlDataTest { Q_OBJECT - void init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true, + void init(bool qmlscene, const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true, bool restrictServices = false); private slots: @@ -170,43 +173,65 @@ private slots: void connect_data(); void connect(); + void interrupt_data() { targetData(); } void interrupt(); + void getVersion_data() { targetData(); } void getVersion(); // void getVersionWhenAttaching(); + void disconnect_data() { targetData(); } void disconnect(); + void setBreakpointInScriptOnCompleted_data() { targetData(); } void setBreakpointInScriptOnCompleted(); + void setBreakpointInScriptOnComponentCreated_data() { targetData(); } void setBreakpointInScriptOnComponentCreated(); + void setBreakpointInScriptOnTimerCallback_data() { targetData(); } void setBreakpointInScriptOnTimerCallback(); + void setBreakpointInScriptInDifferentFile_data() { targetData(); } void setBreakpointInScriptInDifferentFile(); + void setBreakpointInScriptOnComment_data() { targetData(); } void setBreakpointInScriptOnComment(); + void setBreakpointInScriptOnEmptyLine_data() { targetData(); } void setBreakpointInScriptOnEmptyLine(); + void setBreakpointInScriptOnOptimizedBinding_data() { targetData(); } void setBreakpointInScriptOnOptimizedBinding(); + void setBreakpointInScriptWithCondition_data() { targetData(); } void setBreakpointInScriptWithCondition(); + void setBreakpointInScriptThatQuits_data() { targetData(); } void setBreakpointInScriptThatQuits(); //void setBreakpointInFunction(); //NOT SUPPORTED // void setBreakpointOnEvent(); // void setBreakpointWhenAttaching(); + void clearBreakpoint_data() { targetData(); } void clearBreakpoint(); + void setExceptionBreak_data() { targetData(); } void setExceptionBreak(); + void stepNext_data() { targetData(); } void stepNext(); + void stepIn_data() { targetData(); } void stepIn(); + void stepOut_data() { targetData(); } void stepOut(); + void continueDebugging_data() { targetData(); } void continueDebugging(); + void backtrace_data() { targetData(); } void backtrace(); + void getFrameDetails_data() { targetData(); } void getFrameDetails(); + void getScopeDetails_data() { targetData(); } void getScopeDetails(); // void evaluateInGlobalScope(); // Not supported yet. // void evaluateInLocalScope(); // Not supported yet. + void getScripts_data() { targetData(); } void getScripts(); // void profile(); //NOT SUPPORTED @@ -214,6 +239,8 @@ private slots: // void verifyQMLOptimizerDisabled(); private: + void targetData(); + QQmlDebugProcess *process; QJSDebugClient *client; QQmlDebugConnection *connection; @@ -557,11 +584,9 @@ void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int c // } if (type == QLatin1String(EVENT)) { - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); + QPacket rs(connection()->currentDataStreamVersion()); rs << target.toUtf8() << enabled; - sendMessage(packMessage(QByteArray("breakonsignal"), reply)); - + sendMessage(packMessage(QByteArray("breakonsignal"), rs.data())); } else { VARIANTMAPINIT; jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETBREAKPOINT))); @@ -709,7 +734,7 @@ void QJSDebugClient::stateChanged(State state) void QJSDebugClient::messageReceived(const QByteArray &data) { - QDataStream ds(data); + QPacket ds(connection()->currentDataStreamVersion(), data); QByteArray command; ds >> command; @@ -794,11 +819,10 @@ void QJSDebugClient::flushSendBuffer() QByteArray QJSDebugClient::packMessage(const QByteArray &type, const QByteArray &message) { - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); + QPacket rs(connection()->currentDataStreamVersion()); QByteArray cmd = "V8DEBUG"; rs << cmd << type << message; - return reply; + return rs.data(); } void tst_QQmlDebugJS::initTestCase() @@ -826,11 +850,18 @@ void tst_QQmlDebugJS::cleanupTestCase() // qDebug() << "Time Elapsed:" << t.elapsed(); } -void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrictServices) +void tst_QQmlDebugJS::init(bool qmlscene, const QString &qmlFile, bool blockMode, + bool restrictServices) { connection = new QQmlDebugConnection(); - process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this); + if (qmlscene) + process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + + "/qmlscene", this); + else + process = new QQmlDebugProcess(QCoreApplication::applicationDirPath() + + QLatin1String("/qqmldebugjsserver"), this); client = new QJSDebugClient(connection); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(connection); const char *args = 0; if (blockMode) @@ -849,6 +880,11 @@ void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrict if (client->state() != QQmlDebugClient::Enabled) QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(enabled()))); + + foreach (QQmlDebugClient *otherClient, others) + QCOMPARE(otherClient->state(), restrictServices ? QQmlDebugClient::Unavailable : + QQmlDebugClient::Enabled); + qDeleteAll(others); } void tst_QQmlDebugJS::cleanup() @@ -878,17 +914,23 @@ void tst_QQmlDebugJS::connect_data() { QTest::addColumn<bool>("blockMode"); QTest::addColumn<bool>("restrictMode"); - QTest::newRow("normal/unrestricted") << false << false; - QTest::newRow("block/unrestricted") << true << false; - QTest::newRow("normal/restricted") << false << true; - QTest::newRow("block/restricted") << true << true; + QTest::addColumn<bool>("qmlscene"); + QTest::newRow("normal / unrestricted / custom") << false << false << false; + QTest::newRow("block / unrestricted / custom") << true << false << false; + QTest::newRow("normal / restricted / custom") << false << true << false; + QTest::newRow("block / restricted / custom") << true << true << false; + QTest::newRow("normal / unrestricted / qmlscene") << false << false << true; + QTest::newRow("block / unrestricted / qmlscene") << true << false << true; + QTest::newRow("normal / restricted / qmlscene") << false << true << true; + QTest::newRow("block / restricted / qmlscene") << true << true << true; } void tst_QQmlDebugJS::connect() { QFETCH(bool, blockMode); QFETCH(bool, restrictMode); - init(QString(TEST_QMLFILE), blockMode, restrictMode); + QFETCH(bool, qmlscene); + init(qmlscene, QString(TEST_QMLFILE), blockMode, restrictMode); client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected()))); } @@ -897,7 +939,8 @@ void tst_QQmlDebugJS::interrupt() { //void connect() - init(); + QFETCH(bool, qmlscene); + init(qmlscene); client->connect(); client->interrupt(); @@ -908,7 +951,8 @@ void tst_QQmlDebugJS::getVersion() { //void version() - init(); + QFETCH(bool, qmlscene); + init(qmlscene); client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected()))); @@ -933,7 +977,8 @@ void tst_QQmlDebugJS::disconnect() { //void disconnect() - init(); + QFETCH(bool, qmlscene); + init(qmlscene); client->connect(); client->disconnect(); @@ -943,9 +988,10 @@ void tst_QQmlDebugJS::disconnect() void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 39; - init(ONCOMPLETED_QMLFILE); + init(qmlscene, ONCOMPLETED_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(); @@ -963,9 +1009,10 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted() void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 39; - init(CREATECOMPONENT_QMLFILE); + init(qmlscene, CREATECOMPONENT_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(); @@ -982,8 +1029,9 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated() void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback() { + QFETCH(bool, qmlscene); int sourceLine = 40; - init(TIMER_QMLFILE); + init(qmlscene, TIMER_QMLFILE); client->connect(); //We can set the breakpoint after connect() here because the timer is repeating and if we miss @@ -1003,9 +1051,10 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback() void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 35; - init(LOADJSFILE_QMLFILE); + init(qmlscene, LOADJSFILE_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true); client->connect(); @@ -1023,10 +1072,11 @@ void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile() void tst_QQmlDebugJS::setBreakpointInScriptOnComment() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 39; int actualLine = 41; - init(BREAKPOINTRELOCATION_QMLFILE); + init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1045,10 +1095,11 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComment() void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 40; int actualLine = 41; - init(BREAKPOINTRELOCATION_QMLFILE); + init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1067,9 +1118,10 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine() void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding() { //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1) + QFETCH(bool, qmlscene); int sourceLine = 44; - init(BREAKPOINTRELOCATION_QMLFILE); + init(qmlscene, BREAKPOINTRELOCATION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1086,9 +1138,10 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding() void tst_QQmlDebugJS::setBreakpointInScriptWithCondition() { + QFETCH(bool, qmlscene); int out = 10; int sourceLine = 42; - init(CONDITION_QMLFILE); + init(qmlscene, CONDITION_QMLFILE); client->connect(); //The breakpoint is in a timer loop so we can set it after connect(). @@ -1122,7 +1175,8 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition() void tst_QQmlDebugJS::setBreakpointInScriptThatQuits() { - init(QUIT_QMLFILE); + QFETCH(bool, qmlscene); + init(qmlscene, QUIT_QMLFILE); int sourceLine = 41; @@ -1181,10 +1235,11 @@ void tst_QQmlDebugJS::setBreakpointOnEvent() void tst_QQmlDebugJS::clearBreakpoint() { //void clearBreakpoint(int breakpoint); + QFETCH(bool, qmlscene); int sourceLine1 = 42; int sourceLine2 = 43; - init(CHANGEBREAKPOINT_QMLFILE); + init(qmlscene, CHANGEBREAKPOINT_QMLFILE); client->connect(); //The breakpoints are in a timer loop so we can set them after connect(). @@ -1228,8 +1283,9 @@ void tst_QQmlDebugJS::clearBreakpoint() void tst_QQmlDebugJS::setExceptionBreak() { //void setExceptionBreak(QString type, bool enabled = false); + QFETCH(bool, qmlscene); - init(EXCEPTION_QMLFILE); + init(qmlscene, EXCEPTION_QMLFILE); client->setExceptionBreak(QJSDebugClient::All,true); client->connect(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); @@ -1238,9 +1294,10 @@ void tst_QQmlDebugJS::setExceptionBreak() void tst_QQmlDebugJS::stepNext() { //void continueDebugging(StepAction stepAction, int stepCount = 1); + QFETCH(bool, qmlscene); int sourceLine = 42; - init(STEPACTION_QMLFILE); + init(qmlscene, STEPACTION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1261,10 +1318,11 @@ void tst_QQmlDebugJS::stepNext() void tst_QQmlDebugJS::stepIn() { //void continueDebugging(StepAction stepAction, int stepCount = 1); + QFETCH(bool, qmlscene); int sourceLine = 46; int actualLine = 42; - init(STEPACTION_QMLFILE); + init(qmlscene, STEPACTION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true); client->connect(); @@ -1285,10 +1343,11 @@ void tst_QQmlDebugJS::stepIn() void tst_QQmlDebugJS::stepOut() { //void continueDebugging(StepAction stepAction, int stepCount = 1); + QFETCH(bool, qmlscene); int sourceLine = 42; int actualLine = 46; - init(STEPACTION_QMLFILE); + init(qmlscene, STEPACTION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1309,10 +1368,11 @@ void tst_QQmlDebugJS::stepOut() void tst_QQmlDebugJS::continueDebugging() { //void continueDebugging(StepAction stepAction, int stepCount = 1); + QFETCH(bool, qmlscene); int sourceLine1 = 46; int sourceLine2 = 43; - init(STEPACTION_QMLFILE); + init(qmlscene, STEPACTION_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true); @@ -1334,9 +1394,10 @@ void tst_QQmlDebugJS::continueDebugging() void tst_QQmlDebugJS::backtrace() { //void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false); + QFETCH(bool, qmlscene); int sourceLine = 39; - init(ONCOMPLETED_QMLFILE); + init(qmlscene, ONCOMPLETED_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1349,9 +1410,10 @@ void tst_QQmlDebugJS::backtrace() void tst_QQmlDebugJS::getFrameDetails() { //void frame(int number = -1); + QFETCH(bool, qmlscene); int sourceLine = 39; - init(ONCOMPLETED_QMLFILE); + init(qmlscene, ONCOMPLETED_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1364,9 +1426,10 @@ void tst_QQmlDebugJS::getFrameDetails() void tst_QQmlDebugJS::getScopeDetails() { //void scope(int number = -1, int frameNumber = -1); + QFETCH(bool, qmlscene); int sourceLine = 39; - init(ONCOMPLETED_QMLFILE); + init(qmlscene, ONCOMPLETED_QMLFILE); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true); client->connect(); @@ -1437,7 +1500,8 @@ void tst_QQmlDebugJS::getScripts() { //void scripts(int types = -1, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant()); - init(); + QFETCH(bool, qmlscene); + init(qmlscene); client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QString(TEST_QMLFILE), 40, -1, true); client->connect(); @@ -1455,6 +1519,13 @@ void tst_QQmlDebugJS::getScripts() QVERIFY(scripts.first().toMap()[QStringLiteral("name")].toString().endsWith(QStringLiteral("data/test.qml"))); } +void tst_QQmlDebugJS::targetData() +{ + QTest::addColumn<bool>("qmlscene"); + QTest::newRow("custom") << false; + QTest::newRow("qmlscene") << true; +} + QTEST_MAIN(tst_QQmlDebugJS) #include "tst_qqmldebugjs.moc" diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp new file mode 100644 index 0000000000..dd3416a78f --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/qguiapplication.h> +#include <QtQml/qqmlengine.h> +#include <QtQml/qqmlapplicationengine.h> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + QQmlEngine someWeirdEngine; // add another engine to cause some trouble + + QQmlApplicationEngine engine; + engine.load(QUrl::fromLocalFile(QLatin1String(argv[argc - 1]))); + + return app.exec(); +} + diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro new file mode 100644 index 0000000000..837eaed9f1 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro @@ -0,0 +1,12 @@ +QT += qml testlib +osx:CONFIG -= app_bundle +CONFIG -= debug_and_release_target +INCLUDEPATH += ../../shared +SOURCES += qqmldebugjsserver.cpp +DEFINES += QT_QML_DEBUG_NO_WARNING + +DESTDIR = ../qqmldebugjs + +target.path = $$[QT_INSTALL_TESTS]/tst_qqmldebugjs +INSTALLS += target + diff --git a/tests/auto/qml/debugger/qqmldebuglocal/qqmldebuglocal.pro b/tests/auto/qml/debugger/qqmldebuglocal/qqmldebuglocal.pro index b612da11de..860d39cca4 100644 --- a/tests/auto/qml/debugger/qqmldebuglocal/qqmldebuglocal.pro +++ b/tests/auto/qml/debugger/qqmldebuglocal/qqmldebuglocal.pro @@ -10,7 +10,6 @@ SOURCES += tst_qqmldebuglocal.cpp \ INCLUDEPATH += ../shared include(../shared/debugutil.pri) -CONFIG += parallel_test QT += qml-private testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING +DEFINES += QT_QML_DEBUG_NO_WARNING diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp index 0343ea77ee..083e6de09e 100644 --- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp +++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp @@ -31,18 +31,20 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> -#include <ctime> - -#include "debugutil_p.h" #include "qqmldebugtestservice.h" +#include "debugutil_p.h" #include <private/qqmldebugconnector_p.h> +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> +#include <QtNetwork/qhostaddress.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> + +#include <ctime> QString fileName; diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro index 573e58d3a6..79cbe52331 100644 --- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro +++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmldebugservice -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle HEADERS += ../shared/qqmldebugtestservice.h @@ -19,4 +19,3 @@ OTHER_FILES += \ DEFINES += QT_QML_DEBUG_NO_WARNING QT += qml-private testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp index b63c5c0a6d..e2cdc89a56 100644 --- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp +++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp @@ -30,22 +30,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> -#include <QLibraryInfo> -#include <QtQml/qqmlengine.h> -#include "../../../shared/util.h" -#include "debugutil_p.h" -#include "qqmldebugclient.h" #include "qqmldebugtestservice.h" +#include "debugutil_p.h" +#include "../../../shared/util.h" + +#include <private/qqmldebugclient_p.h> +#include <private/qqmldebugconnection_p.h> #include <private/qqmldebugconnector_p.h> +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> +#include <QtNetwork/qhostaddress.h> +#include <QtQml/qqmlengine.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> +#include <QtCore/qlibraryinfo.h> + #define PORT 3769 #define STR_PORT "3769" @@ -74,10 +77,19 @@ void tst_QQmlDebugService::initTestCase() { QQmlDataTest::initTestCase(); QQmlDebugConnector::setPluginKey(QLatin1String("QQmlDebugServer")); + QQmlDebugConnector::setServices(QStringList() + << QStringLiteral("tst_QQmlDebugService")); QTest::ignoreMessage(QtWarningMsg, "QML debugger: Cannot set plugin key after loading the plugin."); m_service = new QQmlDebugTestService("tst_QQmlDebugService", 2); + foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT); QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData()); QQmlDebuggingEnabler::startTcpDebugServer(PORT); @@ -195,7 +207,7 @@ void tst_QQmlDebugService::checkSupportForDataStreamVersion() client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); - QCOMPARE(m_conn->dataStreamVersion(), int(QDataStream::Qt_5_0)); + QCOMPARE(m_conn->currentDataStreamVersion(), int(QDataStream::Qt_DefaultCompiledVersion)); } void tst_QQmlDebugService::idForObject() @@ -238,7 +250,7 @@ void tst_QQmlDebugService::checkSupportForOldDataStreamVersion() //create a new connection; delete m_conn; m_conn = new QQmlDebugConnection(this); - m_conn->setDataStreamVersion(QDataStream::Qt_4_7); + m_conn->setMaximumDataStreamVersion(QDataStream::Qt_5_0); for (int i = 0; i < 50; ++i) { // try for 5 seconds ... m_conn->connectToHost("127.0.0.1", PORT); @@ -258,7 +270,7 @@ void tst_QQmlDebugService::checkSupportForOldDataStreamVersion() client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); - QCOMPARE(m_conn->dataStreamVersion(), int(QDataStream::Qt_4_7)); + QCOMPARE(m_conn->currentDataStreamVersion(), int(QDataStream::Qt_5_0)); } QTEST_MAIN(tst_QQmlDebugService) diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro index 901dd229c0..2518650493 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmlenginecontrol -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qqmlenginecontrol.cpp @@ -11,7 +11,6 @@ include(../shared/debugutil.pri) TESTDATA = data/* QT += core qml testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/test.qml \ diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp index 11fa56d710..fb4d46b8c8 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp +++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp @@ -31,60 +31,43 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QLibraryInfo> - #include "debugutil_p.h" -#include "qqmldebugclient.h" #include "../../../shared/util.h" +#include <private/qqmldebugclient_p.h> +#include <private/qqmldebugconnection_p.h> +#include <private/qpacket_p.h> +#include <private/qqmlenginecontrolclient_p.h> + +#include <QtTest/qtest.h> +#include <QtCore/qlibraryinfo.h> + #define STR_PORT_FROM "13773" #define STR_PORT_TO "13783" -class QQmlEngineControlClient : public QQmlDebugClient +class QQmlEngineBlocker : public QObject { Q_OBJECT public: - enum MessageType { - EngineAboutToBeAdded, - EngineAdded, - EngineAboutToBeRemoved, - EngineRemoved, - - MaximumMessageType - }; - - enum CommandType { - StartWaitingEngine, - StopWaitingEngine, - - MaximumCommandType - }; - - QQmlEngineControlClient(QQmlDebugConnection *connection) - : QQmlDebugClient(QLatin1String("EngineControl"), connection) - {} - - - void command(CommandType command, int engine) { - QByteArray message; - QDataStream stream(&message, QIODevice::WriteOnly); - stream << (int)command << engine; - sendMessage(message); - } + QQmlEngineBlocker(QQmlEngineControlClient *parent); - QList<int> startingEngines; - QList<int> stoppingEngines; +public slots: + void blockEngine(int engineId, const QString &name); +}; -signals: - void engineAboutToBeAdded(); - void engineAdded(); - void engineAboutToBeRemoved(); - void engineRemoved(); +QQmlEngineBlocker::QQmlEngineBlocker(QQmlEngineControlClient *parent): QObject(parent) +{ + connect(parent, &QQmlEngineControlClient::engineAboutToBeAdded, + this, &QQmlEngineBlocker::blockEngine); + connect(parent, &QQmlEngineControlClient::engineAboutToBeRemoved, + this, &QQmlEngineBlocker::blockEngine); +} -protected: - void messageReceived(const QByteArray &message); -}; +void QQmlEngineBlocker::blockEngine(int engineId, const QString &name) +{ + Q_UNUSED(name); + static_cast<QQmlEngineControlClient *>(parent())->blockEngine(engineId); +} class tst_QQmlEngineControl : public QQmlDataTest { @@ -97,7 +80,6 @@ public: , m_client(0) {} - private: QQmlDebugProcess *m_process; QQmlDebugConnection *m_connection; @@ -115,42 +97,6 @@ private slots: void stopEngine(); }; -void QQmlEngineControlClient::messageReceived(const QByteArray &message) -{ - QByteArray msg = message; - QDataStream stream(&msg, QIODevice::ReadOnly); - - int messageType; - int engineId; - stream >> messageType >> engineId; - - switch (messageType) { - case EngineAboutToBeAdded: - startingEngines.append(engineId); - emit engineAboutToBeAdded(); - break; - case EngineAdded: - QVERIFY(startingEngines.contains(engineId)); - startingEngines.removeOne(engineId); - emit engineAdded(); - break; - case EngineAboutToBeRemoved: - stoppingEngines.append(engineId); - emit engineAboutToBeRemoved(); - break; - case EngineRemoved: - QVERIFY(stoppingEngines.contains(engineId)); - stoppingEngines.removeOne(engineId); - emit engineRemoved(); - break; - default: - QString failMsg = QString("Unknown message type:") + messageType; - QFAIL(qPrintable(failMsg)); - break; - } - QVERIFY(stream.atEnd()); -} - void tst_QQmlEngineControl::connect(const QString &testFile, bool restrictServices) { const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"; @@ -167,11 +113,17 @@ void tst_QQmlEngineControl::connect(const QString &testFile, bool restrictServic m_connection = new QQmlDebugConnection(); m_client = new QQmlEngineControlClient(m_connection); + new QQmlEngineBlocker(m_client); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection); const int port = m_process->debugPort(); m_connection->connectToHost(QLatin1String("127.0.0.1"), port); QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + foreach (QQmlDebugClient *other, others) + QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable : + QQmlDebugClient::Enabled); + qDeleteAll(others); } void tst_QQmlEngineControl::cleanup() @@ -179,8 +131,8 @@ void tst_QQmlEngineControl::cleanup() if (QTest::currentTestFailed()) { qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null")); qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null")); - qDebug() << "Connection State:" << (m_connection ? m_connection->stateString() : QLatin1String("null")); - qDebug() << "Client State:" << (m_client ? m_client->stateString() : QLatin1String("null")); + qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection); + qDebug() << "Client State:" << QQmlDebugTest::clientStateString(m_client); } delete m_process; m_process = 0; @@ -208,10 +160,10 @@ void tst_QQmlEngineControl::startEngine() connect("test.qml", restrictMode); - QTRY_VERIFY(!m_client->startingEngines.empty()); - m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last()); + QTRY_VERIFY(!m_client->blockedEngines().empty()); + m_client->releaseEngine(m_client->blockedEngines().last()); - QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded())), + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded(int,QString))), "No engine start message received in time."); } @@ -226,16 +178,16 @@ void tst_QQmlEngineControl::stopEngine() connect("exit.qml", restrictMode); - QTRY_VERIFY(!m_client->startingEngines.empty()); - m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last()); + QTRY_VERIFY(!m_client->blockedEngines().empty()); + m_client->releaseEngine(m_client->blockedEngines().last()); - QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded())), + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAdded(int,QString))), "No engine start message received in time."); - QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAboutToBeRemoved())), + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineAboutToBeRemoved(int,QString))), "No engine about to stop message received in time."); - m_client->command(QQmlEngineControlClient::StopWaitingEngine, m_client->stoppingEngines.last()); - QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineRemoved())), + m_client->releaseEngine(m_client->blockedEngines().last()); + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(engineRemoved(int,QString))), "No engine stop message received in time."); } diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro index 028eb3644d..e11ccdc6ca 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro @@ -2,7 +2,7 @@ CONFIG += testcase TARGET = tst_qqmlenginedebuginspectorintegration QT += qml testlib gui-private core-private -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qqmlenginedebuginspectorintegration.cpp @@ -13,4 +13,3 @@ include(../shared/qqmlenginedebugclient.pri) include(../shared/debugutil.pri) TESTDATA = data/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 0285bae189..04b068161b 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -31,18 +31,20 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> -#include <QtCore/QLibraryInfo> - -#include "../shared/debugutil_p.h" -#include "../../../shared/util.h" #include "qqmlinspectorclient.h" #include "qqmlenginedebugclient.h" +#include "../shared/debugutil_p.h" +#include "../../../shared/util.h" + +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> +#include <QtNetwork/qhostaddress.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> +#include <QtCore/qlibraryinfo.h> #define STR_PORT_FROM "3776" #define STR_PORT_TO "3786" @@ -111,9 +113,14 @@ void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices) QQmlDebugConnection *m_connection = new QQmlDebugConnection(this); m_inspectorClient = new QQmlInspectorClient(m_connection); m_engineDebugClient = new QQmlEngineDebugClient(m_connection); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection); m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort()); QVERIFY(m_connection->waitForConnected()); + foreach (QQmlDebugClient *other, others) + QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable : + QQmlDebugClient::Enabled); + qDeleteAll(others); } void tst_QQmlEngineDebugInspectorIntegration::cleanup() diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro index 5dadef62e4..06250d9940 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmlenginedebugservice -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += \ tst_qqmlenginedebugservice.cpp @@ -13,4 +13,3 @@ include(../shared/debugutil.pri) DEFINES += QT_QML_DEBUG_NO_WARNING QT += core-private qml-private quick-private testlib gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index bc3220ad8c..fe4000bbb4 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -30,31 +30,33 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> -#include <QModelIndex> -#include <QtQml/qqmlengine.h> -#include <QtQml/qqmlcontext.h> -#include <QtQml/qqmlcomponent.h> -#include <QtQml/qqmlexpression.h> -#include <QtQml/qqmlproperty.h> -#include <QtQuick/qquickitem.h> +#include "qqmlenginedebugclient.h" +#include "debugutil_p.h" +#include "../../../shared/util.h" #include <private/qqmlbinding_p.h> #include <private/qqmlboundsignal_p.h> #include <private/qqmldebugservice_p.h> #include <private/qqmlmetatype_p.h> #include <private/qqmlproperty_p.h> +#include <private/qqmldebugconnection_p.h> -#include "debugutil_p.h" -#include "qqmlenginedebugclient.h" +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> -#include "../../../shared/util.h" +#include <QtQml/qqmlengine.h> +#include <QtQml/qqmlcontext.h> +#include <QtQml/qqmlcomponent.h> +#include <QtQml/qqmlexpression.h> +#include <QtQml/qqmlproperty.h> +#include <QtQuick/qquickitem.h> + +#include <QtNetwork/qhostaddress.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> +#include <QtCore/qabstractitemmodel.h> #define QVERIFYOBJECT(statement) \ do {\ @@ -352,7 +354,11 @@ void tst_QQmlEngineDebugService::initTestCase() bool ok = m_conn->waitForConnected(); QVERIFY(ok); m_dbg = new QQmlEngineDebugClient(m_conn); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_conn); QTRY_COMPARE(m_dbg->state(), QQmlEngineDebugClient::Enabled); + foreach (QQmlDebugClient *other, others) + QCOMPARE(other->state(), QQmlDebugClient::Unavailable); + qDeleteAll(others); } void tst_QQmlEngineDebugService::cleanupTestCase() diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro index 3a1d59f3fa..ee5f3c708a 100644 --- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro +++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro @@ -2,7 +2,7 @@ CONFIG += testcase TARGET = tst_qqmlinspector QT += qml testlib gui-private core-private -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qqmlinspector.cpp @@ -12,4 +12,3 @@ include(../shared/qqmlinspectorclient.pri) include(../shared/debugutil.pri) TESTDATA = data/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp index 70833f5e2c..d5aa1f41ad 100644 --- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp +++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp @@ -30,17 +30,20 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> -#include <QtCore/QLibraryInfo> +#include "qqmlinspectorclient.h" #include "../shared/debugutil_p.h" #include "../../../shared/util.h" -#include "qqmlinspectorclient.h" + +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> +#include <QtCore/qthread.h> +#include <QtCore/qlibraryinfo.h> +#include <QtNetwork/qhostaddress.h> #define STR_PORT_FROM "3772" #define STR_PORT_TO "3782" @@ -91,11 +94,16 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */, bool re m_connection = new QQmlDebugConnection(); m_client = new QQmlInspectorClient(m_connection); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection); m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort()); QVERIFY(m_client); QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + foreach (QQmlDebugClient *other, others) + QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable : + QQmlDebugClient::Enabled); + qDeleteAll(others); } void tst_QQmlInspector::cleanup() diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index e422d3ef99..71a58d6f34 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmlprofilerservice -macx:CONFIG -= app_bundle +osx:CONFIG -= app_bundle SOURCES += tst_qqmlprofilerservice.cpp @@ -11,7 +11,6 @@ include(../shared/debugutil.pri) TESTDATA = data/* QT += core qml testlib gui-private core-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/pixmapCacheTest.qml \ diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 0e63e18952..3a9666b8fe 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -31,20 +31,25 @@ ** ****************************************************************************/ -#include <qtest.h> -#include <QLibraryInfo> - #include "debugutil_p.h" -#include "qqmldebugclient.h" #include "../../../shared/util.h" +#include <private/qqmlprofilerclient_p.h> +#include <private/qqmldebugconnection_p.h> + +#include <QtTest/qtest.h> +#include <QtCore/qlibraryinfo.h> + #define STR_PORT_FROM "13773" #define STR_PORT_TO "13783" struct QQmlProfilerData { - QQmlProfilerData(int messageType = 0, int detailType = 0, const QString &detailData = QString()) - : messageType(messageType), detailType(detailType), detailData(detailData) {} + QQmlProfilerData(qint64 time = -2, int messageType = -1, int detailType = -1, + const QString &detailData = QString()) : + time(time), messageType(messageType), detailType(detailType), detailData(detailData), + line(-1), column(-1), framerate(-1), animationcount(-1), amount(-1) + {} qint64 time; int messageType; @@ -57,109 +62,184 @@ struct QQmlProfilerData int framerate; //used by animation events int animationcount; //used by animation events qint64 amount; //used by heap events - - QByteArray toByteArray() const; }; -class QQmlProfilerClient : public QQmlDebugClient +class QQmlProfilerTestClient : public QQmlProfilerClient { Q_OBJECT public: - enum Message { - Event, - RangeStart, - RangeData, - RangeLocation, - RangeEnd, - Complete, // end of transmission - PixmapCacheEvent, - SceneGraphFrame, - MemoryAllocation, - - MaximumMessage - }; + QQmlProfilerTestClient(QQmlDebugConnection *connection) : QQmlProfilerClient(connection) {} - enum EventType { - FramePaint, - Mouse, - Key, - AnimationFrame, - EndTrace, - StartTrace, + QVector<QQmlProfilerData> qmlMessages; + QVector<QQmlProfilerData> javascriptMessages; + QVector<QQmlProfilerData> jsHeapMessages; + QVector<QQmlProfilerData> asynchronousMessages; + QVector<QQmlProfilerData> pixmapMessages; - MaximumEventType - }; +signals: + void recordingFinished(); - enum RangeType { - Painting, - Compiling, - Creating, - Binding, //running a binding - HandlingSignal, //running a signal handler - Javascript, +private: + void traceStarted(qint64 time, int engineId); + void traceFinished(qint64 time, int engineId); + void rangeStart(QQmlProfilerDefinitions::RangeType type, qint64 startTime); + void rangeData(QQmlProfilerDefinitions::RangeType type, qint64 time, const QString &data); + void rangeLocation(QQmlProfilerDefinitions::RangeType type, qint64 time, + const QQmlEventLocation &location); + void rangeEnd(QQmlProfilerDefinitions::RangeType type, qint64 endTime); + void animationFrame(qint64 time, int frameRate, int animationCount, int threadId); + void sceneGraphEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time, + qint64 numericData1, qint64 numericData2, qint64 numericData3, + qint64 numericData4, qint64 numericData5); + void pixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, qint64 time, + const QString &url, int numericData1, int numericData2); + void memoryAllocation(QQmlProfilerDefinitions::MemoryType type, qint64 time, qint64 amount); + void inputEvent(QQmlProfilerDefinitions::InputEventType type, qint64 time, int a, int b); + void complete(); - MaximumRangeType - }; + void unknownEvent(QQmlProfilerDefinitions::Message messageType, qint64 time, int detailType); + void unknownData(QPacket &stream); +}; - enum PixmapEventType { - PixmapSizeKnown, - PixmapReferenceCountChanged, - PixmapCacheCountChanged, - PixmapLoadingStarted, - PixmapLoadingFinished, - PixmapLoadingError, +void QQmlProfilerTestClient::traceStarted(qint64 time, int engineId) +{ + asynchronousMessages.append(QQmlProfilerData(time, QQmlProfilerDefinitions::Event, + QQmlProfilerDefinitions::StartTrace, + QString::number(engineId))); +} - MaximumPixmapEventType - }; +void QQmlProfilerTestClient::traceFinished(qint64 time, int engineId) +{ + asynchronousMessages.append(QQmlProfilerData(time, QQmlProfilerDefinitions::Event, + QQmlProfilerDefinitions::EndTrace, + QString::number(engineId))); +} - enum SceneGraphFrameType { - SceneGraphRendererFrame, - SceneGraphAdaptationLayerFrame, - SceneGraphContextFrame, - SceneGraphRenderLoopFrame, - SceneGraphTexturePrepare, - SceneGraphTextureDeletion, - SceneGraphPolishAndSync, - SceneGraphWindowsRenderShow, - SceneGraphWindowsAnimations, - SceneGraphWindowsPolishFrame, - - MaximumSceneGraphFrameType - }; +void QQmlProfilerTestClient::rangeStart(QQmlProfilerDefinitions::RangeType type, qint64 startTime) +{ + QVERIFY(type >= 0 && type < QQmlProfilerDefinitions::MaximumRangeType); + QQmlProfilerData data(startTime, QQmlProfilerDefinitions::RangeStart, type); + if (type == QQmlProfilerDefinitions::Javascript) + javascriptMessages.append(data); + else + qmlMessages.append(data); +} - enum MemoryType { - HeapPage, - LargeItem, - SmallItem - }; +void QQmlProfilerTestClient::rangeData(QQmlProfilerDefinitions::RangeType type, qint64 time, + const QString &string) +{ + QVERIFY(type >= 0 && type < QQmlProfilerDefinitions::MaximumRangeType); + QQmlProfilerData data(time, QQmlProfilerDefinitions::RangeData, type, string); + if (type == QQmlProfilerDefinitions::Javascript) + javascriptMessages.append(data); + else + qmlMessages.append(data); +} - QQmlProfilerClient(QQmlDebugConnection *connection) - : QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection) - { - } +void QQmlProfilerTestClient::rangeLocation(QQmlProfilerDefinitions::RangeType type, qint64 time, + const QQmlEventLocation &location) +{ + QVERIFY(type >= 0 && type < QQmlProfilerDefinitions::MaximumRangeType); + QVERIFY(location.line >= -2); + QQmlProfilerData data(time, QQmlProfilerDefinitions::RangeLocation, type, location.filename); + data.line = location.line; + data.column = location.column; + if (type == QQmlProfilerDefinitions::Javascript) + javascriptMessages.append(data); + else + qmlMessages.append(data); +} - QVector<QQmlProfilerData> qmlMessages; - QVector<QQmlProfilerData> javascriptMessages; - QVector<QQmlProfilerData> jsHeapMessages; - QVector<QQmlProfilerData> asynchronousMessages; - QVector<QQmlProfilerData> pixmapMessages; +void QQmlProfilerTestClient::rangeEnd(QQmlProfilerDefinitions::RangeType type, qint64 endTime) +{ + QVERIFY(type >= 0 && type < QQmlProfilerDefinitions::MaximumRangeType); + QQmlProfilerData data(endTime, QQmlProfilerDefinitions::RangeEnd, type); + if (type == QQmlProfilerDefinitions::Javascript) + javascriptMessages.append(data); + else + qmlMessages.append(data); +} + +void QQmlProfilerTestClient::animationFrame(qint64 time, int frameRate, int animationCount, int threadId) +{ + QVERIFY(threadId >= 0); + QVERIFY(frameRate != -1); + QVERIFY(animationCount != -1); + QQmlProfilerData data(time, QQmlProfilerDefinitions::Event, + QQmlProfilerDefinitions::AnimationFrame); + data.framerate = frameRate; + data.animationcount = animationCount; + asynchronousMessages.append(data); +} - void setTraceState(bool enabled, quint32 flushInterval = 0) { - QByteArray message; - QDataStream stream(&message, QIODevice::WriteOnly); - stream << enabled; - if (enabled && flushInterval) - stream << -1 << std::numeric_limits<quint64>::max() << flushInterval; - sendMessage(message); +void QQmlProfilerTestClient::sceneGraphEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, + qint64 time, qint64 numericData1, qint64 numericData2, + qint64 numericData3, qint64 numericData4, + qint64 numericData5) +{ + Q_UNUSED(numericData1); + Q_UNUSED(numericData2); + Q_UNUSED(numericData3); + Q_UNUSED(numericData4); + Q_UNUSED(numericData5); + asynchronousMessages.append(QQmlProfilerData(time, QQmlProfilerDefinitions::SceneGraphFrame, + type)); +} + +void QQmlProfilerTestClient::pixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, + qint64 time, const QString &url, int numericData1, + int numericData2) +{ + QQmlProfilerData data(time, QQmlProfilerDefinitions::PixmapCacheEvent, type, url); + switch (type) { + case QQmlProfilerDefinitions::PixmapSizeKnown: + data.line = numericData1; + data.column = numericData2; + break; + case QQmlProfilerDefinitions::PixmapReferenceCountChanged: + case QQmlProfilerDefinitions::PixmapCacheCountChanged: + data.animationcount = numericData1; + break; + default: + break; } + pixmapMessages.append(data); +} -signals: - void complete(); +void QQmlProfilerTestClient::memoryAllocation(QQmlProfilerDefinitions::MemoryType type, qint64 time, + qint64 amount) +{ + QQmlProfilerData data(time, QQmlProfilerDefinitions::MemoryAllocation, type); + data.amount = amount; + jsHeapMessages.append(data); +} -protected: - void messageReceived(const QByteArray &message); -}; +void QQmlProfilerTestClient::inputEvent(QQmlProfilerDefinitions::InputEventType type, qint64 time, + int a, int b) +{ + qmlMessages.append(QQmlProfilerData(time, QQmlProfilerDefinitions::Event, type, + QString::number(a) + QLatin1Char('x') + + QString::number(b))); +} + +void QQmlProfilerTestClient::unknownEvent(QQmlProfilerDefinitions::Message messageType, qint64 time, + int detailType) +{ + QFAIL(qPrintable(QString::fromLatin1("Unknown event %1 with detail type %2 received at %3.") + .arg(messageType).arg(detailType).arg(time))); +} + +void QQmlProfilerTestClient::unknownData(QPacket &stream) +{ + QFAIL(qPrintable(QString::fromLatin1("%1 bytes of extra data after receiving message.") + .arg(stream.device()->bytesAvailable()))); +} + +void QQmlProfilerTestClient::complete() +{ + emit recordingFinished(); +} class tst_QQmlProfilerService : public QQmlDataTest { @@ -177,7 +257,7 @@ public: private: QQmlDebugProcess *m_process; QQmlDebugConnection *m_connection; - QQmlProfilerClient *m_client; + QQmlProfilerTestClient *m_client; enum MessageListType { MessageListQML, @@ -219,143 +299,6 @@ private slots: #define VERIFY(type, position, expected, checks) QVERIFY(verify(type, position, expected, checks)) -void QQmlProfilerClient::messageReceived(const QByteArray &message) -{ - QByteArray msg = message; - QDataStream stream(&msg, QIODevice::ReadOnly); - - - QQmlProfilerData data; - data.time = -2; - data.messageType = -1; - data.detailType = -1; - data.line = -1; - data.framerate = -1; - data.animationcount = -1; - - stream >> data.time >> data.messageType; - - switch (data.messageType) { - case (QQmlProfilerClient::Event): { - stream >> data.detailType; - - switch (data.detailType) { - case QQmlProfilerClient::AnimationFrame: { - int threadId; - stream >> data.framerate >> data.animationcount >> threadId; - QVERIFY(threadId >= 0); - QVERIFY(data.framerate != -1); - QVERIFY(data.animationcount != -1); - break; - } - case QQmlProfilerClient::FramePaint: - case QQmlProfilerClient::Mouse: - case QQmlProfilerClient::Key: - break; - case QQmlProfilerClient::EndTrace: - case QQmlProfilerClient::StartTrace: { - int engineId = -1; - if (!stream.atEnd()) { - stream >> engineId; - QVERIFY(engineId >= 0); - } - break; - } - default: { - QString failMsg = QString("Unknown event type:") + data.detailType; - QFAIL(qPrintable(failMsg)); - break; - } - } - break; - } - case QQmlProfilerClient::Complete: { - emit complete(); - return; - } - case QQmlProfilerClient::RangeStart: { - stream >> data.detailType; - QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType); - break; - } - case QQmlProfilerClient::RangeEnd: { - stream >> data.detailType; - QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType); - break; - } - case QQmlProfilerClient::RangeData: { - stream >> data.detailType >> data.detailData; - QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType); - break; - } - case QQmlProfilerClient::RangeLocation: { - stream >> data.detailType >> data.detailData >> data.line >> data.column; - QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType); - QVERIFY(data.line >= -2); - break; - } - case QQmlProfilerClient::PixmapCacheEvent: { - stream >> data.detailType >> data.detailData; - if (data.detailType == QQmlProfilerClient::PixmapSizeKnown) - stream >> data.line >> data.column; - if (data.detailType == QQmlProfilerClient::PixmapReferenceCountChanged) - stream >> data.animationcount; - if (data.detailType == QQmlProfilerClient::PixmapCacheCountChanged) - stream >> data.animationcount; - break; - } - case QQmlProfilerClient::SceneGraphFrame: { - stream >> data.detailType; - qint64 subtime_1, subtime_2, subtime_3, subtime_4, subtime_5; - int glyphCount; - switch (data.detailType) { - // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime - case QQmlProfilerClient::SceneGraphRendererFrame: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4; break; - // AdaptationLayerFrame: glyphCount, glyphRenderTime, glyphStoreTime - case QQmlProfilerClient::SceneGraphAdaptationLayerFrame: stream >> glyphCount >> subtime_2 >> subtime_3; break; - // ContextFrame: compiling material time - case QQmlProfilerClient::SceneGraphContextFrame: stream >> subtime_1; break; - // RenderLoop: syncTime, renderTime, swapTime - case QQmlProfilerClient::SceneGraphRenderLoopFrame: stream >> subtime_1 >> subtime_2 >> subtime_3; break; - // TexturePrepare: bind, convert, swizzle, upload, mipmap - case QQmlProfilerClient::SceneGraphTexturePrepare: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4 >> subtime_5; break; - // TextureDeletion: deletionTime - case QQmlProfilerClient::SceneGraphTextureDeletion: stream >> subtime_1; break; - // PolishAndSync: polishTime, waitTime, syncTime, animationsTime, - case QQmlProfilerClient::SceneGraphPolishAndSync: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4; break; - // WindowsRenderLoop: GL time, make current time, SceneGraph time - case QQmlProfilerClient::SceneGraphWindowsRenderShow: stream >> subtime_1 >> subtime_2 >> subtime_3; break; - // WindowsAnimations: update time - case QQmlProfilerClient::SceneGraphWindowsAnimations: stream >> subtime_1; break; - // WindowsRenderWindow: polish time - case QQmlProfilerClient::SceneGraphWindowsPolishFrame: stream >> subtime_1; break; - } - break; - } - case QQmlProfilerClient::MemoryAllocation: { - stream >> data.detailType; - stream >> data.amount; - break; - } - default: - QString failMsg = QString("Unknown message type:") + data.messageType; - QFAIL(qPrintable(failMsg)); - break; - } - QVERIFY(stream.atEnd()); - if (data.messageType == QQmlProfilerClient::PixmapCacheEvent) - pixmapMessages.append(data); - else if (data.messageType == QQmlProfilerClient::SceneGraphFrame || - data.messageType == QQmlProfilerClient::Event) - asynchronousMessages.append(data); - else if (data.messageType == QQmlProfilerClient::MemoryAllocation) - jsHeapMessages.append(data); - else if (data.detailType == QQmlProfilerClient::Javascript) - javascriptMessages.append(data); - else - qmlMessages.append(data); -} - void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool restrictServices) { // ### Still using qmlscene due to QTBUG-33377 @@ -372,24 +315,32 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); m_connection = new QQmlDebugConnection(); - m_client = new QQmlProfilerClient(m_connection); + m_client = new QQmlProfilerTestClient(m_connection); + QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection); const int port = m_process->debugPort(); m_connection->connectToHost(QLatin1String("127.0.0.1"), port); QVERIFY(m_client); QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + foreach (QQmlDebugClient *other, others) + QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable : + QQmlDebugClient::Enabled); + qDeleteAll(others); } void tst_QQmlProfilerService::checkTraceReceived() { - QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(recordingFinished())), + "No trace received in time."); // must start with "StartTrace" - QQmlProfilerData expected(QQmlProfilerClient::Event, QQmlProfilerClient::StartTrace); + QQmlProfilerData expected(0, QQmlProfilerDefinitions::Event, + QQmlProfilerDefinitions::StartTrace); VERIFY(MessageListAsynchronous, 0, expected, CheckMessageType | CheckDetailType); // must end with "EndTrace" - expected.detailType = QQmlProfilerClient::EndTrace; + expected.detailType = QQmlProfilerDefinitions::EndTrace; VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected, CheckMessageType | CheckDetailType); } @@ -406,15 +357,15 @@ void tst_QQmlProfilerService::checkJsHeap() qint64 lastTimestamp = -1; foreach (const QQmlProfilerData &message, m_client->jsHeapMessages) { switch (message.detailType) { - case QQmlProfilerClient::HeapPage: + case QV4::Profiling::HeapPage: allocated += message.amount; seen_alloc = true; break; - case QQmlProfilerClient::SmallItem: + case QV4::Profiling::SmallItem: used += message.amount; seen_small = true; break; - case QQmlProfilerClient::LargeItem: + case QV4::Profiling::LargeItem: allocated += message.amount; used += message.amount; seen_large = true; @@ -549,8 +500,8 @@ void tst_QQmlProfilerService::cleanup() qDebug() << " "; qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null")); qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null")); - qDebug() << "Connection State:" << (m_connection ? m_connection->stateString() : QLatin1String("null")); - qDebug() << "Client State:" << m_client->stateString(); + qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection); + qDebug() << "Client State:" << QQmlDebugTest::clientStateString(m_client); } delete m_process; m_process = 0; @@ -585,9 +536,9 @@ void tst_QQmlProfilerService::connect() // if the engine is waiting, then the first message determines if it starts with trace enabled if (!traceEnabled) - m_client->setTraceState(false); - m_client->setTraceState(true); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); + m_client->sendRecordingStatus(true); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); } @@ -596,36 +547,36 @@ void tst_QQmlProfilerService::pixmapCacheData() { connect(true, "pixmapCacheTest.qml"); - m_client->setTraceState(true); + m_client->sendRecordingStatus(true); QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); while (m_process->output().indexOf(QLatin1String("image loaded")) == -1 && m_process->output().indexOf(QLatin1String("image error")) == -1) QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); - QQmlProfilerData expected(QQmlProfilerClient::PixmapCacheEvent); + QQmlProfilerData expected(0, QQmlProfilerDefinitions::PixmapCacheEvent); // image starting to load - expected.detailType = QQmlProfilerClient::PixmapLoadingStarted; + expected.detailType = QQmlProfilerDefinitions::PixmapLoadingStarted; VERIFY(MessageListPixmap, 0, expected, CheckMessageType | CheckDetailType); // image size - expected.detailType = QQmlProfilerClient::PixmapSizeKnown; + expected.detailType = QQmlProfilerDefinitions::PixmapSizeKnown; expected.line = expected.column = 2; // width and height, in fact VERIFY(MessageListPixmap, 1, expected, CheckMessageType | CheckDetailType | CheckLine | CheckColumn); // image loaded - expected.detailType = QQmlProfilerClient::PixmapLoadingFinished; + expected.detailType = QQmlProfilerDefinitions::PixmapLoadingFinished; VERIFY(MessageListPixmap, 2, expected, CheckMessageType | CheckDetailType); // cache size - expected.detailType = QQmlProfilerClient::PixmapCacheCountChanged; + expected.detailType = QQmlProfilerDefinitions::PixmapCacheCountChanged; VERIFY(MessageListPixmap, 3, expected, CheckMessageType | CheckDetailType); } @@ -633,11 +584,11 @@ void tst_QQmlProfilerService::scenegraphData() { connect(true, "scenegraphTest.qml"); - m_client->setTraceState(true); + m_client->sendRecordingStatus(true); while (!m_process->output().contains(QLatin1String("tick"))) QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); @@ -653,8 +604,8 @@ void tst_QQmlProfilerService::scenegraphData() qint64 renderFrameTime = -1; foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) { - if (msg.messageType == QQmlProfilerClient::SceneGraphFrame) { - if (msg.detailType == QQmlProfilerClient::SceneGraphContextFrame) { + if (msg.messageType == QQmlProfilerDefinitions::SceneGraphFrame) { + if (msg.detailType == QQmlProfilerDefinitions::SceneGraphContextFrame) { contextFrameTime = msg.time; break; } @@ -664,7 +615,7 @@ void tst_QQmlProfilerService::scenegraphData() QVERIFY(contextFrameTime != -1); foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) { - if (msg.detailType == QQmlProfilerClient::SceneGraphRendererFrame) { + if (msg.detailType == QQmlProfilerDefinitions::SceneGraphRendererFrame) { QVERIFY(msg.time >= contextFrameTime); renderFrameTime = msg.time; break; @@ -674,7 +625,7 @@ void tst_QQmlProfilerService::scenegraphData() QVERIFY(renderFrameTime != -1); foreach (const QQmlProfilerData &msg, m_client->asynchronousMessages) { - if (msg.detailType == QQmlProfilerClient::SceneGraphRenderLoopFrame) { + if (msg.detailType == QQmlProfilerDefinitions::SceneGraphRenderLoopFrame) { QVERIFY(msg.time >= renderFrameTime); break; } @@ -685,7 +636,7 @@ void tst_QQmlProfilerService::profileOnExit() { connect(true, "exit.qml"); - m_client->setTraceState(true); + m_client->sendRecordingStatus(true); checkTraceReceived(); checkJsHeap(); @@ -695,7 +646,7 @@ void tst_QQmlProfilerService::controlFromJS() { connect(true, "controlFromJS.qml"); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); } @@ -704,15 +655,15 @@ void tst_QQmlProfilerService::signalSourceLocation() { connect(true, "signalSourceLocation.qml"); - m_client->setTraceState(true); + m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("500")))) QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); - QQmlProfilerData expected(QQmlProfilerClient::RangeLocation, - QQmlProfilerClient::HandlingSignal, + QQmlProfilerData expected(0, QQmlProfilerDefinitions::RangeLocation, + QQmlProfilerDefinitions::HandlingSignal, QLatin1String("signalSourceLocation.qml")); expected.line = 8; expected.column = 28; @@ -727,28 +678,29 @@ void tst_QQmlProfilerService::javascript() { connect(true, "javascript.qml"); - m_client->setTraceState(true); + m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("done")))) QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); - QQmlProfilerData expected(QQmlProfilerClient::RangeStart, QQmlProfilerClient::Javascript); + QQmlProfilerData expected(0, QQmlProfilerDefinitions::RangeStart, + QQmlProfilerDefinitions::Javascript); VERIFY(MessageListJavaScript, 6, expected, CheckMessageType | CheckDetailType); - expected.messageType = QQmlProfilerClient::RangeLocation; + expected.messageType = QQmlProfilerDefinitions::RangeLocation; expected.detailData = QLatin1String("javascript.qml"); expected.line = 4; expected.column = 5; VERIFY(MessageListJavaScript, 7, expected, CheckAll); - expected.messageType = QQmlProfilerClient::RangeData; + expected.messageType = QQmlProfilerDefinitions::RangeData; expected.detailData = QLatin1String("something"); VERIFY(MessageListJavaScript, 8, expected, CheckMessageType | CheckDetailType | CheckDataEndsWith); - expected.messageType = QQmlProfilerClient::RangeEnd; + expected.messageType = QQmlProfilerDefinitions::RangeEnd; VERIFY(MessageListJavaScript, 21, expected, CheckMessageType | CheckDetailType); } @@ -756,14 +708,14 @@ void tst_QQmlProfilerService::flushInterval() { connect(true, "timer.qml"); - m_client->setTraceState(true, 1); + m_client->sendRecordingStatus(true, -1, 1); // Make sure we get multiple messages QTRY_VERIFY(m_client->qmlMessages.length() > 0); QVERIFY(m_client->qmlMessages.length() < 100); QTRY_VERIFY(m_client->qmlMessages.length() > 100); - m_client->setTraceState(false); + m_client->sendRecordingStatus(false); checkTraceReceived(); checkJsHeap(); } diff --git a/tests/auto/qml/debugger/qv4debugger/qv4debugger.pro b/tests/auto/qml/debugger/qv4debugger/qv4debugger.pro new file mode 100644 index 0000000000..d11de56e43 --- /dev/null +++ b/tests/auto/qml/debugger/qv4debugger/qv4debugger.pro @@ -0,0 +1,17 @@ +CONFIG += testcase +TARGET = tst_qv4debugger +osx:CONFIG -= app_bundle + +SOURCES += \ + $$PWD/tst_qv4debugger.cpp \ + $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp \ + $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp + +HEADERS += \ + $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h \ + $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h + +INCLUDEPATH += \ + $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger + +QT += core-private gui-private qml-private network testlib diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index 39a1fbc173..c5fa6be7a0 100644 --- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -33,6 +33,7 @@ #include <QtTest/QtTest> #include "qv4datacollector.h" +#include "qv4debugger.h" #include <QJSEngine> #include <QQmlEngine> @@ -159,7 +160,7 @@ public: } public slots: - void debuggerPaused(V4Debugger *debugger, QV4::Debugging::PauseReason reason) + void debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason) { Q_ASSERT(debugger == m_debugger); Q_ASSERT(debugger->engine() == collector.engine()); @@ -167,7 +168,7 @@ public slots: m_pauseReason = reason; m_statesWhenPaused << debugger->currentExecutionState(); - if (debugger->state() == V4Debugger::Paused && + if (debugger->state() == QV4Debugger::Paused && debugger->engine()->hasException) { Refs refs; RefHolder holder(&collector, &refs); @@ -184,7 +185,7 @@ public slots: m_stackTrace = debugger->stackTrace(); while (!m_expressionRequests.isEmpty()) { - Q_ASSERT(debugger->state() == V4Debugger::Paused); + Q_ASSERT(debugger->state() == QV4Debugger::Paused); ExpressionRequest request = m_expressionRequests.takeFirst(); m_expressionResults << Refs(); RefHolder holder(&collector, &m_expressionResults.last()); @@ -196,7 +197,7 @@ public slots: if (m_captureContextInfo) captureContextInfo(debugger); - debugger->resume(V4Debugger::FullThrottle); + debugger->resume(QV4Debugger::FullThrottle); } public: @@ -209,7 +210,7 @@ public: int lineNumber; }; - void captureContextInfo(V4Debugger *debugger) + void captureContextInfo(QV4Debugger *debugger) { for (int i = 0, ei = m_stackTrace.size(); i != ei; ++i) { m_capturedArguments.append(NamedRefs(&collector)); @@ -226,18 +227,17 @@ public: } } - void addDebugger(V4Debugger *debugger) + void addDebugger(QV4Debugger *debugger) { Q_ASSERT(!m_debugger); m_debugger = debugger; - connect(m_debugger, &V4Debugger::debuggerPaused, - this, &TestAgent::debuggerPaused); + connect(m_debugger, &QV4Debugger::debuggerPaused, this, &TestAgent::debuggerPaused); } bool m_wasPaused; - PauseReason m_pauseReason; + QV4Debugger::PauseReason m_pauseReason; bool m_captureContextInfo; - QList<V4Debugger::ExecutionState> m_statesWhenPaused; + QList<QV4Debugger::ExecutionState> m_statesWhenPaused; QList<TestBreakPoint> m_breakPointsToAddWhenPaused; QVector<QV4::StackFrame> m_stackTrace; QVector<NamedRefs> m_capturedArguments; @@ -251,7 +251,7 @@ public: }; QVector<ExpressionRequest> m_expressionRequests; QVector<Refs> m_expressionResults; - V4Debugger *m_debugger; + QV4Debugger *m_debugger; // Utility methods: void dumpStackTrace() const @@ -295,9 +295,9 @@ private slots: void evaluateExpression(); private: - V4Debugger *debugger() const + QV4Debugger *debugger() const { - return static_cast<V4Debugger *>(m_v4->debugger); + return static_cast<QV4Debugger *>(m_v4->debugger); } void evaluateJavaScript(const QString &script, const QString &fileName, int lineNumber = 1) { @@ -319,7 +319,7 @@ void tst_qv4debugger::init() m_engine = new TestEngine; m_v4 = m_engine->v4Engine(); m_v4->iselFactory.reset(new QV4::Moth::ISelFactory); - m_v4->setDebugger(new V4Debugger(m_v4)); + m_v4->setDebugger(new QV4Debugger(m_v4)); m_engine->moveToThread(m_javaScriptThread); m_javaScriptThread->start(); m_debuggerAgent = new TestAgent(m_v4); @@ -359,7 +359,7 @@ void tst_qv4debugger::pendingBreakpoint() evaluateJavaScript(script, "testfile"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("testfile")); QCOMPARE(state.lineNumber, 2); } @@ -375,7 +375,7 @@ void tst_qv4debugger::liveBreakPoint() evaluateJavaScript(script, "liveBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(1); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(1); QCOMPARE(state.fileName, QString("liveBreakPoint")); QCOMPARE(state.lineNumber, 3); } @@ -404,7 +404,7 @@ void tst_qv4debugger::addBreakPointWhilePaused() QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(0); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(0); QCOMPARE(state.fileName, QString("addBreakPointWhilePaused")); QCOMPARE(state.lineNumber, 1); @@ -415,7 +415,7 @@ void tst_qv4debugger::addBreakPointWhilePaused() static QV4::ReturnedValue someCall(QV4::CallContext *ctx) { - static_cast<V4Debugger *>(ctx->d()->engine->debugger) + static_cast<QV4Debugger *>(ctx->d()->engine->debugger) ->removeBreakPoint("removeBreakPointForNextInstruction", 2); return QV4::Encode::undefined(); } @@ -450,7 +450,7 @@ void tst_qv4debugger::conditionalBreakPoint() evaluateJavaScript(script, "conditionalBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 4); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("conditionalBreakPoint")); QCOMPARE(state.lineNumber, 3); @@ -465,7 +465,7 @@ void tst_qv4debugger::conditionalBreakPointInQml() { QQmlEngine engine; QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); - V4Debugger *v4Debugger = new V4Debugger(v4); + QV4Debugger *v4Debugger = new QV4Debugger(v4); v4->iselFactory.reset(new QV4::Moth::ISelFactory); v4->setDebugger(v4Debugger); @@ -644,7 +644,7 @@ void tst_qv4debugger::pauseOnThrow() debugger()->setBreakOnThrow(true); evaluateJavaScript(script, "pauseOnThrow"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_pauseReason, Throwing); + QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Throwing); QCOMPARE(m_debuggerAgent->m_stackTrace.size(), 2); QVERIFY(m_debuggerAgent->m_thrownValue >= qint64(0)); QJsonObject exception = m_debuggerAgent->collector.lookupRef(m_debuggerAgent->m_thrownValue); @@ -665,9 +665,9 @@ void tst_qv4debugger::breakInCatch() debugger()->addBreakPoint("breakInCatch", 4); evaluateJavaScript(script, "breakInCatch"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_pauseReason, BreakPoint); + QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInCatch")); QCOMPARE(state.lineNumber, 4); } @@ -682,9 +682,9 @@ void tst_qv4debugger::breakInWith() debugger()->addBreakPoint("breakInWith", 2); evaluateJavaScript(script, "breakInWith"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_pauseReason, BreakPoint); + QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); - V4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInWith")); QCOMPARE(state.lineNumber, 2); } diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index 51d706b818..54720fc848 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -33,10 +33,12 @@ #include "debugutil_p.h" -#include <QEventLoop> -#include <QTimer> -#include <QFileInfo> -#include <QDir> +#include <private/qqmldebugconnection_p.h> + +#include <QtCore/qeventloop.h> +#include <QtCore/qtimer.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdir.h> bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) { QEventLoop loop; @@ -51,6 +53,46 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim return timer.isActive(); } +QList<QQmlDebugClient *> QQmlDebugTest::createOtherClients(QQmlDebugConnection *connection) +{ + QList<QQmlDebugClient *> ret; + foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) { + if (!connection->client(service)) + ret << new QQmlDebugClient(service, connection); + } + foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) { + if (!connection->client(service)) + ret << new QQmlDebugClient(service, connection); + } + foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) { + if (!connection->client(service)) + ret << new QQmlDebugClient(service, connection); + } + return ret; +} + +QString QQmlDebugTest::clientStateString(const QQmlDebugClient *client) +{ + if (!client) + return QLatin1String("null"); + + switch (client->state()) { + case QQmlDebugClient::NotConnected: return QLatin1String("Not connected"); + case QQmlDebugClient::Unavailable: return QLatin1String("Unavailable"); + case QQmlDebugClient::Enabled: return QLatin1String("Enabled"); + default: return QLatin1String("Invalid"); + } + +} + +QString QQmlDebugTest::connectionStateString(const QQmlDebugConnection *connection) +{ + if (!connection) + return QLatin1String("null"); + + return connection->isConnected() ? QLatin1String("connected") : QLatin1String("not connected"); +} + QQmlDebugTestClient::QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c) : QQmlDebugClient(s, c) { diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri index cb9c761395..1983f3583e 100644 --- a/tests/auto/qml/debugger/shared/debugutil.pri +++ b/tests/auto/qml/debugger/shared/debugutil.pri @@ -1,8 +1,4 @@ -HEADERS += $$PWD/debugutil_p.h \ - $$PWD/qqmldebugclient.h \ - $$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h - -SOURCES += $$PWD/debugutil.cpp \ - $$PWD/qqmldebugclient.cpp \ - $$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.cpp +QT += qmldebug-private +HEADERS += $$PWD/debugutil_p.h +SOURCES += $$PWD/debugutil.cpp diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h index d544a89ff2..7ab817a509 100644 --- a/tests/auto/qml/debugger/shared/debugutil_p.h +++ b/tests/auto/qml/debugger/shared/debugutil_p.h @@ -32,8 +32,8 @@ ** ****************************************************************************/ -#ifndef DEBUGUTIL_H -#define DEBUGUTIL_H +#ifndef DEBUGUTIL_P_H +#define DEBUGUTIL_P_H // // W A R N I N G @@ -46,21 +46,23 @@ // We mean it. // -#include <QEventLoop> -#include <QTimer> -#include <QThread> -#include <QTest> -#include <QProcess> -#include <QMutex> +#include <private/qqmldebugclient_p.h> +#include <QtCore/qeventloop.h> +#include <QtCore/qtimer.h> +#include <QtCore/qthread.h> +#include <QtCore/qprocess.h> +#include <QtCore/qmutex.h> +#include <QtTest/qtest.h> #include <QtQml/qqmlengine.h> -#include "qqmldebugclient.h" - class QQmlDebugTest { public: static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000); + static QList<QQmlDebugClient *> createOtherClients(QQmlDebugConnection *connection); + static QString clientStateString(const QQmlDebugClient *client); + static QString connectionStateString(const QQmlDebugConnection *connection); }; class QQmlDebugTestClient : public QQmlDebugClient @@ -128,4 +130,4 @@ private: int m_receivedBindErrors; }; -#endif // DEBUGUTIL_H +#endif // DEBUGUTIL_P_H diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp deleted file mode 100644 index 0f7e572e02..0000000000 --- a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qqmldebugclient.h" -#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h" - -#include <QtCore/qdebug.h> -#include <QtCore/qeventloop.h> -#include <QtCore/qstringlist.h> -#include <QtCore/qtimer.h> -#include <QtNetwork/qnetworkproxy.h> -#include <QtNetwork/qlocalserver.h> -#include <QtNetwork/qlocalsocket.h> - -const int protocolVersion = 1; -const QString serverId = QLatin1String("QDeclarativeDebugServer"); -const QString clientId = QLatin1String("QDeclarativeDebugClient"); - -class QQmlDebugClientPrivate -{ -public: - QQmlDebugClientPrivate(); - - QString name; - QQmlDebugConnection *connection; -}; - -class QQmlDebugConnectionPrivate : public QObject -{ - Q_OBJECT -public: - QQmlDebugConnectionPrivate(QQmlDebugConnection *c); - QQmlDebugConnection *q; - QPacketProtocol *protocol; - QIODevice *device; - QLocalServer *server; - QEventLoop handshakeEventLoop; - QTimer handshakeTimer; - - bool gotHello; - QHash <QString, float> serverPlugins; - QHash<QString, QQmlDebugClient *> plugins; - - void advertisePlugins(); - void connectDeviceSignals(); - -public Q_SLOTS: - void forwardStateChange(QLocalSocket::LocalSocketState state); - void forwardError(QLocalSocket::LocalSocketError error); - - void newConnection(); - void connected(); - void readyRead(); - void deviceAboutToClose(); - void handshakeTimeout(); -}; - -QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c) - : QObject(c), q(c), protocol(0), device(0), server(0), gotHello(false) -{ - protocol = new QPacketProtocol(q, this); - QObject::connect(c, SIGNAL(connected()), this, SLOT(connected())); - QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - - handshakeTimer.setSingleShot(true); - handshakeTimer.setInterval(3000); - connect(&handshakeTimer, SIGNAL(timeout()), SLOT(handshakeTimeout())); -} - -void QQmlDebugConnectionPrivate::advertisePlugins() -{ - if (!q->isConnected()) - return; - - QPacket pack; - pack << serverId << 1 << plugins.keys(); - protocol->send(pack); - q->flush(); -} - -void QQmlDebugConnectionPrivate::connected() -{ - QPacket pack; - pack << serverId << 0 << protocolVersion << plugins.keys() - << q->m_dataStreamVersion; - protocol->send(pack); - q->flush(); -} - -void QQmlDebugConnectionPrivate::readyRead() -{ - if (!gotHello) { - QPacket pack = protocol->read(); - QString name; - - pack >> name; - - bool validHello = false; - if (name == clientId) { - int op = -1; - pack >> op; - if (op == 0) { - int version = -1; - pack >> version; - if (version == protocolVersion) { - QStringList pluginNames; - QList<float> pluginVersions; - pack >> pluginNames; - if (!pack.isEmpty()) - pack >> pluginVersions; - - const int pluginNamesSize = pluginNames.size(); - const int pluginVersionsSize = pluginVersions.size(); - for (int i = 0; i < pluginNamesSize; ++i) { - float pluginVersion = 1.0; - if (i < pluginVersionsSize) - pluginVersion = pluginVersions.at(i); - serverPlugins.insert(pluginNames.at(i), pluginVersion); - } - - pack >> q->m_dataStreamVersion; - validHello = true; - } - } - } - - if (!validHello) { - qWarning("QQmlDebugConnection: Invalid hello message"); - QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - return; - } - gotHello = true; - - QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin(); - for (; iter != plugins.end(); ++iter) { - QQmlDebugClient::State newState = QQmlDebugClient::Unavailable; - if (serverPlugins.contains(iter.key())) - newState = QQmlDebugClient::Enabled; - iter.value()->stateChanged(newState); - } - - handshakeTimer.stop(); - handshakeEventLoop.quit(); - } - - while (protocol->packetsAvailable()) { - QPacket pack = protocol->read(); - QString name; - pack >> name; - - if (name == clientId) { - int op = -1; - pack >> op; - - if (op == 1) { - // Service Discovery - QHash<QString, float> oldServerPlugins = serverPlugins; - serverPlugins.clear(); - - QStringList pluginNames; - QList<float> pluginVersions; - pack >> pluginNames; - if (!pack.isEmpty()) - pack >> pluginVersions; - - const int pluginNamesSize = pluginNames.size(); - const int pluginVersionsSize = pluginVersions.size(); - for (int i = 0; i < pluginNamesSize; ++i) { - float pluginVersion = 1.0; - if (i < pluginVersionsSize) - pluginVersion = pluginVersions.at(i); - serverPlugins.insert(pluginNames.at(i), pluginVersion); - } - - QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin(); - for (; iter != plugins.end(); ++iter) { - const QString pluginName = iter.key(); - QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable; - if (serverPlugins.contains(pluginName)) - newSate = QQmlDebugClient::Enabled; - - if (oldServerPlugins.contains(pluginName) - != serverPlugins.contains(pluginName)) { - iter.value()->stateChanged(newSate); - } - } - } else { - qWarning() << "QQmlDebugConnection: Unknown control message id" << op; - } - } else { - QByteArray message; - pack >> message; - - QHash<QString, QQmlDebugClient *>::Iterator iter = - plugins.find(name); - if (iter == plugins.end()) { - qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name; - } else { - (*iter)->messageReceived(message); - } - } - } -} - -void QQmlDebugConnectionPrivate::deviceAboutToClose() -{ - // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close()) - // without calling the underlying device close fn as that would cause an infinite loop - q->QIODevice::close(); -} - -void QQmlDebugConnectionPrivate::handshakeTimeout() -{ - if (!gotHello) { - qWarning() << "Qml Debug Client: Did not get handshake answer in time"; - handshakeEventLoop.quit(); - } -} - -QQmlDebugConnection::QQmlDebugConnection(QObject *parent) - : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this)), - m_dataStreamVersion(QDataStream::Qt_5_0) -{ -} - -QQmlDebugConnection::~QQmlDebugConnection() -{ - QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) { - iter.value()->d->connection = 0; - iter.value()->stateChanged(QQmlDebugClient::NotConnected); - } -} - -void QQmlDebugConnection::setDataStreamVersion(int dataStreamVersion) -{ - m_dataStreamVersion = dataStreamVersion; -} - -int QQmlDebugConnection::dataStreamVersion() -{ - return m_dataStreamVersion; -} - -bool QQmlDebugConnection::isConnected() const -{ - return state() == QAbstractSocket::ConnectedState; -} - -qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize) -{ - return d->device->read(data, maxSize); -} - -qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize) -{ - return d->device->write(data, maxSize); -} - -qint64 QQmlDebugConnection::bytesAvailable() const -{ - return d->device->bytesAvailable(); -} - -bool QQmlDebugConnection::isSequential() const -{ - return true; -} - -void QQmlDebugConnection::close() -{ - if (isOpen()) { - QIODevice::close(); - d->device->close(); - emit stateChanged(QAbstractSocket::UnconnectedState); - - QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) { - iter.value()->stateChanged(QQmlDebugClient::NotConnected); - } - } -} - -bool QQmlDebugConnection::waitForConnected(int msecs) -{ - QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device); - if (!socket) { - if (!d->server || (!d->server->hasPendingConnections() && - !d->server->waitForNewConnection(msecs))) - return false; - } else if (!socket->waitForConnected(msecs)) { - return false; - } - // wait for handshake - d->handshakeTimer.start(); - d->handshakeEventLoop.exec(); - return d->gotHello; -} - -QString QQmlDebugConnection::stateString() const -{ - QString state; - - if (isConnected()) - state = "Connected"; - else - state = "Not connected"; - - if (d->gotHello) - state += ", got hello"; - else - state += ", did not get hello!"; - - return state; -} - -QAbstractSocket::SocketState QQmlDebugConnection::state() const -{ - QAbstractSocket *abstractSocket = qobject_cast<QAbstractSocket*>(d->device); - if (abstractSocket) - return abstractSocket->state(); - - QLocalSocket *localSocket = qobject_cast<QLocalSocket*>(d->device); - if (localSocket) - return static_cast<QAbstractSocket::SocketState>(localSocket->state()); - - return QAbstractSocket::UnconnectedState; -} - -void QQmlDebugConnection::flush() -{ - QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device); - if (socket) { - socket->flush(); - return; - } -} - -void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port) -{ - QTcpSocket *socket = new QTcpSocket(d); - socket->setProxy(QNetworkProxy::NoProxy); - d->device = socket; - d->connectDeviceSignals(); - d->gotHello = false; - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState))); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(connected()), this, SIGNAL(connected())); - socket->connectToHost(hostName, port); - QIODevice::open(ReadWrite | Unbuffered); -} - -void QQmlDebugConnection::startLocalServer(const QString &fileName) -{ - d->gotHello = false; - d->server = new QLocalServer(d); - // QueuedConnection so that waitForNewConnection() returns true. - connect(d->server, SIGNAL(newConnection()), d, SLOT(newConnection()), Qt::QueuedConnection); - d->server->listen(fileName); - QIODevice::open(ReadWrite | Unbuffered); -} - -void QQmlDebugConnectionPrivate::newConnection() -{ - QLocalSocket *socket = server->nextPendingConnection(); - server->close(); - device = socket; - connectDeviceSignals(); - connect(socket, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)), - this, SLOT(forwardStateChange(QLocalSocket::LocalSocketState))); - connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)), - this, SLOT(forwardError(QLocalSocket::LocalSocketError))); - emit q->connected(); -} - -void QQmlDebugConnectionPrivate::connectDeviceSignals() -{ - connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64))); - connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead())); - connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose())); -} - -void QQmlDebugConnectionPrivate::forwardStateChange(QLocalSocket::LocalSocketState state) -{ - emit q->stateChanged(static_cast<QAbstractSocket::SocketState>(state)); -} - -void QQmlDebugConnectionPrivate::forwardError(QLocalSocket::LocalSocketError error) -{ - emit q->error(static_cast<QAbstractSocket::SocketError>(error)); -} - -QQmlDebugClientPrivate::QQmlDebugClientPrivate() - : connection(0) -{ -} - -QQmlDebugClient::QQmlDebugClient(const QString &name, - QQmlDebugConnection *parent) - : QObject(parent), - d(new QQmlDebugClientPrivate) -{ - d->name = name; - d->connection = parent; - - if (!d->connection) - return; - - if (d->connection->d->plugins.contains(name)) { - qWarning() << "QQmlDebugClient: Conflicting plugin name" << name; - d->connection = 0; - } else { - d->connection->d->plugins.insert(name, this); - d->connection->d->advertisePlugins(); - } -} - -QQmlDebugClient::~QQmlDebugClient() -{ - if (d->connection && d->connection->d) { - d->connection->d->plugins.remove(d->name); - d->connection->d->advertisePlugins(); - } - delete d; -} - -QString QQmlDebugClient::name() const -{ - return d->name; -} - -float QQmlDebugClient::serviceVersion() const -{ - if (d->connection->d->serverPlugins.contains(d->name)) - return d->connection->d->serverPlugins.value(d->name); - return -1; -} - -QQmlDebugClient::State QQmlDebugClient::state() const -{ - if (!d->connection - || !d->connection->isConnected() - || !d->connection->d->gotHello) - return NotConnected; - - if (d->connection->d->serverPlugins.contains(d->name)) - return Enabled; - - return Unavailable; -} - -QString QQmlDebugClient::stateString() const -{ - switch (state()) { - case NotConnected: return QLatin1String("Not connected"); - case Unavailable: return QLatin1String("Unavailable"); - case Enabled: return QLatin1String("Enabled"); - } - return QLatin1String("Invalid"); -} - -void QQmlDebugClient::sendMessage(const QByteArray &message) -{ - if (state() != Enabled) - return; - - QPacket pack; - pack << d->name << message; - d->connection->d->protocol->send(pack); - d->connection->flush(); -} - -void QQmlDebugClient::stateChanged(State) -{ -} - -void QQmlDebugClient::messageReceived(const QByteArray &) -{ -} - -#include <qqmldebugclient.moc> diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h deleted file mode 100644 index fe9da693c8..0000000000 --- a/tests/auto/qml/debugger/shared/qqmldebugclient.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLDEBUGCLIENT_H -#define QQMLDEBUGCLIENT_H - -#include <QtNetwork/qtcpsocket.h> - -class QQmlDebugConnectionPrivate; -class QQmlDebugConnection : public QIODevice -{ - Q_OBJECT - Q_DISABLE_COPY(QQmlDebugConnection) -public: - QQmlDebugConnection(QObject * = 0); - ~QQmlDebugConnection(); - - void connectToHost(const QString &hostName, quint16 port); - void startLocalServer(const QString &fileName); - - void setDataStreamVersion(int dataStreamVersion); - int dataStreamVersion(); - - qint64 bytesAvailable() const; - bool isConnected() const; - QAbstractSocket::SocketState state() const; - void flush(); - bool isSequential() const; - void close(); - bool waitForConnected(int msecs = 30000); - - QString stateString() const; - -signals: - void connected(); - void stateChanged(QAbstractSocket::SocketState socketState); - void error(QAbstractSocket::SocketError socketError); - -protected: - qint64 readData(char *data, qint64 maxSize); - qint64 writeData(const char *data, qint64 maxSize); - -private: - QQmlDebugConnectionPrivate *d; - int m_dataStreamVersion; - friend class QQmlDebugClient; - friend class QQmlDebugClientPrivate; - friend class QQmlDebugConnectionPrivate; -}; - -class QQmlDebugClientPrivate; -class QQmlDebugClient : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(QQmlDebugClient) - -public: - enum State { NotConnected, Unavailable, Enabled }; - - QQmlDebugClient(const QString &, QQmlDebugConnection *parent); - ~QQmlDebugClient(); - - QString name() const; - float serviceVersion() const; - State state() const; - QString stateString() const; - - virtual void sendMessage(const QByteArray &); - -protected: - virtual void stateChanged(State); - virtual void messageReceived(const QByteArray &); - -private: - QQmlDebugClientPrivate *d; - friend class QQmlDebugConnection; - friend class QQmlDebugConnectionPrivate; -}; - -#endif // QQMLDEBUGCLIENT_H diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp index 9b48b40c07..ef5c3e09ca 100644 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp +++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include "qqmlenginedebugclient.h" -#include "qdatastream.h" +#include <private/qqmldebugconnection_p.h> struct QmlObjectData { QUrl url; @@ -46,7 +46,7 @@ struct QmlObjectData { int parentId; }; -QDataStream &operator>>(QDataStream &ds, QmlObjectData &data) +QPacket &operator>>(QPacket &ds, QmlObjectData &data) { ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString >> data.objectName >> data.objectType >> data.objectId >> data.contextId @@ -64,7 +64,7 @@ struct QmlObjectProperty { bool hasNotifySignal; }; -QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data) +QPacket &operator>>(QPacket &ds, QmlObjectProperty &data) { int type; ds >> type >> data.name >> data.value >> data.valueTypeName @@ -77,8 +77,7 @@ QQmlEngineDebugClient::QQmlEngineDebugClient( QQmlDebugConnection *connection) : QQmlDebugClient(QLatin1String("QmlDebugger"), connection), m_nextId(0), - m_valid(false), - m_connection(connection) + m_valid(false) { } @@ -89,11 +88,10 @@ quint32 QQmlEngineDebugClient::addWatch( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("WATCH_PROPERTY") << id << property.objectDebugId << property.name.toUtf8(); - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -115,10 +113,9 @@ quint32 QQmlEngineDebugClient::addWatch( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.debugId << expr; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -131,10 +128,9 @@ quint32 QQmlEngineDebugClient::addWatch( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("WATCH_OBJECT") << id << object.debugId; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -152,10 +148,9 @@ void QQmlEngineDebugClient::removeWatch(quint32 id, bool *success) { *success = false; if (state() == QQmlDebugClient::Enabled) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("NO_WATCH") << id; - sendMessage(message); + sendMessage(ds.data()); *success = true; } } @@ -167,10 +162,9 @@ quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success) *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("LIST_ENGINES") << id; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -184,10 +178,9 @@ quint32 QQmlEngineDebugClient::queryRootContexts( *success = false; if (state() == QQmlDebugClient::Enabled && engine.debugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("LIST_OBJECTS") << id << engine.debugId; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -201,11 +194,9 @@ quint32 QQmlEngineDebugClient::queryObject( *success = false; if (state() == QQmlDebugClient::Enabled && object.debugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false << - true; - sendMessage(message); + QPacket ds(connection()->currentDataStreamVersion()); + ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false << true; + sendMessage(ds.data()); *success = true; } return id; @@ -219,11 +210,10 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocation( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber << columnNumber << false << true; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -237,11 +227,9 @@ quint32 QQmlEngineDebugClient::queryObjectRecursive( *success = false; if (state() == QQmlDebugClient::Enabled && object.debugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true << - true; - sendMessage(message); + QPacket ds(connection()->currentDataStreamVersion()); + ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true << true; + sendMessage(ds.data()); *success = true; } return id; @@ -255,11 +243,10 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &f *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber << columnNumber << true << true; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -273,11 +260,10 @@ quint32 QQmlEngineDebugClient::queryExpressionResult( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr << engines()[0].debugId; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -291,10 +277,9 @@ quint32 QQmlEngineDebugClient::queryExpressionResultBC( *success = false; if (state() == QQmlDebugClient::Enabled) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -312,11 +297,10 @@ quint32 QQmlEngineDebugClient::setBindingForObject( *success = false; if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName << bindingExpression << isLiteralValue << source << line; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -331,10 +315,9 @@ quint32 QQmlEngineDebugClient::resetBindingForObject( *success = false; if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; @@ -348,17 +331,16 @@ quint32 QQmlEngineDebugClient::setMethodBody( *success = false; if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) { id = getId(); - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId << methodName << methodBody; - sendMessage(message); + sendMessage(ds.data()); *success = true; } return id; } -void QQmlEngineDebugClient::decode(QDataStream &ds, +void QQmlEngineDebugClient::decode(QPacket &ds, QmlDebugObjectReference &o, bool simple) { @@ -419,7 +401,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds, } } -void QQmlEngineDebugClient::decode(QDataStream &ds, +void QQmlEngineDebugClient::decode(QPacket &ds, QList<QmlDebugObjectReference> &o, bool simple) { @@ -432,7 +414,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds, } } -void QQmlEngineDebugClient::decode(QDataStream &ds, +void QQmlEngineDebugClient::decode(QPacket &ds, QmlDebugContextReference &c) { ds >> c.name >> c.debugId; @@ -460,9 +442,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds, void QQmlEngineDebugClient::messageReceived(const QByteArray &data) { m_valid = false; - QDataStream ds(data); - ds.setVersion(m_connection->dataStreamVersion()); - + QPacket ds(connection()->currentDataStreamVersion(), data); int queryId; QByteArray type; diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h index 28adb8b159..cd80a8ed46 100644 --- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h +++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h @@ -34,13 +34,12 @@ #ifndef QQMLENGINEDEBUGCLIENT_H #define QQMLENGINEDEBUGCLIENT_H -#include "qqmldebugclient.h" +#include <private/qqmldebugclient_p.h> +#include <private/qpacket_p.h> #include <QtCore/qurl.h> #include <QtCore/qvariant.h> -class QQmlDebugConnection; - struct QmlDebugPropertyReference { QmlDebugPropertyReference() @@ -207,9 +206,9 @@ public: quint32 getId() { return m_nextId++; } - void decode(QDataStream &, QmlDebugContextReference &); - void decode(QDataStream &, QmlDebugObjectReference &, bool simple); - void decode(QDataStream &ds, QList<QmlDebugObjectReference> &o, bool simple); + void decode(QPacket &ds, QmlDebugContextReference &); + void decode(QPacket &ds, QmlDebugObjectReference &, bool simple); + void decode(QPacket &ds, QList<QmlDebugObjectReference> &o, bool simple); QList<QmlDebugEngineReference> engines() { return m_engines; } QmlDebugContextReference rootContext() { return m_rootContext; } @@ -234,8 +233,6 @@ private: QmlDebugObjectReference m_object; QList<QmlDebugObjectReference> m_objects; QVariant m_exprResult; - - QQmlDebugConnection *m_connection; }; #endif // QQMLENGINEDEBUGCLIENT_H diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp index a46bd9012b..5fce58c17d 100644 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp +++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp @@ -32,33 +32,34 @@ ****************************************************************************/ #include "qqmlinspectorclient.h" -#include "qdatastream.h" + +#include <private/qpacket_p.h> +#include <private/qqmldebugconnection_p.h> +#include <QtCore/qdebug.h> void QQmlInspectorClient::setShowAppOnTop(bool showOnTop) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); ds << QByteArray("request") << m_requestId++ << QByteArray("showAppOnTop") << showOnTop; - sendMessage(message); + sendMessage(ds.data()); } void QQmlInspectorClient::reloadQml(const QHash<QString, QByteArray> &changesHash) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + QPacket ds(connection()->currentDataStreamVersion()); m_reloadRequestId = m_requestId; ds << QByteArray("request") << m_requestId++ << QByteArray("reload") << changesHash; - sendMessage(message); + sendMessage(ds.data()); } void QQmlInspectorClient::messageReceived(const QByteArray &message) { - QDataStream ds(message); + QPacket ds(connection()->currentDataStreamVersion(), message); QByteArray type; ds >> type; diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h index a8b42c8430..964dac7701 100644 --- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h +++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h @@ -33,7 +33,7 @@ #ifndef QQMLINSPECTORCLIENT_H #define QQMLINSPECTORCLIENT_H -#include "qqmldebugclient.h" +#include <private/qqmldebugclient_p.h> class QQmlInspectorClient : public QQmlDebugClient { diff --git a/tests/auto/qml/parserstress/parserstress.pro b/tests/auto/qml/parserstress/parserstress.pro index 8d92d69494..7c37745585 100644 --- a/tests/auto/qml/parserstress/parserstress.pro +++ b/tests/auto/qml/parserstress/parserstress.pro @@ -6,7 +6,5 @@ SOURCES += tst_parserstress.cpp TESTDATA = tests/* -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qjsengine/qjsengine.pro b/tests/auto/qml/qjsengine/qjsengine.pro index fc2452c2bc..c9d78e22a0 100644 --- a/tests/auto/qml/qjsengine/qjsengine.pro +++ b/tests/auto/qml/qjsengine/qjsengine.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qjsengine QT += qml qml-private widgets testlib gui-private macx:CONFIG -= app_bundle @@ -7,4 +6,3 @@ SOURCES += tst_qjsengine.cpp RESOURCES += qjsengine.qrc TESTDATA = script/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qjsonbinding/qjsonbinding.pro b/tests/auto/qml/qjsonbinding/qjsonbinding.pro index a54eab198b..75b48aa854 100644 --- a/tests/auto/qml/qjsonbinding/qjsonbinding.pro +++ b/tests/auto/qml/qjsonbinding/qjsonbinding.pro @@ -12,6 +12,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core qml testlib gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qjsvalue/qjsvalue.pro b/tests/auto/qml/qjsvalue/qjsvalue.pro index d914d40762..3bbbbd4787 100644 --- a/tests/auto/qml/qjsvalue/qjsvalue.pro +++ b/tests/auto/qml/qjsvalue/qjsvalue.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qjsvalue macx:CONFIG -= app_bundle QT += qml widgets testlib gui-private SOURCES += tst_qjsvalue.cpp HEADERS += tst_qjsvalue.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp index bf9bd18807..0d15268d6f 100644 --- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp @@ -540,7 +540,7 @@ void tst_QJSValue::toBoolean() // deprecated QCOMPARE(number.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number), false); - QJSValue number2 = eng.toScriptValue(qSNaN()); + QJSValue number2 = eng.toScriptValue(qQNaN()); QCOMPARE(number2.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number2), false); @@ -583,7 +583,7 @@ void tst_QJSValue::toBoolean() // deprecated QCOMPARE(number.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number), false); - QJSValue number2 = QJSValue(qSNaN()); + QJSValue number2 = QJSValue(qQNaN()); QCOMPARE(number2.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number2), false); @@ -633,7 +633,7 @@ void tst_QJSValue::toBool() QCOMPARE(number.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number), false); - QJSValue number2 = eng.toScriptValue(qSNaN()); + QJSValue number2 = eng.toScriptValue(qQNaN()); QCOMPARE(number2.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number2), false); @@ -676,7 +676,7 @@ void tst_QJSValue::toBool() QCOMPARE(number.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number), false); - QJSValue number2 = QJSValue(qSNaN()); + QJSValue number2 = QJSValue(qQNaN()); QCOMPARE(number2.toBool(), false); QCOMPARE(qjsvalue_cast<bool>(number2), false); @@ -714,7 +714,7 @@ void tst_QJSValue::toInt() QCOMPARE(number.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number), 123); - QJSValue number2 = eng.toScriptValue(qSNaN()); + QJSValue number2 = eng.toScriptValue(qQNaN()); QCOMPARE(number2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number2), 0); @@ -776,7 +776,7 @@ void tst_QJSValue::toInt() QCOMPARE(number.toInt(), 123); QCOMPARE(qjsvalue_cast<qint32>(number), 123); - QJSValue number2 = QJSValue(qSNaN()); + QJSValue number2 = QJSValue(qQNaN()); QCOMPARE(number2.toInt(), 0); QCOMPARE(qjsvalue_cast<qint32>(number2), 0); @@ -850,7 +850,7 @@ void tst_QJSValue::toUInt() QCOMPARE(number.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123)); - QJSValue number2 = eng.toScriptValue(qSNaN()); + QJSValue number2 = eng.toScriptValue(qQNaN()); QCOMPARE(number2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0)); @@ -910,7 +910,7 @@ void tst_QJSValue::toUInt() QCOMPARE(number.toUInt(), quint32(123)); QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123)); - QJSValue number2 = QJSValue(qSNaN()); + QJSValue number2 = QJSValue(qQNaN()); QCOMPARE(number2.toUInt(), quint32(0)); QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0)); @@ -1015,7 +1015,7 @@ void tst_QJSValue::toVariant() { QVariant var = qobject.toVariant(); QCOMPARE(var.userType(), int(QMetaType::QObjectStar)); - QCOMPARE(qVariantValue<QObject*>(var), (QObject *)&temp); + QCOMPARE(qvariant_cast<QObject*>(var), (QObject *)&temp); } { diff --git a/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro b/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro index 9f4d4fb371..4ee1693ad8 100644 --- a/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro +++ b/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qjsvalueiterator macx:CONFIG -= app_bundle QT = core qml testlib SOURCES += tst_qjsvalueiterator.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 66c19098ef..5e798f3b48 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -57,7 +57,6 @@ PRIVATETESTS += \ qrcqml \ qqmltimer \ qqmlinstantiator \ - qv4debugger \ qqmlenginecleanup \ v4misc \ qqmltranslation \ diff --git a/tests/auto/qml/qmlmin/qmlmin.pro b/tests/auto/qml/qmlmin/qmlmin.pro index 03b60aea19..6af6653270 100644 --- a/tests/auto/qml/qmlmin/qmlmin.pro +++ b/tests/auto/qml/qmlmin/qmlmin.pro @@ -6,7 +6,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlmin.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" -CONFIG += parallel_test cross_compile: DEFINES += QTEST_CROSS_COMPILED -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qmlplugindump/qmlplugindump.pro b/tests/auto/qml/qmlplugindump/qmlplugindump.pro index 902bcad585..c713edc541 100644 --- a/tests/auto/qml/qmlplugindump/qmlplugindump.pro +++ b/tests/auto/qml/qmlplugindump/qmlplugindump.pro @@ -2,7 +2,5 @@ CONFIG += testcase TARGET = tst_qmlplugindump QT += testlib gui-private macx:CONFIG -= app_bundle -CONFIG += parallel_test SOURCES += tst_qmlplugindump.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlbinding/qqmlbinding.pro b/tests/auto/qml/qqmlbinding/qqmlbinding.pro index 35a5f1ca74..45298f8ffc 100644 --- a/tests/auto/qml/qqmlbinding/qqmlbinding.pro +++ b/tests/auto/qml/qqmlbinding/qqmlbinding.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro index b65e58c0b3..9f854f1fa2 100644 --- a/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro +++ b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmlchangeset.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro index 8151bacd75..9f8c8a4e24 100644 --- a/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro +++ b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro @@ -13,4 +13,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlconnections/data/test-connection.qml b/tests/auto/qml/qqmlconnections/data/test-connection.qml index ce851fc3db..f44cbc047f 100644 --- a/tests/auto/qml/qqmlconnections/data/test-connection.qml +++ b/tests/auto/qml/qqmlconnections/data/test-connection.qml @@ -6,5 +6,5 @@ Item { property bool tested: false signal testMe - Connections { target: screen; onWidthChanged: screen.tested = true } + Connections { objectName: "connections"; target: screen; onWidthChanged: screen.tested = true } } diff --git a/tests/auto/qml/qqmlconnections/qqmlconnections.pro b/tests/auto/qml/qqmlconnections/qqmlconnections.pro index 7004ee0385..99cc4d0d0b 100644 --- a/tests/auto/qml/qqmlconnections/qqmlconnections.pro +++ b/tests/auto/qml/qqmlconnections/qqmlconnections.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index e529c74acc..b148baab35 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -56,6 +56,7 @@ private slots: void errors(); void rewriteErrors(); void singletonTypeTarget(); + void enableDisable_QTBUG_36350(); private: QQmlEngine engine; @@ -329,6 +330,33 @@ void tst_qqmlconnections::singletonTypeTarget() delete object; } +void tst_qqmlconnections::enableDisable_QTBUG_36350() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("test-connection.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(item != 0); + + QQmlConnections *connections = item->findChild<QQmlConnections*>("connections"); + QVERIFY(connections); + + connections->setEnabled(false); + QCOMPARE(item->property("tested").toBool(), false); + QCOMPARE(item->width(), 50.); + emit item->setWidth(100.); + QCOMPARE(item->width(), 100.); + QCOMPARE(item->property("tested").toBool(), false); //Should not have received signal to change property + + connections->setEnabled(true); //Re-enable the connectSignals() + QCOMPARE(item->property("tested").toBool(), false); + QCOMPARE(item->width(), 100.); + emit item->setWidth(50.); + QCOMPARE(item->width(), 50.); + QCOMPARE(item->property("tested").toBool(), true); //Should have received signal to change property + + delete item; +} + QTEST_MAIN(tst_qqmlconnections) #include "tst_qqmlconnections.moc" diff --git a/tests/auto/qml/qqmlconsole/qqmlconsole.pro b/tests/auto/qml/qqmlconsole/qqmlconsole.pro index 0f3f10bd89..99192c4b16 100644 --- a/tests/auto/qml/qqmlconsole/qqmlconsole.pro +++ b/tests/auto/qml/qqmlconsole/qqmlconsole.pro @@ -8,7 +8,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += qml testlib gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlcontext/qqmlcontext.pro b/tests/auto/qml/qqmlcontext/qqmlcontext.pro index 2fb299cb10..19e5c1072a 100644 --- a/tests/auto/qml/qqmlcontext/qqmlcontext.pro +++ b/tests/auto/qml/qqmlcontext/qqmlcontext.pro @@ -8,7 +8,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro b/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro index 75436dd8e2..bc692a6e78 100644 --- a/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro +++ b/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmlcpputils.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmldirparser/qqmldirparser.pro b/tests/auto/qml/qqmldirparser/qqmldirparser.pro index 0be38a0a35..dda74b1ef9 100644 --- a/tests/auto/qml/qqmldirparser/qqmldirparser.pro +++ b/tests/auto/qml/qqmldirparser/qqmldirparser.pro @@ -6,6 +6,3 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmldirparser.cpp include (../../shared/util.pri) - -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro index 6f3f765aba..101181bba0 100644 --- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro +++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro @@ -20,5 +20,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private network testlib qtHaveModule(widgets): QT += widgets - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index b30dfcbd0b..5a7732fa9a 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -4910,7 +4910,7 @@ void tst_qqmlecmascript::propertyVarImplicitOwnership() QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); 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. + QPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. QVERIFY(!qobjectGuard.isNull()); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); @@ -4933,9 +4933,9 @@ void tst_qqmlecmascript::propertyVarReparent() QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); - QWeakPointer<QObject> rectGuard(rect); - QWeakPointer<QObject> textGuard(text); - QWeakPointer<QObject> text2Guard(text2); + QPointer<QObject> rectGuard(rect); + QPointer<QObject> textGuard(text); + QPointer<QObject> text2Guard(text2); QVERIFY(!rectGuard.isNull()); QVERIFY(!textGuard.isNull()); QVERIFY(!text2Guard.isNull()); @@ -4944,7 +4944,7 @@ void tst_qqmlecmascript::propertyVarReparent() // now construct an image which we will reparent. QMetaObject::invokeMethod(text2, "constructQObject"); QObject *image = text2->property("vp").value<QObject*>(); - QWeakPointer<QObject> imageGuard(image); + QPointer<QObject> imageGuard(image); QVERIFY(!imageGuard.isNull()); QCOMPARE(image->property("imageCanary").toInt(), 13); // now reparent the "Image" object (currently, it has JS ownership) @@ -4975,9 +4975,9 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); - QWeakPointer<QObject> rectGuard(rect); - QWeakPointer<QObject> textGuard(text); - QWeakPointer<QObject> text2Guard(text2); + QPointer<QObject> rectGuard(rect); + QPointer<QObject> textGuard(text); + QPointer<QObject> text2Guard(text2); QVERIFY(!rectGuard.isNull()); QVERIFY(!textGuard.isNull()); QVERIFY(!text2Guard.isNull()); @@ -4986,7 +4986,7 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() // now construct an image which we will reparent. QMetaObject::invokeMethod(text2, "constructQObject"); QObject *image = text2->property("vp").value<QObject*>(); - QWeakPointer<QObject> imageGuard(image); + QPointer<QObject> imageGuard(image); QVERIFY(!imageGuard.isNull()); QCOMPARE(image->property("imageCanary").toInt(), 13); // now reparent the "Image" object (currently, it has JS ownership) @@ -5044,9 +5044,9 @@ void tst_qqmlecmascript::propertyVarCircular2() QVERIFY(rootObject != 0); QObject *childObject = rootObject->findChild<QObject*>("text"); QVERIFY(childObject != 0); - QWeakPointer<QObject> rootObjectTracker(rootObject); + QPointer<QObject> rootObjectTracker(rootObject); QVERIFY(!rootObjectTracker.isNull()); - QWeakPointer<QObject> childObjectTracker(childObject); + QPointer<QObject> childObjectTracker(childObject); QVERIFY(!childObjectTracker.isNull()); gc(engine); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); @@ -6613,8 +6613,7 @@ void tst_qqmlecmascript::urlPropertyWithEncoding() 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); + const QUrl encoded = QUrl::fromEncoded("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); @@ -6632,8 +6631,7 @@ void tst_qqmlecmascript::urlListPropertyWithEncoding() 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); + const QUrl encoded = QUrl::fromEncoded("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)); @@ -7332,7 +7330,7 @@ void tst_qqmlecmascript::sequenceSort_data() QString fnName = QLatin1String("test_") + testName; bool useComparer = c != 0; testName += useComparer ? QLatin1String("[custom]") : QLatin1String("[default]"); - QTest::newRow(testName.toAscii().constData()) << fnName << useComparer; + QTest::newRow(testName.toLatin1().constData()) << fnName << useComparer; } } } @@ -7351,7 +7349,7 @@ void tst_qqmlecmascript::sequenceSort() QVERIFY(object != 0); QVariant q; - QMetaObject::invokeMethod(object, function.toAscii().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); + QMetaObject::invokeMethod(object, function.toLatin1().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); QVERIFY(q.toBool()); delete object; diff --git a/tests/auto/qml/qqmlengine/qqmlengine.pro b/tests/auto/qml/qqmlengine/qqmlengine.pro index e84512fae3..e7952d8e3a 100644 --- a/tests/auto/qml/qqmlengine/qqmlengine.pro +++ b/tests/auto/qml/qqmlengine/qqmlengine.pro @@ -7,4 +7,3 @@ include (../../shared/util.pri) SOURCES += tst_qqmlengine.cpp QT += core-private gui-private qml-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro b/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro index 6428933233..5bcec9f5b4 100644 --- a/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro +++ b/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro @@ -7,4 +7,3 @@ include (../../shared/util.pri) SOURCES += tst_qqmlenginecleanup.cpp QT += testlib qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlerror/qqmlerror.pro b/tests/auto/qml/qqmlerror/qqmlerror.pro index 5339f8740b..17a1d1dec7 100644 --- a/tests/auto/qml/qqmlerror/qqmlerror.pro +++ b/tests/auto/qml/qqmlerror/qqmlerror.pro @@ -6,9 +6,6 @@ include (../../shared/util.pri) macx:CONFIG -= app_bundle -CONFIG += parallel_test - TESTDATA = data/* QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlexpression/qqmlexpression.pro b/tests/auto/qml/qqmlexpression/qqmlexpression.pro index 45545b084e..5b1d397555 100644 --- a/tests/auto/qml/qqmlexpression/qqmlexpression.pro +++ b/tests/auto/qml/qqmlexpression/qqmlexpression.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlfileselector/qqmlfileselector.pro b/tests/auto/qml/qqmlfileselector/qqmlfileselector.pro index 3475fa4b1d..8a55f4de9c 100644 --- a/tests/auto/qml/qqmlfileselector/qqmlfileselector.pro +++ b/tests/auto/qml/qqmlfileselector/qqmlfileselector.pro @@ -8,6 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlglobal/qqmlglobal.pro b/tests/auto/qml/qqmlglobal/qqmlglobal.pro index d0d9fc400e..dbc8806de7 100644 --- a/tests/auto/qml/qqmlglobal/qqmlglobal.pro +++ b/tests/auto/qml/qqmlglobal/qqmlglobal.pro @@ -3,6 +3,4 @@ TARGET = tst_qqmlglobal SOURCES += tst_qqmlglobal.cpp macx:CONFIG -= app_bundle -CONFIG += parallel_test QT += qml-private testlib core-private gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlimport/qqmlimport.pro b/tests/auto/qml/qqmlimport/qqmlimport.pro index 6c99c00570..c8b0f68d9f 100644 --- a/tests/auto/qml/qqmlimport/qqmlimport.pro +++ b/tests/auto/qml/qqmlimport/qqmlimport.pro @@ -6,6 +6,3 @@ osx:CONFIG -= app_bundle SOURCES += tst_qqmlimport.cpp include (../../shared/util.pri) - -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index c53977482b..1f495c3581 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -43,6 +43,7 @@ class tst_QQmlImport : public QQmlDataTest Q_OBJECT private slots: + void importPathOrder(); void testDesignerSupported(); void uiFormatLoading(); void cleanup(); @@ -81,7 +82,7 @@ void tst_QQmlImport::testDesignerSupported() warningString.remove('\r'); #endif warningString = warningString.arg(testFileUrl("testfile_unsupported.qml").toString()); - QTest::ignoreMessage(QtWarningMsg, warningString.toAscii()); + QTest::ignoreMessage(QtWarningMsg, warningString.toLocal8Bit()); window->setSource(testFileUrl("testfile_unsupported.qml")); QVERIFY(!window->errors().isEmpty()); @@ -127,6 +128,29 @@ void tst_QQmlImport::uiFormatLoading() delete test; } +void tst_QQmlImport::importPathOrder() +{ + QStringList expectedImportPaths; + QString appDirPath = QCoreApplication::applicationDirPath(); + QString qml2Imports = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); +#ifdef Q_OS_WIN + // The drive letter has a different case as QQmlImport will + // cause it to be converted after passing through QUrl + appDirPath[0] = appDirPath[0].toUpper(); + qml2Imports[0] = qml2Imports[0].toUpper(); +#endif + expectedImportPaths << appDirPath + << QLatin1String("qrc:/qt-project.org/imports") + << qml2Imports; + QQmlEngine engine; + QCOMPARE(expectedImportPaths, engine.importPathList()); + + // Add an import path + engine.addImportPath(QT_QMLTEST_DATADIR); + expectedImportPaths.prepend(QT_QMLTEST_DATADIR); + QCOMPARE(expectedImportPaths, engine.importPathList()); +} + QTEST_MAIN(tst_QQmlImport) #include "tst_qqmlimport.moc" diff --git a/tests/auto/qml/qqmlincubator/qqmlincubator.pro b/tests/auto/qml/qqmlincubator/qqmlincubator.pro index 9249061912..e5fa45f1d3 100644 --- a/tests/auto/qml/qqmlincubator/qqmlincubator.pro +++ b/tests/auto/qml/qqmlincubator/qqmlincubator.pro @@ -11,7 +11,5 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlinfo/qqmlinfo.pro b/tests/auto/qml/qqmlinfo/qqmlinfo.pro index e813982210..89b4abd00c 100644 --- a/tests/auto/qml/qqmlinfo/qqmlinfo.pro +++ b/tests/auto/qml/qqmlinfo/qqmlinfo.pro @@ -8,6 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlitemmodels/qqmlitemmodels.pro b/tests/auto/qml/qqmlitemmodels/qqmlitemmodels.pro index f76c6d0d25..d50c630003 100644 --- a/tests/auto/qml/qqmlitemmodels/qqmlitemmodels.pro +++ b/tests/auto/qml/qqmlitemmodels/qqmlitemmodels.pro @@ -9,10 +9,7 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core qml testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DISTFILES += \ data/modelindex.qml \ diff --git a/tests/auto/qml/qqmllanguage/qqmllanguage.pro b/tests/auto/qml/qqmllanguage/qqmllanguage.pro index f0c8bb6c1b..99c0c3e823 100644 --- a/tests/auto/qml/qqmllanguage/qqmllanguage.pro +++ b/tests/auto/qml/qqmllanguage/qqmllanguage.pro @@ -15,7 +15,6 @@ TESTDATA = data/* QT += core-private gui-private qml-private network testlib include (../../shared/util.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/readonlyObjectProperty.qml diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 1f299c0dbb..32b0d9661f 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -677,8 +677,7 @@ void tst_qqmllanguage::assignBasicTypes() QCOMPARE(object->variantProperty(), QVariant("Hello World!")); QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f)); QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f)); - QUrl encoded; - encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); + const QUrl encoded = QUrl::fromEncoded("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()); @@ -1156,8 +1155,7 @@ void tst_qqmllanguage::bindTypeToJSValue() } { MyQmlObject *object = root->findChild<MyQmlObject *>("urlProperty"); QJSValue value = object->qjsvalue(); - QUrl encoded; - encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); + const QUrl encoded = QUrl::fromEncoded("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); QCOMPARE(value.toString(), component.url().resolved(encoded).toString()); } { MyQmlObject *object = root->findChild<MyQmlObject *>("objectProperty"); diff --git a/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro index e6c9dc3a29..4ada590a2a 100644 --- a/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro +++ b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmllistcompositor.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro index 1555dc2b2c..8e3aed0baf 100644 --- a/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro +++ b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro index 7647c3d713..9e1cea9867 100644 --- a/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro +++ b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro @@ -9,4 +9,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmllistreference/qqmllistreference.pro b/tests/auto/qml/qqmllistreference/qqmllistreference.pro index f30b245975..dceb7d1133 100644 --- a/tests/auto/qml/qqmllistreference/qqmllistreference.pro +++ b/tests/auto/qml/qqmllistreference/qqmllistreference.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmllocale/qqmllocale.pro b/tests/auto/qml/qqmllocale/qqmllocale.pro index 6d8eccd61c..d3d022b44e 100644 --- a/tests/auto/qml/qqmllocale/qqmllocale.pro +++ b/tests/auto/qml/qqmllocale/qqmllocale.pro @@ -8,7 +8,5 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += qml testlib gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro b/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro index 87f70852fa..03aaf8ecdd 100644 --- a/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro +++ b/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro @@ -8,6 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += qml testlib gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro index 54a6e0507f..0d8de91931 100644 --- a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro +++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro @@ -6,6 +6,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* include (../../shared/util.pri) -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro index 9a6ee63b88..523c6eaea1 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro index 002f177cfd..4a8ce58edc 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro index 562d109179..150f2f08d3 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro index 5636941951..eca74e9bef 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro index 0d900eb707..49d290132b 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro index 445b98d647..9389679f2d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro index 00c076d9cf..76544aa553 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro @@ -11,4 +11,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro index 3a0455569e..bd1399b1aa 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro index d3b237b0f7..c7e0f6dc09 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro +++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro @@ -11,4 +11,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro index 5cec9b8ebd..bc9ee5c102 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro +++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro index ba66d60f18..9decde52bf 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro +++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro @@ -11,4 +11,3 @@ IMPORT_FILES = \ MyQmlFile.qml include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro index 99bac141de..26f553ea89 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro +++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro @@ -11,4 +11,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro index 22926bf1ca..45255800f3 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro index c07f0621f7..745d1dc405 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/protectedModule/protectedModule.pro b/tests/auto/qml/qqmlmoduleplugin/protectedModule/protectedModule.pro index 749a440ca8..fb64f4415f 100644 --- a/tests/auto/qml/qqmlmoduleplugin/protectedModule/protectedModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/protectedModule/protectedModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro index b715c6b82e..5c30d8cc00 100644 --- a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro @@ -22,6 +22,4 @@ SUBDIRS =\ tst_qqmlmoduleplugin_pro.depends += plugin SUBDIRS += tst_qqmlmoduleplugin.pro -CONFIG += parallel_test - QT += core-private gui-private qml-private diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/strictModule.2.pro b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/strictModule.2.pro index 14f3c59c21..b87cd19e0d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/strictModule.2.pro +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/strictModule.2.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro index bf1c5df1a7..aedca480d3 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro @@ -10,4 +10,3 @@ IMPORT_FILES = \ qmldir include (../../../shared/imports.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro index c483ef8ccd..43bd112415 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro @@ -11,4 +11,3 @@ include (../../shared/util.pri) TESTDATA = data/* imports/* $$OUT_PWD/imports/* QT += core-private gui-private qml-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlobjectmodel/qqmlobjectmodel.pro b/tests/auto/qml/qqmlobjectmodel/qqmlobjectmodel.pro index f8232f8854..88bb630e29 100644 --- a/tests/auto/qml/qqmlobjectmodel/qqmlobjectmodel.pro +++ b/tests/auto/qml/qqmlobjectmodel/qqmlobjectmodel.pro @@ -4,7 +4,5 @@ osx:CONFIG -= app_bundle SOURCES += tst_qqmlobjectmodel.cpp -CONFIG += parallel_test - QT += qml testlib QT += core-private qml-private diff --git a/tests/auto/qml/qqmlopenmetaobject/qqmlopenmetaobject.pro b/tests/auto/qml/qqmlopenmetaobject/qqmlopenmetaobject.pro index c81394e77e..f29a444395 100644 --- a/tests/auto/qml/qqmlopenmetaobject/qqmlopenmetaobject.pro +++ b/tests/auto/qml/qqmlopenmetaobject/qqmlopenmetaobject.pro @@ -4,6 +4,4 @@ osx:CONFIG -= app_bundle SOURCES += tst_qqmlopenmetaobject.cpp -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlparser/qqmlparser.pro b/tests/auto/qml/qqmlparser/qqmlparser.pro index c666b71d6c..74cb620f06 100644 --- a/tests/auto/qml/qqmlparser/qqmlparser.pro +++ b/tests/auto/qml/qqmlparser/qqmlparser.pro @@ -6,7 +6,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmlparser.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" -CONFIG += parallel_test - cross_compile: DEFINES += QTEST_CROSS_COMPILED -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlproperty/qqmlproperty.pro b/tests/auto/qml/qqmlproperty/qqmlproperty.pro index c2177d5fbf..b1bcf1f17d 100644 --- a/tests/auto/qml/qqmlproperty/qqmlproperty.pro +++ b/tests/auto/qml/qqmlproperty/qqmlproperty.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 6ada14ce79..3133d6c00a 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -2062,13 +2062,11 @@ void tst_qqmlproperty::floatToStringPrecision() QVERIFY(obj != 0); QCOMPARE(obj->property("a").toDouble(), 3.4); - QEXPECT_FAIL("", "QVariant's double-to-string conversion is worse than V4's.", Continue); QCOMPARE(obj->property("a").toString(), QLatin1String("3.4")); QCOMPARE(obj->property("b").toDouble(), 3.4); QCOMPARE(obj->property("b").toString(), QLatin1String("3.4")); QCOMPARE(obj->property("c").toDouble(), 0.035003945); - QEXPECT_FAIL("", "QVariant's double-to-string conversion is worse than V4's.", Continue); QCOMPARE(obj->property("c").toString(), QLatin1String("0.035003945")); QCOMPARE(obj->property("d").toDouble(), 0.035003945); QCOMPARE(obj->property("d").toString(), QLatin1String("0.035003945")); diff --git a/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro b/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro index 7cc83cd440..9a04c899fe 100644 --- a/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro +++ b/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro @@ -4,6 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmlpropertycache.cpp -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro index 81212bb064..8da300171d 100644 --- a/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro +++ b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro @@ -6,7 +6,4 @@ SOURCES += tst_qqmlpropertymap.cpp include (../../shared/util.pri) -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlqt/qqmlqt.pro b/tests/auto/qml/qqmlqt/qqmlqt.pro index 0470156e28..74306d704f 100644 --- a/tests/auto/qml/qqmlqt/qqmlqt.pro +++ b/tests/auto/qml/qqmlqt/qqmlqt.pro @@ -9,4 +9,3 @@ macx:CONFIG -= app_bundle TESTDATA = data/* QT += core-private qml-private quick-private testlib gui gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlsettings/qqmlsettings.pro b/tests/auto/qml/qqmlsettings/qqmlsettings.pro index efcef27f7e..392f496dc8 100644 --- a/tests/auto/qml/qqmlsettings/qqmlsettings.pro +++ b/tests/auto/qml/qqmlsettings/qqmlsettings.pro @@ -9,4 +9,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += qml testlib -CONFIG += parallel_test diff --git a/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro b/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro index c32f3c6c34..fbb873b649 100644 --- a/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro +++ b/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro @@ -9,4 +9,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private sql testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro index 002af1d707..635f2fa5e0 100644 --- a/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro +++ b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro @@ -6,6 +6,4 @@ SOURCES += tst_qqmlstatemachine.cpp include (../../shared/util.pri) -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private gui testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmltimer/qqmltimer.pro b/tests/auto/qml/qqmltimer/qqmltimer.pro index 28f8e6959f..da66bc87ca 100644 --- a/tests/auto/qml/qqmltimer/qqmltimer.pro +++ b/tests/auto/qml/qqmltimer/qqmltimer.pro @@ -4,6 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qqmltimer.cpp -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private gui testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmltranslation/qqmltranslation.pro b/tests/auto/qml/qqmltranslation/qqmltranslation.pro index 6ccec6fc7d..ac329a204b 100644 --- a/tests/auto/qml/qqmltranslation/qqmltranslation.pro +++ b/tests/auto/qml/qqmltranslation/qqmltranslation.pro @@ -9,7 +9,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro index 9e2261df8d..3a20e94741 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro @@ -7,5 +7,3 @@ SOURCES += tst_qqmltypeloader.cpp include (../../shared/util.pri) -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro b/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro index 7ef81e0cc4..0c36088853 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro +++ b/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro @@ -11,7 +11,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private gui testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro b/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro index e36be45f41..36b36d2f0e 100644 --- a/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro +++ b/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro @@ -11,10 +11,7 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private gui testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DISTFILES += \ data/customvaluetype.qml diff --git a/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro b/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro index fcfdf23d33..44b2963918 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro +++ b/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro @@ -13,4 +13,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro index c4fdcdc7dd..23b9117889 100644 --- a/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro +++ b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro @@ -8,8 +8,6 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 RESOURCES += data/introspect.qrc diff --git a/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro b/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro index 268b45f4e7..be8b9089a2 100644 --- a/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro +++ b/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qrcqml/qrcqml.pro b/tests/auto/qml/qrcqml/qrcqml.pro index 3bbc6d6085..60ccba27f2 100644 --- a/tests/auto/qml/qrcqml/qrcqml.pro +++ b/tests/auto/qml/qrcqml/qrcqml.pro @@ -5,6 +5,3 @@ macx:CONFIG -= app_bundle SOURCES += tst_qrcqml.cpp RESOURCES = qrcqml.qrc - -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro index c6d442ecac..69e14aaecf 100644 --- a/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro +++ b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro @@ -9,4 +9,3 @@ macx:CONFIG -= app_bundle TESTDATA = data/* QT += core-private qml-private testlib gui gui-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qv4debugger/qv4debugger.pro b/tests/auto/qml/qv4debugger/qv4debugger.pro deleted file mode 100644 index 540cab70e6..0000000000 --- a/tests/auto/qml/qv4debugger/qv4debugger.pro +++ /dev/null @@ -1,15 +0,0 @@ -CONFIG += testcase -TARGET = tst_qv4debugger -macx:CONFIG -= app_bundle - -SOURCES += \ - $$PWD/tst_qv4debugger.cpp \ - $$PWD/../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp - -HEADERS += \ - $$PWD/../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h - -INCLUDEPATH += \ - $$PWD/../../../../src/plugins/qmltooling/qmldbg_debugger - -QT += core-private gui-private qml-private network testlib diff --git a/tests/auto/qml/v4misc/v4misc.pro b/tests/auto/qml/v4misc/v4misc.pro index d68025f410..5150df5999 100644 --- a/tests/auto/qml/v4misc/v4misc.pro +++ b/tests/auto/qml/v4misc/v4misc.pro @@ -4,6 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_v4misc.cpp -CONFIG += parallel_test QT += core-private qml-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qmldevtools/compile/compile.pro b/tests/auto/qmldevtools/compile/compile.pro index 0ed113a031..186ef71e8d 100644 --- a/tests/auto/qmldevtools/compile/compile.pro +++ b/tests/auto/qmldevtools/compile/compile.pro @@ -12,4 +12,3 @@ macx:CONFIG -= app_bundle SOURCES += tst_compile.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro index 7662cb1687..54db7a78ab 100644 --- a/tests/auto/qmltest/qmltest.pro +++ b/tests/auto/qmltest/qmltest.pro @@ -10,6 +10,5 @@ importFiles.files = borderimage buttonclick createbenchmark events qqmlbindi importFiles.path = . DEPLOYMENT += importFiles -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 CONFIG+=insignificant_test # QTBUG-33723 diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro index 3d821fc13d..fd8cfd83c8 100644 --- a/tests/auto/quick/examples/examples.pro +++ b/tests/auto/quick/examples/examples.pro @@ -6,9 +6,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_examples.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" -CONFIG += parallel_test #temporary QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 !qtHaveModule(xmlpatterns): DEFINES += QT_NO_XMLPATTERNS diff --git a/tests/auto/quick/geometry/geometry.pro b/tests/auto/quick/geometry/geometry.pro index 4a225c2546..0b7e64d038 100644 --- a/tests/auto/quick/geometry/geometry.pro +++ b/tests/auto/quick/geometry/geometry.pro @@ -7,4 +7,3 @@ SOURCES += tst_geometry.cpp CONFIG+=parallel_test QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/nodes/nodes.pro b/tests/auto/quick/nodes/nodes.pro index 256318a441..6cfcc43a98 100644 --- a/tests/auto/quick/nodes/nodes.pro +++ b/tests/auto/quick/nodes/nodes.pro @@ -7,4 +7,3 @@ SOURCES += tst_nodestest.cpp CONFIG+=parallel_test QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/nokeywords/nokeywords.pro b/tests/auto/quick/nokeywords/nokeywords.pro index 51fd490cb7..6872dac22a 100644 --- a/tests/auto/quick/nokeywords/nokeywords.pro +++ b/tests/auto/quick/nokeywords/nokeywords.pro @@ -7,4 +7,3 @@ SOURCES += tst_nokeywords.cpp CONFIG+=parallel_test QT += quick core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickaccessible/qquickaccessible.pro b/tests/auto/quick/qquickaccessible/qquickaccessible.pro index bdbe2e3fb4..02915e8e22 100644 --- a/tests/auto/quick/qquickaccessible/qquickaccessible.pro +++ b/tests/auto/quick/qquickaccessible/qquickaccessible.pro @@ -16,12 +16,9 @@ OTHER_FILES += data/checkbuttons.qml \ data/statictext.qml \ data/ignored.qml \ -CONFIG += parallel_test - wince*: { accessneeded.files = $$QT.widgets.plugins/accessible/*.dll accessneeded.path = accessible DEPLOYMENT += accessneeded } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickanchors/qquickanchors.pro b/tests/auto/quick/qquickanchors/qquickanchors.pro index 184066753b..a5b47e3797 100644 --- a/tests/auto/quick/qquickanchors/qquickanchors.pro +++ b/tests/auto/quick/qquickanchors/qquickanchors.pro @@ -9,7 +9,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro b/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro index 83607137e1..5792626720 100644 --- a/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro +++ b/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro @@ -11,4 +11,3 @@ macx:CONFIG -= app_bundle TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro index 3e47844feb..81c73be831 100644 --- a/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro +++ b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro @@ -8,10 +8,7 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/largeAnimation.qml diff --git a/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro b/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro index b5e03ee620..6909922cb1 100644 --- a/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro +++ b/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro @@ -3,8 +3,6 @@ TEMPLATE=app TARGET=tst_qquickanimationcontroller CONFIG += qmltestcase -CONFIG += parallel_test SOURCES += tst_qquickanimationcontroller.cpp TESTDATA = data/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro index dc8f471259..8bb1f47af5 100644 --- a/tests/auto/quick/qquickanimations/qquickanimations.pro +++ b/tests/auto/quick/qquickanimations/qquickanimations.pro @@ -8,7 +8,60 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +OTHER_FILES += \ + data/attached.qml \ + data/badproperty1.qml \ + data/badproperty2.qml \ + data/badtype1.qml \ + data/badtype2.qml \ + data/badtype3.qml \ + data/badtype4.qml \ + data/disabledTransition.qml \ + data/dontAutoStart.qml \ + data/dontStart.qml \ + data/dontStart2.qml \ + data/dotproperty.qml \ + data/Double.qml \ + data/doubleRegistrationBug.qml \ + data/looping.qml \ + data/mixedtype1.qml \ + data/mixedtype2.qml \ + data/nonTransitionBug.qml \ + data/parallelAnimationNullChildBug.qml \ + data/pathAnimation.qml \ + data/pathAnimation2.qml \ + data/pathAnimationInOutBackCrash.qml \ + data/pathAnimationNoStart.qml \ + data/pathInterpolator.qml \ + data/pathInterpolatorBack.qml \ + data/pathInterpolatorBack2.qml \ + data/pathTransition.qml \ + data/pauseBindingBug.qml \ + data/pauseBug.qml \ + data/properties.qml \ + data/properties2.qml \ + data/properties3.qml \ + data/properties4.qml \ + data/properties5.qml \ + data/propertiesTransition.qml \ + data/propertiesTransition2.qml \ + data/propertiesTransition3.qml \ + data/propertiesTransition4.qml \ + data/propertiesTransition5.qml \ + data/propertiesTransition6.qml \ + data/propertiesTransition7.qml \ + data/reanchor.qml \ + data/registrationBug.qml \ + data/reparent.qml \ + data/rotation.qml \ + data/runningTrueBug.qml \ + data/scriptActionBug.qml \ + data/scriptActionCrash.qml \ + data/sequentialAnimationNullChildBug.qml \ + data/signals.qml \ + data/transitionAssignmentBug.qml \ + data/valuesource.qml \ + data/valuesource2.qml diff --git a/tests/auto/quick/qquickapplication/qquickapplication.pro b/tests/auto/quick/qquickapplication/qquickapplication.pro index 7079478628..59445a6c16 100644 --- a/tests/auto/quick/qquickapplication/qquickapplication.pro +++ b/tests/auto/quick/qquickapplication/qquickapplication.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquickapplication macx:CONFIG -= app_bundle SOURCES += tst_qquickapplication.cpp QT += core-private gui-private qml quick qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro index f005c03a82..51bc42c390 100644 --- a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro +++ b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro @@ -8,7 +8,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickborderimage/qquickborderimage.pro b/tests/auto/quick/qquickborderimage/qquickborderimage.pro index ac213f0265..3e16063559 100644 --- a/tests/auto/quick/qquickborderimage/qquickborderimage.pro +++ b/tests/auto/quick/qquickborderimage/qquickborderimage.pro @@ -11,4 +11,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro index c770dbb488..3c41d498e5 100644 --- a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro +++ b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro @@ -8,7 +8,6 @@ SOURCES += tst_qquickcanvasitem.cpp TESTDATA = data/* OTHER_FILES += \ - data/testhelper.js \ data/tst_transform.qml \ data/tst_text.qml \ data/tst_strokeStyle.qml \ @@ -19,15 +18,38 @@ OTHER_FILES += \ data/tst_line.qml \ data/tst_fillStyle.qml \ data/tst_fillrect.qml \ - data/tst_drawimage.qml \ data/tst_composite.qml \ data/tst_canvas.qml \ data/tst_pixel.qml \ data/tst_gradient.qml \ data/tst_arcto.qml \ data/tst_arc.qml \ - data/tst_context.qml + data/tst_context.qml \ + data/CanvasTestCase.qml \ + data/CanvasComponent.qml \ + data/tst_image.qml \ + data/tst_svgpath.qml \ + data/anim-gr.gif \ + data/anim-gr.png \ + data/anim-poster-gr.png \ + data/background.png \ + data/broken.png \ + data/ggrr-256x256.png \ + data/green-1x1.png \ + data/green-2x2.png \ + data/green-16x16.png \ + data/green-256x256.png \ + data/green.png \ + data/grgr-256x256.png \ + data/red-16x16.png \ + data/red.png \ + data/redtransparent.png \ + data/rgrg-256x256.png \ + data/rrgg-256x256.png \ + data/transparent.png \ + data/transparent50.png \ + data/yellow.png \ + data/yellow75.png -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 CONFIG += insignificant_test # QTBUG-41043 diff --git a/tests/auto/quick/qquickdesignersupport/qquickdesignersupport.pro b/tests/auto/quick/qquickdesignersupport/qquickdesignersupport.pro index af932d834b..6e1ad6b95e 100644 --- a/tests/auto/quick/qquickdesignersupport/qquickdesignersupport.pro +++ b/tests/auto/quick/qquickdesignersupport/qquickdesignersupport.pro @@ -10,7 +10,6 @@ osx:CONFIG -= app_bundle TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DISTFILES += \ data/TestComponent.qml diff --git a/tests/auto/quick/qquickdrag/qquickdrag.pro b/tests/auto/quick/qquickdrag/qquickdrag.pro index 6e02a4d443..4bc6b2b2f6 100644 --- a/tests/auto/quick/qquickdrag/qquickdrag.pro +++ b/tests/auto/quick/qquickdrag/qquickdrag.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquickdrag.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickdroparea/qquickdroparea.pro b/tests/auto/quick/qquickdroparea/qquickdroparea.pro index c7ffbfd427..a34d5ad009 100644 --- a/tests/auto/quick/qquickdroparea/qquickdroparea.pro +++ b/tests/auto/quick/qquickdroparea/qquickdroparea.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquickdroparea.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro index a67daa91ba..33fa9aff7a 100644 --- a/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro +++ b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro @@ -8,7 +8,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core gui qml quick testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickflickable/qquickflickable.pro b/tests/auto/quick/qquickflickable/qquickflickable.pro index 88dc2fbc2a..99a840218d 100644 --- a/tests/auto/quick/qquickflickable/qquickflickable.pro +++ b/tests/auto/quick/qquickflickable/qquickflickable.pro @@ -10,4 +10,3 @@ include (../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickflipable/qquickflipable.pro b/tests/auto/quick/qquickflipable/qquickflipable.pro index 3e4d04a401..5a1fb6e816 100644 --- a/tests/auto/quick/qquickflipable/qquickflipable.pro +++ b/tests/auto/quick/qquickflipable/qquickflipable.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro b/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro index 9ec643dc4d..7a4b7302d0 100644 --- a/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro +++ b/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro @@ -10,4 +10,3 @@ macx:CONFIG -= app_bundle TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickfontloader/qquickfontloader.pro b/tests/auto/quick/qquickfontloader/qquickfontloader.pro index 2e7300564e..cea5b55bdf 100644 --- a/tests/auto/quick/qquickfontloader/qquickfontloader.pro +++ b/tests/auto/quick/qquickfontloader/qquickfontloader.pro @@ -11,4 +11,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickfontmetrics/qquickfontmetrics.pro b/tests/auto/quick/qquickfontmetrics/qquickfontmetrics.pro index 452dd70bd3..15e3bb00c1 100644 --- a/tests/auto/quick/qquickfontmetrics/qquickfontmetrics.pro +++ b/tests/auto/quick/qquickfontmetrics/qquickfontmetrics.pro @@ -4,7 +4,4 @@ osx:CONFIG -= app_bundle SOURCES += tst_quickfontmetrics.cpp -CONFIG += parallel_test - QT += core gui qml quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickframebufferobject/qquickframebufferobject.pro b/tests/auto/quick/qquickframebufferobject/qquickframebufferobject.pro index 612b6f7283..f4e9e1f890 100644 --- a/tests/auto/quick/qquickframebufferobject/qquickframebufferobject.pro +++ b/tests/auto/quick/qquickframebufferobject/qquickframebufferobject.pro @@ -7,7 +7,6 @@ include(../../shared/util.pri) macx:CONFIG -= app_bundle -CONFIG += parallel_test QT += quick testlib OTHER_FILES += \ diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro index 3b98ed4dea..3c33cc78fb 100644 --- a/tests/auto/quick/qquickgridview/qquickgridview.pro +++ b/tests/auto/quick/qquickgridview/qquickgridview.pro @@ -12,4 +12,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 3699bef56d..e8261be675 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -211,6 +211,8 @@ private slots: void QTBUG_45640(); + void keyNavigationEnabled(); + private: QList<int> toIntList(const QVariantList &list); void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes); @@ -6566,6 +6568,71 @@ void tst_QQuickGridView::QTBUG_45640() delete window; } +void tst_QQuickGridView::keyNavigationEnabled() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("gridview4.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + + QQuickGridView *gridView = qobject_cast<QQuickGridView *>(window->rootObject()); + QVERIFY(gridView); + QCOMPARE(gridView->isKeyNavigationEnabled(), true); + + gridView->setFocus(true); + QVERIFY(gridView->hasActiveFocus()); + + gridView->setHighlightMoveDuration(0); + + // If keyNavigationEnabled is not explicitly set to true, respect the original behavior + // of disabling both mouse and keyboard interaction. + QSignalSpy enabledSpy(gridView, SIGNAL(keyNavigationEnabledChanged())); + gridView->setInteractive(false); + QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(gridView->isKeyNavigationEnabled(), false); + + flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); + QVERIFY(!gridView->isMoving()); + QCOMPARE(gridView->contentY(), 0.0); + QCOMPARE(gridView->currentIndex(), 0); + + QTest::keyClick(window.data(), Qt::Key_Right); + QCOMPARE(gridView->currentIndex(), 0); + + // Check that isKeyNavigationEnabled implicitly follows the value of interactive. + gridView->setInteractive(true); + QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(gridView->isKeyNavigationEnabled(), true); + + // Change it back again for the next check. + gridView->setInteractive(false); + QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(gridView->isKeyNavigationEnabled(), false); + + // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. + gridView->setKeyNavigationEnabled(true); + QCOMPARE(enabledSpy.count(), 4); + flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); + QVERIFY(!gridView->isMoving()); + QCOMPARE(gridView->contentY(), 0.0); + QCOMPARE(gridView->currentIndex(), 0); + + // Should now work. + QTest::keyClick(window.data(), Qt::Key_Right); + QCOMPARE(gridView->currentIndex(), 1); + + // Changing interactive now shouldn't result in keyNavigationEnabled changing, + // since we broke the "binding". + gridView->setInteractive(true); + QCOMPARE(enabledSpy.count(), 4); + + // Keyboard interaction shouldn't work now. + gridView->setKeyNavigationEnabled(false); + QTest::keyClick(window.data(), Qt::Key_Right); + QCOMPARE(gridView->currentIndex(), 1); +} + QTEST_MAIN(tst_QQuickGridView) #include "tst_qquickgridview.moc" diff --git a/tests/auto/quick/qquickimage/qquickimage.pro b/tests/auto/quick/qquickimage/qquickimage.pro index 9581ae02d1..5b1059bd24 100644 --- a/tests/auto/quick/qquickimage/qquickimage.pro +++ b/tests/auto/quick/qquickimage/qquickimage.pro @@ -12,4 +12,3 @@ include (../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro b/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro index 496dc31d30..f67b697c0f 100644 --- a/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro +++ b/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquickimageprovider.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickitem/qquickitem.pro b/tests/auto/quick/qquickitem/qquickitem.pro index 1d8ae0148b..9aca5926f2 100644 --- a/tests/auto/quick/qquickitem/qquickitem.pro +++ b/tests/auto/quick/qquickitem/qquickitem.pro @@ -11,4 +11,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickitem2/qquickitem2.pro b/tests/auto/quick/qquickitem2/qquickitem2.pro index ac4200a8a3..37bfb68f1c 100644 --- a/tests/auto/quick/qquickitem2/qquickitem2.pro +++ b/tests/auto/quick/qquickitem2/qquickitem2.pro @@ -9,4 +9,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index c7717b9cca..518e248207 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -117,6 +117,7 @@ private slots: void contains_data(); void contains(); void childAt(); + void isAncestorOf(); void grab(); @@ -2959,6 +2960,43 @@ void tst_QQuickItem::grab() } +void tst_QQuickItem::isAncestorOf() +{ + QQuickItem parent; + + QQuickItem sub1; + sub1.setParentItem(&parent); + + QQuickItem child1; + child1.setParentItem(&sub1); + QQuickItem child2; + child2.setParentItem(&sub1); + + QQuickItem sub2; + sub2.setParentItem(&parent); + + QQuickItem child3; + child3.setParentItem(&sub2); + QQuickItem child4; + child4.setParentItem(&sub2); + + QVERIFY(parent.isAncestorOf(&sub1)); + QVERIFY(parent.isAncestorOf(&sub2)); + QVERIFY(parent.isAncestorOf(&child1)); + QVERIFY(parent.isAncestorOf(&child2)); + QVERIFY(parent.isAncestorOf(&child3)); + QVERIFY(parent.isAncestorOf(&child4)); + QVERIFY(sub1.isAncestorOf(&child1)); + QVERIFY(sub1.isAncestorOf(&child2)); + QVERIFY(!sub1.isAncestorOf(&child3)); + QVERIFY(!sub1.isAncestorOf(&child4)); + QVERIFY(sub2.isAncestorOf(&child3)); + QVERIFY(sub2.isAncestorOf(&child4)); + QVERIFY(!sub2.isAncestorOf(&child1)); + QVERIFY(!sub2.isAncestorOf(&child2)); + QVERIFY(!sub1.isAncestorOf(&sub1)); + QVERIFY(!sub2.isAncestorOf(&sub2)); +} QTEST_MAIN(tst_QQuickItem) diff --git a/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro index a087948f6d..ec890b99b4 100644 --- a/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro +++ b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro @@ -8,7 +8,6 @@ TESTDATA = data/* include(../../shared/util.pri) -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib OTHER_FILES += \ @@ -27,4 +26,3 @@ OTHER_FILES += \ data/ItemEffect.qml \ data/RectangleEffect.qml \ data/TextureMirroring.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicklistview/qquicklistview.pro b/tests/auto/quick/qquicklistview/qquicklistview.pro index c9b634b9e8..a95b6fdf33 100644 --- a/tests/auto/quick/qquicklistview/qquicklistview.pro +++ b/tests/auto/quick/qquicklistview/qquicklistview.pro @@ -18,5 +18,4 @@ include (../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index b3a6edb66a..86add7435c 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -252,6 +252,8 @@ private slots: void QTBUG_48044_currentItemNotVisibleAfterTransition(); void QTBUG_48870_fastModelUpdates(); + void keyNavigationEnabled(); + private: template <class T> void items(const QUrl &source); template <class T> void changed(const QUrl &source); @@ -8307,6 +8309,72 @@ void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition() QVERIFY(!currentPriv->culled); } +void tst_QQuickListView::keyNavigationEnabled() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("simplelistview.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + + QQuickListView *listView = qobject_cast<QQuickListView *>(window->rootObject()); + QVERIFY(listView); + QCOMPARE(listView->isKeyNavigationEnabled(), true); + + listView->setFocus(true); + QVERIFY(listView->hasActiveFocus()); + + listView->setHighlightMoveDuration(0); + + // If keyNavigationEnabled is not explicitly set to true, respect the original behavior + // of disabling both mouse and keyboard interaction. + QSignalSpy enabledSpy(listView, SIGNAL(keyNavigationEnabledChanged())); + listView->setInteractive(false); + QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(listView->isKeyNavigationEnabled(), false); + + flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); + QVERIFY(!listView->isMoving()); + QCOMPARE(listView->contentY(), 0.0); + QCOMPARE(listView->currentIndex(), 0); + + QTest::keyClick(window.data(), Qt::Key_Down); + QCOMPARE(listView->currentIndex(), 0); + + // Check that isKeyNavigationEnabled implicitly follows the value of interactive. + listView->setInteractive(true); + QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(listView->isKeyNavigationEnabled(), true); + + // Change it back again for the next check. + listView->setInteractive(false); + QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(listView->isKeyNavigationEnabled(), false); + + // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. + listView->setKeyNavigationEnabled(true); + QCOMPARE(enabledSpy.count(), 4); + flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); + QVERIFY(!listView->isMoving()); + QCOMPARE(listView->contentY(), 0.0); + QCOMPARE(listView->currentIndex(), 0); + + // Should now work. + QTest::keyClick(window.data(), Qt::Key_Down); + QCOMPARE(listView->currentIndex(), 1); + // contentY won't change for one index change in a view this high. + + // Changing interactive now shouldn't result in keyNavigationEnabled changing, + // since we broke the "binding". + listView->setInteractive(true); + QCOMPARE(enabledSpy.count(), 4); + + // Keyboard interaction shouldn't work now. + listView->setKeyNavigationEnabled(false); + QTest::keyClick(window.data(), Qt::Key_Down); + QCOMPARE(listView->currentIndex(), 1); +} + static bool testVisibleItems(const QQuickItemViewPrivate *priv, bool *nonUnique, FxViewItem **failItem, int *expectedIdx) { QHash<QQuickItem*, int> uniqueItems; diff --git a/tests/auto/quick/qquickloader/qquickloader.pro b/tests/auto/quick/qquickloader/qquickloader.pro index 567917877c..32350388e8 100644 --- a/tests/auto/quick/qquickloader/qquickloader.pro +++ b/tests/auto/quick/qquickloader/qquickloader.pro @@ -13,4 +13,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index f4fab1d79f..b9d058ab80 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -111,6 +111,8 @@ private slots: void asynchronous(); void asynchronous_clear(); void simultaneousSyncAsync(); + void asyncToSync1(); + void asyncToSync2(); void loadedSignal(); void parented(); @@ -1035,6 +1037,73 @@ void tst_QQuickLoader::simultaneousSyncAsync() delete root; } +void tst_QQuickLoader::asyncToSync1() +{ + QQmlEngine engine; + PeriodicIncubationController *controller = new PeriodicIncubationController; + QQmlIncubationController *previous = engine.incubationController(); + engine.setIncubationController(controller); + delete previous; + + QQmlComponent component(&engine, testFileUrl("asynchronous.qml")); + QQuickItem *root = qobject_cast<QQuickItem*>(component.create()); + QVERIFY(root); + + QQuickLoader *loader = root->findChild<QQuickLoader*>("loader"); + QVERIFY(loader); + + QVERIFY(!loader->item()); + root->setProperty("comp", "BigComponent.qml"); + QMetaObject::invokeMethod(root, "loadComponent"); + QVERIFY(!loader->item()); + + controller->start(); + QCOMPARE(loader->status(), QQuickLoader::Loading); + QCOMPARE(engine.incubationController()->incubatingObjectCount(), 0); + + // force completion before component created + loader->setAsynchronous(false); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QQuickLoader::Ready); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + + delete root; +} + +void tst_QQuickLoader::asyncToSync2() +{ + PeriodicIncubationController *controller = new PeriodicIncubationController; + QQmlIncubationController *previous = engine.incubationController(); + engine.setIncubationController(controller); + delete previous; + + QQmlComponent component(&engine, testFileUrl("asynchronous.qml")); + QQuickItem *root = qobject_cast<QQuickItem*>(component.create()); + QVERIFY(root); + + QQuickLoader *loader = root->findChild<QQuickLoader*>("loader"); + QVERIFY(loader); + + QVERIFY(!loader->item()); + root->setProperty("comp", "BigComponent.qml"); + QMetaObject::invokeMethod(root, "loadComponent"); + QVERIFY(!loader->item()); + + controller->start(); + QCOMPARE(loader->status(), QQuickLoader::Loading); + QTRY_COMPARE(engine.incubationController()->incubatingObjectCount(), 1); + + // force completion after component created but before incubation complete + loader->setAsynchronous(false); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QQuickLoader::Ready); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + + delete root; +} + void tst_QQuickLoader::loadedSignal() { PeriodicIncubationController *controller = new PeriodicIncubationController; diff --git a/tests/auto/quick/qquickmousearea/qquickmousearea.pro b/tests/auto/quick/qquickmousearea/qquickmousearea.pro index dd7b434898..15a080aa3e 100644 --- a/tests/auto/quick/qquickmousearea/qquickmousearea.pro +++ b/tests/auto/quick/qquickmousearea/qquickmousearea.pro @@ -11,4 +11,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro index 5724a7179e..e5a2bae840 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro +++ b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro @@ -1,6 +1,5 @@ TARGET = tst_qquickmultipointtoucharea CONFIG += testcase -CONFIG += parallel_test macx:CONFIG -= app_bundle SOURCES += tst_qquickmultipointtoucharea.cpp @@ -11,4 +10,3 @@ include(../../shared/util.pri) include(../shared/util.pri) QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro b/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro index 8489dfffd2..650ec04029 100644 --- a/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro +++ b/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro @@ -7,7 +7,6 @@ include(../../shared/util.pri) osx:CONFIG -= app_bundle -CONFIG += parallel_test QT += quick testlib OTHER_FILES += \ diff --git a/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro b/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro index 381167cd09..a188001bd4 100644 --- a/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro +++ b/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro @@ -4,7 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquickpainteditem.cpp -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickpath/qquickpath.pro b/tests/auto/quick/qquickpath/qquickpath.pro index 4898f28c14..492f82f53d 100644 --- a/tests/auto/quick/qquickpath/qquickpath.pro +++ b/tests/auto/quick/qquickpath/qquickpath.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickpathview/qquickpathview.pro b/tests/auto/quick/qquickpathview/qquickpathview.pro index e6cf9a488f..90c1eb0c67 100644 --- a/tests/auto/quick/qquickpathview/qquickpathview.pro +++ b/tests/auto/quick/qquickpathview/qquickpathview.pro @@ -11,4 +11,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib qtHaveModule(widgets): QT += widgets -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickpincharea/qquickpincharea.pro b/tests/auto/quick/qquickpincharea/qquickpincharea.pro index fa14afa261..d37b37309d 100644 --- a/tests/auto/quick/qquickpincharea/qquickpincharea.pro +++ b/tests/auto/quick/qquickpincharea/qquickpincharea.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquickpincharea macx:CONFIG -= app_bundle @@ -11,4 +10,3 @@ include (../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro index 62678dc660..185eb2c213 100644 --- a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro +++ b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro @@ -15,4 +15,3 @@ TESTDATA = data/* # LIBS += -lgcov QT += core-private gui-private qml-private quick-private network testlib concurrent -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickpositioners/qquickpositioners.pro b/tests/auto/quick/qquickpositioners/qquickpositioners.pro index f6a046e622..6e85ba9db8 100644 --- a/tests/auto/quick/qquickpositioners/qquickpositioners.pro +++ b/tests/auto/quick/qquickpositioners/qquickpositioners.pro @@ -10,4 +10,3 @@ macx:CONFIG -= app_bundle TESTDATA = data/* QT += testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickrectangle/qquickrectangle.pro b/tests/auto/quick/qquickrectangle/qquickrectangle.pro index e881926c80..daefb5fe75 100644 --- a/tests/auto/quick/qquickrectangle/qquickrectangle.pro +++ b/tests/auto/quick/qquickrectangle/qquickrectangle.pro @@ -10,4 +10,3 @@ include (../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickrepeater/qquickrepeater.pro b/tests/auto/quick/qquickrepeater/qquickrepeater.pro index a27c34c84b..5554342943 100644 --- a/tests/auto/quick/qquickrepeater/qquickrepeater.pro +++ b/tests/auto/quick/qquickrepeater/qquickrepeater.pro @@ -9,6 +9,4 @@ include (../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickscreen/qquickscreen.pro b/tests/auto/quick/qquickscreen/qquickscreen.pro index fa64556a69..145ae0f04e 100644 --- a/tests/auto/quick/qquickscreen/qquickscreen.pro +++ b/tests/auto/quick/qquickscreen/qquickscreen.pro @@ -6,6 +6,4 @@ include (../../shared/util.pri) macx:CONFIG -= app_bundle -CONFIG += parallel_test QT += core-private gui-private qml-private testlib quick-private -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro index 0af54f83f6..437a548a90 100644 --- a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro +++ b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro @@ -5,6 +5,4 @@ SOURCES += tst_qquickshadereffect.cpp include (../../shared/util.pri) macx:CONFIG -= app_bundle -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickshortcut/qquickshortcut.pro b/tests/auto/quick/qquickshortcut/qquickshortcut.pro index 917a7605e6..d780d9061a 100644 --- a/tests/auto/quick/qquickshortcut/qquickshortcut.pro +++ b/tests/auto/quick/qquickshortcut/qquickshortcut.pro @@ -8,4 +8,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core gui qml quick testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro b/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro index 4694172ac4..3d71ef4c62 100644 --- a/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro +++ b/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro b/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro index 2f0395d3ea..bf8ddfe8ae 100644 --- a/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro +++ b/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro @@ -8,7 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro b/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro index ee5cb5d25b..a61396bd0e 100644 --- a/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro +++ b/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro @@ -8,7 +8,4 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickstates/qquickstates.pro b/tests/auto/quick/qquickstates/qquickstates.pro index 1b638dfa67..85fdebff96 100644 --- a/tests/auto/quick/qquickstates/qquickstates.pro +++ b/tests/auto/quick/qquickstates/qquickstates.pro @@ -8,6 +8,4 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro b/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro index e9a8ffe8ee..def2a27bf7 100644 --- a/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro +++ b/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro @@ -4,6 +4,4 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquickstyledtext.cpp -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro index 48fd7e8e9a..9aa57b146b 100644 --- a/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro +++ b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro @@ -4,7 +4,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qquicksystempalette.cpp -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib qtHaveModule(widgets): QT += widgets -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktext/qquicktext.pro b/tests/auto/quick/qquicktext/qquicktext.pro index ee0a9be776..4f4b77ed7b 100644 --- a/tests/auto/quick/qquicktext/qquicktext.pro +++ b/tests/auto/quick/qquicktext/qquicktext.pro @@ -13,4 +13,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro index e6bfdbd099..b5866e9e89 100644 --- a/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro +++ b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro @@ -8,8 +8,5 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro index 2a6d753536..a61f46cb49 100644 --- a/tests/auto/quick/qquicktextedit/qquicktextedit.pro +++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro @@ -13,4 +13,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private network-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro index c14b09c545..205ee4f672 100644 --- a/tests/auto/quick/qquicktextinput/qquicktextinput.pro +++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro @@ -13,4 +13,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktextmetrics/qquicktextmetrics.pro b/tests/auto/quick/qquicktextmetrics/qquicktextmetrics.pro index 6ef68db8e2..a5c088d454 100644 --- a/tests/auto/quick/qquicktextmetrics/qquicktextmetrics.pro +++ b/tests/auto/quick/qquicktextmetrics/qquicktextmetrics.pro @@ -4,7 +4,4 @@ osx:CONFIG -= app_bundle SOURCES += tst_qquicktextmetrics.cpp -CONFIG += parallel_test - QT += core gui qml quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquicktimeline/qquicktimeline.pro b/tests/auto/quick/qquicktimeline/qquicktimeline.pro index 3fafc33505..489fc7e081 100644 --- a/tests/auto/quick/qquicktimeline/qquicktimeline.pro +++ b/tests/auto/quick/qquicktimeline/qquicktimeline.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquicktimeline macx:CONFIG -= app_bundle SOURCES += tst_qquicktimeline.cpp QT += core-private gui-private qml quick qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickview/qquickview.pro b/tests/auto/quick/qquickview/qquickview.pro index 3e9c39e2ce..1302908bf7 100644 --- a/tests/auto/quick/qquickview/qquickview.pro +++ b/tests/auto/quick/qquickview/qquickview.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquickview macx:CONFIG -= app_bundle @@ -10,4 +9,3 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro index d9aff688ab..9222e39477 100644 --- a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro +++ b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro @@ -11,4 +11,3 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib qtHaveModule(widgets): QT += widgets -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index d578a0900c..a1d8779555 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -102,15 +102,20 @@ public: }; SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = 0) - : QAbstractItemModel(parent) { - QHash<int, QByteArray> roles; - roles.insert(Qt::DisplayRole , role); - setRoleNames(roles); + : QAbstractItemModel(parent), m_role(role) + { foreach (const QString &string, list) trunk.children.append(Node(string)); } ~SingleRoleModel() {} + QHash<int,QByteArray> roleNames() const + { + QHash<int,QByteArray> roles; + roles.insert(Qt::DisplayRole, m_role); + return roles; + } + Branch *branchForIndex(const QModelIndex &index) const { return index.isValid() ? static_cast<Branch *>(index.internalPointer())->children.at(index.row()).branch @@ -235,6 +240,7 @@ public slots: } private: + const QByteArray m_role; Branch trunk; }; diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro index e95b7dbb10..f0d287f30f 100644 --- a/tests/auto/quick/qquickwindow/qquickwindow.pro +++ b/tests/auto/quick/qquickwindow/qquickwindow.pro @@ -17,5 +17,3 @@ OTHER_FILES += \ data/Headless.qml \ data/showHideAnimate.qml \ data/windoworder.qml - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index f53ade9541..b16b7b3686 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -397,7 +397,7 @@ void tst_qquickwindow::openglContextCreatedSignal() QVERIFY(spy.size() > 0); QVariant ctx = spy.at(0).at(0); - QCOMPARE(qVariantValue<QOpenGLContext *>(ctx), window.openglContext()); + QCOMPARE(qvariant_cast<QOpenGLContext *>(ctx), window.openglContext()); } void tst_qquickwindow::aboutToStopSignal() diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro index 574481c456..642345a4bb 100644 --- a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro +++ b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro @@ -8,10 +8,7 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private network testlib xmlpatterns -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/groups.qml diff --git a/tests/auto/quick/rendernode/rendernode.pro b/tests/auto/quick/rendernode/rendernode.pro index bedcefde86..e4397713d9 100644 --- a/tests/auto/quick/rendernode/rendernode.pro +++ b/tests/auto/quick/rendernode/rendernode.pro @@ -8,7 +8,6 @@ TESTDATA = data/* include(../../shared/util.pri) -CONFIG += parallel_test QT += core-private gui-private qml-private quick-private testlib OTHER_FILES += \ @@ -16,4 +15,3 @@ OTHER_FILES += \ data/MessUpState.qml \ data/matrix.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/scenegraph/scenegraph.pro b/tests/auto/quick/scenegraph/scenegraph.pro index 0ad13a086f..320228bd08 100644 --- a/tests/auto/quick/scenegraph/scenegraph.pro +++ b/tests/auto/quick/scenegraph/scenegraph.pro @@ -8,7 +8,6 @@ macx:CONFIG -= app_bundle QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ data/render_OutOfFloatRange.qml \ diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index 1330cbccc9..9121314420 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -148,10 +148,6 @@ QList<int> QQuickViewTestUtil::adjustIndexesForRemoveDisplaced(const QList<int> QQuickViewTestUtil::QaimModel::QaimModel(QObject *parent) : QAbstractListModel(parent) { - QHash<int, QByteArray> roles; - roles[Name] = "name"; - roles[Number] = "number"; - setRoleNames(roles); } int QQuickViewTestUtil::QaimModel::rowCount(const QModelIndex &parent) const @@ -160,6 +156,14 @@ int QQuickViewTestUtil::QaimModel::rowCount(const QModelIndex &parent) const return list.count(); } +QHash<int,QByteArray> QQuickViewTestUtil::QaimModel::roleNames() const +{ + QHash<int,QByteArray> roles = QAbstractListModel::roleNames(); + roles.insert(Name, "name"); + roles.insert(Number, "number"); + return roles; +} + QVariant QQuickViewTestUtil::QaimModel::data(const QModelIndex &index, int role) const { QVariant rv; diff --git a/tests/auto/quick/shared/viewtestutil.h b/tests/auto/quick/shared/viewtestutil.h index 1643eca979..1de2f54d8a 100644 --- a/tests/auto/quick/shared/viewtestutil.h +++ b/tests/auto/quick/shared/viewtestutil.h @@ -80,6 +80,7 @@ namespace QQuickViewTestUtil int rowCount(const QModelIndex &parent=QModelIndex()) const; QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; + QHash<int,QByteArray> roleNames() const; int count() const; QString name(int index) const; diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index 7d23dfc0ae..0df9bc53d3 100644 --- a/tests/auto/quick/touchmouse/touchmouse.pro +++ b/tests/auto/quick/touchmouse/touchmouse.pro @@ -14,4 +14,3 @@ TESTDATA = data/* # OTHER_FILES += data/foo.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quickwidgets/qquickwidget/qquickwidget.pro b/tests/auto/quickwidgets/qquickwidget/qquickwidget.pro index 069270da3c..aeeff8b479 100644 --- a/tests/auto/quickwidgets/qquickwidget/qquickwidget.pro +++ b/tests/auto/quickwidgets/qquickwidget/qquickwidget.pro @@ -16,4 +16,3 @@ OTHER_FILES += \ rectangle.qml \ resizemodeitem.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/toolsupport/toolsupport.pro b/tests/auto/toolsupport/toolsupport.pro index 40dd7c5200..89de3086c3 100644 --- a/tests/auto/toolsupport/toolsupport.pro +++ b/tests/auto/toolsupport/toolsupport.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_toolsupport QT = testlib core-private qml-private SOURCES = $$PWD/tst_toolsupport.cpp |