test:basic: Do not add useless references, and minor improvements

This commit is contained in:
Thibault Saunier 2013-03-23 08:48:43 +01:00
parent 134ce9a8d8
commit 15c1481a56

View file

@ -463,13 +463,11 @@ GST_START_TEST (test_ges_timeline_remove_track)
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (GES_TRACK_ELEMENT (tmp->data), "trackelement", 3);
}
gst_object_ref (t1);
/* There are 3 references held:
* 1 by the container
* 1 by the track
* 1 by the timeline
* 1 added by ourselves above (gst_object_ref (t1)) */
ASSERT_OBJECT_REFCOUNT (t1, "trackelement", 4);
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (t1, "trackelement", 3);
trackelements = GES_CONTAINER_CHILDREN (s2);
fail_unless (trackelements != NULL);
@ -481,13 +479,11 @@ GST_START_TEST (test_ges_timeline_remove_track)
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (GES_TRACK_ELEMENT (tmp->data), "trackelement", 3);
}
gst_object_ref (t2);
/* There are 3 references held:
* 1 by the container
* 1 by the track
* 1 by the timeline
* 1 added by ourselves above (gst_object_ref (t2)) */
ASSERT_OBJECT_REFCOUNT (t2, "t2", 4);
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (t2, "t2", 3);
trackelements = GES_CONTAINER_CHILDREN (s3);
fail_unless (trackelements != NULL);
@ -499,29 +495,28 @@ GST_START_TEST (test_ges_timeline_remove_track)
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (GES_TRACK_ELEMENT (tmp->data), "trackelement", 3);
}
gst_object_ref (t3);
/* There are 3 references held:
* 1 by the container
* 1 by the track
* 1 by the timeline
* 1 added by ourselves above (gst_object_ref (t3)) */
ASSERT_OBJECT_REFCOUNT (t3, "t3", 4);
* 1 by the timeline */
ASSERT_OBJECT_REFCOUNT (t3, "t3", 3);
/* remove the track and check that the track elements have been released */
fail_unless (ges_timeline_remove_track (timeline, track));
ASSERT_OBJECT_REFCOUNT (t1, "trackelement", 3);
ASSERT_OBJECT_REFCOUNT (t2, "trackelement", 3);
ASSERT_OBJECT_REFCOUNT (t3, "trackelement", 3);
gst_object_unref (t1);
gst_object_unref (t2);
gst_object_unref (t3);
ASSERT_OBJECT_REFCOUNT (t1, "trackelement", 2);
ASSERT_OBJECT_REFCOUNT (t2, "trackelement", 2);
ASSERT_OBJECT_REFCOUNT (t3, "trackelement", 2);
ASSERT_OBJECT_REFCOUNT (layer, "1 for the timeline", 1);
ASSERT_OBJECT_REFCOUNT (timeline, "1 for the us", 1);
tmp = ges_timeline_layer_get_clips (layer);
assert_equals_int (g_list_length (tmp), 3);
gst_object_unref (timeline);
ASSERT_OBJECT_REFCOUNT (t1, "trackelement", 0);
ASSERT_OBJECT_REFCOUNT (t2, "trackelement", 0);
ASSERT_OBJECT_REFCOUNT (t3, "trackelement", 0);
fail_if (G_IS_OBJECT (layer));
fail_if (G_IS_OBJECT (t1));
fail_if (G_IS_OBJECT (t2));
fail_if (G_IS_OBJECT (t3));
}
GST_END_TEST;