tests/ges/basic: Extend test to remove the object.

This commit is contained in:
Edward Hervey 2009-08-07 16:47:18 +02:00
parent 3ce00c0308
commit f2851c3473

View file

@ -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);
source = ges_timeline_source_new ();
/* Create a source and add it to the Layer */
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;