diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-09-16 16:10:19 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-12-19 13:24:16 +0000 |
commit | 18332d15b5e2aaa15c8edc36be138429cfdce350 (patch) | |
tree | 8dc021ee4704a38e268b0961852c4b75d7929e4f /src/plugins/qmlprofiler/tests | |
parent | c2b89ae3b2a3431726b0d35567c3ae0fb4cd6bd0 (diff) |
Timeline: Move printTime() into Timeline and add hours, minutes, nanos
We should use it for all time printing instead of duplicating the code
everywhere.
Change-Id: I530baa31fd7044aefce6201fec0ab27c99a61a1d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/tests')
4 files changed, 11 insertions, 4 deletions
diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp index 7be5f04ff17..83ad6cf4788 100644 --- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp @@ -24,6 +24,9 @@ ****************************************************************************/ #include "debugmessagesmodel_test.h" + +#include <timeline/timelineformattime.h> + #include <QtTest> namespace QmlProfiler { @@ -93,7 +96,7 @@ void DebugMessagesModelTest::testDetails() QCOMPARE(details.value(QLatin1String("displayName")).toString(), model.tr(messageTypes[i % (QtMsgType::QtInfoMsg + 1)])); QCOMPARE(details.value(model.tr("Timestamp")).toString(), - QmlProfilerDataModel::formatTime(i)); + Timeline::formatTime(i)); QCOMPARE(details.value(model.tr("Message")).toString(), QString::fromLatin1("message %1").arg(i)); QCOMPARE(details.value(model.tr("Location")).toString(), diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp index c67856bc03b..2ae3d6957d5 100644 --- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp @@ -25,6 +25,8 @@ #include "inputeventsmodel_test.h" #include "timeline/timelinemodel_p.h" +#include "timeline/timelineformattime.h" + #include <QtTest> namespace QmlProfiler { @@ -105,7 +107,7 @@ void InputEventsModelTest::testDetails() { for (int i = 0; i < 10; ++i) { const QVariantMap details = model.details(i); - QCOMPARE(details[model.tr("Timestamp")].toString(), QmlProfilerDataModel::formatTime(i)); + QCOMPARE(details[model.tr("Timestamp")].toString(), Timeline::formatTime(i)); QString displayName = details[QString("displayName")].toString(); QVERIFY(!displayName.isEmpty()); switch (static_cast<InputEventType>(i % MaximumInputEventType)) { diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp index 069de0cca1c..cc7beb7ec66 100644 --- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "pixmapcachemodel_test.h" +#include <timeline/timelineformattime.h> #include <QtTest> namespace QmlProfiler { @@ -248,7 +249,7 @@ void PixmapCacheModelTest::testConsistency() QVERIFY(expandedRow < model.expandedRowCount()); QVERIFY(details[QLatin1String("displayName")].toString() == model.tr("Image Loaded")); QCOMPARE(details[model.tr("Duration")].toString(), - QmlProfilerDataModel::formatTime(model.duration(i))); + Timeline::formatTime(model.duration(i))); // In expanded view pixmaps of the same URL but different sizes are allowed to overlap. // It looks bad, but that should be a rare thing. break; diff --git a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp index ee90b4fc266..67ecda8c84c 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "qmlprofileranimationsmodel_test.h" +#include <timeline/timelineformattime.h> #include <QtTest> namespace QmlProfiler { @@ -127,7 +128,7 @@ void QmlProfilerAnimationsModelTest::testDetails() QVariantMap details = model.details(i); QCOMPARE(details["displayName"].toString(), model.displayName()); QCOMPARE(details[QmlProfilerAnimationsModel::tr("Duration")].toString(), - QmlProfilerDataModel::formatTime(1)); + Timeline::formatTime(1)); QCOMPARE(details[QmlProfilerAnimationsModel::tr("Framerate")].toString(), QString::fromLatin1("%1 FPS").arg(frameRate(i))); QCOMPARE(details[QmlProfilerAnimationsModel::tr("Animations")].toString(), |