[pitivi] timeline: Avoid having 2 layers with the same prio in the timeline



commit cc57ff06c5ea5fbf33b4718c8c0847e4b906604c
Author: Thibault Saunier <tsaunier gnome org>
Date:   Sat Feb 18 23:41:02 2017 -0300

    timeline: Avoid having 2 layers with the same prio in the timeline
    
    This is completely forbiden by GES and should never happen.
    
    GES should not segfault when this case happens but we are anyway
    going to replace the layer.priority API with a timeline.move_layer(),
    basically because the current API was badly designed and gives to much
    constraints on it user (ie. this bug can happen!).
    
    (See https://phabricator.freedesktop.org/D233 for the GES API change
    proposal).
    
    Reviewed-by: Alex Băluț <alexandru balut gmail com>
    Differential Revision: https://phabricator.freedesktop.org/D1674

 pitivi/timeline/timeline.py |    3 ++-
 tests/test_undo_timeline.py |    3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 1305d36..7c5613e 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1214,12 +1214,13 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
         assert 0 <= priority <= len(ges_layers)
         new_ges_layer = GES.Layer.new()
         new_ges_layer.props.priority = priority
-        self.ges_timeline.add_layer(new_ges_layer)
 
         for ges_layer in ges_layers:
             if priority <= ges_layer.get_priority():
                 ges_layer.props.priority += 1
 
+        self.ges_timeline.add_layer(new_ges_layer)
+
         return new_ges_layer
 
     def dragEnd(self):
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 7224ff3..50654f9 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -868,7 +868,6 @@ class TestDragDropUndo(BaseTestUndoTimeline):
         self.assertEqual(layers[0].get_clips(), [])
         self.assertEqual(layers[1].get_clips(), [clip])
 
-    @skip("segfaults, see T7704")
     def test_clip_dragged_to_create_layer_above(self):
         self.setup_timeline_container()
         timeline_ui = self.timeline_container.timeline
@@ -915,7 +914,7 @@ class TestDragDropUndo(BaseTestUndoTimeline):
         self.action_log.redo()
         layers = self.timeline.get_layers()
         self.assertEqual(len(layers), 2)
-        self.assertEqual(layers[0], self.layer)
+        self.assertEqual(layers[1], self.layer)
         self.check_layers(layers)
         self.assertEqual(layers[0].get_clips(), [clip])
         self.assertEqual(layers[1].get_clips(), [])


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