From b58b8b1ba58f77904ce211d2e4e9f6bd3b9e8909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 6 Dec 2011 20:30:55 +0000 Subject: [PATCH] tests: fix calculation of last pixel offset in video unit test And check the right buffer (pix2) in one case. --- tests/check/libs/video.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index bd9674a..18a6417 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -843,7 +843,11 @@ GST_START_TEST (test_overlay_composition) /* get scaled pixbuf and touch last byte */ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); - fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + (h * stride + w - 1)), 0); + fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1), + "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1), + ((h - 1) * stride + (w * 4) - 1)); + fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride + + (w * 4) - 1)), 0); gst_video_overlay_rectangle_get_render_rectangle (rect2, &x, &y, &w, &h); fail_unless_equals_int (x, 50); @@ -854,7 +858,11 @@ GST_START_TEST (test_overlay_composition) /* get scaled pixbuf and touch last byte */ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); - fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + (h * stride + w - 1)), 0); + fail_unless (GST_BUFFER_SIZE (pix2) > ((h - 1) * stride + (w * 4) - 1), + "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1), + ((h - 1) * stride + (w * 4) - 1)); + fail_unless_equals_int (*(GST_BUFFER_DATA (pix2) + ((h - 1) * stride + + (w * 4) - 1)), 0); /* get scaled pixbuf again, should be the same buffer as before (caching) */ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride, @@ -873,7 +881,11 @@ GST_START_TEST (test_overlay_composition) fail_unless_equals_int (h, 50); /* touch last byte */ - fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + (h * stride + w - 1)), 0); + fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1), + "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1), + ((h - 1) * stride + (w * 4) - 1)); + fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride + + (w * 4) - 1)), 0); /* test attaching and retrieving of compositions to/from buffers */ buf = gst_buffer_new (); -- 2.7.4