region-translate-test.c revision 1176bdada62cabc6ec4b0308a930e83b679d5d36
1#include <assert.h>
2#include "utils.h"
3
4/* Pixman had a bug where 32bit regions where clipped to 16bit sizes when
5 * pixman_region32_translate() was called. This test exercises that bug.
6 */
7
8#define LARGE 32000
9
10int
11main (int argc, char **argv)
12{
13  pixman_box32_t rect = { -LARGE, -LARGE, LARGE, LARGE };
14  pixman_region32_t r1, r2;
15
16  pixman_region32_init_rects (&r1, &rect, 1);
17  pixman_region32_init_rect (&r2, rect.x1, rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1);
18
19  assert (pixman_region32_equal (&r1,  &r2));
20
21  pixman_region32_translate (&r1, -LARGE, LARGE);
22  pixman_region32_translate (&r1, LARGE, -LARGE);
23
24  assert (pixman_region32_equal (&r1,  &r2));
25
26  pixman_region32_fini (&r1);
27  pixman_region32_fini (&r2);
28
29  return 0;
30}
31