Commit 6743d1d0 authored by Fabián Orccón's avatar Fabián Orccón Committed by Alexandru Băluț

timeline: Fix undo split clip

Differential Revision: https://phabricator.freedesktop.org/D621
parent b3ac86b2
......@@ -1631,7 +1631,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
If clips are selected, split them at the current playhead position.
Otherwise, split all clips at the playhead position.
"""
self.app.action_log.begin("split clip")
self._splitElements(self.timeline.selection.selected)
self.app.action_log.commit()
self.timeline.hideSnapBar()
self._project.pipeline.commit_timeline()
......
......@@ -343,3 +343,30 @@ class TestTimelineUndo(TestCase):
self.assertEqual(1, len(timeline_clips))
self.assertEqual(5 * Gst.SECOND, timeline_clips[0].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[0].get_duration())
def testSplitClip(self):
clip = GES.TitleClip()
clip.set_start(0 * Gst.SECOND)
clip.set_duration(20 * Gst.SECOND)
self.layer.add_clip(clip)
self.action_log.begin("split clip")
clip1 = clip.split(10 * Gst.SECOND)
self.assertEqual(2, len(self.layer.get_clips()))
self.action_log.commit()
self.action_log.begin("split clip")
clip2 = clip1.split(15 * Gst.SECOND)
self.assertEqual(3, len(self.layer.get_clips()))
self.action_log.commit()
self.action_log.undo()
self.assertEqual(2, len(self.layer.get_clips()))
self.action_log.undo()
self.assertEqual(1, len(self.layer.get_clips()))
self.action_log.redo()
self.assertEqual(2, len(self.layer.get_clips()))
self.action_log.redo()
self.assertEqual(3, len(self.layer.get_clips()))
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