summaryrefslogtreecommitdiff
path: root/test/extend-reflect.c
blob: 1d53af9bbbaf0e34b93ed24b4ac8b554290a98d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <math.h>
#include "cairo-test.h"
#include <stdio.h>

#define SIZE 400
#define OFFSET 50
const char	png_filename[]	= "romedalen.png";

cairo_test_t test = {
    "extend-reflect",
    "Test CAIRO_EXTEND_REFLECT for surface patterns"
    "\nCAIRO_EXTEND_REFLECT code is broken and corrupts memory",
    SIZE, SIZE,
    draw
};

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_pattern_t *pattern;
    cairo_set_source_rgba (cr, 0, 0, 0, 1);
    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
    cairo_fill (cr);

    pattern = cairo_test_create_pattern_from_png (png_filename);
    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);

    cairo_paint (cr);

    return CAIRO_TEST_SUCCESS;
}

int
main (void)
{
    return cairo_test (&test);
}