mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
element: Properly handle the fact that pasting can return NULL
And fix paste annotation
This commit is contained in:
parent
0f238144bf
commit
ded3a5fb2f
3 changed files with 25 additions and 3 deletions
|
@ -649,7 +649,6 @@ _paste (GESTimelineElement * element, GESTimelineElement * ref,
|
|||
if (!ges_layer_add_clip (self->priv->copied_layer, nclip)) {
|
||||
GST_INFO ("%" GES_FORMAT " could not be pasted to %" GST_TIME_FORMAT,
|
||||
GES_ARGS (element), GST_TIME_ARGS (paste_position));
|
||||
gst_object_unref (nclip);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1897,7 +1897,8 @@ ges_timeline_element_get_track_types (GESTimelineElement * self)
|
|||
* using ges_timeline_element_copy with recurse=TRUE set,
|
||||
* otherwise it will fail.
|
||||
*
|
||||
* Returns: (transfer none): Paste @self copying the element
|
||||
* Returns: (transfer full): New element resulting of pasting @self
|
||||
* or %NULL
|
||||
*
|
||||
* Since: 1.6.0
|
||||
*/
|
||||
|
@ -1925,7 +1926,7 @@ ges_timeline_element_paste (GESTimelineElement * self,
|
|||
|
||||
g_clear_object (&self->priv->copied_from);
|
||||
|
||||
return g_object_ref (res);
|
||||
return res ? g_object_ref (res) : res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -677,6 +677,28 @@ class TestInvalidOverlaps(common.GESSimpleTimelineTest):
|
|||
]
|
||||
])
|
||||
|
||||
def test_copy_paste_overlapping(self):
|
||||
self.track_types = [GES.TrackType.AUDIO]
|
||||
super().setUp()
|
||||
clip = self.append_clip()
|
||||
|
||||
copy = clip.copy(True)
|
||||
self.assertIsNone(copy.paste(copy.props.start))
|
||||
self.assertTimelineTopology([
|
||||
[
|
||||
(GES.TestClip, 0, 10),
|
||||
|
||||
]
|
||||
])
|
||||
copy = clip.copy(True)
|
||||
self.assertIsNotNone(copy.paste(copy.props.start + 1))
|
||||
self.assertTimelineTopology([
|
||||
[
|
||||
(GES.TestClip, 0, 10),
|
||||
(GES.TestClip, 1, 10),
|
||||
]
|
||||
])
|
||||
|
||||
def test_move_group_with_overlaping_clips(self):
|
||||
self.track_types = [GES.TrackType.AUDIO]
|
||||
super().setUp()
|
||||
|
|
Loading…
Reference in a new issue