ges: Handle moving groups with effects inside
authorThibault Saunier <tsaunier@gnome.org>
Thu, 11 Aug 2016 17:19:44 +0000 (13:19 -0400)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 26 Sep 2016 16:33:00 +0000 (13:33 -0300)
We were only concidering that we should let the group handle moving
transitions when changing transitions but in fact as soon as a
transition is happenning between two clips that are in a same group
the group properly handles moving the transition, so let the
group do its job.

Fixes T7543

Differential Revision: https://phabricator.freedesktop.org/D1281

ges/ges-auto-transition.c
tests/check/python/test_group.py

index 3961621..d52d1c4 100644 (file)
@@ -43,7 +43,7 @@ neighbour_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
   GESTimelineElement *parent =
       ges_timeline_element_get_toplevel_parent (GES_TIMELINE_ELEMENT (clip));
 
-  if (!g_strcmp0 (g_param_spec_get_name (arg), "priority") && parent) {
+  if (parent) {
     GESTimelineElement *prev_topparent =
         ges_timeline_element_get_toplevel_parent (GES_TIMELINE_ELEMENT
         (self->next_source));
index 87c097c..5221f7e 100644 (file)
@@ -199,3 +199,55 @@ class TestGroup(unittest.TestCase):
         self.assertEqual(len(layer.get_clips()), 2)
         for clip in layer.get_clips():
             self.assertEqual(clip.get_parent(), group)
+
+    def test_moving_group_with_transition(self):
+        self.timeline.props.auto_transition = True
+        clip1 = GES.TestClip.new()
+        clip1.props.start = 0
+        clip1.props.duration = 30
+
+        clip2 = GES.TestClip.new()
+        clip2.props.start = 20
+        clip2.props.duration = 20
+
+        self.layer.add_clip(clip1)
+        self.layer.add_clip(clip2)
+
+        clips = self.layer.get_clips()
+        self.assertEqual(len(clips), 4)
+
+        video_transition = None
+        audio_transition = None
+        for clip in clips:
+            if isinstance(clip, GES.TransitionClip):
+                if isinstance(clip.get_children(False)[0], GES.VideoTransition):
+                    video_transition = clip
+                else:
+                    audio_transition = clip
+        self.assertIsNotNone(audio_transition)
+        self.assertIsNotNone(video_transition)
+
+        self.assertEqual(video_transition.props.start, 20)
+        self.assertEqual(video_transition.props.duration, 10)
+        self.assertEqual(audio_transition.props.start, 20)
+        self.assertEqual(audio_transition.props.duration, 10)
+
+        group = GES.Container.group(clips)
+        self.assertIsNotNone(group)
+
+        self.assertTrue(clip2.edit(
+            self.timeline.get_layers(), 0,
+            GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE, 25))
+        clip2.props.start = 25
+
+        clips = self.layer.get_clips()
+        self.assertEqual(len(clips), 4)
+        self.assertEqual(clip1.props.start, 5)
+        self.assertEqual(clip1.props.duration, 30)
+        self.assertEqual(clip2.props.start, 25)
+        self.assertEqual(clip2.props.duration, 20)
+
+        self.assertEqual(video_transition.props.start, 25)
+        self.assertEqual(video_transition.props.duration, 10)
+        self.assertEqual(audio_transition.props.start, 25)
+        self.assertEqual(audio_transition.props.duration, 10)