Commit 153a57ce authored by Ulf Hermann's avatar Ulf Hermann
Browse files

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: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent e1126473
......@@ -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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment