Commit 2306f442 authored by Nicolas Carion's avatar Nicolas Carion

[Timeline2][Model] Slight test reorganization

parent 3627ab0c
......@@ -68,7 +68,7 @@ TEST_CASE("Basic creation/deletion of a clip", "[ClipModel]")
REQUIRE(timeline->getClipsCount() == 0);
}
TEST_CASE("Insert a clip in a track and change track", "[ClipModel]")
TEST_CASE("Clip manipulation", "[ClipModel]")
{
std::shared_ptr<TimelineModel> timeline = TimelineModel::construct();
......@@ -80,78 +80,80 @@ TEST_CASE("Insert a clip in a track and change track", "[ClipModel]")
int cid1 = ClipModel::construct(timeline, producer);
int tid1 = TrackModel::construct(timeline);
int tid2 = TrackModel::construct(timeline);
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getClipTrackId(cid1) == -1);
REQUIRE(timeline->getClipPosition(cid1) == -1);
int pos = 10;
//dry
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, pos,true));
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getClipTrackId(cid1) == -1);
REQUIRE(timeline->getClipPosition(cid1) == -1);
//real insert
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, pos));
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
pos = 1;
//dry
REQUIRE(timeline->requestClipChangeTrack(cid1, tid2, pos,true));
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == 10);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
//real
REQUIRE(timeline->requestClipChangeTrack(cid1, tid2, pos));
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
// Check conflicts
int cid2 = ClipModel::construct(timeline, producer);
int pos2 = producer->get_playtime();
REQUIRE(timeline->requestClipChangeTrack(cid2, tid1, pos2));
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 + 2, true));
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 + 2));
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 - 2, true));
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 - 2));
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, 0));
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getTrackClipsCount(tid1) == 2);
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == 0);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
SECTION("Insert a clip in a track and change track") {
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getClipTrackId(cid1) == -1);
REQUIRE(timeline->getClipPosition(cid1) == -1);
int pos = 10;
//dry
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, pos,true));
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getClipTrackId(cid1) == -1);
REQUIRE(timeline->getClipPosition(cid1) == -1);
//real insert
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, pos));
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
pos = 1;
//dry
REQUIRE(timeline->requestClipChangeTrack(cid1, tid2, pos,true));
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == 10);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
//real
REQUIRE(timeline->requestClipChangeTrack(cid1, tid2, pos));
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 0);
// Check conflicts
int pos2 = producer->get_playtime();
REQUIRE(timeline->requestClipChangeTrack(cid2, tid1, pos2));
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 + 2, true));
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 + 2));
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 - 2, true));
REQUIRE_FALSE(timeline->requestClipChangeTrack(cid1, tid1, pos2 - 2));
REQUIRE(timeline->getTrackClipsCount(tid2) == 1);
REQUIRE(timeline->getTrackClipsCount(tid1) == 1);
REQUIRE(timeline->getClipTrackId(cid1) == tid2);
REQUIRE(timeline->getClipPosition(cid1) == pos);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
REQUIRE(timeline->requestClipChangeTrack(cid1, tid1, 0));
REQUIRE(timeline->getTrackClipsCount(tid2) == 0);
REQUIRE(timeline->getTrackClipsCount(tid1) == 2);
REQUIRE(timeline->getClipTrackId(cid1) == tid1);
REQUIRE(timeline->getClipPosition(cid1) == 0);
REQUIRE(timeline->getClipTrackId(cid2) == tid1);
REQUIRE(timeline->getClipPosition(cid2) == pos2);
}
}
TEST_CASE("Check id unicity", "[ClipModel]")
......
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