[pitivi: 6/14] timeline: fix a bug in the transition detection code. Fixes #630827.
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 6/14] timeline: fix a bug in the transition detection code. Fixes #630827.
- Date: Fri, 1 Oct 2010 12:16:41 +0000 (UTC)
commit d33f08306e275c89272b70b3f25090f132c2ca4e
Author: Alessandro Decina <alessandro d gmail com>
Date: Wed Sep 29 14:56:35 2010 +0200
timeline: fix a bug in the transition detection code. Fixes #630827.
pitivi/timeline/timeline.py | 8 ++++----
tests/test_timeline.py | 27 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index be37adf..7009038 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1150,13 +1150,13 @@ class MoveContext(EditingContext):
self._restoreValues(self.default_originals)
def _overlapsAreTransitions(self, focus, priority):
- left_gap, right_gap = Gap.findAroundObject(focus)
+ tracks = set(o.track for o in focus.track_objects)
+ left_gap, right_gap = Gap.findAroundObject(focus, tracks=tracks)
focus_end = focus.start + focus.duration
# left_transition
if left_gap.duration < 0:
-
left_obj = left_gap.left_object
left_end = left_obj.start + left_obj.duration
@@ -1172,7 +1172,8 @@ class MoveContext(EditingContext):
# overlap the previous and previous previous clips
try:
- prev_prev = self.timeline.getPreviousTimelineObject(left_obj)
+ prev_prev = self.timeline.getPreviousTimelineObject(left_obj,
+ tracks=tracks)
if prev_prev.start + prev_prev.duration > self.focus.start:
return False
except TimelineError:
@@ -1180,7 +1181,6 @@ class MoveContext(EditingContext):
# right transition
if right_gap.duration < 0:
-
right_obj = right_gap.right_object
right_end = right_obj.start + right_obj.duration
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index 1b36e01..f9ef98a 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -1304,6 +1304,33 @@ class TestContexts(TestCase):
self.failUnlessEqual(self.track_object3.start, 10 * gst.SECOND)
self.failUnlessEqual(self.track_object3.duration, 10 * gst.SECOND)
+ def testMoveContextOverlapTransition(self):
+ # start
+ # track1: [focus ][ t2 ]
+ # track2: [t3 ]
+ self.track_object1.start = 0 * gst.SECOND
+ self.track_object1.duration = 10 * gst.SECOND
+ self.track_object1.priority = 1
+ self.track_object2.start = 10 * gst.SECOND
+ self.track_object2.duration = 10 * gst.SECOND
+ self.track_object2.priority = 1
+ self.track_object3.start = 0 * gst.SECOND
+ self.track_object3.duration = 10 * gst.SECOND
+ self.track_object3.priority = 1
+
+ # move to
+ # track1: [focus[ ]t2 ]
+ # track2: [t3 ]
+ context = MoveContext(self.timeline, self.track_object2, set([]))
+ context.editTo(gst.SECOND * 5, 1)
+ context.finish()
+ self.failUnlessEqual(self.track_object1.start, 0 * gst.SECOND)
+ self.failUnlessEqual(self.track_object1.duration, 10 * gst.SECOND)
+ self.failUnlessEqual(self.track_object2.start, 5 * gst.SECOND)
+ self.failUnlessEqual(self.track_object2.duration, 10 * gst.SECOND)
+ self.failUnlessEqual(self.track_object3.start, 0 * gst.SECOND)
+ self.failUnlessEqual(self.track_object3.duration, 10 * gst.SECOND)
+
def testMoveContextFocusNotEarliest(self):
# [t2 ][focus] [t3 ]
self.track_object1.start = 10 * gst.SECOND
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]