SimpleTimelineLayer: Remove bogus check and extend unit test to validate it

This commit is contained in:
Thibault Saunier 2010-12-01 12:16:37 +01:00 committed by Edward Hervey
parent 098a2294f3
commit 4add2937de
2 changed files with 11 additions and 6 deletions

View file

@ -390,9 +390,6 @@ ges_simple_timeline_layer_move_object (GESSimpleTimelineLayer * layer,
/* pop it off the list */
layer->objects = g_list_remove (layer->objects, object);
newposition = (newposition >= 0 && newposition < idx) ? newposition :
newposition - 1;
/* re-add it at the proper position */
layer->objects = g_list_insert (layer->objects, object, newposition);

View file

@ -157,13 +157,21 @@ GST_START_TEST (test_gsl_move_simple)
fail_unless_equals_int (info.new, 0);
fail_unless_equals_int (info.old, 1);
/* Move source2 to end (newpos:-1) */
/* Move source2 after source 1 (newpos:0) */
fail_unless (ges_simple_timeline_layer_move_object (GES_SIMPLE_TIMELINE_LAYER
(layer), GES_TIMELINE_OBJECT (source2), -1));
(layer), GES_TIMELINE_OBJECT (source2), 1));
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), GST_SECOND);
fail_unless_equals_int (info.new, 1);
fail_unless_equals_int (info.old, 0);
/* Move source1 to end (newpos:-1) */
fail_unless (ges_simple_timeline_layer_move_object (GES_SIMPLE_TIMELINE_LAYER
(layer), GES_TIMELINE_OBJECT (source1), -1));
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), 0);
/* position will be decremented, this is expected */
fail_unless_equals_int (info.new, -2);
fail_unless_equals_int (info.new, -1);
fail_unless_equals_int (info.old, 0);
/* remove source1, source2 should be moved to the beginning */