aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmlprofilerservice
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/debugger/qqmlprofilerservice')
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/qstr.qml9
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp124
4 files changed, 59 insertions, 79 deletions
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST b/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST
new file mode 100644
index 0000000000..5fb1dc193b
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/BLACKLIST
@@ -0,0 +1,2 @@
+# QTQAINFRA-1334
+windows gcc
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/qstr.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/qstr.qml
new file mode 100644
index 0000000000..09dcd34b5c
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/qstr.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+
+Timer {
+ property string stuff: qsTr("foo")
+
+ running: true
+ interval: 1
+ onTriggered: Qt.quit();
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 56840d5c8f..7c78b5fcb3 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -4,8 +4,6 @@ osx:CONFIG -= app_bundle
SOURCES += tst_qqmlprofilerservice.cpp
-INCLUDEPATH += ../shared
-include(../../../shared/util.pri)
include(../shared/debugutil.pri)
TESTDATA = data/*
@@ -22,4 +20,5 @@ OTHER_FILES += \
data/signalSourceLocation.qml \
data/javascript.qml \
data/timer.qml \
+ data/qstr.qml \
data/memory.qml
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index bc6c51707a..f60e821071 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -36,9 +36,6 @@
#include <private/qtestresult_p.h>
#include <QtCore/qlibraryinfo.h>
-#define STR_PORT_FROM "13773"
-#define STR_PORT_TO "13783"
-
struct QQmlProfilerData
{
QQmlProfilerData(qint64 time = -2, int messageType = -1, int detailType = -1,
@@ -258,24 +255,11 @@ void QQmlProfilerTestClient::complete()
emit recordingFinished();
}
-class tst_QQmlProfilerService : public QQmlDataTest
+class tst_QQmlProfilerService : public QQmlDebugTest
{
Q_OBJECT
-public:
- tst_QQmlProfilerService()
- : m_process(0)
- , m_connection(0)
- , m_client(0)
- {
- }
-
-
private:
- QQmlDebugProcess *m_process;
- QQmlDebugConnection *m_connection;
- QQmlProfilerTestClient *m_client;
-
enum MessageListType {
MessageListQML,
MessageListJavaScript,
@@ -294,14 +278,17 @@ private:
CheckAll = CheckMessageType | CheckDetailType | CheckLine | CheckColumn | CheckDataEndsWith
};
- void connect(bool block, const QString &testFile, bool restrictServices = true);
+ ConnectResult connect(bool block, const QString &testFile, bool restrictServices = true);
void checkTraceReceived();
void checkJsHeap();
bool verify(MessageListType type, int expectedPosition, const QQmlProfilerData &expected,
quint32 checks);
+ QList<QQmlDebugClient *> createClients() override;
+ QPointer<QQmlProfilerTestClient> m_client;
+
private slots:
- void cleanup();
+ void cleanup() override;
void connect_data();
void connect();
@@ -312,39 +299,19 @@ private slots:
void signalSourceLocation();
void javascript();
void flushInterval();
+ void translationBinding();
void memory();
};
#define VERIFY(type, position, expected, checks) QVERIFY(verify(type, position, expected, checks))
-void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool restrictServices)
+QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(bool block, const QString &file,
+ bool restrictServices)
{
// ### Still using qmlscene due to QTBUG-33377
- const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
- QStringList arguments;
- arguments << QString::fromLatin1("-qmljsdebugger=port:%1,%2%3%4")
- .arg(STR_PORT_FROM).arg(STR_PORT_TO)
- .arg(block ? QStringLiteral(",block") : QString())
- .arg(restrictServices ? QStringLiteral(",services:CanvasFrameRate") : QString())
- << QQmlDataTest::instance()->testFile(testFile);
-
- m_process = new QQmlDebugProcess(executable, this);
- m_process->start(QStringList() << arguments);
- QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'.");
-
- m_connection = new QQmlDebugConnection();
- m_client = new 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);
+ return QQmlDebugTest::connect(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
+ restrictServices ? QStringLiteral("CanvasFrameRate") : QString(),
+ testFile(file), block);
}
void tst_QQmlProfilerService::checkTraceReceived()
@@ -479,6 +446,12 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty
return false;
}
+QList<QQmlDebugClient *> tst_QQmlProfilerService::createClients()
+{
+ m_client = new QQmlProfilerTestClient(m_connection);
+ return QList<QQmlDebugClient *>({m_client});
+}
+
void tst_QQmlProfilerService::cleanup()
{
if (m_client && QTest::currentTestFailed()) {
@@ -516,17 +489,9 @@ void tst_QQmlProfilerService::cleanup()
qDebug() << i++ << data.time << data.messageType << data.detailType;
}
qDebug() << " ";
- qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null"));
- qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null"));
- qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection);
- qDebug() << "Client State:" << QQmlDebugTest::clientStateString(m_client);
}
- delete m_process;
- m_process = 0;
- delete m_client;
- m_client = 0;
- delete m_connection;
- m_connection = 0;
+
+ QQmlDebugTest::cleanup();
}
void tst_QQmlProfilerService::connect_data()
@@ -550,7 +515,7 @@ void tst_QQmlProfilerService::connect()
QFETCH(bool, restrictMode);
QFETCH(bool, traceEnabled);
- connect(blockMode, "test.qml", restrictMode);
+ QCOMPARE(connect(blockMode, "test.qml", restrictMode), ConnectSuccess);
// if the engine is waiting, then the first message determines if it starts with trace enabled
if (!traceEnabled)
@@ -563,9 +528,7 @@ void tst_QQmlProfilerService::connect()
void tst_QQmlProfilerService::pixmapCacheData()
{
- connect(true, "pixmapCacheTest.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "pixmapCacheTest.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true);
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
@@ -602,9 +565,7 @@ void tst_QQmlProfilerService::pixmapCacheData()
void tst_QQmlProfilerService::scenegraphData()
{
- connect(true, "scenegraphTest.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "scenegraphTest.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true);
@@ -661,9 +622,7 @@ void tst_QQmlProfilerService::scenegraphData()
void tst_QQmlProfilerService::profileOnExit()
{
- connect(true, "exit.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "exit.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true);
@@ -673,9 +632,7 @@ void tst_QQmlProfilerService::profileOnExit()
void tst_QQmlProfilerService::controlFromJS()
{
- connect(true, "controlFromJS.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "controlFromJS.qml"), ConnectSuccess);
m_client->sendRecordingStatus(false);
checkTraceReceived();
@@ -684,9 +641,7 @@ void tst_QQmlProfilerService::controlFromJS()
void tst_QQmlProfilerService::signalSourceLocation()
{
- connect(true, "signalSourceLocation.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "signalSourceLocation.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true);
while (!(m_process->output().contains(QLatin1String("500"))))
@@ -709,9 +664,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
void tst_QQmlProfilerService::javascript()
{
- connect(true, "javascript.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "javascript.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true);
while (!(m_process->output().contains(QLatin1String("done"))))
@@ -741,9 +694,7 @@ void tst_QQmlProfilerService::javascript()
void tst_QQmlProfilerService::flushInterval()
{
- connect(true, "timer.qml");
- if (QTest::currentTestFailed() || QTestResult::skipCurrentTest())
- return;
+ QCOMPARE(connect(true, "timer.qml"), ConnectSuccess);
m_client->sendRecordingStatus(true, -1, 1);
@@ -757,6 +708,25 @@ void tst_QQmlProfilerService::flushInterval()
checkJsHeap();
}
+void tst_QQmlProfilerService::translationBinding()
+{
+ QCOMPARE(connect(true, "qstr.qml"), ConnectSuccess);
+
+ m_client->sendRecordingStatus(true);
+
+ checkTraceReceived();
+ checkJsHeap();
+
+ QQmlProfilerData expected(0, QQmlProfilerDefinitions::RangeStart,
+ QQmlProfilerDefinitions::Binding);
+ VERIFY(MessageListQML, 8, expected,
+ CheckDetailType | CheckMessageType);
+
+ expected.messageType = QQmlProfilerDefinitions::RangeEnd;
+ VERIFY(MessageListQML, 10, expected,
+ CheckDetailType | CheckMessageType);
+}
+
void tst_QQmlProfilerService::memory()
{
connect(true, "memory.qml");