mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
increase default priority offset for sources; update unit tests
This commit is contained in:
parent
0e07ea40f7
commit
efbc4a22cd
3 changed files with 45 additions and 35 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue