aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2013-12-16 15:30:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 15:57:58 +0100
commit4cf8a6ad7189991ff6852f4096fa8673ffa98bf0 (patch)
tree5660c4037754ef500d758fcd9c3a51dfc4d46552 /tests
parentd5f5b3f87dc376b237c81d150a8d36cbb525e12e (diff)
Parse source location for signal handling functions
Previously the source location of signal handlers was always line 0 and column 0. This poses problems when trying to extract meaningful profiling information. The change assigns the source location of the statement declaring the function as the function's source location. Task-number: QTCREATORBUG-11100 Change-Id: I4bb8682b35147a7cfe4ecec342d4a00623bb1e0d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml9
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp30
3 files changed, 41 insertions, 1 deletions
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml
new file mode 100644
index 0000000000..25e63669c4
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ onWidthChanged: console.log(width);
+ Component.onCompleted: width = 500;
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index a83927e720..d08ed31e8b 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -15,4 +15,5 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
OTHER_FILES += \
data/pixmapCacheTest.qml \
- data/controlFromJS.qml
+ data/controlFromJS.qml \
+ data/signalSourceLocation.qml
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index acbc62807b..276dcf5d29 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -181,6 +181,7 @@ private slots:
void scenegraphData();
void profileOnExit();
void controlFromJS();
+ void signalSourceLocation();
};
void QQmlProfilerClient::messageReceived(const QByteArray &message)
@@ -513,6 +514,35 @@ void tst_QQmlProfilerService::controlFromJS()
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
+void tst_QQmlProfilerService::signalSourceLocation()
+{
+ connect(true, "signalSourceLocation.qml");
+ QVERIFY(m_client);
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+ while (!(m_process->output().contains(QLatin1String("500"))))
+ QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
+ m_client->setTraceState(false);
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ QVERIFY(m_client->traceMessages[14].detailData.endsWith("signalSourceLocation.qml"));
+ QVERIFY(m_client->traceMessages[14].line == 8);
+ QVERIFY(m_client->traceMessages[14].column == 28);
+
+ QVERIFY(m_client->traceMessages[16].detailData.endsWith("signalSourceLocation.qml"));
+ QVERIFY(m_client->traceMessages[16].line == 7);
+ QVERIFY(m_client->traceMessages[16].column == 21);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+}
+
QTEST_MAIN(tst_QQmlProfilerService)
#include "tst_qqmlprofilerservice.moc"