aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/debugger')
-rw-r--r--tests/auto/qml/debugger/debugger.pro4
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/data/test.qml29
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro3
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp69
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro4
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp160
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro3
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp61
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml29
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp140
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp38
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml47
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml52
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/condition.qml46
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml46
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/exception.qml43
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml40
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml45
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/quit.qml45
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml49
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/test.js45
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/test.qml52
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/timer.qml44
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro26
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml42
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml47
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml41
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml41
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml38
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml35
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml40
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml40
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml44
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js40
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml47
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml39
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro24
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp (renamed from tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp)488
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp43
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro12
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/qqmldebuglocal.pro3
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp49
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/data/test.qml29
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp69
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp161
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml13
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp210
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp67
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/changes.txt8
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml41
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/window.qml2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp223
-rw-r--r--tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp29
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml29
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp517
-rw-r--r--tests/auto/qml/debugger/qv4debugger/qv4debugger.pro19
-rw-r--r--tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp751
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp85
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri10
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h74
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp511
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h110
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp29
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.h29
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp129
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h42
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp119
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.h60
75 files changed, 2879 insertions, 2740 deletions
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/data/test.qml b/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml
index d53ab5665f..6ca456b853 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml
+++ b/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
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..8be82c30f9 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -1,44 +1,42 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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 +74,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 +119,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 +128,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 +218,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 = 35;
entry1.file = path;
entry1.function = QLatin1String("onCompleted");
+ entry1.category = QLatin1String("qml");
LogEntry entry2(QtDebugMsg, QLatin1String("console.count: 1"));
- entry2.line = 49;
+ entry2.line = 36;
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..cadc2a7cc4 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +33,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 +51,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 +83,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 +113,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 +132,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 +139,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..04bc5c3c1a 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -1,48 +1,44 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $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 +64,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 +150,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 +163,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/data/test.qml b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml
index 5a7fa718f2..a36d0cae91 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
index 98ef590317..8d1a165243 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
@@ -1,48 +1,45 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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 +50,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 +140,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::customBlock()
+void tst_QQmlDebuggingEnabler::custom_data()
{
- QVERIFY(init(true, false, 5555, 5565));
+ data();
+}
+
+void tst_QQmlDebuggingEnabler::custom()
+{
+ 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..cfbb31f9e1 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
@@ -1,38 +1,35 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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 +51,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/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
deleted file mode 100644
index 55663b7983..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- Component.onCompleted: {
- //Comment
-
- var x = 6;
- }
-
- width : height + 2
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml b/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml
deleted file mode 100644
index 1bd9191334..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- id: item
- property int d: 0
-
- function doSomething() {
- var a = 5;
- var b = 6;
- }
-
- Timer {
- id: timer; interval: 1; running: true; repeat: true
- onTriggered: doSomething();
- }
-
-}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml b/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml
deleted file mode 100644
index 2f9b3aceb2..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- id: item
- property int a: 0
- Timer {
- id: timer; interval: 1; repeat: true; running: true
- onTriggered: a++
- }
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml b/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml
deleted file mode 100644
index 53b1f52745..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-Item {
- Component.onCompleted: {
- var component = Qt.createComponent("oncompleted.qml")
- if (component.status === Component.Ready) {
- component.createObject();
- }
- }
-}
-
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml b/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml
deleted file mode 100644
index d0fa4e715c..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- id: root
-
- Component.onCompleted: dummy()
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml b/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml
deleted file mode 100644
index 9fc75d251f..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import "test.js" as Script
-
-//DO NOT CHANGE
-Item {
- Component.onCompleted: Script.printMessage("onCompleted");
-}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml b/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml
deleted file mode 100644
index 6f32af39ad..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- Component.onCompleted: {
- console.log("Hello world")
- }
- id: root
- property int a: 10
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml b/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml
deleted file mode 100644
index b858fdf942..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- Timer {
- running: true
- triggeredOnStart: true
- onTriggered: Qt.quit();
- }
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml b/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml
deleted file mode 100644
index b9ee1380aa..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- id: item
- property int d: 0
-
- function doSomething() {
- var a = 5;
- var b = 6;
- }
-
- Component.onCompleted: doSomething()
-
-}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.js b/tests/auto/qml/debugger/qqmldebugjs/data/test.js
deleted file mode 100644
index ca25e9baf7..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-function printMessage(msg)
-{
- print(msg);
-}
-
-function add(a,b)
-{
- //This is a comment and below is an empty line
-
- var out = a + b;
- return out;
-}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.qml b/tests/auto/qml/debugger/qqmldebugjs/data/test.qml
deleted file mode 100644
index 5a7fa718f2..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/test.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-
-Item {
- Component.onCompleted: {
- var a = [1, 2]
- var b = {a: "hello", d: 1 }
- var c
- var d = 12
- }
- function foo() {
- var a = [1, 2]
- var b = {a: "hello", d: 1 }
- var c
- var d = 12
- }
-}
-
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml b/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml
deleted file mode 100644
index 1fee24a1fa..0000000000
--- a/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//DO NOT CHANGE
-Item {
- Timer {
- id: timer; interval: 1; running: true; repeat: true; triggeredOnStart: true
- onTriggered: {
- console.log("timer");
- }
- }
-}
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/qqmldebugjs/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml
new file mode 100644
index 0000000000..06aabc94f9
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ //Comment
+
+ var x = 6;
+ }
+
+ width : height + 2
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml
new file mode 100644
index 0000000000..00a85e56ac
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int d: 0
+
+ function doSomething() {
+ var a = 5;
+ var b = 6;
+ }
+
+ Timer {
+ id: timer; interval: 1; running: true; repeat: true
+ onTriggered: doSomething();
+ }
+
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml
new file mode 100644
index 0000000000..3a50ba2eb7
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int a: 0
+ Timer {
+ id: timer; interval: 1; repeat: true; running: true
+ onTriggered: a++
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml
new file mode 100644
index 0000000000..089cc03733
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+Item {
+ Component.onCompleted: {
+ var component = Qt.createComponent("oncompleted.qml")
+ if (component.status === Component.Ready) {
+ component.createObject();
+ }
+ }
+}
+
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml
new file mode 100644
index 0000000000..06f11fa016
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: root
+
+ Component.onCompleted: dummy()
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml
new file mode 100644
index 0000000000..088c1b19fd
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "test.js" as Script
+
+//DO NOT CHANGE
+Item {
+ Component.onCompleted: Script.printMessage("onCompleted");
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml
new file mode 100644
index 0000000000..deba24cf91
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ console.log("Hello world")
+ }
+ id: root
+ property int a: 10
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml
new file mode 100644
index 0000000000..bc8c2b90ae
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Timer {
+ running: true
+ triggeredOnStart: true
+ onTriggered: Qt.quit();
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml
new file mode 100644
index 0000000000..fb0b6c401c
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int d: 0
+
+ function doSomething() {
+ var a = 5;
+ var b = 6;
+ }
+
+ Component.onCompleted: doSomething()
+
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js
new file mode 100644
index 0000000000..92e61d103c
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function printMessage(msg)
+{
+ print(msg);
+}
+
+function add(a,b)
+{
+ //This is a comment and below is an empty line
+
+ var out = a + b;
+ return out;
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml
new file mode 100644
index 0000000000..a36d0cae91
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+ function foo() {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml
new file mode 100644
index 0000000000..66e6b96e18
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+Item {
+ Timer {
+ id: timer; interval: 1; running: true; repeat: true; triggeredOnStart: true
+ onTriggered: {
+ console.log("timer");
+ }
+ }
+}
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..b800cc3715 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -1,49 +1,46 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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
@@ -97,7 +94,6 @@ const char *SETEXCEPTIONBREAK = "setexceptionbreak";
const char *VERSION = "version";
const char *DISCONNECT = "disconnect";
const char *GARBAGECOLLECTOR = "gc";
-//const char *PROFILE = "profile";
const char *CONNECT = "connect";
const char *INTERRUPT = "interrupt";
@@ -107,7 +103,6 @@ const char *IN = "in";
const char *NEXT = "next";
const char *OUT = "out";
-const char *FUNCTION = "function";
const char *SCRIPT = "script";
const char *SCRIPTREGEXP = "scriptRegExp";
const char *EVENT = "event";
@@ -115,9 +110,6 @@ const char *EVENT = "event";
const char *ALL = "all";
const char *UNCAUGHT = "uncaught";
-//const char *PAUSE = "pause";
-//const char *RESUME = "resume";
-
const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
const char *BLOCKRESTRICTEDMODE = "-qmljsdebugger=port:3771,3800,block,services:V8Debugger";
@@ -159,7 +151,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,50 +162,70 @@ private slots:
void connect_data();
void connect();
+ void interrupt_data() { targetData(); }
void interrupt();
+ void getVersion_data() { targetData(); }
void getVersion();
-// void getVersionWhenAttaching();
+ void getVersionWhenAttaching_data() { targetData(); }
+ 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 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 evaluateInGlobalScope();
+ void evaluateInLocalScope_data() { targetData(); }
+ void evaluateInLocalScope();
+ void getScripts_data() { targetData(); }
void getScripts();
- // void profile(); //NOT SUPPORTED
-
- // void verifyQMLOptimizerDisabled();
-
private:
+ void targetData();
+
QQmlDebugProcess *process;
QJSDebugClient *client;
QQmlDebugConnection *connection;
@@ -238,12 +250,6 @@ public:
Uncaught
};
-// enum ProfileCommand
-// {
-// Pause,
-// Resume
-// };
-
QJSDebugClient(QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("V8Debugger"), connection),
seq(0)
@@ -256,17 +262,17 @@ public:
void interrupt();
void continueDebugging(StepAction stepAction);
- void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
+ void evaluate(QString expr, int frame = -1);
void lookup(QList<int> handles, bool includeSource = false);
void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
void frame(int number = -1);
void scope(int number = -1, int frameNumber = -1);
void scripts(int types = 4, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
- void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = true, QString condition = QString(), int ignoreCount = -1);
+ void setBreakpoint(QString target, int line = -1, int column = -1, bool enabled = true,
+ QString condition = QString(), int ignoreCount = -1);
void clearBreakpoint(int breakpoint);
void setExceptionBreak(Exception type, bool enabled = false);
void version();
- //void profile(ProfileCommand command); //NOT SUPPORTED
void disconnect();
protected:
@@ -280,8 +286,6 @@ signals:
void interruptRequested();
void result();
void stopped();
- void scriptsResult();
- void evaluateResult();
private:
void sendMessage(const QByteArray &);
@@ -341,20 +345,13 @@ void QJSDebugClient::continueDebugging(StepAction action)
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-void QJSDebugClient::evaluate(QString expr, bool global, bool disableBreak, int frame, const QVariantMap &/*addContext*/)
+void QJSDebugClient::evaluate(QString expr, int frame)
{
// { "seq" : <number>,
// "type" : "request",
// "command" : "evaluate",
// "arguments" : { "expression" : <expression to evaluate>,
- // "frame" : <number>,
- // "global" : <boolean>,
- // "disable_break" : <boolean>,
- // "additional_context" : [
- // { "name" : <name1>, "handle" : <handle1> },
- // { "name" : <name2>, "handle" : <handle2> },
- // ...
- // ]
+ // "frame" : <number>
// }
// }
VARIANTMAPINIT;
@@ -366,12 +363,6 @@ void QJSDebugClient::evaluate(QString expr, bool global, bool disableBreak, int
if (frame != -1)
args.setProperty(QLatin1String(FRAME),QJSValue(frame));
- if (global)
- args.setProperty(QLatin1String(GLOBAL),QJSValue(global));
-
- if (disableBreak)
- args.setProperty(QLatin1String(DISABLEBREAK),QJSValue(disableBreak));
-
if (!args.isUndefined()) {
jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
}
@@ -541,12 +532,13 @@ void QJSDebugClient::scripts(int types, QList<int> ids, bool includeSource, QVar
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int column, bool enabled, QString condition, int ignoreCount)
+void QJSDebugClient::setBreakpoint(QString target, int line, int column, bool enabled,
+ QString condition, int ignoreCount)
{
// { "seq" : <number>,
// "type" : "request",
// "command" : "setbreakpoint",
- // "arguments" : { "type" : <"function" or "script" or "scriptId" or "scriptRegExp">
+ // "arguments" : { "type" : "scriptRegExp"
// "target" : <function expression or script identification>
// "line" : <line in script or function>
// "column" : <character position within the line>
@@ -556,42 +548,34 @@ void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int c
// }
// }
- if (type == QLatin1String(EVENT)) {
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << target.toUtf8() << enabled;
- sendMessage(packMessage(QByteArray("breakonsignal"), reply));
-
- } else {
- VARIANTMAPINIT;
- jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETBREAKPOINT)));
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETBREAKPOINT)));
- QJSValue args = parser.call(QJSValueList() << obj);
+ QJSValue args = parser.call(QJSValueList() << obj);
- args.setProperty(QLatin1String(TYPE),QJSValue(type));
- args.setProperty(QLatin1String(TARGET),QJSValue(target));
+ args.setProperty(QLatin1String(TYPE),QJSValue(QLatin1String(SCRIPTREGEXP)));
+ args.setProperty(QLatin1String(TARGET),QJSValue(target));
- if (line != -1)
- args.setProperty(QLatin1String(LINE),QJSValue(line));
+ if (line != -1)
+ args.setProperty(QLatin1String(LINE),QJSValue(line));
- if (column != -1)
- args.setProperty(QLatin1String(COLUMN),QJSValue(column));
+ if (column != -1)
+ args.setProperty(QLatin1String(COLUMN),QJSValue(column));
- args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
+ args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
- if (!condition.isEmpty())
- args.setProperty(QLatin1String(CONDITION),QJSValue(condition));
+ if (!condition.isEmpty())
+ args.setProperty(QLatin1String(CONDITION),QJSValue(condition));
- if (ignoreCount != -1)
- args.setProperty(QLatin1String(IGNORECOUNT),QJSValue(ignoreCount));
+ if (ignoreCount != -1)
+ args.setProperty(QLatin1String(IGNORECOUNT),QJSValue(ignoreCount));
- if (!args.isUndefined()) {
- jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
- }
-
- QJSValue json = stringify.call(QJSValueList() << jsonVal);
- sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
}
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
void QJSDebugClient::clearBreakpoint(int breakpoint)
@@ -660,32 +644,6 @@ void QJSDebugClient::version()
sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
}
-//void QJSDebugClient::profile(ProfileCommand command)
-//{
-//// { "seq" : <number>,
-//// "type" : "request",
-//// "command" : "profile",
-//// "arguments" : { "command" : "resume" or "pause" }
-//// }
-// VARIANTMAPINIT;
-// jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(PROFILE)));
-
-// QJSValue args = parser.call(QJSValueList() << obj);
-
-// if (command == Resume)
-// args.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(RESUME)));
-// else
-// args.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(PAUSE)));
-
-// args.setProperty(QLatin1String("modules"),QJSValue(1));
-// if (!args.isUndefined()) {
-// jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
-// }
-
-// QJSValue json = stringify.call(QJSValueList() << jsonVal);
-// sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
-//}
-
void QJSDebugClient::disconnect()
{
// { "seq" : <number>,
@@ -709,7 +667,7 @@ void QJSDebugClient::stateChanged(State state)
void QJSDebugClient::messageReceived(const QByteArray &data)
{
- QDataStream ds(data);
+ QPacket ds(connection()->currentDataStreamVersion(), data);
QByteArray command;
ds >> command;
@@ -731,7 +689,7 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
if (type == "response") {
if (!value.value("success").toBool()) {
-// qDebug() << "Error: The test case will fail since no signal is emitted";
+ qDebug() << "Received success == false response from application";
return;
}
@@ -757,12 +715,6 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
} else {
// DO NOTHING
}
- //Emit separate signals for scripts ane evaluate
- //as the associated test cases are flaky
- if (debugCommand == "scripts")
- emit scriptsResult();
- if (debugCommand == "evaluate")
- emit evaluateResult();
} else if (type == QLatin1String(EVENT)) {
QString event(value.value(QLatin1String(EVENT)).toString());
@@ -794,11 +746,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()
@@ -822,15 +773,20 @@ void tst_QQmlDebugJS::cleanupTestCase()
if (connection)
delete connection;
-
-// 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 +805,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 +839,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 +864,8 @@ void tst_QQmlDebugJS::interrupt()
{
//void connect()
- init();
+ QFETCH(bool, qmlscene);
+ init(qmlscene);
client->connect();
client->interrupt();
@@ -908,7 +876,8 @@ void tst_QQmlDebugJS::getVersion()
{
//void version()
- init();
+ QFETCH(bool, qmlscene);
+ init(qmlscene);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
@@ -916,24 +885,24 @@ void tst_QQmlDebugJS::getVersion()
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
}
-/* TODO fails because of a race condition when starting up the engine before the view
void tst_QQmlDebugJS::getVersionWhenAttaching()
{
//void version()
+ QFETCH(bool, qmlscene);
- QVERIFY(init(QLatin1String(TIMER_QMLFILE), false));
+ init(qmlscene, QLatin1String(TIMER_QMLFILE), false);
client->connect();
client->version();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
}
-*/
void tst_QQmlDebugJS::disconnect()
{
//void disconnect()
- init();
+ QFETCH(bool, qmlscene);
+ init(qmlscene);
client->connect();
client->disconnect();
@@ -943,11 +912,12 @@ 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);
+ int sourceLine = 34;
+ init(qmlscene, ONCOMPLETED_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -963,11 +933,12 @@ 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);
+ int sourceLine = 34;
+ init(qmlscene, CREATECOMPONENT_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -982,13 +953,14 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback()
{
- int sourceLine = 40;
- init(TIMER_QMLFILE);
+ QFETCH(bool, qmlscene);
+ int sourceLine = 35;
+ init(qmlscene, TIMER_QMLFILE);
client->connect();
//We can set the breakpoint after connect() here because the timer is repeating and if we miss
//its first iteration we can still catch the second one.
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(TIMER_QMLFILE), sourceLine, -1, true);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
QString jsonString(client->response);
@@ -1003,11 +975,12 @@ 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);
+ int sourceLine = 31;
+ init(qmlscene, LOADJSFILE_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(TEST_JSFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1023,12 +996,13 @@ 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);
+ int sourceLine = 34;
+ int actualLine = 36;
+ init(qmlscene, BREAKPOINTRELOCATION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1));
@@ -1045,12 +1019,13 @@ 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);
+ int sourceLine = 35;
+ int actualLine = 36;
+ init(qmlscene, BREAKPOINTRELOCATION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1));
@@ -1067,11 +1042,12 @@ 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);
+ int sourceLine = 39;
+ init(qmlscene, BREAKPOINTRELOCATION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1086,13 +1062,14 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
+ QFETCH(bool, qmlscene);
int out = 10;
- int sourceLine = 42;
- init(CONDITION_QMLFILE);
+ int sourceLine = 37;
+ init(qmlscene, CONDITION_QMLFILE);
client->connect();
//The breakpoint is in a timer loop so we can set it after connect().
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CONDITION_QMLFILE), sourceLine, 1, true, QLatin1String("a > 10"));
+ client->setBreakpoint(QLatin1String(CONDITION_QMLFILE), sourceLine, 1, true, QLatin1String("a > 10"));
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
//Get the frame index
@@ -1122,11 +1099,12 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{
- init(QUIT_QMLFILE);
+ QFETCH(bool, qmlscene);
+ init(qmlscene, QUIT_QMLFILE);
- int sourceLine = 41;
+ int sourceLine = 36;
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(QUIT_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(QUIT_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1143,55 +1121,38 @@ void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
QCOMPARE(process->exitStatus(), QProcess::NormalExit);
}
-/* TODO fails because of a race condition when starting up the engine before the view
void tst_QQmlDebugJS::setBreakpointWhenAttaching()
{
- int sourceLine = 49;
- QVERIFY(init(QLatin1String(TIMER_QMLFILE), false));
+ int sourceLine = 35;
+ init(true, QLatin1String(TIMER_QMLFILE), false);
client->connect();
- //The breakpoint is in a timer loop so we can set it after connect().
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-}
-*/
-
-#if 0
-void tst_QQmlDebugJS::setBreakpointOnEvent()
-{
- QFAIL("Not implemented in V4.");
- //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+ QSKIP("\nThe breakpoint may not hit because the engine may run in JIT mode or not have debug\n"
+ "instructions, as we've connected in non-blocking mode above. That means we may have\n"
+ "connected after the engine was already running, with all the QML already compiled.");
- init(TIMER_QMLFILE);
+ //The breakpoint is in a timer loop so we can set it after connect().
+ client->setBreakpoint(QLatin1String(TIMER_QMLFILE), sourceLine);
- client->setBreakpoint(QLatin1String(EVENT), QLatin1String("triggered"), -1, -1, true);
- client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
-
- QString jsonString(client->response);
- QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
- QVariantMap body = value.value("body").toMap();
-
- QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(TIMER_QMLFILE));
}
-#endif
void tst_QQmlDebugJS::clearBreakpoint()
{
//void clearBreakpoint(int breakpoint);
+ QFETCH(bool, qmlscene);
- int sourceLine1 = 42;
- int sourceLine2 = 43;
- init(CHANGEBREAKPOINT_QMLFILE);
+ int sourceLine1 = 37;
+ int sourceLine2 = 38;
+ init(qmlscene, CHANGEBREAKPOINT_QMLFILE);
client->connect();
//The breakpoints are in a timer loop so we can set them after connect().
//Furthermore the breakpoints should be hit in the right order because setting of breakpoints
//can only occur in the QML event loop. (see QCOMPARE for sourceLine2 below)
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
+ client->setBreakpoint(QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
+ client->setBreakpoint(QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1228,8 +1189,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,11 +1200,12 @@ void tst_QQmlDebugJS::setExceptionBreak()
void tst_QQmlDebugJS::stepNext()
{
//void continueDebugging(StepAction stepAction, int stepCount = 1);
+ QFETCH(bool, qmlscene);
- int sourceLine = 42;
- init(STEPACTION_QMLFILE);
+ int sourceLine = 37;
+ init(qmlscene, STEPACTION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1261,12 +1224,13 @@ 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);
+ int sourceLine = 41;
+ int actualLine = 37;
+ init(qmlscene, STEPACTION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true);
+ client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1285,12 +1249,13 @@ 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);
+ int sourceLine = 37;
+ int actualLine = 41;
+ init(qmlscene, STEPACTION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1309,13 +1274,14 @@ 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);
+ int sourceLine1 = 41;
+ int sourceLine2 = 38;
+ init(qmlscene, STEPACTION_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true);
+ client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true);
+ client->setBreakpoint(QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1334,11 +1300,12 @@ 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);
+ int sourceLine = 34;
+ init(qmlscene, ONCOMPLETED_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1349,11 +1316,12 @@ void tst_QQmlDebugJS::backtrace()
void tst_QQmlDebugJS::getFrameDetails()
{
//void frame(int number = -1);
+ QFETCH(bool, qmlscene);
- int sourceLine = 39;
- init(ONCOMPLETED_QMLFILE);
+ int sourceLine = 34;
+ init(qmlscene, ONCOMPLETED_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1364,11 +1332,12 @@ 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);
+ int sourceLine = 34;
+ init(qmlscene, ONCOMPLETED_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1376,36 +1345,34 @@ void tst_QQmlDebugJS::getScopeDetails()
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
}
-#if 0
void tst_QQmlDebugJS::evaluateInGlobalScope()
{
- //void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
-
- init();
+ //void evaluate(QString expr, int frame = -1);
+ init(true);
client->connect();
- client->evaluate(QLatin1String("console.log('Hello World')"), true);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
- //Verify the value of 'print'
+ do {
+ // The engine might not be initialized, yet. We just try until it shows up.
+ client->evaluate(QLatin1String("console.log('Hello World')"));
+ } while (!QQmlDebugTest::waitForSignal(client, SIGNAL(result()), 500));
+
+ //Verify the return value of 'console.log()', which is "undefined"
QString jsonString(client->response);
QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
-
QVariantMap body = value.value("body").toMap();
-
- QCOMPARE(body.value("text").toString(),QLatin1String("undefined"));
+ QCOMPARE(body.value("type").toString(),QLatin1String("undefined"));
}
-#endif
-#if 0
void tst_QQmlDebugJS::evaluateInLocalScope()
{
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
- int sourceLine = 47;
- init(ONCOMPLETED_QMLFILE);
+ QFETCH(bool, qmlscene);
+ int sourceLine = 34;
+ init(qmlscene, ONCOMPLETED_QMLFILE);
- client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->setBreakpoint(QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1421,7 +1388,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
int frameIndex = body.value("index").toInt();
client->evaluate(QLatin1String("root.a"), frameIndex);
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
//Verify the value of 'timer.interval'
jsonString = client->response;
@@ -1431,20 +1398,20 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
QCOMPARE(body.value("value").toInt(),10);
}
-#endif
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->setBreakpoint(QString(TEST_QMLFILE), 35, -1, true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
client->scripts();
- QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult())));
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
QString jsonString(client->response);
QVariantMap value = client->parser.call(QJSValueList()
<< QJSValue(jsonString)).toVariant().toMap();
@@ -1455,6 +1422,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..6a4ec5cc75
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $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..a503da4e4b 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -1,48 +1,45 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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/data/test.qml b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
index 5a7fa718f2..a36d0cae91 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
+++ b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
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..8092faba04 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -1,51 +1,49 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $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 +72,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 +202,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 +245,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 +265,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..3f8731ce6b 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -1,90 +1,68 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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 +75,6 @@ public:
, m_client(0)
{}
-
private:
QQmlDebugProcess *m_process;
QQmlDebugConnection *m_connection;
@@ -115,42 +92,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 +108,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 +126,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 +155,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 +173,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/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml
index 9c36e13c5b..2e6cd2397c 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml
@@ -1,5 +1,18 @@
import QtQuick 2.0
Item {
+ Rectangle {
+ id: rect1
+ width: 20
+ height: 20
+ color: "green"
+ }
+ Rectangle {
+ id: rect2
+ x: 20
+ width: 20
+ height: 20
+ color: "red"
+ }
}
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..940f89e936 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -1,48 +1,45 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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"
@@ -56,6 +53,7 @@ public:
: m_process(0)
, m_inspectorClient(0)
, m_engineDebugClient(0)
+ , m_recipient(0)
{
}
@@ -67,33 +65,40 @@ private:
QQmlDebugProcess *m_process;
QQmlInspectorClient *m_inspectorClient;
QQmlEngineDebugClient *m_engineDebugClient;
+ QQmlInspectorResultRecipient *m_recipient;
private slots:
void cleanup();
void connect_data();
void connect();
- void clearObjectReferenceHashonReloadQml();
+ void objectLocationLookup();
+ void select();
+ void createObject();
+ void moveObject();
+ void destroyObject();
};
-
QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject()
{
bool success = false;
m_engineDebugClient->queryAvailableEngines(&success);
- QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+ if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
+ return QmlDebugObjectReference();
m_engineDebugClient->queryRootContexts(m_engineDebugClient->engines()[0].debugId, &success);
- QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+ if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
+ return QmlDebugObjectReference();
+
int count = m_engineDebugClient->rootContext().contexts.count();
m_engineDebugClient->queryObject(
m_engineDebugClient->rootContext().contexts[count - 1].objects[0], &success);
- QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+ if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
+ return QmlDebugObjectReference();
return m_engineDebugClient->object();
}
-
void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
{
const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
@@ -101,9 +106,8 @@ void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
.arg(restrictServices ? QStringLiteral(",services:QmlDebugger,QmlInspector") :
QString());
- // ### Still using qmlscene because of QTBUG-33376
- m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
- + "/qmlscene", this);
+ m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+ this);
m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
@@ -111,9 +115,21 @@ void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
QQmlDebugConnection *m_connection = new QQmlDebugConnection(this);
m_inspectorClient = new QQmlInspectorClient(m_connection);
m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
+ m_recipient = new QQmlInspectorResultRecipient(this);
+ QObject::connect(m_inspectorClient, &QQmlInspectorClient::responseReceived,
+ m_recipient, &QQmlInspectorResultRecipient::recordResponse);
+
+ 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);
+
+ QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlEngineDebugInspectorIntegration::cleanup()
@@ -123,8 +139,13 @@ void tst_QQmlEngineDebugInspectorIntegration::cleanup()
qDebug() << "Application Output:" << m_process->output();
}
delete m_process;
+ m_process = 0;
delete m_engineDebugClient;
+ m_engineDebugClient = 0;
delete m_inspectorClient;
+ m_inspectorClient = 0;
+ delete m_recipient;
+ m_recipient = 0;
}
void tst_QQmlEngineDebugInspectorIntegration::connect_data()
@@ -138,16 +159,15 @@ void tst_QQmlEngineDebugInspectorIntegration::connect()
{
QFETCH(bool, restrictMode);
init(restrictMode);
- QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
- QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
}
-void tst_QQmlEngineDebugInspectorIntegration::clearObjectReferenceHashonReloadQml()
+void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup()
{
init(true);
- QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
+
bool success = false;
QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
int lineNumber = rootObject.source.lineNumber;
int columnNumber = rootObject.source.columnNumber;
@@ -165,38 +185,94 @@ void tst_QQmlEngineDebugInspectorIntegration::clearObjectReferenceHashonReloadQm
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
}
+}
- QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
+void tst_QQmlEngineDebugInspectorIntegration::select()
+{
+ init(true);
+ QmlDebugObjectReference rootObject = findRootObject();
+ QList<int> childIds;
+ int requestId = 0;
+ foreach (const QmlDebugObjectReference &child, rootObject.children) {
+ requestId = m_inspectorClient->select(QList<int>() << child.debugId);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+ childIds << child.debugId;
+ }
+ requestId = m_inspectorClient->select(childIds);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+}
- QByteArray contents;
- contents.append("import QtQuick 2.0\n"
- "Text {"
- "y: 10\n"
- "text: \"test\"\n"
- "}");
-
- QHash<QString, QByteArray> changesHash;
- changesHash.insert("test.qml", contents);
- m_inspectorClient->reloadQml(changesHash);
- QVERIFY(QQmlDebugTest::waitForSignal(m_inspectorClient, SIGNAL(responseReceived())));
-
- lineNumber = rootObject.source.lineNumber;
- columnNumber = rootObject.source.columnNumber;
- success = false;
- m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
- columnNumber, &success);
+void tst_QQmlEngineDebugInspectorIntegration::createObject()
+{
+ init(true);
+
+ QString qml = QLatin1String("Rectangle {\n"
+ " id: xxxyxxx\n"
+ " width: 10\n"
+ " height: 10\n"
+ " color: \"blue\"\n"
+ "}");
+
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 2);
+
+ int requestId = m_inspectorClient->createObject(
+ qml, rootObject.debugId, QStringList() << QLatin1String("import QtQuick 2.0"),
+ QLatin1String("testcreate.qml"));
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+
+ rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 3);
+ QCOMPARE(rootObject.children[2].idString, QLatin1String("xxxyxxx"));
+}
+
+void tst_QQmlEngineDebugInspectorIntegration::moveObject()
+{
+ init(true);
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 2);
+
+ int childId = rootObject.children[0].debugId;
+ int requestId = m_inspectorClient->moveObject(childId, rootObject.children[1].debugId);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+
+ rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 1);
+ bool success = false;
+ m_engineDebugClient->queryObject(rootObject.children[0], &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+ QCOMPARE(m_engineDebugClient->object().children.length(), 1);
+ QCOMPARE(m_engineDebugClient->object().children[0].debugId, childId);
+}
- foreach (QmlDebugObjectReference child, rootObject.children) {
- success = false;
- lineNumber = child.source.lineNumber;
- columnNumber = child.source.columnNumber;
- m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
- columnNumber, &success);
- QVERIFY(success);
- QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
- }
+void tst_QQmlEngineDebugInspectorIntegration::destroyObject()
+{
+ init(true);
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 2);
+
+ int requestId = m_inspectorClient->destroyObject(rootObject.children[0].debugId);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+
+ rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QCOMPARE(rootObject.children.length(), 1);
+ bool success = false;
+ m_engineDebugClient->queryObject(rootObject.children[0], &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+ QCOMPARE(m_engineDebugClient->object().children.length(), 0);
}
QTEST_MAIN(tst_QQmlEngineDebugInspectorIntegration)
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..4568d25dc1 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -1,60 +1,57 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $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 +349,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/data/changes.txt b/tests/auto/qml/debugger/qqmlinspector/data/changes.txt
deleted file mode 100644
index 38b17caeff..0000000000
--- a/tests/auto/qml/debugger/qqmlinspector/data/changes.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-import QtQuick 2.0
-Item {
- id: test
- Component.onCompleted: {
- console.log("version 2.0");
- Qt.quit()
- }
-}
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
index 9c36e13c5b..f44c653840 100644
--- a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
+++ b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
@@ -1,5 +1,44 @@
import QtQuick 2.0
-Item {
+Rectangle {
+ width: 100
+ height: 100
+ color: "blue"
+ RotationAnimation on rotation {
+ duration: 3600
+ loops: Animation.Infinite
+ from: 0
+ to: 360
+ }
+
+ Timer {
+ interval: 300
+ repeat: true
+ running: true
+ property int prevHit: -1
+ property int prevRotation: -1
+ onTriggered: {
+ var date = new Date;
+ var millis = date.getMilliseconds()
+
+ if (prevHit < 0) {
+ prevHit = millis;
+ prevRotation = parent.rotation
+ return;
+ }
+
+ var milliDelta = millis - prevHit;
+ if (milliDelta < 0)
+ milliDelta += 1000;
+ console.log(milliDelta, "milliseconds ");
+ prevHit = millis;
+
+ var delta = parent.rotation - prevRotation;
+ if (delta < 0)
+ delta += 360
+ prevRotation = parent.rotation
+ console.log(delta, "degrees ");
+ }
+ }
}
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/window.qml b/tests/auto/qml/debugger/qqmlinspector/data/window.qml
index 29eaced121..20baa153c5 100644
--- a/tests/auto/qml/debugger/qqmlinspector/data/window.qml
+++ b/tests/auto/qml/debugger/qqmlinspector/data/window.qml
@@ -2,6 +2,8 @@ import QtQuick 2.0
import QtQuick.Window 2.0
Window {
+ visible: true
+
height: 100
width: 100
}
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..f55fef232e 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -1,101 +1,130 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $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"
-
class tst_QQmlInspector : public QQmlDataTest
{
Q_OBJECT
-public:
- tst_QQmlInspector()
- : m_process(0)
- , m_connection(0)
- , m_client(0)
- {
- }
-
private:
- void startQmlsceneProcess(const char *qmlFile, bool restrictMode = true);
+ void startQmlProcess(const QString &qmlFile, bool restrictMode = true);
+ void checkAnimationSpeed(int targetMillisPerDegree);
private:
- QQmlDebugProcess *m_process;
- QQmlDebugConnection *m_connection;
- QQmlInspectorClient *m_client;
+ QScopedPointer<QQmlDebugProcess> m_process;
+ QScopedPointer<QQmlDebugConnection> m_connection;
+ QScopedPointer<QQmlInspectorClient> m_client;
+ QScopedPointer<QQmlInspectorResultRecipient> m_recipient;
private slots:
void cleanup();
void connect_data();
void connect();
+ void setAnimationSpeed();
void showAppOnTop();
- void reloadQml();
- void reloadQmlWindow();
};
-void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */, bool restrictServices)
+void tst_QQmlInspector::startQmlProcess(const QString &qmlFile, bool restrictServices)
{
const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
.arg(STR_PORT_FROM).arg(STR_PORT_TO)
.arg(restrictServices ? QStringLiteral(",services:QmlInspector") : QString());
- // ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase)
- m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
- m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
+ m_process.reset(new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) +
+ "/qml"));
+ // Make sure the animation timing is exact
+ m_process->addEnvironment(QLatin1String("QSG_RENDER_LOOP=basic"));
+ m_process->start(QStringList() << argument << testFile(qmlFile));
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
- m_connection = new QQmlDebugConnection();
- m_client = new QQmlInspectorClient(m_connection);
+ m_client.reset();
+ m_connection.reset(new QQmlDebugConnection);
+ m_client.reset(new QQmlInspectorClient(m_connection.data()));
+
+ m_recipient.reset(new QQmlInspectorResultRecipient);
+ QObject::connect(m_client.data(), &QQmlInspectorClient::responseReceived,
+ m_recipient.data(), &QQmlInspectorResultRecipient::recordResponse);
+
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection.data());
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::checkAnimationSpeed(int targetMillisPerDegree)
+{
+ QString degreesString = QStringLiteral("degrees");
+ QString millisecondsString = QStringLiteral("milliseconds");
+ for (int i = 0; i < 2; ++i) { // skip one period; the change might have happened inside it
+ int position = m_process->output().length();
+ while (!m_process->output().mid(position).contains(degreesString) ||
+ !m_process->output().mid(position).contains(millisecondsString)) {
+ QVERIFY(QQmlDebugTest::waitForSignal(m_process.data(),
+ SIGNAL(readyReadStandardOutput())));
+ }
+ }
+
+ QStringList words = m_process->output().split(QLatin1Char(' '));
+ int degreesMarker = words.lastIndexOf(degreesString);
+ QVERIFY(degreesMarker > 1);
+ double degrees = words[degreesMarker - 1].toDouble();
+ int millisecondsMarker = words.lastIndexOf(millisecondsString);
+ QVERIFY(millisecondsMarker > 1);
+ int milliseconds = words[millisecondsMarker - 1].toInt();
+
+ double millisecondsPerDegree = milliseconds / degrees;
+ QVERIFY(millisecondsPerDegree > targetMillisPerDegree - 3);
+ QVERIFY(millisecondsPerDegree < targetMillisPerDegree + 3);
+
}
void tst_QQmlInspector::cleanup()
@@ -104,93 +133,71 @@ void tst_QQmlInspector::cleanup()
qDebug() << "Process State:" << m_process->state();
qDebug() << "Application Output:" << m_process->output();
}
- delete m_client;
- m_client = 0;
- delete m_connection;
- m_connection = 0;
- delete m_process;
- m_process = 0;
}
void tst_QQmlInspector::connect_data()
{
+ QTest::addColumn<QString>("file");
QTest::addColumn<bool>("restrictMode");
- QTest::newRow("unrestricted") << false;
- QTest::newRow("restricted") << true;
+ QTest::newRow("rectangle/unrestricted") << "qtquick2.qml" << false;
+ QTest::newRow("rectangle/restricted") << "qtquick2.qml" << true;
+ QTest::newRow("window/unrestricted") << "window.qml" << false;
+ QTest::newRow("window/restricted") << "window.qml" << true;
}
void tst_QQmlInspector::connect()
{
+ QFETCH(QString, file);
QFETCH(bool, restrictMode);
- startQmlsceneProcess("qtquick2.qml", restrictMode);
-}
-
-void tst_QQmlInspector::showAppOnTop()
-{
- startQmlsceneProcess("qtquick2.qml");
+ startQmlProcess(file, restrictMode);
QVERIFY(m_client);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
- m_client->setShowAppOnTop(true);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
- QCOMPARE(m_client->m_requestResult, true);
+ int requestId = m_client->setInspectToolEnabled(true);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
- m_client->setShowAppOnTop(false);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
- QCOMPARE(m_client->m_requestResult, true);
+ requestId = m_client->setInspectToolEnabled(false);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
}
-void tst_QQmlInspector::reloadQml()
+void tst_QQmlInspector::showAppOnTop()
{
- startQmlsceneProcess("qtquick2.qml");
+ startQmlProcess("qtquick2.qml");
QVERIFY(m_client);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
- QByteArray fileContents;
-
- QFile file(testFile("changes.txt"));
- if (file.open(QFile::ReadOnly))
- fileContents = file.readAll();
- file.close();
-
- QHash<QString, QByteArray> changesHash;
- changesHash.insert("qtquick2.qml", fileContents);
+ int requestId = m_client->setShowAppOnTop(true);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
- m_client->reloadQml(changesHash);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
-
- QTRY_COMPARE(m_process->output().contains(
- QString("version 2.0")), true);
-
- QCOMPARE(m_client->m_requestResult, true);
- QCOMPARE(m_client->m_reloadRequestId, m_client->m_responseId);
+ requestId = m_client->setShowAppOnTop(false);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
}
-void tst_QQmlInspector::reloadQmlWindow()
+void tst_QQmlInspector::setAnimationSpeed()
{
- startQmlsceneProcess("window.qml");
+ startQmlProcess("qtquick2.qml");
QVERIFY(m_client);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
-
- QByteArray fileContents;
-
- QFile file(testFile("changes.txt"));
- if (file.open(QFile::ReadOnly))
- fileContents = file.readAll();
- file.close();
-
- QHash<QString, QByteArray> changesHash;
- changesHash.insert("window.qml", fileContents);
-
- m_client->reloadQml(changesHash);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
-
- QEXPECT_FAIL("", "cannot debug with a QML file containing a top-level Window", Abort); // QTBUG-33376
- // TODO: remove the timeout once we don't expect it to fail anymore.
- QTRY_VERIFY_WITH_TIMEOUT(m_process->output().contains(QString("version 2.0")), 1);
-
- QCOMPARE(m_client->m_requestResult, true);
- QCOMPARE(m_client->m_reloadRequestId, m_client->m_responseId);
+ checkAnimationSpeed(10);
+
+ int requestId = m_client->setAnimationSpeed(0.5);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+ checkAnimationSpeed(5);
+
+ requestId = m_client->setAnimationSpeed(2.0);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+ checkAnimationSpeed(20);
+
+ requestId = m_client->setAnimationSpeed(1.0);
+ QTRY_COMPARE(m_recipient->lastResponseId, requestId);
+ QVERIFY(m_recipient->lastResult);
+ checkAnimationSpeed(10);
}
QTEST_MAIN(tst_QQmlInspector)
diff --git a/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp b/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp
index 099b952352..33d3c6369f 100644
--- a/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp
+++ b/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml
index 0b7fc9ba62..d1db2af367 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
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 61006ad1f1..4f9088d67d 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -1,50 +1,50 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#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,111 +57,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), lastTimestamp(-1)
- {
- }
+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);
+}
- qint64 lastTimestamp;
+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
{
@@ -179,7 +252,7 @@ public:
private:
QQmlDebugProcess *m_process;
QQmlDebugConnection *m_connection;
- QQmlProfilerClient *m_client;
+ QQmlProfilerTestClient *m_client;
enum MessageListType {
MessageListQML,
@@ -221,147 +294,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());
-
- QVERIFY(data.time >= lastTimestamp);
- lastTimestamp = data.time;
-
- 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
@@ -378,24 +310,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);
}
@@ -412,15 +352,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;
@@ -555,8 +495,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;
@@ -591,9 +531,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();
}
@@ -602,36 +542,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);
}
@@ -639,11 +579,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();
@@ -659,8 +599,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;
}
@@ -670,7 +610,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;
@@ -680,7 +620,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) {
if (msg.time >= contextFrameTime) {
// Make sure SceneGraphRenderLoopFrame is not between SceneGraphContextFrame and
// SceneGraphRendererFrame. A SceneGraphRenderLoopFrame before everything else is
@@ -696,7 +636,7 @@ void tst_QQmlProfilerService::profileOnExit()
{
connect(true, "exit.qml");
- m_client->setTraceState(true);
+ m_client->sendRecordingStatus(true);
checkTraceReceived();
checkJsHeap();
@@ -706,7 +646,7 @@ void tst_QQmlProfilerService::controlFromJS()
{
connect(true, "controlFromJS.qml");
- m_client->setTraceState(false);
+ m_client->sendRecordingStatus(false);
checkTraceReceived();
checkJsHeap();
}
@@ -715,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;
@@ -738,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);
}
@@ -767,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..e25b4260e5
--- /dev/null
+++ b/tests/auto/qml/debugger/qv4debugger/qv4debugger.pro
@@ -0,0 +1,19 @@
+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 \
+ $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
+
+HEADERS += \
+ $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h \
+ $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h \
+ $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
+
+INCLUDEPATH += \
+ $$PWD/../../../../../src/plugins/qmltooling/qmldbg_debugger
+
+QT += core-private gui-private qml-private network testlib
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
new file mode 100644
index 0000000000..3f89913f3b
--- /dev/null
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -0,0 +1,751 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+
+#include "qv4datacollector.h"
+#include "qv4debugger.h"
+#include "qv4debugjob.h"
+
+#include <QJSEngine>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/qv4engine_p.h>
+#include <private/qv4debugging_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4objectiterator_p.h>
+#include <private/qv4isel_moth_p.h>
+#include <private/qv4string_p.h>
+#include <private/qqmlbuiltinfunctions_p.h>
+
+using namespace QV4;
+using namespace QV4::Debugging;
+
+typedef QV4::ReturnedValue (*InjectedFunction)(QV4::CallContext*);
+Q_DECLARE_METATYPE(InjectedFunction)
+
+static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
+class TestEngine : public QJSEngine
+{
+ Q_OBJECT
+public:
+ TestEngine()
+ {
+ qMetaTypeId<InjectedFunction>();
+ }
+
+ Q_INVOKABLE void evaluate(const QString &script, const QString &fileName, int lineNumber = 1)
+ {
+ QJSEngine::evaluate(script, fileName, lineNumber);
+ emit evaluateFinished();
+ }
+
+ QV4::ExecutionEngine *v4Engine() { return QV8Engine::getV4(this); }
+
+ Q_INVOKABLE void injectFunction(const QString &functionName, InjectedFunction injectedFunction)
+ {
+ QV4::ExecutionEngine *v4 = v4Engine();
+ QV4::Scope scope(v4);
+
+ QV4::ScopedString name(scope, v4->newString(functionName));
+ QV4::ScopedContext ctx(scope, v4->rootContext());
+ QV4::ScopedValue function(scope, BuiltinFunction::create(ctx, name, injectedFunction));
+ v4->globalObject->put(name, function);
+ }
+
+signals:
+ void evaluateFinished();
+};
+
+class ExceptionCollectJob: public CollectJob
+{
+ QV4DataCollector::Ref exception;
+
+public:
+ ExceptionCollectJob(QV4DataCollector *collector) :
+ CollectJob(collector), exception(-1) {}
+
+ void run() {
+ QV4::Scope scope(collector->engine());
+ QV4::ScopedValue v(scope, *collector->engine()->exceptionValue);
+ exception = collector->collect(v);
+ }
+
+ QV4DataCollector::Ref exceptionValue() const { return exception; }
+};
+
+class TestAgent : public QObject
+{
+ Q_OBJECT
+public:
+ typedef QV4DataCollector::Refs Refs;
+ typedef QV4DataCollector::Ref Ref;
+ struct NamedRefs {
+ QJsonArray refs;
+ QJsonObject scope;
+
+ int size() const {
+ return scope.size();
+ }
+
+ bool contains(const QString &name) const {
+ return scope.contains(name);
+ }
+
+ QJsonObject resolveRef(int ref) const {
+ foreach (const QJsonValue &val, refs) {
+ QJsonObject obj = val.toObject();
+ if (obj.value(QLatin1String("handle")).toInt() == ref)
+ return obj;
+ }
+ return QJsonObject();
+ }
+
+#define DUMP_JSON(x) {\
+ QJsonDocument doc(x);\
+ qDebug() << #x << "=" << doc.toJson(QJsonDocument::Indented);\
+}
+
+ QJsonObject rawValue(const QString &name) const {
+ Q_ASSERT(contains(name));
+ return scope[name].toObject();
+ }
+
+ QJsonValue value(const QString &name) const {
+ return rawValue(name).value(QStringLiteral("value"));
+ }
+
+ QString type(const QString &name) const {
+ return rawValue(name).value(QStringLiteral("type")).toString();
+ }
+
+ void dump(const QString &name) const {
+ if (!contains(name)) {
+ qDebug() << "no" << name;
+ return;
+ }
+
+ QJsonObject o = scope[name].toObject();
+ QJsonDocument d;
+ d.setObject(o);
+ qDebug() << name << "=" << d.toJson(QJsonDocument::Indented);
+ }
+ };
+
+ TestAgent(QV4::ExecutionEngine *engine)
+ : m_wasPaused(false)
+ , m_captureContextInfo(false)
+ , m_thrownValue(-1)
+ , collector(engine)
+ , m_debugger(0)
+ {
+ }
+
+public slots:
+ void debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason)
+ {
+ Q_ASSERT(debugger == m_debugger);
+ Q_ASSERT(debugger->engine() == collector.engine());
+ m_wasPaused = true;
+ m_pauseReason = reason;
+ m_statesWhenPaused << debugger->currentExecutionState();
+
+ if (debugger->state() == QV4Debugger::Paused && debugger->engine()->hasException) {
+ ExceptionCollectJob job(&collector);
+ debugger->runInEngine(&job);
+ m_thrownValue = job.exceptionValue();
+ }
+
+ foreach (const TestBreakPoint &bp, m_breakPointsToAddWhenPaused)
+ debugger->addBreakPoint(bp.fileName, bp.lineNumber);
+ m_breakPointsToAddWhenPaused.clear();
+
+ m_stackTrace = debugger->stackTrace();
+
+ while (!m_expressionRequests.isEmpty()) {
+ Q_ASSERT(debugger->state() == QV4Debugger::Paused);
+ ExpressionRequest request = m_expressionRequests.takeFirst();
+ ExpressionEvalJob job(debugger->engine(), request.frameNr, request.expression,
+ &collector);
+ debugger->runInEngine(&job);
+ m_expressionResults << job.returnValue();
+ m_expressionRefs << job.refs();
+ }
+
+ if (m_captureContextInfo)
+ captureContextInfo(debugger);
+
+ debugger->resume(QV4Debugger::FullThrottle);
+ }
+
+public:
+ struct TestBreakPoint
+ {
+ TestBreakPoint() : lineNumber(-1) {}
+ TestBreakPoint(const QString &fileName, int lineNumber)
+ : fileName(fileName), lineNumber(lineNumber) {}
+ QString fileName;
+ int lineNumber;
+ };
+
+ void captureContextInfo(QV4Debugger *debugger)
+ {
+ for (int i = 0, ei = m_stackTrace.size(); i != ei; ++i) {
+ m_capturedScope.append(NamedRefs());
+ ScopeJob job(&collector, i, 0);
+ debugger->runInEngine(&job);
+ NamedRefs &refs = m_capturedScope.last();
+ refs.refs = job.refs();
+ QJsonObject object = job.returnValue();
+ object = object.value(QLatin1String("object")).toObject();
+ int ref = object.value(QLatin1String("ref")).toInt();
+ object = refs.resolveRef(ref);
+ foreach (const QJsonValue &value, object.value(QLatin1String("properties")).toArray()) {
+ QJsonObject property = value.toObject();
+ QString name = property.value(QLatin1String("name")).toString();
+ property.remove(QLatin1String("name"));
+ if (property.contains(QLatin1String("ref"))) {
+ int childRef = property.value(QLatin1String("ref")).toInt();
+ if (childRef >= 0 && refs.refs.size() > childRef) {
+ property.remove(QLatin1String("ref"));
+ property.insert(QLatin1String("properties"),
+ refs.resolveRef(childRef).value(
+ QLatin1String("properties")).toArray());
+ }
+ }
+ refs.scope.insert(name, property);
+ }
+ }
+ }
+
+ void addDebugger(QV4Debugger *debugger)
+ {
+ Q_ASSERT(!m_debugger);
+ m_debugger = debugger;
+ connect(m_debugger, &QV4Debugger::debuggerPaused, this, &TestAgent::debuggerPaused);
+ }
+
+ bool m_wasPaused;
+ QV4Debugger::PauseReason m_pauseReason;
+ bool m_captureContextInfo;
+ QList<QV4Debugger::ExecutionState> m_statesWhenPaused;
+ QList<TestBreakPoint> m_breakPointsToAddWhenPaused;
+ QVector<QV4::StackFrame> m_stackTrace;
+ QVector<NamedRefs> m_capturedScope;
+ qint64 m_thrownValue;
+ QV4DataCollector collector;
+
+ struct ExpressionRequest {
+ QString expression;
+ int frameNr;
+ };
+ QVector<ExpressionRequest> m_expressionRequests;
+ QList<QJsonObject> m_expressionResults;
+ QList<QJsonArray> m_expressionRefs;
+ QV4Debugger *m_debugger;
+
+ // Utility methods:
+ void dumpStackTrace() const
+ {
+ qDebug() << "Stack depth:" << m_stackTrace.size();
+ foreach (const QV4::StackFrame &frame, m_stackTrace)
+ qDebug("\t%s (%s:%d:%d)", qPrintable(frame.function), qPrintable(frame.source),
+ frame.line, frame.column);
+ }
+};
+
+class tst_qv4debugger : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+
+ // breakpoints:
+ void breakAnywhere();
+ void pendingBreakpoint();
+ void liveBreakPoint();
+ void removePendingBreakPoint();
+ void addBreakPointWhilePaused();
+ void removeBreakPointForNextInstruction();
+ void conditionalBreakPoint();
+ void conditionalBreakPointInQml();
+
+ // context access:
+ void readArguments();
+ void readLocals();
+ void readObject();
+ void readContextInAllFrames();
+
+ // exceptions:
+ void pauseOnThrow();
+ void breakInCatch();
+ void breakInWith();
+
+ void evaluateExpression();
+
+private:
+ QV4Debugger *debugger() const
+ {
+ return static_cast<QV4Debugger *>(m_v4->debugger);
+ }
+ void evaluateJavaScript(const QString &script, const QString &fileName, int lineNumber = 1)
+ {
+ QMetaObject::invokeMethod(m_engine, "evaluate", Qt::QueuedConnection,
+ Q_ARG(QString, script), Q_ARG(QString, fileName),
+ Q_ARG(int, lineNumber));
+ waitForSignal(m_engine, SIGNAL(evaluateFinished()), /*timeout*/0);
+ }
+
+ TestEngine *m_engine;
+ QV4::ExecutionEngine *m_v4;
+ TestAgent *m_debuggerAgent;
+ QThread *m_javaScriptThread;
+};
+
+void tst_qv4debugger::init()
+{
+ m_javaScriptThread = new QThread;
+ m_engine = new TestEngine;
+ m_v4 = m_engine->v4Engine();
+ m_v4->iselFactory.reset(new QV4::Moth::ISelFactory);
+ m_v4->setDebugger(new QV4Debugger(m_v4));
+ m_engine->moveToThread(m_javaScriptThread);
+ m_javaScriptThread->start();
+ m_debuggerAgent = new TestAgent(m_v4);
+ m_debuggerAgent->addDebugger(debugger());
+}
+
+void tst_qv4debugger::cleanup()
+{
+ m_javaScriptThread->exit();
+ m_javaScriptThread->wait();
+ delete m_engine;
+ delete m_javaScriptThread;
+ m_engine = 0;
+ m_v4 = 0;
+ delete m_debuggerAgent;
+ m_debuggerAgent = 0;
+}
+
+void tst_qv4debugger::breakAnywhere()
+{
+ QString script =
+ "var i = 42;\n"
+ "var j = i + 1\n"
+ "var k = i\n";
+ debugger()->pause();
+ evaluateJavaScript(script, "testFile");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+}
+
+void tst_qv4debugger::pendingBreakpoint()
+{
+ QString script =
+ "var i = 42;\n"
+ "var j = i + 1\n"
+ "var k = i\n";
+ debugger()->addBreakPoint("testfile", 2);
+ evaluateJavaScript(script, "testfile");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1);
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first();
+ QCOMPARE(state.fileName, QString("testfile"));
+ QCOMPARE(state.lineNumber, 2);
+}
+
+void tst_qv4debugger::liveBreakPoint()
+{
+ QString script =
+ "var i = 42;\n"
+ "var j = i + 1\n"
+ "var k = i\n";
+ m_debuggerAgent->m_breakPointsToAddWhenPaused << TestAgent::TestBreakPoint("liveBreakPoint", 3);
+ debugger()->pause();
+ evaluateJavaScript(script, "liveBreakPoint");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2);
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(1);
+ QCOMPARE(state.fileName, QString("liveBreakPoint"));
+ QCOMPARE(state.lineNumber, 3);
+}
+
+void tst_qv4debugger::removePendingBreakPoint()
+{
+ QString script =
+ "var i = 42;\n"
+ "var j = i + 1\n"
+ "var k = i\n";
+ debugger()->addBreakPoint("removePendingBreakPoint", 2);
+ debugger()->removeBreakPoint("removePendingBreakPoint", 2);
+ evaluateJavaScript(script, "removePendingBreakPoint");
+ QVERIFY(!m_debuggerAgent->m_wasPaused);
+}
+
+void tst_qv4debugger::addBreakPointWhilePaused()
+{
+ QString script =
+ "var i = 42;\n"
+ "var j = i + 1\n"
+ "var k = i\n";
+ debugger()->addBreakPoint("addBreakPointWhilePaused", 1);
+ m_debuggerAgent->m_breakPointsToAddWhenPaused << TestAgent::TestBreakPoint("addBreakPointWhilePaused", 2);
+ evaluateJavaScript(script, "addBreakPointWhilePaused");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2);
+
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(0);
+ QCOMPARE(state.fileName, QString("addBreakPointWhilePaused"));
+ QCOMPARE(state.lineNumber, 1);
+
+ state = m_debuggerAgent->m_statesWhenPaused.at(1);
+ QCOMPARE(state.fileName, QString("addBreakPointWhilePaused"));
+ QCOMPARE(state.lineNumber, 2);
+}
+
+static QV4::ReturnedValue someCall(QV4::CallContext *ctx)
+{
+ static_cast<QV4Debugger *>(ctx->d()->engine->debugger)
+ ->removeBreakPoint("removeBreakPointForNextInstruction", 2);
+ return QV4::Encode::undefined();
+}
+
+void tst_qv4debugger::removeBreakPointForNextInstruction()
+{
+ QString script =
+ "someCall();\n"
+ "var i = 42;";
+
+ QMetaObject::invokeMethod(m_engine, "injectFunction", Qt::BlockingQueuedConnection,
+ Q_ARG(QString, "someCall"), Q_ARG(InjectedFunction, someCall));
+
+ debugger()->addBreakPoint("removeBreakPointForNextInstruction", 2);
+
+ evaluateJavaScript(script, "removeBreakPointForNextInstruction");
+ QVERIFY(!m_debuggerAgent->m_wasPaused);
+}
+
+void tst_qv4debugger::conditionalBreakPoint()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function test() {\n"
+ " for (var i = 0; i < 15; ++i) {\n"
+ " var x = i;\n"
+ " }\n"
+ "}\n"
+ "test()\n";
+
+ debugger()->addBreakPoint("conditionalBreakPoint", 3, QStringLiteral("i > 10"));
+ evaluateJavaScript(script, "conditionalBreakPoint");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 4);
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first();
+ QCOMPARE(state.fileName, QString("conditionalBreakPoint"));
+ QCOMPARE(state.lineNumber, 3);
+
+ QVERIFY(m_debuggerAgent->m_capturedScope.size() > 1);
+ const TestAgent::NamedRefs &frame0 = m_debuggerAgent->m_capturedScope.at(0);
+ QCOMPARE(frame0.size(), 2);
+ QVERIFY(frame0.contains("i"));
+ QCOMPARE(frame0.value("i").toInt(), 11);
+}
+
+void tst_qv4debugger::conditionalBreakPointInQml()
+{
+ QQmlEngine engine;
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine);
+ QV4Debugger *v4Debugger = new QV4Debugger(v4);
+ v4->iselFactory.reset(new QV4::Moth::ISelFactory);
+ v4->setDebugger(v4Debugger);
+
+ QScopedPointer<QThread> debugThread(new QThread);
+ debugThread->start();
+ QScopedPointer<TestAgent> debuggerAgent(new TestAgent(v4));
+ debuggerAgent->addDebugger(v4Debugger);
+ debuggerAgent->moveToThread(debugThread.data());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQml 2.0\n"
+ "QtObject {\n"
+ " id: root\n"
+ " property int foo: 42\n"
+ " property bool success: false\n"
+ " Component.onCompleted: {\n"
+ " success = true;\n" // breakpoint here
+ " }\n"
+ "}\n", QUrl("test.qml"));
+
+ v4Debugger->addBreakPoint("test.qml", 7, "root.foo == 42");
+
+ QScopedPointer<QObject> obj(component.create());
+ QCOMPARE(obj->property("success").toBool(), true);
+
+ QCOMPARE(debuggerAgent->m_statesWhenPaused.count(), 1);
+ QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).fileName, QStringLiteral("test.qml"));
+ QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).lineNumber, 7);
+
+ debugThread->quit();
+ debugThread->wait();
+}
+
+void tst_qv4debugger::readArguments()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a, b, c, d) {\n"
+ " return a === b\n"
+ "}\n"
+ "var four;\n"
+ "f(1, 'two', null, four);\n";
+ debugger()->addBreakPoint("readArguments", 2);
+ evaluateJavaScript(script, "readArguments");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QVERIFY(m_debuggerAgent->m_capturedScope.size() > 1);
+ const TestAgent::NamedRefs &frame0 = m_debuggerAgent->m_capturedScope.at(0);
+ QCOMPARE(frame0.size(), 4);
+ QVERIFY(frame0.contains(QStringLiteral("a")));
+ QCOMPARE(frame0.type(QStringLiteral("a")), QStringLiteral("number"));
+ QCOMPARE(frame0.value(QStringLiteral("a")).toDouble(), 1.0);
+ QVERIFY(frame0.scope.contains("b"));
+ QCOMPARE(frame0.type(QStringLiteral("b")), QStringLiteral("string"));
+ QCOMPARE(frame0.value(QStringLiteral("b")).toString(), QStringLiteral("two"));
+}
+
+void tst_qv4debugger::readLocals()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a, b) {\n"
+ " var c = a + b\n"
+ " var d = a - b\n" // breakpoint, c should be set, d should be undefined
+ " return c === d\n"
+ "}\n"
+ "f(1, 2, 3);\n";
+ debugger()->addBreakPoint("readLocals", 3);
+ evaluateJavaScript(script, "readLocals");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QVERIFY(m_debuggerAgent->m_capturedScope.size() > 1);
+ const TestAgent::NamedRefs &frame0 = m_debuggerAgent->m_capturedScope.at(0);
+ QCOMPARE(frame0.size(), 4); // locals and parameters
+ QVERIFY(frame0.contains("c"));
+ QCOMPARE(frame0.type("c"), QStringLiteral("number"));
+ QCOMPARE(frame0.value("c").toDouble(), 3.0);
+ QVERIFY(frame0.contains("d"));
+ QCOMPARE(frame0.type("d"), QStringLiteral("undefined"));
+}
+
+void tst_qv4debugger::readObject()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function f(a) {\n"
+ " var b = a\n"
+ " return b\n"
+ "}\n"
+ "f({head: 1, tail: { head: 'asdf', tail: null }});\n";
+ debugger()->addBreakPoint("readObject", 3);
+ evaluateJavaScript(script, "readObject");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QVERIFY(m_debuggerAgent->m_capturedScope.size() > 1);
+ const TestAgent::NamedRefs &frame0 = m_debuggerAgent->m_capturedScope.at(0);
+ QCOMPARE(frame0.size(), 2);
+ QVERIFY(frame0.contains("b"));
+ QCOMPARE(frame0.type("b"), QStringLiteral("object"));
+ QJsonObject b = frame0.rawValue("b");
+ QVERIFY(b.contains(QStringLiteral("properties")));
+ QVERIFY(b.value("properties").isArray());
+ QJsonArray b_props = b.value("properties").toArray();
+ QCOMPARE(b_props.size(), 2);
+
+ QVERIFY(b_props.at(0).isObject());
+ QJsonObject b_head = b_props.at(0).toObject();
+ QCOMPARE(b_head.value("name").toString(), QStringLiteral("head"));
+ QCOMPARE(b_head.value("type").toString(), QStringLiteral("number"));
+ QCOMPARE(b_head.value("value").toDouble(), 1.0);
+ QVERIFY(b_props.at(1).isObject());
+ QJsonObject b_tail = b_props.at(1).toObject();
+ QCOMPARE(b_tail.value("name").toString(), QStringLiteral("tail"));
+ QVERIFY(b_tail.contains("ref"));
+
+ QJsonObject b_tail_value = m_debuggerAgent->collector.lookupRef(b_tail.value("ref").toInt());
+ QCOMPARE(b_tail_value.value("type").toString(), QStringLiteral("object"));
+ QVERIFY(b_tail_value.contains("properties"));
+ QJsonArray b_tail_props = b_tail_value.value("properties").toArray();
+ QCOMPARE(b_tail_props.size(), 2);
+ QJsonObject b_tail_head = b_tail_props.at(0).toObject();
+ QCOMPARE(b_tail_head.value("name").toString(), QStringLiteral("head"));
+ QCOMPARE(b_tail_head.value("type").toString(), QStringLiteral("string"));
+ QCOMPARE(b_tail_head.value("value").toString(), QStringLiteral("asdf"));
+ QJsonObject b_tail_tail = b_tail_props.at(1).toObject();
+ QCOMPARE(b_tail_tail.value("name").toString(), QStringLiteral("tail"));
+ QCOMPARE(b_tail_tail.value("type").toString(), QStringLiteral("null"));
+ QVERIFY(b_tail_tail.value("value").isNull());
+}
+
+void tst_qv4debugger::readContextInAllFrames()
+{
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "function fact(n) {\n"
+ " if (n > 1) {\n"
+ " var n_1 = n - 1;\n"
+ " n_1 = fact(n_1);\n"
+ " return n * n_1;\n"
+ " } else\n"
+ " return 1;\n" // breakpoint
+ "}\n"
+ "fact(12);\n";
+ debugger()->addBreakPoint("readFormalsInAllFrames", 7);
+ evaluateJavaScript(script, "readFormalsInAllFrames");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_stackTrace.size(), 13);
+ QCOMPARE(m_debuggerAgent->m_capturedScope.size(), 13);
+
+ for (int i = 0; i < 12; ++i) {
+ const TestAgent::NamedRefs &scope = m_debuggerAgent->m_capturedScope.at(i);
+ QCOMPARE(scope.size(), 2);
+ QVERIFY(scope.contains("n"));
+ QCOMPARE(scope.type("n"), QStringLiteral("number"));
+ QCOMPARE(scope.value("n").toDouble(), i + 1.0);
+ QVERIFY(scope.contains("n_1"));
+ if (i == 0) {
+ QCOMPARE(scope.type("n_1"), QStringLiteral("undefined"));
+ } else {
+ QCOMPARE(scope.type("n_1"), QStringLiteral("number"));
+ QCOMPARE(scope.value("n_1").toInt(), i);
+ }
+ }
+ QCOMPARE(m_debuggerAgent->m_capturedScope[12].size(), 0);
+}
+
+void tst_qv4debugger::pauseOnThrow()
+{
+ QString script =
+ "function die(n) {\n"
+ " throw n\n"
+ "}\n"
+ "die('hard');\n";
+ debugger()->setBreakOnThrow(true);
+ evaluateJavaScript(script, "pauseOnThrow");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ 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);
+// DUMP_JSON(exception);
+ QCOMPARE(exception.value("type").toString(), QStringLiteral("string"));
+ QCOMPARE(exception.value("value").toString(), QStringLiteral("hard"));
+}
+
+void tst_qv4debugger::breakInCatch()
+{
+ QString script =
+ "try {\n"
+ " throw 'catch...'\n"
+ "} catch (e) {\n"
+ " console.log(e, 'me');\n"
+ "}\n";
+
+ debugger()->addBreakPoint("breakInCatch", 4);
+ evaluateJavaScript(script, "breakInCatch");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1);
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first();
+ QCOMPARE(state.fileName, QString("breakInCatch"));
+ QCOMPARE(state.lineNumber, 4);
+}
+
+void tst_qv4debugger::breakInWith()
+{
+ QString script =
+ "with (42) {\n"
+ " console.log('give the answer');\n"
+ "}\n";
+
+ debugger()->addBreakPoint("breakInWith", 2);
+ evaluateJavaScript(script, "breakInWith");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit);
+ QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1);
+ QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first();
+ QCOMPARE(state.fileName, QString("breakInWith"));
+ QCOMPARE(state.lineNumber, 2);
+}
+
+void tst_qv4debugger::evaluateExpression()
+{
+ QString script =
+ "function testFunction() {\n"
+ " var x = 10\n"
+ " return x\n" // breakpoint
+ "}\n"
+ "var x = 20\n"
+ "testFunction()\n";
+
+ TestAgent::ExpressionRequest request;
+ request.expression = "x";
+ request.frameNr = 0;
+ m_debuggerAgent->m_expressionRequests << request;
+ request.expression = "x";
+ request.frameNr = 1;
+ m_debuggerAgent->m_expressionRequests << request;
+
+ debugger()->addBreakPoint("evaluateExpression", 3);
+
+ evaluateJavaScript(script, "evaluateExpression");
+
+ QCOMPARE(m_debuggerAgent->m_expressionRefs.count(), 2);
+ QCOMPARE(m_debuggerAgent->m_expressionRefs[0].size(), 1);
+ QJsonObject result0 = m_debuggerAgent->m_expressionRefs[0].first().toObject();
+ QCOMPARE(result0.value("type").toString(), QStringLiteral("number"));
+ QCOMPARE(result0.value("value").toInt(), 10);
+ QCOMPARE(m_debuggerAgent->m_expressionRefs[1].size(), 1);
+ QJsonObject result1 = m_debuggerAgent->m_expressionRefs[1].first().toObject();
+ QCOMPARE(result1.value("type").toString(), QStringLiteral("number"));
+ QCOMPARE(result1.value("value").toInt(), 20);
+}
+
+QTEST_MAIN(tst_qv4debugger)
+
+#include "tst_qv4debugger.moc"
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 51d706b818..7b9e935678 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -33,10 +28,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 +48,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)
{
@@ -134,7 +171,7 @@ void QQmlDebugProcess::start(const QStringList &arguments)
#endif
m_mutex.lock();
m_port = 0;
- m_process.setEnvironment(m_environment);
+ m_process.setEnvironment(QProcess::systemEnvironment() + m_environment);
m_process.start(m_executable, arguments);
if (!m_process.waitForStarted()) {
qWarning() << "QML Debug Client: Could not launch app " << m_executable
@@ -192,9 +229,9 @@ QProcess::ExitStatus QQmlDebugProcess::exitStatus() const
return m_process.exitStatus();
}
-void QQmlDebugProcess::setEnvironment(const QStringList &environment)
+void QQmlDebugProcess::addEnvironment(const QString &environment)
{
- m_environment = environment;
+ m_environment.append(environment);
}
QString QQmlDebugProcess::output() const
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..6fe5d897e0 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -1,39 +1,34 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef DEBUGUTIL_H
-#define DEBUGUTIL_H
+#ifndef DEBUGUTIL_P_H
+#define DEBUGUTIL_P_H
//
// W A R N I N G
@@ -46,21 +41,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
@@ -92,7 +89,7 @@ public:
QString state();
- void setEnvironment(const QStringList &environment);
+ void addEnvironment(const QString &environment);
void start(const QStringList &arguments);
bool waitForSessionStart();
@@ -128,4 +125,23 @@ private:
int m_receivedBindErrors;
};
-#endif // DEBUGUTIL_H
+class QQmlInspectorResultRecipient : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlInspectorResultRecipient(QObject *parent = 0) :
+ QObject(parent), lastResponseId(-1), lastResult(false) {}
+
+ int lastResponseId;
+ bool lastResult;
+
+public slots:
+
+ void recordResponse(int requestId, bool result)
+ {
+ lastResponseId = requestId;
+ lastResult = result;
+ }
+};
+
+#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/qqmldebugtestservice.cpp b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
index e62aa2ce61..4dce07d824 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.h b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
index cc24f3c119..37b4a9f98c 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 9b48b40c07..3ad7beb7ff 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -1,38 +1,33 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qqmlenginedebugclient.h"
-#include "qdatastream.h"
+#include <private/qqmldebugconnection_p.h>
struct QmlObjectData {
QUrl url;
@@ -46,7 +41,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 +59,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 +72,7 @@ QQmlEngineDebugClient::QQmlEngineDebugClient(
QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("QmlDebugger"), connection),
m_nextId(0),
- m_valid(false),
- m_connection(connection)
+ m_valid(false)
{
}
@@ -89,11 +83,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 +108,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 +123,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 +143,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 +157,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 +173,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 +189,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 +205,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 +222,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 +238,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 +255,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 +272,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 +292,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 +310,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 +326,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 +396,7 @@ void QQmlEngineDebugClient::decode(QDataStream &ds,
}
}
-void QQmlEngineDebugClient::decode(QDataStream &ds,
+void QQmlEngineDebugClient::decode(QPacket &ds,
QList<QmlDebugObjectReference> &o,
bool simple)
{
@@ -432,7 +409,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 +437,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..a64a77e13e 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -34,13 +29,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 +201,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 +228,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..20faef177e 100644
--- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
@@ -1,64 +1,114 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qqmlinspectorclient.h"
-#include "qdatastream.h"
-void QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
+#include <private/qpacket_p.h>
+#include <private/qqmldebugconnection_p.h>
+#include <QtCore/qdebug.h>
+
+QQmlInspectorClient::QQmlInspectorClient(QQmlDebugConnection *connection) :
+ QQmlDebugClient(QLatin1String("QmlInspector"), connection),
+ m_lastRequestId(-1)
+{
+}
+
+int QQmlInspectorClient::setInspectToolEnabled(bool enabled)
{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("request") << m_requestId++
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray(enabled ? "enable" : "disable");
+
+ sendMessage(ds.data());
+ return m_lastRequestId;
+}
+
+int QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
+{
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
<< QByteArray("showAppOnTop") << showOnTop;
- sendMessage(message);
+ sendMessage(ds.data());
+ return m_lastRequestId;
}
-void QQmlInspectorClient::reloadQml(const QHash<QString, QByteArray> &changesHash)
+int QQmlInspectorClient::setAnimationSpeed(qreal speed)
{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- m_reloadRequestId = m_requestId;
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray("setAnimationSpeed") << speed;
- ds << QByteArray("request") << m_requestId++
- << QByteArray("reload") << changesHash;
+ sendMessage(ds.data());
+ return m_lastRequestId;
+}
- sendMessage(message);
+int QQmlInspectorClient::select(const QList<int> &objectIds)
+{
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray("select") << objectIds;
+
+ sendMessage(ds.data());
+ return m_lastRequestId;
+}
+
+int QQmlInspectorClient::createObject(const QString &qml, int parentId, const QStringList &imports,
+ const QString &filename)
+{
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray("createObject") << qml << parentId << imports << filename;
+ sendMessage(ds.data());
+ return m_lastRequestId;
+}
+
+int QQmlInspectorClient::moveObject(int childId, int newParentId)
+{
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray("moveObject") << childId << newParentId;
+ sendMessage(ds.data());
+ return m_lastRequestId;
+}
+
+int QQmlInspectorClient::destroyObject(int objectId)
+{
+ QPacket ds(connection()->currentDataStreamVersion());
+ ds << QByteArray("request") << ++m_lastRequestId
+ << QByteArray("destroyObject") << objectId;
+ sendMessage(ds.data());
+ return m_lastRequestId;
}
void QQmlInspectorClient::messageReceived(const QByteArray &message)
{
- QDataStream ds(message);
+ QPacket ds(connection()->currentDataStreamVersion(), message);
QByteArray type;
ds >> type;
@@ -67,7 +117,8 @@ void QQmlInspectorClient::messageReceived(const QByteArray &message)
return;
}
- m_requestResult = false;
- ds >> m_responseId >> m_requestResult;
- emit responseReceived();
+ int responseId;
+ bool result;
+ ds >> responseId >> result;
+ emit responseReceived(responseId, result);
}
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
index a8b42c8430..bfb489c8f7 100644
--- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -33,39 +28,32 @@
#ifndef QQMLINSPECTORCLIENT_H
#define QQMLINSPECTORCLIENT_H
-#include "qqmldebugclient.h"
+#include <private/qqmldebugclient_p.h>
class QQmlInspectorClient : public QQmlDebugClient
{
Q_OBJECT
public:
- QQmlInspectorClient(QQmlDebugConnection *connection)
- : QQmlDebugClient(QLatin1String("QmlInspector"), connection)
- , m_showAppOnTop(false)
- , m_requestId(0)
- , m_requestResult(false)
- , m_responseId(-1)
- {
- }
+ QQmlInspectorClient(QQmlDebugConnection *connection);
- void setShowAppOnTop(bool showOnTop);
- void reloadQml(const QHash<QString, QByteArray> &changesHash);
+ int setInspectToolEnabled(bool enabled);
+ int setShowAppOnTop(bool showOnTop);
+ int setAnimationSpeed(qreal speed);
+ int select(const QList<int> &objectIds);
+ int createObject(const QString &qml, int parentId, const QStringList &imports,
+ const QString &filename);
+ int moveObject(int childId, int newParentId);
+ int destroyObject(int objectId);
signals:
- void responseReceived();
+ void responseReceived(int requestId, bool result);
protected:
void messageReceived(const QByteArray &message);
private:
- bool m_showAppOnTop;
- int m_requestId;
-
-public:
- bool m_requestResult;
- int m_responseId;
- int m_reloadRequestId;
+ int m_lastRequestId;
};
#endif // QQMLINSPECTORCLIENT_H