diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-03-16 16:55:50 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-03-17 17:45:57 +0100 |
commit | 0ce4face45392cd4a44179062fb4a5715f18bb85 (patch) | |
tree | 1d01d8ab7adcf5d8e9609419d7facc4cdc32c76b /test | |
parent | 75fea162d985bea622afa59771fb2d07f5241d1b (diff) |
test: Use ARRAY_LENGTH() macro
Some tests hand-code ARRAY_LENGTH(). It is now provided by
cairo-test.h, so it can be reused.
Diffstat (limited to 'test')
-rw-r--r-- | test/a1-bug.c | 2 | ||||
-rw-r--r-- | test/clip-disjoint.c | 2 | ||||
-rw-r--r-- | test/clip-draw-unbounded.c | 2 | ||||
-rw-r--r-- | test/dash-caps-joins.c | 2 | ||||
-rw-r--r-- | test/dash-scale.c | 6 | ||||
-rw-r--r-- | test/fallback-resolution.c | 2 | ||||
-rw-r--r-- | test/filter-nearest-transformed.c | 2 | ||||
-rw-r--r-- | test/joins.c | 2 | ||||
-rw-r--r-- | test/long-dashed-lines.c | 2 | ||||
-rw-r--r-- | test/mask-glyphs.c | 2 | ||||
-rw-r--r-- | test/path-precision.c | 2 | ||||
-rw-r--r-- | test/pattern-getters.c | 2 | ||||
-rw-r--r-- | test/reflected-stroke.c | 2 |
13 files changed, 15 insertions, 15 deletions
diff --git a/test/a1-bug.c b/test/a1-bug.c index bdbecea7..9166ff50 100644 --- a/test/a1-bug.c +++ b/test/a1-bug.c @@ -40,7 +40,7 @@ draw (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr, 0, 0, 0); cairo_paint (cr); - for (i = 0; i < sizeof (xy) / sizeof (xy[0]); i++) + for (i = 0; i < ARRAY_LENGTH (xy); i++) cairo_line_to (cr, xy[i].x, xy[i].y); cairo_set_source_rgb (cr, 1, 0, 0); diff --git a/test/clip-disjoint.c b/test/clip-disjoint.c index 797898ea..28bb963c 100644 --- a/test/clip-disjoint.c +++ b/test/clip-disjoint.c @@ -45,7 +45,7 @@ paint_curve (cairo_t *cr) cairo_set_line_width (cr, 2); cairo_move_to (cr, points[0].x, points[0].y); - for (i = 1; i < sizeof (points) / sizeof (points[0]) - 2; i += 3) { + for (i = 1; i < ARRAY_LENGTH (points) - 2; i += 3) { cairo_curve_to (cr, points[i].x, points[i].y, points[i + 1].x, points[i + 1].y, diff --git a/test/clip-draw-unbounded.c b/test/clip-draw-unbounded.c index ce9b2e4a..6b9263be 100644 --- a/test/clip-draw-unbounded.c +++ b/test/clip-draw-unbounded.c @@ -129,7 +129,7 @@ draw (cairo_t *cr, void (*shapes)(cairo_t *)) cairo_set_source_rgb (cr, 1, 1, 1); cairo_paint (cr); - for (i = 0; i < sizeof (clip_funcs) / sizeof (clip_funcs[0]); i++) { + for (i = 0; i < ARRAY_LENGTH (clip_funcs); i++) { cairo_translate (cr, translations[i][0], translations[i][1]); cairo_save (cr); diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c index 4347c6d2..ace27e9b 100644 --- a/test/dash-caps-joins.c +++ b/test/dash-caps-joins.c @@ -64,7 +64,7 @@ draw (cairo_t *cr, int width, int height) for (i=0; i<2; i++) { cairo_save (cr); cairo_set_line_width (cr, LINE_WIDTH); - cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), dash_offset); + cairo_set_dash (cr, dash, ARRAY_LENGTH (dash), dash_offset); cairo_translate (cr, PAD, PAD); diff --git a/test/dash-scale.c b/test/dash-scale.c index afe3f9e7..fd517025 100644 --- a/test/dash-scale.c +++ b/test/dash-scale.c @@ -82,7 +82,7 @@ draw (cairo_t *cr, int width, int height) cairo_translate (cr, PAD, PAD); - cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH); + cairo_set_dash (cr, dash, ARRAY_LENGTH (dash), - 2 * LINE_WIDTH); cairo_set_line_width (cr, LINE_WIDTH); draw_three_shapes (cr); @@ -90,7 +90,7 @@ draw (cairo_t *cr, int width, int height) cairo_save (cr); { - cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH); + cairo_set_dash (cr, dash, ARRAY_LENGTH (dash), - 2 * LINE_WIDTH); cairo_set_line_width (cr, LINE_WIDTH); cairo_scale (cr, 1, 2); draw_three_shapes (cr); @@ -102,7 +102,7 @@ draw (cairo_t *cr, int width, int height) cairo_save (cr); { cairo_scale (cr, 1, 2); - cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH); + cairo_set_dash (cr, dash, ARRAY_LENGTH (dash), - 2 * LINE_WIDTH); cairo_set_line_width (cr, LINE_WIDTH); draw_three_shapes (cr); } diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c index 1d05973f..5447a56d 100644 --- a/test/fallback-resolution.c +++ b/test/fallback-resolution.c @@ -346,7 +346,7 @@ preamble (cairo_test_context_t *ctx) int n, num_ppi; const char *path = _cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : "."; - num_ppi = sizeof (ppi) / sizeof (ppi[0]); + num_ppi = ARRAY_LENGTH (ppi); #if GENERATE_REFERENCE for (n = 0; n < num_ppi; n++) { diff --git a/test/filter-nearest-transformed.c b/test/filter-nearest-transformed.c index 96295582..ba56f7c5 100644 --- a/test/filter-nearest-transformed.c +++ b/test/filter-nearest-transformed.c @@ -79,7 +79,7 @@ draw (cairo_t *cr, int width, int height) cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); - for (k = 0; k < sizeof (transform) / sizeof (transform[0]); k++) { + for (k = 0; k < ARRAY_LENGTH (transform); k++) { /* draw a "large" section from an image */ cairo_save (cr); { cairo_set_matrix(cr, &ctx_transform[k]); diff --git a/test/joins.c b/test/joins.c index 10f9fe7c..66847dc7 100644 --- a/test/joins.c +++ b/test/joins.c @@ -42,7 +42,7 @@ make_path (cairo_t *cr) }; unsigned int i, j; - for (j = 0; j < sizeof (scales) / sizeof (scales[0]); j++) { + for (j = 0; j < ARRAY_LENGTH (scales); j++) { cairo_save (cr); /* include reflections to flip the orientation of the join */ cairo_scale (cr, scales[j].x, scales[j].y); diff --git a/test/long-dashed-lines.c b/test/long-dashed-lines.c index cd940fbd..215bd912 100644 --- a/test/long-dashed-lines.c +++ b/test/long-dashed-lines.c @@ -49,7 +49,7 @@ draw (cairo_t *cr, int width, int height) /* completely invisible rectangle */ cairo_rectangle (cr, -5, -5, 70, 70); - cairo_set_dash (cr, dashes, sizeof (dashes) / sizeof (dashes[0]), 0.); + cairo_set_dash (cr, dashes, ARRAY_LENGTH (dashes), 0.); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL); cairo_set_source_rgb (cr, 0, 0, 0); diff --git a/test/mask-glyphs.c b/test/mask-glyphs.c index 0a912e17..9ac02722 100644 --- a/test/mask-glyphs.c +++ b/test/mask-glyphs.c @@ -128,7 +128,7 @@ _render_image (cairo_t *cr, cairo_set_font_size (cr, 5); scaled_font = cairo_get_scaled_font (cr); - for (i = 0; i < sizeof (channel) / sizeof (channel[0]); i++) { + for (i = 0; i < ARRAY_LENGTH (channel); i++) { cairo_push_group_with_content (cr, CAIRO_CONTENT_ALPHA); for (n = 0; n < 256; n++) { cairo_status_t status; diff --git a/test/path-precision.c b/test/path-precision.c index 3261fb43..3a7fb11c 100644 --- a/test/path-precision.c +++ b/test/path-precision.c @@ -57,7 +57,7 @@ draw (cairo_t *cr, int width, int height) cairo_test_status_t result = CAIRO_TEST_SUCCESS; path.status = CAIRO_STATUS_SUCCESS; - path.num_data = sizeof (path_data) / sizeof (path_data[0]); + path.num_data = ARRAY_LENGTH (path_data); path.data = path_data; cairo_new_path (cr); diff --git a/test/pattern-getters.c b/test/pattern-getters.c index da56db4b..28bc1f99 100644 --- a/test/pattern-getters.c +++ b/test/pattern-getters.c @@ -151,7 +151,7 @@ draw (cairo_t *cr, int width, int height) } if (!double_buf_equal (ctx, new_buf, expected_values, - sizeof(expected_values)/sizeof(double)) != 0) + ARRAY_LENGTH (expected_values)) != 0) { cairo_pattern_destroy (pat); return CAIRO_TEST_FAILURE; diff --git a/test/reflected-stroke.c b/test/reflected-stroke.c index 0981f752..b11f5a9b 100644 --- a/test/reflected-stroke.c +++ b/test/reflected-stroke.c @@ -40,7 +40,7 @@ draw_symbol (cairo_t *cr) cairo_stroke (cr); cairo_save (cr); - cairo_set_dash (cr, dash, sizeof (dash) / sizeof (dash[0]), 0.); + cairo_set_dash (cr, dash, ARRAY_LENGTH (dash), 0.); cairo_move_to (cr, 0, 0); cairo_arc (cr, 0, 0, 12.5, 0, 3 * M_PI / 2); cairo_close_path (cr); |