aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-05-14 09:34:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-07-16 10:03:30 +0000
commitc679b3202a8622b47d4508799e6eb0cbb80d5f24 (patch)
tree86b64e810b188ae1e8f88650ee40cb1f0a584ca9 /tests
parent96982d61775b0a3556d6bff71a9d7aeb370cbf56 (diff)
Tracing: Simplify TimelineModel signals
Instead of laborously calculating which properties have changed under which circumstances, we can just connect the signals of dependent properties. This will give us a few false positive signals at a greatly reduced risk of missing some actual change. Also, the number of expanded and collapsed rows will always be determined by the content of the model. We don't need separate signals for those. Change-Id: Id8495ee525a91405b039fd032509afa125f96412 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tracing/timelinemodel/tst_timelinemodel.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/auto/tracing/timelinemodel/tst_timelinemodel.cpp b/tests/auto/tracing/timelinemodel/tst_timelinemodel.cpp
index be527af1273..812f51d2267 100644
--- a/tests/auto/tracing/timelinemodel/tst_timelinemodel.cpp
+++ b/tests/auto/tracing/timelinemodel/tst_timelinemodel.cpp
@@ -108,6 +108,7 @@ void DummyModel::loadData()
computeNesting();
setCollapsedRowCount(2);
setExpandedRowCount(3);
+ emit contentChanged();
}
tst_TimelineModel::tst_TimelineModel() :
@@ -216,7 +217,6 @@ void tst_TimelineModel::height()
int heightAfterLastSignal = 0;
int heightChangedSignals = 0;
connect(&dummy, &Timeline::TimelineModel::heightChanged, [&](){
- QVERIFY(dummy.height() != heightAfterLastSignal);
++heightChangedSignals;
heightAfterLastSignal = dummy.height();
});
@@ -432,20 +432,17 @@ void tst_TimelineModel::insertStartEnd()
void tst_TimelineModel::rowCount()
{
DummyModel dummy(&aggregator);
- QSignalSpy expandedSpy(&dummy, SIGNAL(expandedRowCountChanged()));
- QSignalSpy collapsedSpy(&dummy, SIGNAL(collapsedRowCountChanged()));
+ QSignalSpy contentSpy(&dummy, SIGNAL(contentChanged()));
QCOMPARE(dummy.rowCount(), 1);
dummy.setExpanded(true);
QCOMPARE(dummy.rowCount(), 1);
dummy.loadData();
- QCOMPARE(expandedSpy.count(), 1);
- QCOMPARE(collapsedSpy.count(), 1);
+ QCOMPARE(contentSpy.count(), 1);
QCOMPARE(dummy.rowCount(), 3);
dummy.setExpanded(false);
QCOMPARE(dummy.rowCount(), 2);
dummy.clear();
- QCOMPARE(expandedSpy.count(), 2);
- QCOMPARE(collapsedSpy.count(), 2);
+ QCOMPARE(contentSpy.count(), 2);
QCOMPARE(dummy.rowCount(), 1);
}