container: Handle children pasting failures

This commit is contained in:
Thibault Saunier 2019-05-25 20:20:07 -04:00 committed by Thibault Saunier
parent 3b95bec095
commit b3e449fd4f
2 changed files with 24 additions and 0 deletions

View file

@ -348,6 +348,15 @@ _paste (GESTimelineElement * element, GESTimelineElement * ref,
nchild =
ges_timeline_element_paste (map->child,
paste_position - map->start_offset);
if (!nchild) {
while (ncontainer->children)
ges_container_remove (ncontainer, ncontainer->children->data);
g_object_unref (ncontainer);
return NULL;
}
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (ncontainer),
GES_TIMELINE_ELEMENT_TIMELINE (ref));
ges_container_add (ncontainer, nchild);

View file

@ -721,6 +721,21 @@ class TestInvalidOverlaps(common.GESSimpleTimelineTest):
],
])
group = GES.Group.new()
group.add(clip)
copied_group = group.copy(True)
self.assertFalse(copied_group.paste(group.props.start))
self.assertTimelineTopology([
[
(GES.TestClip, 0, 10),
],
[
(GES.TestClip, 0, 10),
(GES.TestClip, 1, 10),
],
])
def test_move_group_with_overlaping_clips(self):
self.track_types = [GES.TrackType.AUDIO]
super().setUp()