[pitivi] timeline: Ignore title clips when updating the assets



commit 87962bee5fc61608d9daac4e043042e9bd35dbc5
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Oct 9 00:11:48 2019 +0200

    timeline: Ignore title clips when updating the assets

 pitivi/timeline/timeline.py     |  4 +++-
 tests/test_timeline_timeline.py | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index cc7ade76..64b1f2b6 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1432,12 +1432,14 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
 
         Args:
             asset (GES.Asset): Only the clips who's current asset's target is
-                is this will be updated.
+                this will be updated.
             proxy (Ges.Asset): The proxy to use, or None to use the asset itself.
         """
         original_asset = get_proxy_target(asset)
         replacement_asset = proxy or asset
         for clip in self.timeline.clips():
+            if not isinstance(clip, GES.UriClip):
+                continue
             if get_proxy_target(clip) == original_asset:
                 clip.set_asset(replacement_asset)
         self._project.pipeline.commit_timeline()
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 76b4b69d..3877c398 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -23,6 +23,7 @@ from gi.repository import GES
 from gi.repository import Gst
 from gi.repository import Gtk
 
+from pitivi.timeline.timeline import TimelineContainer
 from pitivi.utils.timeline import UNSELECT
 from pitivi.utils.ui import LAYER_HEIGHT
 from pitivi.utils.ui import SEPARATOR_HEIGHT
@@ -779,3 +780,21 @@ class TestShiftSelection(BaseTestTimeline):
     def test_shift_selection_multiple_layers(self):
         self.__check_shift_selection_multiple_layers(left_click_also_seeks=False)
         self.__check_shift_selection_multiple_layers(left_click_also_seeks=True)
+
+
+class TestTimelineContainer(BaseTestTimeline):
+    """Tests for the TimelineContainer class."""
+
+    def test_update_clips_asset(self):
+        timeline_container = common.create_timeline_container()
+        mainloop = common.create_main_loop()
+        mainloop.run(until_empty=True)
+        ges_timeline = timeline_container.ges_timeline
+        layer, = ges_timeline.get_layers()
+        title_clip = GES.TitleClip()
+        title_clip.props.duration = 100
+        layer.add_clip(title_clip)
+        self.assertListEqual(list(timeline_container.timeline.clips()), [title_clip])
+
+        # Check the title clips are ignored.
+        timeline_container.update_clips_asset(mock.Mock(), mock.Mock())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]