gst-editing-services: test: Better layer priority handling testing

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Jan 11 07:04:29 PST 2012


Module: gst-editing-services
Branch: master
Commit: 09e0d1bbe2b4aaf9c9082338aeba07ed4d9a0d16
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=09e0d1bbe2b4aaf9c9082338aeba07ed4d9a0d16

Author: Thibault Saunier <thibault.saunier at collabora.com>
Date:   Mon Jun  6 15:56:23 2011 -0400

test: Better layer priority handling testing

We use the ges_timeline_object_move_to_layer new function to make sure it works,
and that everything goes well on priority handling with this new method

---

 tests/check/ges/layer.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tests/check/ges/layer.c b/tests/check/ges/layer.c
index c6130e5..92b5e0b 100644
--- a/tests/check/ges/layer.c
+++ b/tests/check/ges/layer.c
@@ -154,6 +154,7 @@ GST_START_TEST (test_layer_priorities)
   GESTimelineObject *object1, *object2, *object3;
   GstElement *gnlobj1, *gnlobj2, *gnlobj3;
   guint prio1, prio2, prio3;
+  GList *objs, *tmp;
 
   ges_init ();
 
@@ -251,6 +252,38 @@ GST_START_TEST (test_layer_priorities)
   assert_equals_int (prio2, 1);
   assert_equals_int (prio3, LAYER_HEIGHT * 2 - 1);
 
+  /* And move objects around */
+  fail_unless (ges_timeline_object_move_to_layer (object2, layer1));
+  fail_unless (ges_timeline_object_move_to_layer (object3, layer1));
+
+  objs = ges_timeline_layer_get_objects (layer1);
+  assert_equals_int (g_list_length (objs), 3);
+  fail_unless (ges_timeline_layer_get_objects (layer2) == NULL);
+  fail_unless (ges_timeline_layer_get_objects (layer3) == NULL);
+
+  for (tmp = objs; tmp; tmp = g_list_next (tmp)) {
+    g_object_unref (tmp->data);
+  }
+  g_list_free (objs);
+
+  /*  Check their priorities (layer1 priority is now 2) */
+  assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object1), 0);
+  assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object2), 1);
+  assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), LAYER_HEIGHT - 1);
+  g_object_get (gnlobj1, "priority", &prio1, NULL);
+  g_object_get (gnlobj2, "priority", &prio2, NULL);
+  g_object_get (gnlobj3, "priority", &prio3, NULL);
+  assert_equals_int (prio1, 2 * LAYER_HEIGHT);
+  assert_equals_int (prio2, 2 * LAYER_HEIGHT + 1);
+  assert_equals_int (prio3, LAYER_HEIGHT * 3 - 1);
+
+  /* And change TrackObject-s priorities and check that changes are well
+   * refected on it containing TimelineObject */
+  ges_track_object_set_priority (tckobj3, LAYER_HEIGHT * 2);
+  g_object_get (gnlobj3, "priority", &prio3, NULL);
+  assert_equals_int (prio3, 2 * LAYER_HEIGHT);
+  assert_equals_int (GES_TIMELINE_OBJECT_PRIORITY (object3), 0);
+
   g_object_unref (tckobj1);
   g_object_unref (tckobj2);
   g_object_unref (tckobj3);



More information about the gstreamer-commits mailing list