diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-04-08 18:05:20 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-04-09 13:41:51 +0000 |
commit | 153a57ce80cf278b6dcc52477d5f3e51c399cf2f (patch) | |
tree | 62c02cb707996eec7c56a84bc88e912c4a150ae1 /tests | |
parent | e112647397bd24d85863853e9b65ec1e16ac1c9c (diff) | |
download | qt-creator-153a57ce80cf278b6dcc52477d5f3e51c399cf2f.tar.gz |
Timeline: Test parenting of equal start times
If you insert events with equal start times in a way that the model can
not reorder them by their end times the parenting follows the indexes,
not the end times. This has caused confusion multiple times and it's
good to test it.
Change-Id: I3e9ba212ff377dc2afa2a2893637bb55edebafea
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp b/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp index c253503d9a..7080d11bba 100644 --- a/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp +++ b/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp @@ -88,6 +88,7 @@ private slots: void insertStartEnd(); void rowCount(); void prevNext(); + void parentingOfEqualStarts(); }; DummyModel::DummyModel(int modelId) : @@ -443,6 +444,22 @@ void tst_TimelineModel::prevNext() QCOMPARE(dummy.prevItemByTypeId(-1, 10, 5), 4); } +void tst_TimelineModel::parentingOfEqualStarts() +{ + DummyModel dummy; + // Trick it so that it cannot reorder the events and has to parent them in the "wrong" way ... + QCOMPARE(dummy.insert(1, 10, 998), 0); + QCOMPARE(dummy.insertStart(1, 999), 1); + dummy.insertEnd(1, 20); + dummy.computeNesting(); + + // .. which is reflected in the resulting order. + QCOMPARE(dummy.selectionId(0), 998); + QCOMPARE(dummy.selectionId(1), 999); + QCOMPARE(dummy.firstIndex(10), 0); + QCOMPARE(dummy.lastIndex(2), 1); +} + QTEST_MAIN(tst_TimelineModel) #include "tst_timelinemodel.moc" |