QmlProfiler: Don't expose the vector of event types

We always want either the total number of event types or one specific
type. There is no need to expose the fact that we keep them as a vector.

Also, use int as the type of the "number" methods as that aligns better
with Qt containers, and rename the methods. We don't need to state the
fact that we've loaded the events and types at some point.

Change-Id: Iaf680ec9fa10e1070ddee6bcc079800e401775f0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ulf Hermann
2018-03-28 09:42:28 +02:00
parent 7ca958fa85
commit dcd8d37f35
19 changed files with 77 additions and 66 deletions

View File

@@ -98,21 +98,21 @@ void QmlProfilerToolTest::testClearEvents()
stateManager->setCurrentState(QmlProfilerStateManager::AppRunning);
stateManager->setServerRecording(true);
QCOMPARE(modelManager->numLoadedEventTypes(), 0u);
QCOMPARE(modelManager->numLoadedEvents(), 0u);
QCOMPARE(modelManager->numEventTypes(), 0);
QCOMPARE(modelManager->numEvents(), 0);
modelManager->addEventType(QmlEventType());
modelManager->addEvent(QmlEvent(0, 0, ""));
QCOMPARE(modelManager->numLoadedEventTypes(), 1u);
QCOMPARE(modelManager->numLoadedEvents(), 1u);
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 1);
stateManager->setServerRecording(false);
QCOMPARE(modelManager->numLoadedEventTypes(), 1u);
QCOMPARE(modelManager->numLoadedEvents(), 1u);
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 1);
stateManager->setServerRecording(true); // clears previous events, but not types
QCOMPARE(modelManager->numLoadedEventTypes(), 1u);
QCOMPARE(modelManager->numLoadedEvents(), 0u);
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 0);
modelManager->addEvent(QmlEvent(0, 0, ""));
QCOMPARE(modelManager->numLoadedEventTypes(), 1u);
QCOMPARE(modelManager->numLoadedEvents(), 1u);
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 1);
}
} // namespace Internal