From 1757ae2e5e84d63a0b738426d615d1f891377997 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 11 Aug 2016 13:19:44 -0400 Subject: [PATCH] ges: Handle moving groups with effects inside 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 | 2 +- tests/check/python/test_group.py | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/ges/ges-auto-transition.c b/ges/ges-auto-transition.c index 3961621..d52d1c4 100644 --- a/ges/ges-auto-transition.c +++ b/ges/ges-auto-transition.c @@ -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)); diff --git a/tests/check/python/test_group.py b/tests/check/python/test_group.py index 87c097c..5221f7e 100644 --- a/tests/check/python/test_group.py +++ b/tests/check/python/test_group.py @@ -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) -- 2.7.4