mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 08:48:00 +02:00
[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:
parent
b6eb1c5c92
commit
b181f40949
1 changed files with 18 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue