[pitivi] test_transitions.py: check in Transition object test cases



commit 8cbfa4361489eb7f714ed8bae156e29290be25e7
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Thu Mar 4 17:56:02 2010 -0800

    test_transitions.py: check in Transition object test cases

 tests/test_transitions.py |   53 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_transitions.py b/tests/test_transitions.py
index f409ad9..341c1d9 100644
--- a/tests/test_transitions.py
+++ b/tests/test_transitions.py
@@ -20,3 +20,56 @@
 # Boston, MA 02111-1307, USA.
 
 
+    def testTransitionProperties(self):
+        factory = self.factory
+        track1 = self.track1
+        track1._update_transitions = False
+        stream = self.stream
+
+        test_data = [
+            ("a", 0, 10),
+            ("b", 5, 15),
+        ]
+
+        objs = {}
+        names = {}
+
+        for name, start, end in test_data:
+            obj = SourceTrackObject(factory, stream)
+            obj.start = start * gst.SECOND
+            obj.in_point = 0
+            obj.duration = end * gst.SECOND - obj.start
+            obj.media_duration = obj.duration
+            track1.addTrackObject(obj)
+            names[obj] = name
+            objs[name] = obj
+
+        # add transitions and check that initial properties are properly
+        # evaluated
+        tr = Transition(objs["a"], objs["b"])
+
+        # move a and b together,
+        # check that transition start, duration are updated
+        objs["a"].start = 5 * gst.SECOND
+        objs["b"].start = 10 * gst.SECOND
+
+        self.failUnlessEqual(tr.start, 10 * gst.SECOND)
+        self.failUnlessEqual(tr.duration, 5 * gst.SECOND)
+
+        # make A longer
+        objs["a"].duration = 11 * gst.SECOND
+        self.failUnlessEqual(tr.start, 10 * gst.SECOND)
+        self.failUnlessEqual(tr.duration, 6 * gst.SECOND)
+
+        # move B earlier
+        objs["b"].start = 9 * gst.SECOND
+        self.failUnlessEqual(tr.start, 9 * gst.SECOND)
+        self.failUnlessEqual(tr.duration, 7 * gst.SECOND)
+
+        # update a, b priority
+        self.failUnlessEqual(tr.priority, 0)
+        self.failUnlessEqual(tr.operation.props.priority, 1)
+        objs["a"].priority = 2
+        objs["b"].priority = 2
+        self.failUnlessEqual(tr.priority, 2)
+        self.failUnlessEqual(tr.operation.props.priority, 7)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]