[pitivi] tests: Check undo/redo for layer removal



commit 6633af7d448a7382cf1a737c8519ae1c953044d8
Author: Fabián Orccón <Fabian Orccon>
Date:   Mon Dec 14 14:05:09 2015 -0500

    tests: Check undo/redo for layer removal
    
    Differential Revision: https://phabricator.freedesktop.org/D687

 tests/test_undo_timeline.py |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 1bbc776..004eaa3 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -103,8 +103,7 @@ class TestTimelineUndo(TestCase):
         app.project_manager.newBlankProject()
 
         self.timeline = app.project_manager.current_project.timeline
-        self.layer = GES.Layer()
-        self.timeline.add_layer(self.layer)
+        self.layer = self.timeline.append_layer()
         self.action_log = UndoableActionLog()
         self.observer = TimelineObserverSpy(self.action_log)
         self.observer.startObserving(self.timeline)
@@ -118,6 +117,22 @@ class TestTimelineUndo(TestCase):
     def commitCb(action_log, stack, stacks):
         stacks.append(stack)
 
+    def testLayerRemoved(self):
+        layer1 = self.layer
+        layer2 = self.timeline.append_layer()
+        layer3 = self.timeline.append_layer()
+        self.assertEqual([layer1, layer2, layer3], self.timeline.get_layers())
+
+        self.action_log.begin("layer removed")
+        self.timeline.remove_layer(layer2)
+        self.action_log.commit()
+        self.assertEqual([layer1, layer3], self.timeline.get_layers())
+
+        self.action_log.undo()
+        self.assertEqual([layer1, layer2, layer3], self.timeline.get_layers())
+        self.action_log.redo()
+        self.assertEqual([layer1, layer3], self.timeline.get_layers())
+
     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]