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/qdebugmessageservice/qdebugmessageservice.pro2
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml19
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro3
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp67
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp1
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp63
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp85
-rw-r--r--tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp22
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp16
15 files changed, 227 insertions, 63 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index 9cf323ba36..3f2c0ca390 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qdebugmessageservice
-QT += qml network testlib gui-private core-private
+QT += network testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qdebugmessageservice.cpp
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index b1e3835844..dc0120cd87 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -6,4 +6,4 @@ SOURCES += tst_qpacketprotocol.cpp
include(../shared/debugutil.pri)
-QT += qml network testlib gui-private core-private
+QT += network testlib gui-private core-private
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml
new file mode 100644
index 0000000000..7ea048044f
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 0
+ property int b: 0
+ onAChanged: console.log("inline")
+ onBChanged: {
+ console.log("extra braces");
+ }
+
+ Timer {
+ interval: 10
+ running: true
+ onTriggered: {
+ parent.a += 10;
+ parent.b -= 10;
+ }
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro
index 90623c75a6..52d70bd1b1 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro
@@ -20,4 +20,5 @@ OTHER_FILES += data/test.qml data/test.js \
data/changeBreakpoint.qml \
data/stepAction.qml \
data/breakpointRelocation.qml \
- data/createComponent.qml
+ data/createComponent.qml \
+ data/encodeQmlScope.qml
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
index 3cd359cf48..660afce216 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -124,6 +124,7 @@ const char *QUIT_QMLFILE = "quit.qml";
const char *CHANGEBREAKPOINT_QMLFILE = "changeBreakpoint.qml";
const char *STEPACTION_QMLFILE = "stepAction.qml";
const char *BREAKPOINTRELOCATION_QMLFILE = "breakpointRelocation.qml";
+const char *ENCODEQMLSCOPE_QMLFILE = "encodeQmlScope.qml";
#define VARIANTMAPINIT \
QString obj("{}"); \
@@ -217,6 +218,8 @@ private slots:
void getScripts_data() { targetData(); }
void getScripts();
+ void encodeQmlScope();
+
private:
ConnectResult init(bool qmlscene, const QString &qmlFile = QString(TEST_QMLFILE),
bool blockMode = true, bool restrictServices = false);
@@ -1455,6 +1458,70 @@ void tst_QQmlDebugJS::getScripts()
QVERIFY(scripts.first().toMap()[QStringLiteral("name")].toString().endsWith(QStringLiteral("data/test.qml")));
}
+void tst_QQmlDebugJS::encodeQmlScope()
+{
+ QString file(ENCODEQMLSCOPE_QMLFILE);
+ QCOMPARE(init(true, file), ConnectSuccess);
+
+ int numFrames = 0;
+ int numExpectedScopes = 0;
+ int numReceivedScopes = 0;
+ bool isStopped = false;
+ bool scopesFailed = false;
+
+ QObject::connect(m_client, &QJSDebugClient::failure, this, [&]() {
+ qWarning() << "received failure" << m_client->response;
+ scopesFailed = true;
+ m_process->stop();
+ numFrames = 2;
+ isStopped = false;
+ });
+
+ QObject::connect(m_client, &QJSDebugClient::stopped, this, [&]() {
+ m_client->frame();
+ isStopped = true;
+ });
+
+ QObject::connect(m_client, &QJSDebugClient::result, this, [&]() {
+ const QVariantMap value = m_client->parser.call(
+ QJSValueList() << QJSValue(QString(m_client->response))).toVariant().toMap();
+
+ const QMap<QString, QVariant> body = value.value("body").toMap();
+ const QString command = value.value("command").toString();
+
+ if (command == QString("scope")) {
+ // If the scope commands fail we get a failure() signal above.
+ if (++numReceivedScopes == numExpectedScopes) {
+ m_client->continueDebugging(QJSDebugClient::Continue);
+ isStopped = false;
+ }
+ } else if (command == QString("frame")) {
+
+ // We want at least a global scope and some kind of local scope here.
+ const QList<QVariant> scopes = body.value("scopes").toList();
+ if (scopes.length() < 2)
+ scopesFailed = true;
+
+ for (const QVariant &scope : scopes) {
+ ++numExpectedScopes;
+ m_client->scope(scope.toMap().value("index").toInt());
+ }
+
+ ++numFrames;
+ }
+ });
+
+ m_client->setBreakpoint(file, 6);
+ m_client->setBreakpoint(file, 8);
+ m_client->connect();
+
+ QTRY_COMPARE(numFrames, 2);
+ QVERIFY(numExpectedScopes > 3);
+ QVERIFY(!scopesFailed);
+ QTRY_VERIFY(!isStopped);
+ QCOMPARE(numReceivedScopes, numExpectedScopes);
+}
+
QList<QQmlDebugClient *> tst_QQmlDebugJS::createClients()
{
m_client = new QJSDebugClient(m_connection);
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index 9f0501241d..5b3c0c5240 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -32,7 +32,6 @@
#include <private/qqmldebugconnector_p.h>
#include <private/qqmldebugconnection_p.h>
-#include <QtQml/qqmldebug.h>
#include <QtQml/qqmlengine.h>
#include <QtTest/qtest.h>
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
index 73455bd903..36957628b2 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro
@@ -8,7 +8,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib gui-private core-private
+QT += core testlib gui-private core-private
OTHER_FILES += \
data/test.qml \
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
index 5f58e5ec7f..54244c6d16 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlenginedebuginspectorintegration
-QT += qml testlib gui-private core-private
+QT += testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qqmlenginedebuginspectorintegration.cpp
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index 33ee023c06..ed4224446e 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -10,4 +10,4 @@ include(../shared/debugutil.pri)
DEFINES += QT_QML_DEBUG_NO_WARNING
-QT += core-private qml-private quick-private testlib gui-private
+QT += quick qml-private testlib
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 89217e7556..417b75e760 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -53,6 +53,9 @@
#include <QtCore/qdebug.h>
#include <QtCore/qthread.h>
#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qjsonobject.h>
+#include <QtCore/qjsonarray.h>
+#include <QtCore/qjsondocument.h>
#define QVERIFYOBJECT(statement) \
do {\
@@ -82,6 +85,40 @@ public:
QModelIndex modelIndex() { return QModelIndex(); }
};
+class JsonTest : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QJsonObject data READ data WRITE setData NOTIFY dataChanged)
+
+public:
+ JsonTest(QObject *parent = 0) : QObject(parent)
+ {
+ m_data["foo"] = QJsonValue(12);
+ m_data["ttt"] = QJsonArray({4, 5, 4, 3, 2});
+ m_data["a"] = QJsonValue(QJsonValue::Null);
+ m_data["b"] = QJsonValue(QJsonValue::Undefined);
+ m_data["c"] = QJsonValue("fffff");
+ }
+
+ QJsonObject data() const { return m_data; }
+
+signals:
+ void dataChanged(const QJsonObject &data);
+
+public slots:
+ void setData(const QJsonObject &data)
+ {
+ if (data != m_data) {
+ m_data = data;
+ emit dataChanged(data);
+ }
+ }
+
+private:
+ QJsonObject m_data;
+};
+
+
class tst_QQmlEngineDebugService : public QObject
{
Q_OBJECT
@@ -139,6 +176,7 @@ private slots:
void regression_QTCREATORBUG_7451();
void queryObjectWithNonStreamableTypes();
+ void jsonData();
void asynchronousCreate();
void invalidContexts();
void createObjectOnDestruction();
@@ -363,6 +401,11 @@ void tst_QQmlEngineDebugService::initTestCase()
"CustomTypes {}"
;
+ qmlRegisterType<JsonTest>("JsonTest", 1, 0, "JsonTest");
+ qml << "import JsonTest 1.0\n"
+ "JsonTest {}"
+ ;
+
for (int i=0; i<qml.count(); i++) {
QQmlComponent component(m_engine);
component.setData(qml[i], QUrl::fromLocalFile(""));
@@ -676,7 +719,7 @@ void tst_QQmlEngineDebugService::queryRootContexts()
// root context query sends only root object data - it doesn't fill in
// the children or property info
QCOMPARE(context.objects.count(), 0);
- QCOMPARE(context.contexts.count(), 6);
+ QCOMPARE(context.contexts.count(), 7);
QVERIFY(context.contexts[0].debugId >= 0);
QCOMPARE(context.contexts[0].name, QString("tst_QQmlDebug_childContext"));
}
@@ -915,6 +958,24 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes()
QVariant(QLatin1String("QModelIndex()")));
}
+void tst_QQmlEngineDebugService::jsonData()
+{
+ bool success;
+
+ QmlDebugObjectReference rootObject = findRootObject(5, true);
+ QVERIFY(!rootObject.className.isEmpty());
+
+ m_dbg->queryObject(rootObject, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QmlDebugObjectReference obj = m_dbg->object();
+ QVERIFY(!obj.className.isEmpty());
+
+ QCOMPARE(findProperty(obj.properties, "data").value,
+ QJsonDocument::fromJson("{\"a\":null,\"c\":\"fffff\",\"foo\":12,\"ttt\":[4,5,4,3,2]}")
+ .toVariant());
+}
void tst_QQmlEngineDebugService::queryExpressionResult()
{
diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
index fd07255ae5..3d4473c693 100644
--- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qqmlinspector
-QT += qml testlib gui-private core-private
+QT += testlib gui-private core-private
osx:CONFIG -= app_bundle
SOURCES += tst_qqmlinspector.cpp
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 7c78b5fcb3..2a685ed877 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -8,7 +8,7 @@ include(../shared/debugutil.pri)
TESTDATA = data/*
-QT += core qml testlib testlib-private gui-private core-private
+QT += testlib gui-private
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 562804bc45..3cb315b355 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -34,13 +34,12 @@
#include <private/qqmldebugconnection_p.h>
#include <QtTest/qtest.h>
-#include <private/qtestresult_p.h>
#include <QtCore/qlibraryinfo.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
-class QQmlProfilerTestClient : public QQmlProfilerEventReceiver, public QQmlProfilerDefinitions
+class QQmlProfilerTestClient : public QQmlProfilerEventReceiver
{
Q_OBJECT
@@ -229,8 +228,8 @@ private:
bool m_isComplete = false;
// Don't use ({...}) here as MSVC will interpret that as the "QVector(int size)" ctor.
- const QVector<qint64> m_rangeStart = (QVector<qint64>() << QQmlProfilerDefinitions::RangeStart);
- const QVector<qint64> m_rangeEnd = (QVector<qint64>() << QQmlProfilerDefinitions::RangeEnd);
+ const QVector<qint64> m_rangeStart = (QVector<qint64>() << RangeStart);
+ const QVector<qint64> m_rangeEnd = (QVector<qint64>() << RangeEnd);
};
#define VERIFY(type, position, expected, checks, numbers) \
@@ -247,7 +246,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(
// ### Still using qmlscene due to QTBUG-33377
return QQmlDebugTest::connect(
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
- restrictServices ? QQmlDebuggingEnabler::profilerServices().join(',') : QString(),
+ restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(),
testFile(file), block);
}
@@ -272,15 +271,11 @@ void tst_QQmlProfilerService::checkTraceReceived()
QVector<qint64> numbers;
// must start with "StartTrace"
- QQmlProfilerEventType expected(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::StartTrace);
+ QQmlProfilerEventType expected(Event, MaximumRangeType, StartTrace);
VERIFY(MessageListAsynchronous, 0, expected, CheckMessageType | CheckDetailType, numbers);
// must end with "EndTrace"
- expected = QQmlProfilerEventType(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::EndTrace);
+ expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace);
VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected,
CheckMessageType | CheckDetailType, numbers);
}
@@ -299,15 +294,15 @@ void tst_QQmlProfilerService::checkJsHeap()
const qint64 amount = message.number<qint64>(0);
const QQmlProfilerEventType &type = m_client->types.at(message.typeIndex());
switch (type.detailType()) {
- case QV4::Profiling::HeapPage:
+ case HeapPage:
allocated += amount;
seen_alloc = true;
break;
- case QV4::Profiling::SmallItem:
+ case SmallItem:
used += amount;
seen_small = true;
break;
- case QV4::Profiling::LargeItem:
+ case LargeItem:
allocated += amount;
used += amount;
seen_large = true;
@@ -548,28 +543,27 @@ void tst_QQmlProfilerService::pixmapCacheData()
checkTraceReceived();
checkJsHeap();
- auto createType = [](QQmlProfilerDefinitions::PixmapEventType type) {
- return QQmlProfilerEventType(QQmlProfilerDefinitions::PixmapCacheEvent,
- QQmlProfilerDefinitions::MaximumRangeType, type);
+ auto createType = [](PixmapEventType type) {
+ return QQmlProfilerEventType(PixmapCacheEvent, MaximumRangeType, type);
};
QVector<qint64> numbers;
// image starting to load
- VERIFY(MessageListPixmap, 0, createType(QQmlProfilerDefinitions::PixmapLoadingStarted),
+ VERIFY(MessageListPixmap, 0, createType(PixmapLoadingStarted),
CheckMessageType | CheckDetailType, numbers);
// image size
numbers = QVector<qint64>({2, 2, 1});
- VERIFY(MessageListPixmap, 1, createType(QQmlProfilerDefinitions::PixmapSizeKnown),
+ VERIFY(MessageListPixmap, 1, createType(PixmapSizeKnown),
CheckMessageType | CheckDetailType | CheckNumbers, numbers);
// image loaded
- VERIFY(MessageListPixmap, 2, createType(QQmlProfilerDefinitions::PixmapLoadingFinished),
+ VERIFY(MessageListPixmap, 2, createType(PixmapLoadingFinished),
CheckMessageType | CheckDetailType, numbers);
// cache size
- VERIFY(MessageListPixmap, 3, createType(QQmlProfilerDefinitions::PixmapCacheCountChanged),
+ VERIFY(MessageListPixmap, 3, createType(PixmapCacheCountChanged),
CheckMessageType | CheckDetailType, numbers);
}
@@ -597,8 +591,8 @@ void tst_QQmlProfilerService::scenegraphData()
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) {
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphContextFrame) {
+ if (type.message() == SceneGraphFrame) {
+ if (type.detailType() == SceneGraphContextFrame) {
contextFrameTime = msg.timestamp();
break;
}
@@ -610,7 +604,7 @@ void tst_QQmlProfilerService::scenegraphData()
#endif
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRendererFrame) {
+ if (type.detailType() == SceneGraphRendererFrame) {
QVERIFY(msg.timestamp() >= contextFrameTime);
renderFrameTime = msg.timestamp();
break;
@@ -621,7 +615,7 @@ void tst_QQmlProfilerService::scenegraphData()
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRenderLoopFrame) {
+ if (type.detailType() == SceneGraphRenderLoopFrame) {
if (msg.timestamp() >= contextFrameTime) {
// Make sure SceneGraphRenderLoopFrame is not between SceneGraphContextFrame and
// SceneGraphRendererFrame. A SceneGraphRenderLoopFrame before everything else is
@@ -664,8 +658,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
auto createType = [](int line, int column) {
return QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::HandlingSignal, -1,
+ MaximumMessage, HandlingSignal, -1,
QQmlProfilerEventLocation(QLatin1String("signalSourceLocation.qml"), line,
column));
};
@@ -684,23 +677,21 @@ void tst_QQmlProfilerService::javascript()
checkTraceReceived();
checkJsHeap();
- VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 3,
- QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript, -1,
- QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
+ QQmlProfilerEventType(
+ MaximumMessage, Javascript, -1,
+ QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
CheckType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 4, QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage, QQmlProfilerDefinitions::Javascript, -1,
+ MaximumMessage, Javascript, -1,
QQmlProfilerEventLocation(), QLatin1String("something")),
CheckMessageType | CheckDetailType | CheckDataEndsWith | CheckNumbers, m_rangeStart);
- VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeEnd);
}
@@ -726,8 +717,7 @@ void tst_QQmlProfilerService::translationBinding()
checkTraceReceived();
checkJsHeap();
- const QQmlProfilerEventType type(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Binding);
+ const QQmlProfilerEventType type(MaximumMessage, Binding);
VERIFY(MessageListQML, 4, type, CheckDetailType | CheckMessageType | CheckNumbers,
m_rangeStart);
@@ -746,7 +736,7 @@ void tst_QQmlProfilerService::memory()
int smallItems = 0;
for (auto message : m_client->jsHeapMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.detailType() == QV4::Profiling::SmallItem)
+ if (type.detailType() == SmallItem)
++smallItems;
}
@@ -756,8 +746,7 @@ void tst_QQmlProfilerService::memory()
static bool hasCompileEvents(const QVector<QQmlProfilerEventType> &types)
{
for (const QQmlProfilerEventType &type : types) {
- if (type.message() == QQmlProfilerDefinitions::MaximumMessage
- && type.rangeType() == QQmlProfilerDefinitions::Compiling)
+ if (type.message() == MaximumMessage && type.rangeType() == Compiling)
return true;
}
return false;
@@ -776,29 +765,29 @@ void tst_QQmlProfilerService::compile()
checkTraceReceived();
checkJsHeap();
- QQmlProfilerDefinitions::Message rangeStage = QQmlProfilerDefinitions::MaximumMessage;
+ Message rangeStage = MaximumMessage;
for (auto message : m_client->qmlMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.rangeType() == QQmlProfilerDefinitions::Compiling) {
+ if (type.rangeType() == Compiling) {
switch (rangeStage) {
- case QQmlProfilerDefinitions::MaximumMessage:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeStart);
+ case MaximumMessage:
+ QCOMPARE(message.rangeStage(), RangeStart);
break;
- case QQmlProfilerDefinitions::RangeStart:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeEnd);
+ case RangeStart:
+ QCOMPARE(message.rangeStage(), RangeEnd);
break;
default:
QFAIL("Wrong range stage");
}
rangeStage = message.rangeStage();
- QCOMPARE(type.message(), QQmlProfilerDefinitions::MaximumMessage);
+ QCOMPARE(type.message(), MaximumMessage);
QCOMPARE(type.location().filename(), testFileUrl("test.qml").toString());
QCOMPARE(type.location().line(), 0);
QCOMPARE(type.location().column(), 0);
}
}
- QCOMPARE(rangeStage, QQmlProfilerDefinitions::RangeEnd);
+ QCOMPARE(rangeStage, RangeEnd);
}
QTEST_MAIN(tst_QQmlProfilerService)
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
index 4ce0f9fd89..c65c592f10 100644
--- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -297,6 +297,7 @@ private slots:
// context access:
void readArguments_data() { redundancy_data(); }
void readArguments();
+ void readComplicatedArguments();
void readLocals_data() { redundancy_data(); }
void readLocals();
void readObject_data() { redundancy_data(); }
@@ -549,6 +550,27 @@ void tst_qv4debugger::readArguments()
QCOMPARE(frame0.value(QStringLiteral("b")).toString(), QStringLiteral("two"));
}
+void tst_qv4debugger::readComplicatedArguments()
+{
+ m_debuggerAgent->collector.setRedundantRefs(false);
+ m_debuggerAgent->m_captureContextInfo = true;
+ QString script =
+ "var f = function(a) {\n"
+ " a = 12;\n"
+ " return a;\n"
+ "}\n"
+ "f(1, 2);\n";
+ debugger()->addBreakPoint("readArguments", 3);
+ 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(), 1);
+ QVERIFY(frame0.contains(QStringLiteral("a")));
+ QCOMPARE(frame0.type(QStringLiteral("a")), QStringLiteral("number"));
+ QCOMPARE(frame0.value(QStringLiteral("a")).toInt(), 12);
+}
+
void tst_qv4debugger::readLocals()
{
QFETCH(bool, redundantRefs);
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 8ecbe53822..b118b22c64 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -31,8 +31,6 @@
#include <private/qqmldebugconnection_p.h>
-#include <QtQml/qqmldebug.h>
-
#include <QtCore/qeventloop.h>
#include <QtCore/qtimer.h>
@@ -52,15 +50,23 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim
QList<QQmlDebugClient *> QQmlDebugTest::createOtherClients(QQmlDebugConnection *connection)
{
QList<QQmlDebugClient *> ret;
- foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) {
+
+ static const auto debuggerServices
+ = QStringList({"V8Debugger", "QmlDebugger", "DebugMessages"});
+ static const auto inspectorServices
+ = QStringList({"QmlInspector"});
+ static const auto profilerServices
+ = QStringList({"CanvasFrameRate", "EngineControl", "DebugMessages"});
+
+ for (const QString &service : debuggerServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}
- foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) {
+ for (const QString &service : inspectorServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}
- foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) {
+ for (const QString &service : profilerServices) {
if (!connection->client(service))
ret << new QQmlDebugClient(service, connection);
}