Commit a6c3b576 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Fix flame graph context menu test

The context menu event can be generated multiple times within one loop
of QTRY_VERIFY. The result is that multiple showFullRange() signals can
be generated before we check again for spy.count() == 1. Thus, the check
never succeeds and the number of signals keeps growing.

We connect the showFullRange() signal to the model manager in order to
get a more realistic test setup. This way the action that generates the
showFullRange() signal is disabled in any further context menus, just as
it is supposed to be. In addition we can now check for the manager to
actually show the full range.

Change-Id: I5e13c2666ce1a15c7a5fad57affd4274d9656656
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 314f77fa
......@@ -40,6 +40,8 @@ FlameGraphViewTest::FlameGraphViewTest(QObject *parent) : QObject(parent), view(
void FlameGraphViewTest::initTestCase()
{
connect(&view, &QmlProfilerEventsView::showFullRange,
this, [this](){ manager.restrictToRange(-1, -1); });
FlameGraphModelTest::generateData(&manager);
QCOMPARE(manager.state(), QmlProfilerModelManager::Done);
view.resize(500, 500);
......@@ -151,6 +153,7 @@ void FlameGraphViewTest::testContextMenu()
QVERIFY(manager.isRestrictedToRange());
QTRY_COMPARE(spy.count(), 1);
QVERIFY(menuClicks > 1);
QVERIFY(!manager.isRestrictedToRange());
timer.stop();
}
......
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