From 4add2937de41cb74347d8cb3d33b0e9fc3e70797 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 1 Dec 2010 12:16:37 +0100 Subject: [PATCH] SimpleTimelineLayer: Remove bogus check and extend unit test to validate it --- ges/ges-simple-timeline-layer.c | 3 --- tests/check/ges/simplelayer.c | 14 +++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ges/ges-simple-timeline-layer.c b/ges/ges-simple-timeline-layer.c index e5c9bdac92..4139b76204 100644 --- a/ges/ges-simple-timeline-layer.c +++ b/ges/ges-simple-timeline-layer.c @@ -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); diff --git a/tests/check/ges/simplelayer.c b/tests/check/ges/simplelayer.c index 1912692cb5..f87fe29346 100644 --- a/tests/check/ges/simplelayer.c +++ b/tests/check/ges/simplelayer.c @@ -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 */