Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix tests

parent 84dbc61c
......@@ -676,7 +676,7 @@ int TimelineModel::suggestClipMove(int clipId, int trackId, int position, int cu
Q_ASSERT(isTrack(trackId));
int currentPos = getClipPosition(clipId);
int sourceTrackId = getClipTrackId(clipId);
if (getTrackById_const(trackId)->isAudioTrack() != getTrackById_const(sourceTrackId)->isAudioTrack()) {
if (sourceTrackId > -1 && getTrackById_const(trackId)->isAudioTrack() != getTrackById_const(sourceTrackId)->isAudioTrack()) {
// Trying move on incompatible track type, stay on same track
trackId = sourceTrackId;
}
......
......@@ -1642,8 +1642,8 @@ TEST_CASE("Snapping", "[Snapping]")
int beg = 30;
// in the absence of other clips, a valid move shouldn't be modified
for (int snap = -1; snap <= 5; ++snap) {
REQUIRE(timeline->suggestClipMove(cid2, tid2, beg, snap) == beg);
REQUIRE(timeline->suggestClipMove(cid2, tid2, beg + length, snap) == beg + length);
REQUIRE(timeline->suggestClipMove(cid2, tid2, beg, -1, snap) == beg);
REQUIRE(timeline->suggestClipMove(cid2, tid2, beg + length, -1, snap) == beg + length);
REQUIRE(timeline->checkConsistency());
}
......@@ -1653,11 +1653,11 @@ TEST_CASE("Snapping", "[Snapping]")
// Now a clip in second track should snap to beginning
auto check_snap = [&](int pos, int perturb, int snap) {
if (snap >= perturb) {
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos + perturb, snap) == pos);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos - perturb, snap) == pos);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos + perturb, -1, snap) == pos);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos - perturb, -1, snap) == pos);
} else {
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos + perturb, snap) == pos + perturb);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos - perturb, snap) == pos - perturb);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos + perturb, -1, snap) == pos + perturb);
REQUIRE(timeline->suggestClipMove(cid2, tid2, pos - perturb, -1, snap) == pos - perturb);
}
};
for (int snap = -1; snap <= 5; ++snap) {
......
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