~ubuntu-branches/ubuntu/intrepid/cairo/intrepid-updates

« back to all changes in this revision

Viewing changes to test/pattern-getters.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2008-09-25 16:22:33 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080925162233-btx61ymk181i7mcc
Tags: 1.7.6-0ubuntu1
* New upstream version. Most noticable changes are:
  - some API changes with especially the removal of
    cairo_font_options_set_lcd_filter and cairo_font_options_get_lcd_filter
  - xlib: Faster bookkeeping
  - PS: Fix gradients with non-constant alpha
  - Fix deadlock in user-font code
* debian/patches/00list: Remove 03_from_git_fix_lcd_filter_default.dpatch,
  add debian/patches/03_fix_ftbfs_withing_xcb.dpatch
* debian/libcairo2.symbols, debian/libcairo-directfb2.symbols: update
  list of symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
static cairo_test_draw_function_t draw;
31
31
 
32
 
cairo_test_t test = {
 
32
static const cairo_test_t test = {
33
33
    "pattern-getters",
34
34
    "Tests calls to pattern getter functions",
35
35
    1, 1,
39
39
#define CHECK_SUCCESS do { if (status) return CAIRO_TEST_FAILURE; } while (0)
40
40
 
41
41
static int
42
 
double_buf_equal (double *a, double *b, int nc)
 
42
double_buf_equal (const cairo_test_context_t *ctx, double *a, double *b, int nc)
43
43
{
44
44
    int i;
45
45
    for (i = 0; i < nc; i++) {
46
46
        if (!CAIRO_TEST_DOUBLE_EQUALS(a[i],b[i])) {
47
 
            cairo_test_log ("Error: doubles not equal: %g, %g\n",
 
47
            cairo_test_log (ctx, "Error: doubles not equal: %g, %g\n",
48
48
                            a[i], b[i]);
49
49
            return 0;
50
50
        }
55
55
static cairo_test_status_t
56
56
draw (cairo_t *cr, int width, int height)
57
57
{
 
58
    const cairo_test_context_t *ctx = cairo_test_get_context (cr);
58
59
    cairo_status_t status;
59
60
    cairo_pattern_t *pat;
60
61
 
70
71
            !CAIRO_TEST_DOUBLE_EQUALS(g,0.3) ||
71
72
            !CAIRO_TEST_DOUBLE_EQUALS(b,0.4) ||
72
73
            !CAIRO_TEST_DOUBLE_EQUALS(a,0.5)) {
73
 
            cairo_test_log ("Error: cairo_pattern_get_rgba returned unexepcted results: %g, %g, %g, %g\n",
 
74
            cairo_test_log (ctx, "Error: cairo_pattern_get_rgba returned unexepcted results: %g, %g, %g, %g\n",
74
75
                            r, g, b, a);
75
76
            return CAIRO_TEST_FAILURE;
76
77
        }
88
89
        CHECK_SUCCESS;
89
90
 
90
91
        if (surf != cairo_get_target (cr)) {
91
 
            cairo_test_log ("Error: cairo_pattern_get_resurface returned wrong surface\n");
 
92
            cairo_test_log (ctx, "Error: cairo_pattern_get_resurface returned wrong surface\n");
92
93
            return CAIRO_TEST_FAILURE;
93
94
        }
94
95
 
144
145
        if (status != CAIRO_STATUS_INVALID_INDEX)
145
146
            return CAIRO_TEST_FAILURE;
146
147
 
147
 
        if (!double_buf_equal (new_buf, expected_values, sizeof(expected_values)/sizeof(double)) != 0)
 
148
        if (!double_buf_equal (ctx, new_buf, expected_values, sizeof(expected_values)/sizeof(double)) != 0)
148
149
            return CAIRO_TEST_FAILURE;
149
150
 
150
151
        cairo_pattern_destroy (pat);