Commit 8fa07c81 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Accept animations events with 0 animations

There is no reason why we shouldn't. Logically that would be an
animation frame without any running animations. The frame would still
have a frame rate and we can still tell if it's the GUI or render
thread.

Furthermore the assert might be triggered by invalid trace data.

Change-Id: I58578a941c5d1471dd1b299ed5f489ad160b2904
Reviewed-by: default avatarMilian Wolff <milian.wolff@kdab.com>
parent 13910a11
......@@ -85,7 +85,6 @@ void QmlProfilerAnimationsModel::loadEvent(const QmlEvent &event, const QmlEvent
lastEvent.typeId = event.typeIndex();
lastEvent.framerate = event.number<qint32>(0);
lastEvent.animationcount = event.number<qint32>(1);
QTC_ASSERT(lastEvent.animationcount > 0, return);
m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent);
......
......@@ -51,7 +51,7 @@ void QmlProfilerAnimationsModelTest::initTestCase()
for (int i = 0; i < 10; ++i) {
event.setTimestamp(i);
event.setNumbers<int>({frameRate(i), 20 - i, (i % 2) ? RenderThread : GuiThread});
event.setNumbers<int>({frameRate(i), 9 - i, (i % 2) ? RenderThread : GuiThread});
manager.addEvent(event);
}
manager.acquiringDone();
......@@ -69,8 +69,8 @@ void QmlProfilerAnimationsModelTest::testAccepted()
void QmlProfilerAnimationsModelTest::testRowMaxValue()
{
QCOMPARE(model.rowMaxValue(0), 0);
QCOMPARE(model.rowMaxValue(1), 20);
QCOMPARE(model.rowMaxValue(2), 19);
QCOMPARE(model.rowMaxValue(1), 9);
QCOMPARE(model.rowMaxValue(2), 8);
}
void QmlProfilerAnimationsModelTest::testRowNumbers()
......@@ -133,7 +133,7 @@ void QmlProfilerAnimationsModelTest::testDetails()
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Framerate")].toString(),
QString::fromLatin1("%1 FPS").arg(frameRate(i)));
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Animations")].toString(),
QString::number(20 - i));
QString::number(9 - i));
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Context")].toString(), i % 2 ?
QmlProfilerAnimationsModel::tr("Render Thread") :
QmlProfilerAnimationsModel::tr("GUI Thread"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment