tests: Check splitting a clip with several TrackElement

This commit is contained in:
Thibault Saunier 2013-04-18 18:41:02 -03:00
parent 10c25fef13
commit 0c900f7bc6

View file

@ -119,7 +119,6 @@ GST_END_TEST;
GST_START_TEST (test_split_object) GST_START_TEST (test_split_object)
{ {
GESTrack *track;
GESTimeline *timeline; GESTimeline *timeline;
GESTimelineLayer *layer; GESTimelineLayer *layer;
GESClip *clip, *splitclip; GESClip *clip, *splitclip;
@ -128,18 +127,14 @@ GST_START_TEST (test_split_object)
ges_init (); ges_init ();
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY));
fail_unless (track != NULL);
layer = ges_timeline_layer_new (); layer = ges_timeline_layer_new ();
fail_unless (layer != NULL); fail_unless (layer != NULL);
timeline = ges_timeline_new (); timeline = ges_timeline_new_audio_video ();
fail_unless (timeline != NULL); fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
ASSERT_OBJECT_REFCOUNT (timeline, "timeline", 1); ASSERT_OBJECT_REFCOUNT (timeline, "timeline", 1);
clip = (GESClip *) ges_custom_source_clip_new (my_fill_track_func, NULL); clip = GES_CLIP (ges_test_clip_new ());
fail_unless (clip != NULL); fail_unless (clip != NULL);
ASSERT_OBJECT_REFCOUNT (timeline, "timeline", 1); ASSERT_OBJECT_REFCOUNT (timeline, "timeline", 1);
@ -152,12 +147,11 @@ GST_START_TEST (test_split_object)
assert_equals_uint64 (_INPOINT (clip), 12); assert_equals_uint64 (_INPOINT (clip), 12);
ges_timeline_layer_add_clip (layer, GES_CLIP (clip)); ges_timeline_layer_add_clip (layer, GES_CLIP (clip));
assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1); assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 2);
trackelement = GES_CONTAINER_CHILDREN (clip)->data; trackelement = GES_CONTAINER_CHILDREN (clip)->data;
fail_unless (trackelement != NULL); fail_unless (trackelement != NULL);
fail_unless (GES_TIMELINE_ELEMENT_PARENT (trackelement) == fail_unless (GES_TIMELINE_ELEMENT_PARENT (trackelement) ==
GES_TIMELINE_ELEMENT (clip)); GES_TIMELINE_ELEMENT (clip));
fail_unless (ges_track_element_get_track (trackelement) == track);
/* Check that trackelement has the same properties */ /* Check that trackelement has the same properties */
assert_equals_uint64 (_START (trackelement), 42); assert_equals_uint64 (_START (trackelement), 42);
@ -180,7 +174,7 @@ GST_START_TEST (test_split_object)
assert_equals_uint64 (_INPOINT (splitclip), 37); assert_equals_uint64 (_INPOINT (splitclip), 37);
splittrackelements = GES_CONTAINER_CHILDREN (splitclip); splittrackelements = GES_CONTAINER_CHILDREN (splitclip);
fail_unless_equals_int (g_list_length (splittrackelements), 1); fail_unless_equals_int (g_list_length (splittrackelements), 2);
splittrackelement = GES_TRACK_ELEMENT (splittrackelements->data); splittrackelement = GES_TRACK_ELEMENT (splittrackelements->data);
fail_unless (GES_IS_TRACK_ELEMENT (splittrackelement)); fail_unless (GES_IS_TRACK_ELEMENT (splittrackelement));
@ -191,6 +185,15 @@ GST_START_TEST (test_split_object)
fail_unless (splittrackelement != trackelement); fail_unless (splittrackelement != trackelement);
fail_unless (splitclip != clip); fail_unless (splitclip != clip);
splittrackelement = GES_TRACK_ELEMENT (splittrackelements->next->data);
fail_unless (GES_IS_TRACK_ELEMENT (splittrackelement));
assert_equals_uint64 (_START (splittrackelement), 67);
assert_equals_uint64 (_DURATION (splittrackelement), 25);
assert_equals_uint64 (_INPOINT (splittrackelement), 37);
fail_unless (splittrackelement != trackelement);
fail_unless (splitclip != clip);
/* We own the only ref */ /* We own the only ref */
ASSERT_OBJECT_REFCOUNT (splitclip, "splitclip", 1); ASSERT_OBJECT_REFCOUNT (splitclip, "splitclip", 1);
/* 1 ref for the Clip, 1 ref for the Track and 1 ref for the timeline */ /* 1 ref for the Clip, 1 ref for the Track and 1 ref for the timeline */