From f2851c347313d7e692b7988ff1b6e3a050cdb563 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 7 Aug 2009 16:47:18 +0200 Subject: [PATCH] tests/ges/basic: Extend test to remove the object. --- tests/check/ges/basic.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/tests/check/ges/basic.c b/tests/check/ges/basic.c index c47be70..554c530 100644 --- a/tests/check/ges/basic.c +++ b/tests/check/ges/basic.c @@ -28,16 +28,33 @@ GST_START_TEST (test_ges_init) GST_END_TEST; +static gboolean +my_fill_track_func (GESTimelineObject * object, + GESTrackObject * trobject, GstElement * gnlobj) +{ + GstElement *src; + + GST_DEBUG ("timelineobj:%p, trackobjec:%p, gnlobj:%p", + object, trobject, gnlobj); + + /* Let's just put a fakesource in for the time being */ + src = gst_element_factory_make ("fakesrc", NULL); + return gst_bin_add (GST_BIN (gnlobj), src); +} + GST_START_TEST (test_ges_scenario) { GESTimelinePipeline *pipeline; GESTimeline *timeline; GESTimelineLayer *layer; GESTrack *track; - GESTimelineSource *source; + GESCustomTimelineSource *source; + ges_init (); /* This is the simplest scenario ever */ + /* Pipeline, Timeline and 1 Layer */ + pipeline = ges_timeline_pipeline_new (); fail_unless (pipeline != NULL); @@ -49,19 +66,45 @@ GST_START_TEST (test_ges_scenario) fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (layer->timeline == timeline); + fail_unless (g_list_find (timeline->layers, layer) != NULL); + + /* Give the Timeline a Track */ track = ges_track_new (); fail_unless (track != NULL); fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (track->timeline == timeline); + fail_unless (g_list_find (timeline->tracks, track) != NULL); + + /* Create a source and add it to the Layer */ - source = ges_timeline_source_new (); + source = ges_custom_timeline_source_new (my_fill_track_func); fail_unless (source != NULL); fail_unless (ges_timeline_layer_add_object (layer, GES_TIMELINE_OBJECT (source))); fail_unless (GES_TIMELINE_OBJECT (source)->layer == layer); + + /* Make sure the associated TrackObject is in the Track */ + fail_unless (GES_TIMELINE_OBJECT (source)->trackobjects != NULL); + + + /* Now remove the timelineobject */ + fail_unless (ges_timeline_layer_remove_object (layer, + GES_TIMELINE_OBJECT (source))); + fail_unless (GES_TIMELINE_OBJECT (source)->layer == NULL); + fail_unless (GES_TIMELINE_OBJECT (source)->trackobjects == NULL); + + /* Remove the track from the timeline */ + fail_unless (ges_timeline_remove_track (timeline, track)); + fail_unless (track->timeline == NULL); + fail_unless (timeline->tracks == NULL); + + /* Remove the layer from the timeline */ + fail_unless (ges_timeline_remove_layer (timeline, layer)); + fail_unless (layer->timeline == NULL); + fail_unless (timeline->layers == NULL); } GST_END_TEST; -- 2.7.4