[pitivi] tests: Check undo/redo for ControlSourceValues ops
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Check undo/redo for ControlSourceValues ops
- Date: Sat, 16 Apr 2016 14:24:52 +0000 (UTC)
commit 00eb27350012f9806838d9cdfba71b2ab6df1ff5
Author: Fabián Orccón <Fabian Orccon>
Date: Tue Dec 15 13:46:52 2015 -0500
tests: Check undo/redo for ControlSourceValues ops
Differential Revision: https://phabricator.freedesktop.org/D688
tests/test_undo_timeline.py | 52 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 004eaa3..12a6a4c 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -23,6 +23,7 @@ from unittest import TestCase
from gi.repository import GES
from gi.repository import Gst
+from gi.repository import GstController
from pitivi.application import Pitivi
from pitivi.undo.timeline import ClipAdded
@@ -133,6 +134,57 @@ class TestTimelineUndo(TestCase):
self.action_log.redo()
self.assertEqual([layer1, layer3], self.timeline.get_layers())
+ def testControlSourceValueAdded(self):
+ uri = common.getSampleUri("tears_of_steel.webm")
+ asset = GES.UriClipAsset.request_sync(uri)
+ clip = asset.extract()
+ self.layer.add_clip(clip)
+ source = clip.get_children(False)[1]
+ self.assertTrue(isinstance(source, GES.VideoUriSource))
+
+ control_source = GstController.InterpolationControlSource()
+ control_source.props.mode = GstController.InterpolationMode.LINEAR
+ source.set_control_source(control_source, "alpha", "direct")
+
+ self.action_log.begin("keyframe added")
+ self.assertTrue(control_source.set(Gst.SECOND * 0.5, 0.2))
+ self.action_log.commit()
+
+ self.assertEqual(1, len(control_source.get_all()))
+ self.action_log.undo()
+ self.assertEqual(0, len(control_source.get_all()))
+ self.action_log.redo()
+ keyframes = control_source.get_all()
+ self.assertEqual(1, len(keyframes))
+ self.assertEqual(Gst.SECOND * 0.5, keyframes[0].timestamp)
+ self.assertEqual(0.2, keyframes[0].value)
+
+ def testControlSourceValueRemoved(self):
+ uri = common.getSampleUri("tears_of_steel.webm")
+ asset = GES.UriClipAsset.request_sync(uri)
+ clip = asset.extract()
+ self.layer.add_clip(clip)
+ source = clip.get_children(False)[1]
+ self.assertTrue(isinstance(source, GES.VideoUriSource))
+
+ control_source = GstController.InterpolationControlSource()
+ control_source.props.mode = GstController.InterpolationMode.LINEAR
+ source.set_control_source(control_source, "alpha", "direct")
+ self.assertTrue(control_source.set(Gst.SECOND * 0.5, 0.2))
+
+ self.action_log.begin("keyframe removed")
+ self.assertTrue(control_source.unset(Gst.SECOND * 0.5))
+ self.action_log.commit()
+
+ self.assertEqual(0, len(control_source.get_all()))
+ self.action_log.undo()
+ keyframes = control_source.get_all()
+ self.assertEqual(1, len(keyframes))
+ self.assertEqual(Gst.SECOND * 0.5, keyframes[0].timestamp)
+ self.assertEqual(0.2, keyframes[0].value)
+ self.action_log.redo()
+ self.assertEqual(0, len(control_source.get_all()))
+
def testAddClip(self):
stacks = []
self.action_log.connect("commit", TestTimelineUndo.commitCb, stacks)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]