Commit cc57ff06 authored by Thibault Saunier's avatar Thibault Saunier

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: Alexandru Băluț's avatarAlex Băluț <alexandru.balut@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1674
parent 819c13f2
......@@ -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):
......
......@@ -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(), [])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment