[test/a8-mask] Check negative strides as well.

Check that we also allow surfaces to be created using a negative stride.
This commit is contained in:
Chris Wilson 2008-02-28 16:04:08 +00:00
parent b6eb1c5c92
commit b181f40949

View file

@ -70,12 +70,16 @@ test_surface_with_width_and_stride (int width, int stride,
cairo_test_status_t status;
cairo_surface_t *surface;
cairo_t *cr;
int len;
unsigned char *data;
cairo_test_log ("Creating surface with width %d and stride %d\n",
width, stride);
data = xmalloc (stride);
len = stride;
if (len < 0)
len = -len;
data = xmalloc (len);
surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A8,
width, 1, stride);
@ -123,6 +127,13 @@ draw (cairo_t *cr, int dst_width, int dst_height)
if (status)
return status;
status = test_surface_with_width_and_stride (test_width,
-test_width,
expected);
if (status)
return status;
/* Then create a surface using the correct stride, (should
always succeed).*/
status = test_surface_with_width_and_stride (test_width,
@ -130,6 +141,12 @@ draw (cairo_t *cr, int dst_width, int dst_height)
CAIRO_STATUS_SUCCESS);
if (status)
return status;
status = test_surface_with_width_and_stride (test_width,
-stride,
CAIRO_STATUS_SUCCESS);
if (status)
return status;
}
/* Now test actually drawing through our mask data, allocating and