From 59e641f8e627a956d067c02dcdeba08fe2340d26 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 20 Apr 2018 18:01:15 +0200 Subject: [PATCH] QmlProfiler: Fix flame graph view test Clicking in an empty area closes the details window now. Change-Id: I7108b6339021707097bd2a852230fa60473d18e5 Reviewed-by: Tobias Hunger --- .../qmlprofiler/tests/flamegraphview_test.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp index 10b47fb61bc..c5c324c81c3 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphview_test.cpp @@ -58,8 +58,9 @@ void FlameGraphViewTest::testSelection() QCOMPARE(file, QLatin1String("somefile.js")); }); - auto con2 = connect(&view, &QmlProfilerEventsView::typeSelected, [](int selected) { - QCOMPARE(selected, 0); + int expectedType = 0; + auto con2 = connect(&view, &QmlProfilerEventsView::typeSelected, [&](int selected) { + QCOMPARE(selected, expectedType); }); QSignalSpy spy(&view, SIGNAL(typeSelected(int))); @@ -71,12 +72,13 @@ void FlameGraphViewTest::testSelection() view.selectByTypeId(1); QCOMPARE(spy.count(), 1); - // Click in empty area shouldn't change anything, either + // Click in empty area deselects + expectedType = -1; QTest::mouseClick(view.childAt(250, 250), Qt::LeftButton, Qt::NoModifier, QPoint(495, 50)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.count(), 2); view.onVisibleFeaturesChanged(1 << ProfileBinding); - QCOMPARE(spy.count(), 1); // External event: still doesn't change anything + QCOMPARE(spy.count(), 2); // External event: still doesn't change anything disconnect(con1); disconnect(con2);