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

Fix tests

parent c8bfab7b
Pipeline #18522 passed with stage
in 9 minutes and 15 seconds
...@@ -906,6 +906,9 @@ std::unique_ptr<Mlt::Producer> Core::getTrackProducerInstance(int tid) ...@@ -906,6 +906,9 @@ std::unique_ptr<Mlt::Producer> Core::getTrackProducerInstance(int tid)
bool Core::enableMultiTrack(bool enable) bool Core::enableMultiTrack(bool enable)
{ {
if (!m_guiConstructed || !m_mainWindow->getCurrentTimeline()) {
return false;
}
bool isMultiTrack = pCore->monitorManager()->isMultiTrack(); bool isMultiTrack = pCore->monitorManager()->isMultiTrack();
if (isMultiTrack || enable) { if (isMultiTrack || enable) {
pCore->window()->getMainTimeline()->controller()->slotMultitrackView(enable, enable); pCore->window()->getMainTimeline()->controller()->slotMultitrackView(enable, enable);
......
...@@ -1567,23 +1567,27 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim ...@@ -1567,23 +1567,27 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
} }
} }
if (!clipsImported) { if (!clipsImported) {
QTimer::singleShot(200, timeline.get(), [timeline, copiedItems, position]() { // Clips from same document, directly proceed to pasting
TimelineFunctions::pasteTimelineClips(timeline, copiedItems, position); return TimelineFunctions::pasteTimelineClips(timeline, copiedItems, position, undo, redo, false);
});
} }
qDebug()<<"++++++++++++\nWAITIND FOR BIN INSERTION: "<<waitingBinIds<<"\n\n+++++++++++++"; qDebug()<<"++++++++++++\nWAITIND FOR BIN INSERTION: "<<waitingBinIds<<"\n\n+++++++++++++";
return true; return true;
} }
bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position) bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position)
{
std::function<bool(void)> timeline_undo = []() { return true; };
std::function<bool(void)> timeline_redo = []() { return true; };
return TimelineFunctions::pasteTimelineClips(timeline, copiedItems, position, timeline_undo, timeline_redo, true);
}
bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position, Fun &timeline_undo, Fun & timeline_redo, bool pushToStack)
{ {
// Wait until all bin clips are inserted // Wait until all bin clips are inserted
QDomNodeList clips = copiedItems.documentElement().elementsByTagName(QStringLiteral("clip")); QDomNodeList clips = copiedItems.documentElement().elementsByTagName(QStringLiteral("clip"));
QDomNodeList compositions = copiedItems.documentElement().elementsByTagName(QStringLiteral("composition")); QDomNodeList compositions = copiedItems.documentElement().elementsByTagName(QStringLiteral("composition"));
int offset = copiedItems.documentElement().attribute(QStringLiteral("offset")).toInt(); int offset = copiedItems.documentElement().attribute(QStringLiteral("offset")).toInt();
std::function<bool(void)> timeline_undo = []() { return true; };
std::function<bool(void)> timeline_redo = []() { return true; };
bool res = true; bool res = true;
QLocale locale; QLocale locale;
std::unordered_map<int, int> correspondingIds; std::unordered_map<int, int> correspondingIds;
...@@ -1684,7 +1688,9 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod ...@@ -1684,7 +1688,9 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
PUSH_FRONT_LAMBDA(unselect, timeline_undo); PUSH_FRONT_LAMBDA(unselect, timeline_undo);
PUSH_FRONT_LAMBDA(unselect, timeline_redo); PUSH_FRONT_LAMBDA(unselect, timeline_redo);
//UPDATE_UNDO_REDO_NOLOCK(timeline_redo, timeline_undo, undo, redo); //UPDATE_UNDO_REDO_NOLOCK(timeline_redo, timeline_undo, undo, redo);
pCore->pushUndo(timeline_undo, timeline_redo, i18n("Paste timeline clips")); if (pushToStack) {
pCore->pushUndo(timeline_undo, timeline_redo, i18n("Paste timeline clips"));
}
semaphore.release(1); semaphore.release(1);
return true; return true;
} }
......
...@@ -63,6 +63,7 @@ struct TimelineFunctions ...@@ -63,6 +63,7 @@ struct TimelineFunctions
static bool pasteClips(const std::shared_ptr<TimelineItemModel> &timeline, const QString &pasteString, int trackId, int position); static bool pasteClips(const std::shared_ptr<TimelineItemModel> &timeline, const QString &pasteString, int trackId, int position);
static bool pasteClips(const std::shared_ptr<TimelineItemModel> &timeline, const QString &pasteString, int trackId, int position, Fun &undo, Fun &redo); static bool pasteClips(const std::shared_ptr<TimelineItemModel> &timeline, const QString &pasteString, int trackId, int position, Fun &undo, Fun &redo);
static bool pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position); static bool pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position);
static bool pasteTimelineClips(const std::shared_ptr<TimelineItemModel> &timeline, QDomDocument copiedItems, int position, Fun &timeline_undo, Fun &timeline_redo, bool pushToStack);
/* @brief Request the addition of multiple clips to the timeline /* @brief Request the addition of multiple clips to the timeline
* If the addition of any of the clips fails, the entire operation is undone. * If the addition of any of the clips fails, the entire operation is undone.
......
...@@ -873,7 +873,7 @@ TEST_CASE("FuzzBug5") ...@@ -873,7 +873,7 @@ TEST_CASE("FuzzBug5")
REQUIRE(timeline_0->checkConsistency()); REQUIRE(timeline_0->checkConsistency());
REQUIRE(timeline_1->checkConsistency()); REQUIRE(timeline_1->checkConsistency());
{ {
bool res = timeline_1->requestGroupMove(10, 9, 0, 0, false, false); bool res = timeline_1->requestGroupMove(10, 9, 0, 0, true, false, false);
REQUIRE(res == false); REQUIRE(res == false);
} }
REQUIRE(timeline_0->checkConsistency()); REQUIRE(timeline_0->checkConsistency());
......
...@@ -1052,7 +1052,6 @@ TEST_CASE("Copy/paste", "[CP]") ...@@ -1052,7 +1052,6 @@ TEST_CASE("Copy/paste", "[CP]")
cid4 = timeline->m_groups->getSplitPartner(cid3); cid4 = timeline->m_groups->getSplitPartner(cid3);
state2(tid2b); state2(tid2b);
} }
binModel->clean(); binModel->clean();
pCore->m_projectManager = nullptr; pCore->m_projectManager = nullptr;
Logger::print_trace(); Logger::print_trace();
......
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