From efbc4a22cde64b3e6edd184cd221bbdb8f2fcfee Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Fri, 9 Jul 2010 18:29:27 +0200 Subject: [PATCH] increase default priority offset for sources; update unit tests --- ges/ges-timeline-source.c | 5 ++++ tests/check/ges/layer.c | 18 +++++++------- tests/check/ges/simplelayer.c | 57 +++++++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/ges/ges-timeline-source.c b/ges/ges-timeline-source.c index 435d96e..37cb587 100644 --- a/ges/ges-timeline-source.c +++ b/ges/ges-timeline-source.c @@ -120,5 +120,10 @@ ges_timeline_source_create_track_objects (GESTimelineObject * obj, return FALSE; } + /* create priority space for the text overlay. do this regardless of + * wthether we create an overlay so that track objects have a consistent + * priority between tracks. */ + g_object_set (primary, "priority-offset", (guint) 1, NULL); + return ges_track_add_object (track, primary); } diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c index 978077b..1261bc7 100644 --- a/tests/check/ges/layer.c +++ b/tests/check/ges/layer.c @@ -98,33 +98,33 @@ GST_START_TEST (test_layer_properties) assert_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (object), 51); assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 0, TRUE); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 1, TRUE); /* Change the priority of the layer */ g_object_set (layer, "priority", 1, NULL); assert_equals_int (layer->priority, 1); assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 10); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 10, TRUE); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 11, TRUE); /* Change it to an insanely high value */ g_object_set (layer, "priority", 1000000, NULL); assert_equals_int (layer->priority, 1000000); assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 10000000); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 10000000, TRUE); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 10000001, TRUE); /* and back to 0 */ g_object_set (layer, "priority", 0, NULL); assert_equals_int (layer->priority, 0); assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 0); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 0, TRUE); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 1, TRUE); /* check priority offsets */ - g_assert (GES_TIMELINE_OBJECT_HEIGHT (object) == 1); - g_object_set (trackobject, "priority-offset", (guint32) 1, NULL); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 1, TRUE); + assert_equals_int (GES_TIMELINE_OBJECT_HEIGHT (object), 2); + g_object_set (trackobject, "priority-offset", (guint32) 3, NULL); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 3, TRUE); g_object_set (object, "priority", 5, NULL); - gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 6, TRUE); - g_assert (GES_TIMELINE_OBJECT_HEIGHT (object) == 2); + gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 8, TRUE); + assert_equals_int (GES_TIMELINE_OBJECT_HEIGHT (object), 4); g_object_unref (trackobject); fail_unless (ges_timeline_layer_remove_object (layer, object)); diff --git a/tests/check/ges/simplelayer.c b/tests/check/ges/simplelayer.c index e50eef0..92c72e0 100644 --- a/tests/check/ges/simplelayer.c +++ b/tests/check/ges/simplelayer.c @@ -246,11 +246,16 @@ GST_START_TEST (test_gsl_with_transitions) /* simple test scenario with several sources in layer */ /* [0 0.5 1 1.5 2 2.5 3] */ - /* 0 [1-tr1--] */ - /* 1 [0--source1----][3-tr2--] */ - /* 2 [2---source2-----] */ - /* 3 [4---source3---] */ - /* 4 [5---source4-----] */ + /* 0 */ + /* 1 [1-tr1--] */ + /* 2 [0--source1----] */ + /* 3 [0--source1----][3-tr2--] */ + /* 4 [2---source2-----] */ + /* 5 [2---source2-----] */ + /* 6 [4---source3---] */ + /* 7 [4---source3---] */ + /* 8 [5---source4-----] */ + /* 9 [5---source4-----] */ gstl = GES_SIMPLE_TIMELINE_LAYER (layer); @@ -261,31 +266,31 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (tr1), -1)); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 0); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); fail_unless (ges_simple_timeline_layer_add_object (gstl, GES_TIMELINE_OBJECT (source2), -1)); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 0); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 2); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 4); /* add the third source before the second transition */ @@ -294,18 +299,18 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 0); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 2); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 4); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), SECOND (1.5)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 3); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 6); /* now add the second transition */ @@ -314,21 +319,21 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 0); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 2); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 4); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr2), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 3); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 3); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 6); /* fourth source */ @@ -337,25 +342,25 @@ GST_START_TEST (test_gsl_with_transitions) fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source1), 2); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr1), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr1), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 0); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr1), 1); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 2); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source2), 4); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (tr2), HALF_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 1); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (tr2), 3); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), GST_SECOND); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 3); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source3), 6); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source4), GST_SECOND); fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source4), SECOND (2)); - fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source4), 4); + fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (source4), 8); /* check that any insertion which might result in two adjacent transitions * will fail */ -- 2.7.4