[pitivi] tests: Avoid inconsistent timelines
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Avoid inconsistent timelines
- Date: Mon, 11 Mar 2019 15:09:48 +0000 (UTC)
commit 0ecebd814b6743a4fe4d16b9dc54a0ab7320ebc6
Author: Thibault Saunier <tsaunier igalia com>
Date: Fri Mar 8 18:49:09 2019 -0300
tests: Avoid inconsistent timelines
Now GES makes it impossible to have 3 clips overlap at a same point
or two clips fully overlap, make sure that those cases do not happen
in our testsuite.
pitivi/undo/timeline.py | 3 ---
tests/test_timeline_elements.py | 19 +++++++++----------
tests/test_timeline_timeline.py | 5 ++++-
tests/test_undo_timeline.py | 9 ++++++---
4 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 01150167..68289e76 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -302,9 +302,6 @@ class ClipAction(UndoableAction):
self.clip.disconnect_by_func(child_added_cb)
timeline.get_asset().pipeline.commit_timeline()
- def _child_added_cb(self, clip, track_element):
- clip.remove(track_element)
-
def remove(self):
self.layer.remove_clip(self.clip)
self.layer.get_timeline().get_asset().pipeline.commit_timeline()
diff --git a/tests/test_timeline_elements.py b/tests/test_timeline_elements.py
index b0ae2e9f..619b26d6 100644
--- a/tests/test_timeline_elements.py
+++ b/tests/test_timeline_elements.py
@@ -30,8 +30,8 @@ from matplotlib.backend_bases import MouseEvent
from pitivi.timeline.elements import GES_TYPE_UI_TYPE
from pitivi.undo.undo import UndoableActionLog
from pitivi.utils.timeline import Zoomable
-from tests.test_timeline_timeline import BaseTestTimeline
from tests import common
+from tests.test_timeline_timeline import BaseTestTimeline
class TestKeyframeCurve(BaseTestTimeline):
@@ -43,14 +43,15 @@ class TestKeyframeCurve(BaseTestTimeline):
timeline_container.app.action_log = UndoableActionLog()
timeline = timeline_container.timeline
ges_layer = timeline.ges_timeline.append_layer()
- ges_clip1 = self.add_clip(ges_layer, 0, duration=2 * Gst.SECOND)
- ges_clip2 = self.add_clip(ges_layer, 10, duration=2 * Gst.SECOND)
- ges_clip3 = self.add_clip(ges_layer, 20, inpoint=100, duration=2 * Gst.SECOND)
+ ges_clip1 = self.add_clip(ges_layer, 0, duration=Gst.SECOND)
+ ges_clip2 = self.add_clip(ges_layer, Gst.SECOND, duration=Gst.SECOND)
+ ges_clip3 = self.add_clip(ges_layer, 2 * Gst.SECOND, inpoint=Gst.SECOND, duration=Gst.SECOND)
+
# For variety, add TitleClip to the list of clips.
ges_clip4 = common.create_test_clip(GES.TitleClip)
- ges_clip4.props.start = 30
- ges_clip4.props.duration = int(0.9 * Gst.SECOND)
- ges_layer.add_clip(ges_clip4)
+ ges_clip4.props.start = 3 * Gst.SECOND
+ ges_clip4.props.duration = Gst.SECOND
+ self.assertTrue(ges_layer.add_clip(ges_clip4))
self.check_keyframe_toggle(ges_clip1, timeline_container)
self.check_keyframe_toggle(ges_clip2, timeline_container)
@@ -74,9 +75,7 @@ class TestKeyframeCurve(BaseTestTimeline):
timeline.selection.select([ges_clip])
ges_video_source = None
- for child in ges_clip.get_children(recursive=False):
- if isinstance(child, GES.VideoSource):
- ges_video_source = child
+ ges_video_source = ges_clip.find_track_element(None, GES.VideoSource)
binding = ges_video_source.get_control_binding("alpha")
control_source = binding.props.control_source
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 36e9132e..71926386 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -40,7 +40,10 @@ class BaseTestTimeline(common.TestCase):
"""Creates a clip on the specified layer."""
asset = GES.UriClipAsset.request_sync(
common.get_sample_uri("tears_of_steel.webm"))
- return layer.add_asset(asset, start, inpoint, duration, clip_type)
+ clip = layer.add_asset(asset, start, inpoint, duration, clip_type)
+ self.assertIsNotNone(clip)
+
+ return clip
def addClipsSimple(self, timeline, num_clips):
"""Creates a number of clips on a new layer."""
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 28e88dcf..ef0a45f5 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -141,11 +141,14 @@ class TestTimelineObserver(BaseTestUndoTimeline):
uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip2 = asset.extract()
+ clip2.props.start = 1 * Gst.SECOND
- self.layer.add_clip(clip1)
- self.layer.add_clip(clip2)
+ self.assertTrue(self.layer.add_clip(clip1))
+ self.assertTrue(self.layer.add_clip(clip2))
# The selection does not care about GES.Groups, only about GES.Clips.
self.timeline_container.timeline.selection.select([clip1, clip2])
+ self.assertEqual(clip1.props.timeline, self.layer.get_timeline())
+ self.assertEqual(clip2.props.timeline, self.layer.get_timeline())
self.timeline_container.group_action.activate(None)
self.assertTrue(isinstance(clip1.get_parent(), GES.Group))
@@ -558,7 +561,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
clip2 = asset.extract()
clip2.set_start(clip1.props.duration / 2)
- clip2.set_duration(10 * Gst.SECOND)
+ clip2.set_duration(clip2.props.max_duration)
with self.action_log.started("add second clip"):
self.layer.add_clip(clip2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]