tests_: Check the order of signals when a transition is created
authorAlexandru Băluț <alexandru.balut@gmail.com>
Wed, 19 Oct 2016 15:36:49 +0000 (15:36 +0000)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 9 Jan 2017 22:49:17 +0000 (19:49 -0300)
Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1391

tests/check/python/test_timeline.py

index b10948c4a0baad8a6e7d22449f5e907212cd7054..f7d3556ec3ab4b40796db6c2a2abc48909896a2e 100644 (file)
@@ -132,3 +132,31 @@ class TestSnapping(GESSimpleTimelineTest):
         clip2.edit([], self.layer.get_priority(), GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE,
                    clip2.props.start - 1)
         self.assertEqual(clip2.props.start, split_position)
+
+
+class TestTransitions(GESSimpleTimelineTest):
+
+    def test_emission_order_for_transition_clip_added_signal(self):
+        self.timeline.props.auto_transition = True
+        unused_clip1 = self.add_clip(0, 0, 100)
+        clip2 = self.add_clip(100, 0, 100)
+
+        # Connect to signals to track in which order they are emitted.
+        signals = []
+
+        def clip_added_cb(layer, clip):
+            self.assertIsInstance(clip, GES.TransitionClip)
+            signals.append("clip-added")
+        self.layer.connect("clip-added", clip_added_cb)
+
+        def property_changed_cb(clip, pspec):
+            self.assertEqual(clip, clip2)
+            self.assertEqual(pspec.name, "start")
+            signals.append("notify::start")
+        clip2.connect("notify::start", property_changed_cb)
+
+        # Move clip2 to create a transition with clip1.
+        clip2.edit([], self.layer.get_priority(), GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE, 50)
+        # The clip-added signal is emitted twice, once for the video
+        # transition and once for the audio transition.
+        self.assertEqual(signals, ["notify::start", "clip-added", "clip-added"])