QmlProfiler: Fix flame graph view test

Clicking in an empty area closes the details window now.

Change-Id: I7108b6339021707097bd2a852230fa60473d18e5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ulf Hermann
2018-04-20 18:01:15 +02:00
parent 1770c2ffe2
commit 59e641f8e6

View File

@@ -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);