From a6c3b57677425ade55bcae1fbdc61e99becdb1b3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 9 May 2017 11:51:01 +0200 Subject: [PATCH] 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 --- src/plugins/qmlprofiler/tests/flamegraphview_test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp index 56a2a859f2b..22ef4668b9b 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp @@ -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(); }