increase default priority offset for sources; update unit tests

This commit is contained in:
Brandon Lewis 2010-07-09 18:29:27 +02:00 committed by Edward Hervey
parent 0e07ea40f7
commit efbc4a22cd
3 changed files with 45 additions and 35 deletions

View file

@ -120,5 +120,10 @@ ges_timeline_source_create_track_objects (GESTimelineObject * obj,
return FALSE; 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); return ges_track_add_object (track, primary);
} }

View file

@ -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_DURATION (object), 51);
assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12); assert_equals_uint64 (GES_TIMELINE_OBJECT_INPOINT (object), 12);
assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 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);
/* Change the priority of the layer */ /* Change the priority of the layer */
g_object_set (layer, "priority", 1, NULL); g_object_set (layer, "priority", 1, NULL);
assert_equals_int (layer->priority, 1); assert_equals_int (layer->priority, 1);
assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 10); 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 */ /* Change it to an insanely high value */
g_object_set (layer, "priority", 1000000, NULL); g_object_set (layer, "priority", 1000000, NULL);
assert_equals_int (layer->priority, 1000000); assert_equals_int (layer->priority, 1000000);
assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 10000000); 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 */ /* and back to 0 */
g_object_set (layer, "priority", 0, NULL); g_object_set (layer, "priority", 0, NULL);
assert_equals_int (layer->priority, 0); assert_equals_int (layer->priority, 0);
assert_equals_uint64 (GES_TIMELINE_OBJECT_PRIORITY (object), 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 */ /* check priority offsets */
g_assert (GES_TIMELINE_OBJECT_HEIGHT (object) == 1); assert_equals_int (GES_TIMELINE_OBJECT_HEIGHT (object), 2);
g_object_set (trackobject, "priority-offset", (guint32) 1, NULL); g_object_set (trackobject, "priority-offset", (guint32) 3, NULL);
gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 1, TRUE); gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 3, TRUE);
g_object_set (object, "priority", 5, NULL); g_object_set (object, "priority", 5, NULL);
gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 6, TRUE); gnl_object_check (trackobject->gnlobject, 42, 51, 12, 51, 8, TRUE);
g_assert (GES_TIMELINE_OBJECT_HEIGHT (object) == 2); assert_equals_int (GES_TIMELINE_OBJECT_HEIGHT (object), 4);
g_object_unref (trackobject); g_object_unref (trackobject);
fail_unless (ges_timeline_layer_remove_object (layer, object)); fail_unless (ges_timeline_layer_remove_object (layer, object));

View file

@ -246,11 +246,16 @@ GST_START_TEST (test_gsl_with_transitions)
/* simple test scenario with several sources in layer */ /* simple test scenario with several sources in layer */
/* [0 0.5 1 1.5 2 2.5 3] */ /* [0 0.5 1 1.5 2 2.5 3] */
/* 0 [1-tr1--] */ /* 0 */
/* 1 [0--source1----][3-tr2--] */ /* 1 [1-tr1--] */
/* 2 [2---source2-----] */ /* 2 [0--source1----] */
/* 3 [4---source3---] */ /* 3 [0--source1----][3-tr2--] */
/* 4 [5---source4-----] */ /* 4 [2---source2-----] */
/* 5 [2---source2-----] */
/* 6 [4---source3---] */
/* 7 [4---source3---] */
/* 8 [5---source4-----] */
/* 9 [5---source4-----] */
gstl = GES_SIMPLE_TIMELINE_LAYER (layer); 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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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, fail_unless (ges_simple_timeline_layer_add_object (gstl,
GES_TIMELINE_OBJECT (tr1), -1)); GES_TIMELINE_OBJECT (tr1), -1));
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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, fail_unless (ges_simple_timeline_layer_add_object (gstl,
GES_TIMELINE_OBJECT (source2), -1)); GES_TIMELINE_OBJECT (source2), -1));
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_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 */ /* 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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source3), SECOND (1.5)); 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 */ /* 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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_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_DURATION (tr2), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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 */ /* fourth source */
@ -337,25 +342,25 @@ GST_START_TEST (test_gsl_with_transitions)
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source1),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source1), 0); 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_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source2),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source2), HALF_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_DURATION (tr2), HALF_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (tr2), GST_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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source3),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (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), fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_DURATION (source4),
GST_SECOND); GST_SECOND);
fail_unless_equals_uint64 (GES_TIMELINE_OBJECT_START (source4), SECOND (2)); 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 /* check that any insertion which might result in two adjacent transitions
* will fail */ * will fail */