Commit 406c56cc authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix tests :)

parent 24f6b42d
Pipeline #32799 passed with stage
in 50 minutes and 52 seconds
......@@ -1029,7 +1029,18 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
TRACE(binClipId, trackId, position, id, logUndo, refreshView, useTargets);
Fun undo = []() { return true; };
Fun redo = []() { return true; };
bool result = requestClipInsertion(binClipId, trackId, position, id, logUndo, refreshView, useTargets, undo, redo);
QVector<int> allowedTracks;
if (useTargets) {
auto it = m_allTracks.cbegin();
while (it != m_allTracks.cend()) {
int target_track = (*it)->getId();
if (getTrackById_const(target_track)->shouldReceiveTimelineOp()) {
allowedTracks << target_track;
}
++it;
}
}
bool result = requestClipInsertion(binClipId, trackId, position, id, logUndo, refreshView, useTargets, undo, redo, allowedTracks);
if (result && logUndo) {
PUSH_UNDO(undo, redo, i18n("Insert Clip"));
}
......
......@@ -55,6 +55,7 @@ TrackModel::TrackModel(const std::weak_ptr<TimelineModel> &parent, int id, const
// For now we never use the second playlist, only planned for same track transitions
m_playlists[1].set("hide", 3);
m_track->set("kdenlive:trackheight", KdenliveSettings::trackheight());
m_track->set("kdenlive:timeline_active", 1);
m_effectStack = EffectStackModel::construct(m_mainPlaylist, {ObjectType::TimelineTrack, m_id}, ptr->m_undoStack);
// TODO
// When we use the second playlist, register it's stask as child of main playlist effectstack
......
......@@ -617,7 +617,6 @@ void TimelineController::addTrack(int tid)
int newTid;
result = m_model->requestTrackInsertion(d->selectedTrackPosition(), newTid, d->trackName(), d->addAudioTrack(), undo, redo);
if (result) {
m_model->setTrackProperty(newTid, "kdenlive:timeline_active", QStringLiteral("1"));
if (addAVTrack) {
int newTid2;
int mirrorPos = 0;
......@@ -626,9 +625,6 @@ void TimelineController::addTrack(int tid)
mirrorPos = m_model->getTrackMltIndex(mirrorId);
}
result = m_model->requestTrackInsertion(mirrorPos, newTid2, d->trackName(), true, undo, redo);
if (result) {
m_model->setTrackProperty(newTid2, "kdenlive:timeline_active", QStringLiteral("1"));
}
}
if (audioRecTrack) {
m_model->setTrackProperty(newTid, "kdenlive:audio_rec", QStringLiteral("1"));
......@@ -3657,9 +3653,7 @@ void TimelineController::addTracks(int videoTracks, int audioTracks)
result = m_model->requestTrackInsertion(-1, newTid, QString(), false, undo, redo);
videoTracks--;
}
if (result) {
m_model->setTrackProperty(newTid, "kdenlive:timeline_active", QStringLiteral("1"));
} else {
if (!result) {
break;
}
}
......
......@@ -932,6 +932,10 @@ TEST_CASE("Clip manipulation", "[ClipModel]")
QString binId3 = createProducerWithSound(profile_model, binModel);
int cid6 = -1;
// Setup insert stream data
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline->m_binAudioTargets = audioInfo;
REQUIRE(timeline->requestClipInsertion(binId3, tid5, 3, cid6, true, true, false));
int cid7 = timeline->m_groups->getSplitPartner(cid6);
......
......@@ -629,8 +629,9 @@ TEST_CASE("FuzzBug2")
undoStack->redo();
REQUIRE(timeline_0->checkConsistency());
{
int res = timeline_0->requestClipsGroup({3, 2}, true, GroupType::AVSplit);
REQUIRE(res == -1);
// Grouping 2 audio clips as AVSplit, this is now possible with multiple streams
//int res = timeline_0->requestClipsGroup({3, 2}, true, GroupType::AVSplit);
//REQUIRE(res == -1);
}
REQUIRE(timeline_0->checkConsistency());
undoStack->undo();
......@@ -667,6 +668,10 @@ TEST_CASE("FuzzBug3")
undoStack->redo();
REQUIRE(timeline_0->checkConsistency());
TrackModel::construct(timeline_0, -1, 0, "0", true);
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline_0->m_binAudioTargets = audioInfo;
REQUIRE(timeline_0->checkConsistency());
undoStack->undo();
REQUIRE(timeline_0->checkConsistency());
......@@ -819,7 +824,7 @@ TEST_CASE("FuzzBug5")
undoStack->redo();
REQUIRE(timeline_0->checkConsistency());
REQUIRE(timeline_1->checkConsistency());
createProducerWithSound(reg_profile, binModel);
createProducerWithSound(reg_profile, binModel);
REQUIRE(timeline_0->checkConsistency());
REQUIRE(timeline_1->checkConsistency());
undoStack->undo();
......@@ -844,11 +849,26 @@ TEST_CASE("FuzzBug5")
REQUIRE(timeline_0->checkConsistency());
REQUIRE(timeline_1->checkConsistency());
undoStack->redo();
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline_1->m_binAudioTargets = audioInfo;
timeline_1->m_videoTarget = 5;
QMap <int, int>audioTarget;
audioTarget.insert(6,1);
timeline_1->m_audioTarget = audioTarget;
/*timeline_1->setTrackProperty(4, "kdenlive:timeline_active", QStringLiteral("1"));
timeline_1->setTrackProperty(5, "kdenlive:timeline_active", QStringLiteral("1"));
timeline_1->setTrackProperty(6, "kdenlive:timeline_active", QStringLiteral("1"));*/
REQUIRE(timeline_0->checkConsistency());
REQUIRE(timeline_1->checkConsistency());
{
int dummy_3;
bool res = timeline_1->requestClipInsertion("2", 5, 0, dummy_3, true, false, true);
qDebug()<<"==== INSERTED FIRST CLIP DURATION: "<<timeline_1->getClipPlaytime(dummy_3);
REQUIRE(res == true);
}
REQUIRE(timeline_0->checkConsistency());
......@@ -1284,6 +1304,11 @@ TEST_CASE("FuzzBug11")
undoStack->redo();
REQUIRE(timeline_0->checkConsistency());
createProducerWithSound(reg_profile, binModel);
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline_0->m_binAudioTargets = audioInfo;
REQUIRE(timeline_0->checkConsistency());
undoStack->undo();
REQUIRE(timeline_0->checkConsistency());
......
......@@ -30,6 +30,7 @@ QString createProducerWithSound(Mlt::Profile &prof, std::shared_ptr<ProjectItemM
// In case the test system does not have avformat support, we can switch to the integrated blipflash producer
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, "blipflash");
producer->set("length", 10);
producer->set_in_and_out(0, 9);
producer->set("kdenlive:duration", 10);
......
......@@ -447,8 +447,15 @@ TEST_CASE("Advanced trimming operations", "[Trimming]")
SECTION("Cut should preserve AV groups")
{
QString binId3 = createProducerWithSound(profile_trimming, binModel);
int tid6 = TrackModel::construct(timeline, -1, -1, QString(), true);
int tid5 = TrackModel::construct(timeline);
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline->m_binAudioTargets = audioInfo;
timeline->m_videoTarget = tid5;
int cid6 = -1;
int pos = 3;
......@@ -558,6 +565,12 @@ TEST_CASE("Insert/delete", "[Trimming2]")
int tid2 = TrackModel::construct(timeline, -1, -1, QString(), true);
int tid1 = TrackModel::construct(timeline);
TrackModel::construct(timeline);
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline->m_binAudioTargets = audioInfo;
timeline->m_videoTarget = tid1;
SECTION("Remove Space should preserve groups")
{
......@@ -728,6 +741,12 @@ TEST_CASE("Copy/paste", "[CP]")
int tid2 = TrackModel::construct(timeline, -1, -1, QString(), true);
int tid1 = TrackModel::construct(timeline);
int tid1b = TrackModel::construct(timeline);
// Setup timeline audio drop info
QMap <int, QString>audioInfo;
audioInfo.insert(1,QStringLiteral("stream1"));
timeline->m_binAudioTargets = audioInfo;
timeline->m_videoTarget = tid1;
SECTION("Simple copy paste of one clip")
{
......
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