forked from qt-creator/qt-creator
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: Milian Wolff <milian.wolff@kdab.com>
This commit is contained in:
@@ -85,7 +85,6 @@ void QmlProfilerAnimationsModel::loadEvent(const QmlEvent &event, const QmlEvent
|
|||||||
lastEvent.typeId = event.typeIndex();
|
lastEvent.typeId = event.typeIndex();
|
||||||
lastEvent.framerate = event.number<qint32>(0);
|
lastEvent.framerate = event.number<qint32>(0);
|
||||||
lastEvent.animationcount = event.number<qint32>(1);
|
lastEvent.animationcount = event.number<qint32>(1);
|
||||||
QTC_ASSERT(lastEvent.animationcount > 0, return);
|
|
||||||
|
|
||||||
m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent);
|
m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent);
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ void QmlProfilerAnimationsModelTest::initTestCase()
|
|||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
event.setTimestamp(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.addEvent(event);
|
||||||
}
|
}
|
||||||
manager.acquiringDone();
|
manager.acquiringDone();
|
||||||
@@ -69,8 +69,8 @@ void QmlProfilerAnimationsModelTest::testAccepted()
|
|||||||
void QmlProfilerAnimationsModelTest::testRowMaxValue()
|
void QmlProfilerAnimationsModelTest::testRowMaxValue()
|
||||||
{
|
{
|
||||||
QCOMPARE(model.rowMaxValue(0), 0);
|
QCOMPARE(model.rowMaxValue(0), 0);
|
||||||
QCOMPARE(model.rowMaxValue(1), 20);
|
QCOMPARE(model.rowMaxValue(1), 9);
|
||||||
QCOMPARE(model.rowMaxValue(2), 19);
|
QCOMPARE(model.rowMaxValue(2), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerAnimationsModelTest::testRowNumbers()
|
void QmlProfilerAnimationsModelTest::testRowNumbers()
|
||||||
@@ -133,7 +133,7 @@ void QmlProfilerAnimationsModelTest::testDetails()
|
|||||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Framerate")].toString(),
|
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Framerate")].toString(),
|
||||||
QString::fromLatin1("%1 FPS").arg(frameRate(i)));
|
QString::fromLatin1("%1 FPS").arg(frameRate(i)));
|
||||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Animations")].toString(),
|
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Animations")].toString(),
|
||||||
QString::number(20 - i));
|
QString::number(9 - i));
|
||||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Context")].toString(), i % 2 ?
|
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Context")].toString(), i % 2 ?
|
||||||
QmlProfilerAnimationsModel::tr("Render Thread") :
|
QmlProfilerAnimationsModel::tr("Render Thread") :
|
||||||
QmlProfilerAnimationsModel::tr("GUI Thread"));
|
QmlProfilerAnimationsModel::tr("GUI Thread"));
|
||||||
|
Reference in New Issue
Block a user