From 35b9e3c45d8a4c2aa24eff5acb04d0e1eb7bc6ba Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 29 Mar 2005 00:02:19 +0000 Subject: [PATCH] More _/- renames in the test directory. --- ChangeLog | 5 + test/.cvsignore | 24 +-- test/Makefile.am | 66 ++++---- test/buffer-diff.c | 2 +- test/buffer_diff.c | 73 --------- test/buffer_diff.h | 38 ----- test/cairo-test.c | 8 +- test/cairo_test.c | 263 ------------------------------ test/cairo_test.h | 55 ------- test/clip-twice.c | 4 +- test/clip_twice-ref.png | Bin 751 -> 0 bytes test/clip_twice.c | 74 --------- test/coverage.c | 2 +- test/fill-rule.c | 4 +- test/fill_rule-ref.png | Bin 1979 -> 0 bytes test/fill_rule.c | 132 --------------- test/get-and-set.c | 4 +- test/get_and_set.c | 151 ----------------- test/imagediff.c | 6 +- test/leaky-polygon.c | 4 +- test/leaky_polygon-ref.png | Bin 255 -> 0 bytes test/leaky_polygon.c | 84 ---------- test/line-width.c | 4 +- test/line_width-ref.png | Bin 171 -> 0 bytes test/line_width.c | 65 -------- test/linear-gradient.c | 4 +- test/linear_gradient-ref.png | Bin 12724 -> 0 bytes test/linear_gradient.c | 143 ---------------- test/move-to-show-surface.c | 4 +- test/move_to_show_surface-ref.png | Bin 100 -> 0 bytes test/move_to_show_surface.c | 71 -------- test/path-data.c | 4 +- test/path_data-ref.png | Bin 387 -> 0 bytes test/path_data.c | 179 -------------------- test/pixman-rotate.c | 4 +- test/pixman_rotate-ref.png | Bin 260 -> 0 bytes test/pixman_rotate.c | 80 --------- test/read-png.c | 2 +- test/read_png.c | 166 ------------------- test/read_png.h | 45 ----- test/text-cache-crash.c | 4 +- test/text-rotate.c | 4 +- test/text_cache_crash.c | 135 --------------- test/text_rotate.c | 119 -------------- test/user_data.c | 78 --------- test/write-png.c | 2 +- test/write_png.c | 99 ----------- test/write_png.h | 35 ---- 48 files changed, 83 insertions(+), 2163 deletions(-) delete mode 100644 test/buffer_diff.c delete mode 100644 test/buffer_diff.h delete mode 100644 test/cairo_test.c delete mode 100644 test/cairo_test.h delete mode 100644 test/clip_twice-ref.png delete mode 100644 test/clip_twice.c delete mode 100644 test/fill_rule-ref.png delete mode 100644 test/fill_rule.c delete mode 100644 test/get_and_set.c delete mode 100644 test/leaky_polygon-ref.png delete mode 100644 test/leaky_polygon.c delete mode 100644 test/line_width-ref.png delete mode 100644 test/line_width.c delete mode 100644 test/linear_gradient-ref.png delete mode 100644 test/linear_gradient.c delete mode 100644 test/move_to_show_surface-ref.png delete mode 100644 test/move_to_show_surface.c delete mode 100644 test/path_data-ref.png delete mode 100644 test/path_data.c delete mode 100644 test/pixman_rotate-ref.png delete mode 100644 test/pixman_rotate.c delete mode 100644 test/read_png.c delete mode 100644 test/read_png.h delete mode 100644 test/text_cache_crash.c delete mode 100644 test/text_rotate.c delete mode 100644 test/user_data.c delete mode 100644 test/write_png.c delete mode 100644 test/write_png.h diff --git a/ChangeLog b/ChangeLog index 981ddcecd..cc0b73266 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-03-29 Carl Worth + + * test/Makefile.am: + * test/*_*.c: More _/- renames in the test directory. + 2005-03-28 Carl Worth * src/Makefile.am: diff --git a/test/.cvsignore b/test/.cvsignore index 94b04f2a8..2eb691234 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -2,20 +2,20 @@ .libs Makefile Makefile.in -clip_twice +clip-twice coverage -fill_rule -get_and_set +fill-rule +get-and-set imagediff -leaky_polygon -line_width -linear_gradient -move_to_show_surface -path_data -pixman_rotate -text_cache_crash -text_rotate -user_data +leaky-polygon +line-width +linear-gradient +move-to-show-surface +path-data +pixman-rotate +text-cache-crash +text-rotate +user-data *-out.png *-diff.png *.la diff --git a/test/Makefile.am b/test/Makefile.am index e32254cdd..95f7fcfb8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,36 +1,36 @@ # All new test cases go here TESTS = \ -clip_twice \ +clip-twice \ coverage \ -fill_rule \ -get_and_set \ -leaky_polygon \ -line_width \ -linear_gradient \ -move_to_show_surface \ -path_data \ -pixman_rotate \ -text_cache_crash \ -text_rotate \ -user_data +fill-rule \ +get-and-set \ +leaky-polygon \ +line-width \ +linear-gradient \ +move-to-show-surface \ +path-data \ +pixman-rotate \ +text-cache-crash \ +text-rotate \ +user-data # And all new tests go here too. I really don't like having to repeat # this list. Anyone know a good way to avoid it? Can I use a wildcard # here? EXTRA_DIST = \ -fill_rule-ref.png \ -leaky_polygon-ref.png \ -line_width-ref.png \ -linear_gradient-ref.png \ -move_to_show_surface-ref.png \ +fill-rule-ref.png \ +leaky-polygon-ref.png \ +line-width-ref.png \ +linear-gradient-ref.png \ +move-to-show-surface-ref.png \ coverage-ref.png \ -clip_twice-ref.png \ -path_data-ref.png \ -pixman_rotate-ref.png \ +clip-twice-ref.png \ +path-data-ref.png \ +pixman-rotate-ref.png \ romedalen.png -# Once we can draw the text_rotate.c test case correctly, we should -# create and add text_rotate-ref.png to the list of reference PNGs. +# Once we can draw the text-rotate.c test case correctly, we should +# create and add text-rotate-ref.png to the list of reference PNGs. # This list is only for known bugs (not regressions). We do need to # fix these before the next release, but they are expected to fail for @@ -41,9 +41,9 @@ romedalen.png # regression bugs that should not be listed here. Instead they should # be fixed before the code is committed. XFAIL_TESTS = \ -move_to_show_surface \ -pixman_rotate \ -text_rotate +move-to-show-surface \ +pixman-rotate \ +text-rotate check_PROGRAMS = $(TESTS) @@ -56,14 +56,14 @@ INCLUDES = -D_GNU_SOURCE -I$(srcdir) $(CAIRO_CFLAGS) -I$(top_srcdir)/src noinst_LTLIBRARIES = libcairotest.la libcairotest_la_SOURCES =\ -buffer_diff.c \ -buffer_diff.h \ -cairo_test.c \ -cairo_test.h \ -read_png.c \ -read_png.h \ -write_png.c \ -write_png.h \ +buffer-diff.c \ +buffer-diff.h \ +cairo-test.c \ +cairo-test.h \ +read-png.c \ +read-png.h \ +write-png.c \ +write-png.h \ xmalloc.c \ xmalloc.h diff --git a/test/buffer-diff.c b/test/buffer-diff.c index 07abd62a3..486aff1d6 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -23,7 +23,7 @@ * * Author: Richard D. Worth */ -#include "buffer_diff.h" +#include "buffer-diff.h" /* Image comparison code courttesy of Richard Worth. * Returns number of pixels changed. diff --git a/test/buffer_diff.c b/test/buffer_diff.c deleted file mode 100644 index 07abd62a3..000000000 --- a/test/buffer_diff.c +++ /dev/null @@ -1,73 +0,0 @@ -/* imagediff - Compare two images - * - * Copyright © 2004 Richard D. Worth - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Richard Worth - * not be used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * Richard Worth makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * RICHARD WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL RICHARD WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Richard D. Worth */ - -#include "buffer_diff.h" - -/* Image comparison code courttesy of Richard Worth. - * Returns number of pixels changed. - * Also fills out a "diff" image intended to visually show where the - * images differ. - */ -int -buffer_diff (char *buf_a, char *buf_b, char *buf_diff, - int width, int height, int stride) -{ - int x, y; - int total_pixels_changed = 0; - unsigned char *row_a, *row_b, *row; - - for (y = 0; y < height; y++) - { - row_a = buf_a + y * stride; - row_b = buf_b + y * stride; - row = buf_diff + y * stride; - for (x = 0; x < width; x++) - { - int channel; - unsigned char value_a, value_b; - int pixel_changed = 0; - for (channel = 0; channel < 4; channel++) - { - double diff; - value_a = row_a[x * 4 + channel]; - value_b = row_b[x * 4 + channel]; - if (value_a != value_b) - pixel_changed = 1; - diff = value_a - value_b; - row[x * 4 + channel] = 128 + diff / 3.0; - } - if (pixel_changed) { - total_pixels_changed++; - } else { - row[x*4+0] = 0; - row[x*4+1] = 0; - row[x*4+2] = 0; - } - row[x * 4 + 3] = 0xff; /* Set ALPHA to 100% (opaque) */ - } - } - - return total_pixels_changed; -} diff --git a/test/buffer_diff.h b/test/buffer_diff.h deleted file mode 100644 index 9ee51c3cf..000000000 --- a/test/buffer_diff.h +++ /dev/null @@ -1,38 +0,0 @@ -/* imagediff - Compare two images - * - * Copyright © 2004 Richard D. Worth - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Richard Worth - * not be used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * Richard Worth makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * RICHARD WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL RICHARD WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Richard D. Worth */ - -#ifndef BUFFER_DIFF_H -#define BUFFER_DIFF_H - -/* Image comparison code courttesy of Richard Worth. - * Returns number of pixels changed. - * Also fills out a "diff" image intended to visually show where the - * images differ. - */ -int -buffer_diff (char *buf_a, char *buf_b, char *buf_diff, - int width, int height, int stride); - -#endif diff --git a/test/cairo-test.c b/test/cairo-test.c index 5cee2058d..835bf38a0 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -30,11 +30,11 @@ #include #include -#include "cairo_test.h" +#include "cairo-test.h" -#include "buffer_diff.h" -#include "read_png.h" -#include "write_png.h" +#include "buffer-diff.h" +#include "read-png.h" +#include "write-png.h" #include "xmalloc.h" #define CAIRO_TEST_LOG_SUFFIX ".log" diff --git a/test/cairo_test.c b/test/cairo_test.c deleted file mode 100644 index 5cee2058d..000000000 --- a/test/cairo_test.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#include -#include -#include -#include -#include -#include - -#include "cairo_test.h" - -#include "buffer_diff.h" -#include "read_png.h" -#include "write_png.h" -#include "xmalloc.h" - -#define CAIRO_TEST_LOG_SUFFIX ".log" -#define CAIRO_TEST_PNG_SUFFIX "-out.png" -#define CAIRO_TEST_REF_SUFFIX "-ref.png" -#define CAIRO_TEST_DIFF_SUFFIX "-diff.png" - -static void -xasprintf (char **strp, const char *fmt, ...) -{ -#ifdef HAVE_VASPRINTF - va_list va; - int ret; - - va_start (va, fmt); - ret = vasprintf (strp, fmt, va); - va_end (va); - - if (ret < 0) { - fprintf (stderr, "Out of memory\n"); - exit (1); - } -#else /* !HAVE_VASNPRINTF */ -#define BUF_SIZE 1024 - va_list va; - char buffer[BUF_SIZE]; - int ret; - - va_start (va, fmt); - ret = vsnprintf (buffer, sizeof(buffer), fmt, va); - va_end (va); - - if (ret < 0) { - fprintf (stderr, "Failure in vsnprintf\n"); - exit (1); - } - - if (strlen (buffer) == sizeof(buffer) - 1) { - fprintf (stderr, "Overflowed fixed buffer\n"); - exit (1); - } - - *strp = strdup (buffer); - if (!*strp) { - fprintf (stderr, "Out of memory\n"); - exit (1); - } -#endif /* !HAVE_VASNPRINTF */ -} - -static void -xunlink (const char *pathname) -{ - if (unlink (pathname) < 0 && errno != ENOENT) { - fprintf (stderr, " Error: Cannot remove %s: %s\n", - pathname, strerror (errno)); - exit (1); - } -} - -cairo_test_status_t -cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw) -{ - cairo_test_status_t status; - cairo_t *cr; - int stride; - unsigned char *png_buf, *ref_buf, *diff_buf; - char *log_name, *png_name, *ref_name, *diff_name; - char *srcdir; - int pixels_changed; - int ref_width, ref_height, ref_stride; - read_png_status_t png_status; - cairo_test_status_t ret; - FILE *png_file; - FILE *log_file; - - /* Get the strings ready that we'll need. */ - srcdir = getenv ("srcdir"); - if (!srcdir) - srcdir = "."; - xasprintf (&log_name, "%s%s", test->name, CAIRO_TEST_LOG_SUFFIX); - xasprintf (&png_name, "%s%s", test->name, CAIRO_TEST_PNG_SUFFIX); - xasprintf (&ref_name, "%s/%s%s", srcdir, test->name, CAIRO_TEST_REF_SUFFIX); - xasprintf (&diff_name, "%s%s", test->name, CAIRO_TEST_DIFF_SUFFIX); - - xunlink (log_name); - - /* Run the actual drawing code. */ - cr = cairo_create (); - - stride = 4 * test->width; - - png_buf = xcalloc (stride * test->height, 1); - diff_buf = xcalloc (stride * test->height, 1); - - cairo_set_target_image (cr, png_buf, CAIRO_FORMAT_ARGB32, - test->width, test->height, stride); - - status = (draw) (cr, test->width, test->height); - - /* Then, check all the different ways it could fail. */ - if (status) { - log_file = fopen (log_name, "a"); - fprintf (log_file, "Error: Function under test failed\n"); - fclose (log_file); - return status; - } - - if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { - log_file = fopen (log_name, "a"); - fprintf (log_file, "Error: Function under test left cairo status in an error state: %s\n", cairo_status_string (cr)); - fclose (log_file); - return CAIRO_TEST_FAILURE; - } - - cairo_destroy (cr); - - /* Skip image check for tests with no image (width,height == 0,0) */ - if (test->width == 0 || test->height == 0) { - free (png_buf); - free (diff_buf); - return CAIRO_TEST_SUCCESS; - } - - png_file = fopen (png_name, "wb"); - write_png_argb32 (png_buf, png_file, test->width, test->height, stride); - fclose (png_file); - - ref_buf = NULL; - png_status = (read_png_argb32 (ref_name, &ref_buf, &ref_width, &ref_height, &ref_stride)); - if (png_status) { - log_file = fopen (log_name, "a"); - switch (png_status) - { - case READ_PNG_FILE_NOT_FOUND: - fprintf (log_file, "Error: No reference image found: %s\n", ref_name); - break; - case READ_PNG_FILE_NOT_PNG: - fprintf (log_file, "Error: %s is not a png image\n", ref_name); - break; - default: - fprintf (log_file, "Error: Failed to read %s\n", ref_name); - } - fclose (log_file); - - ret = CAIRO_TEST_FAILURE; - goto BAIL; - } else { - } - - if (test->width != ref_width || test->height != ref_height) { - log_file = fopen (log_name, "a"); - fprintf (log_file, - "Error: Image size mismatch: (%dx%d) vs. (%dx%d)\n" - " for %s vs %s\n", - test->width, test->height, - ref_width, ref_height, - png_name, ref_name); - fclose (log_file); - - ret = CAIRO_TEST_FAILURE; - goto BAIL; - } - - pixels_changed = buffer_diff (png_buf, ref_buf, diff_buf, - test->width, test->height, stride); - if (pixels_changed) { - log_file = fopen (log_name, "a"); - fprintf (log_file, "Error: %d pixels differ from reference image %s\n", - pixels_changed, ref_name); - png_file = fopen (diff_name, "wb"); - write_png_argb32 (diff_buf, png_file, test->width, test->height, stride); - fclose (png_file); - fclose (log_file); - - ret = CAIRO_TEST_FAILURE; - goto BAIL; - } else { - xunlink (diff_name); - } - - ret = CAIRO_TEST_SUCCESS; - -BAIL: - free (png_buf); - free (ref_buf); - free (diff_buf); - free (log_name); - free (png_name); - free (ref_name); - free (diff_name); - - return ret; -} - -cairo_pattern_t * -cairo_test_create_png_pattern (cairo_t *cr, const char *filename) -{ - cairo_surface_t *image; - cairo_pattern_t *pattern; - unsigned char *buffer; - int w, h, stride; - read_png_status_t status; - char *srcdir = getenv ("srcdir"); - - status = read_png_argb32 (filename, &buffer, &w,&h, &stride); - if (status != READ_PNG_SUCCESS) { - if (srcdir) { - char *srcdir_filename; - xasprintf (&srcdir_filename, "%s/%s", srcdir, filename); - status = read_png_argb32 (srcdir_filename, &buffer, &w,&h, &stride); - free (srcdir_filename); - } - } - if (status != READ_PNG_SUCCESS) - return NULL; - - image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32, - w, h, stride); - - cairo_surface_set_repeat (image, 1); - - pattern = cairo_pattern_create_for_surface (image); - - return pattern; -} diff --git a/test/cairo_test.h b/test/cairo_test.h deleted file mode 100644 index cc18a7931..000000000 --- a/test/cairo_test.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#ifndef _CAIRO_TEST_H_ -#define _CAIRO_TEST_H_ - -#include -#include - -typedef enum cairo_test_status { - CAIRO_TEST_SUCCESS = 0, - CAIRO_TEST_FAILURE -} cairo_test_status_t; - -typedef struct cairo_test { - char *name; - char *description; - int width; - int height; -} cairo_test_t; - -typedef cairo_test_status_t (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height); - -/* cairo_test.c */ -cairo_test_status_t -cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw); - -cairo_pattern_t * -cairo_test_create_png_pattern (cairo_t *cr, const char *filename); - - -#endif - diff --git a/test/clip-twice.c b/test/clip-twice.c index 50db5fe2b..8862199e7 100644 --- a/test/clip-twice.c +++ b/test/clip-twice.c @@ -23,13 +23,13 @@ * Author: Kristian Høgsberg */ -#include "cairo_test.h" +#include "cairo-test.h" #define WIDTH 64 #define HEIGHT 64 cairo_test_t test = { - "clip_twice", + "clip-twice", "Verifies that the clip mask is updated correctly when it constructed by setting the clip path twice.", WIDTH, HEIGHT }; diff --git a/test/clip_twice-ref.png b/test/clip_twice-ref.png deleted file mode 100644 index ab0ae1aeb158439e272bd6fa7f158ef68918d812..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 751 zcmVo?{X6x6vN;h z)Z%}SZB?MW327z!A_YD{`W7}$@>ZI&0XuVW(E#26GuNbyuQuYZiC?AhizB9voe^-u#4po<@+(+B_1AcXiadfqdl~o$+|DQ7jr1US0ktD-pd1Wn zF9V-}Tl!dDoB_|EdZ-DaG+=uk1_!_$T^uo8C_m6Fhmt(^&Rn+UCpCFo?!m6pB12)o zMT3zyyh2&bw1^Ncfvp9Iesb+k-Pq|vdQWmr5LQ5`K{%5Kn8`GGBdCDZ5|n<)#uiEn z$z9)Lv!DW^Rl=J*K$L0oLSlgW@KGH8+5`qvzqw;ArLZ(TvmOt!! zTwn?&is7~Q`UllPD5NToYf4T~QAdD)|X;2#Q|D!aZyqS-T$!Sm+(5g&+ z{e#ocsz^sG3<%-r50PsT8W76UA0n>;p#dR1{UI_!-j=T%&T_oVnb(HhB)$ z;p!nIPl293*2wf+PF-gha{E7^b_C@Wy!M1BhGf-!y#8hGxLo>o1HfL9v6rN#{xvzn hFbu;m48t&{liz|Wz$EgXkFx*(002ovPDHLkV1kx7Pu2hc diff --git a/test/clip_twice.c b/test/clip_twice.c deleted file mode 100644 index 50db5fe2b..000000000 --- a/test/clip_twice.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Kristian Høgsberg - */ - -#include "cairo_test.h" - -#define WIDTH 64 -#define HEIGHT 64 - -cairo_test_t test = { - "clip_twice", - "Verifies that the clip mask is updated correctly when it constructed by setting the clip path twice.", - WIDTH, HEIGHT -}; - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_set_alpha (cr, 1.0); - cairo_new_path (cr); - cairo_arc (cr, WIDTH / 2, HEIGHT / 2, WIDTH / 3, 0, 2 * M_PI); - cairo_clip (cr); - - cairo_new_path (cr); - cairo_move_to (cr, 0, 0); - cairo_line_to (cr, WIDTH / 4, HEIGHT / 2); - cairo_line_to (cr, 0, HEIGHT); - cairo_line_to (cr, WIDTH, HEIGHT); - cairo_line_to (cr, 3 * WIDTH / 4, HEIGHT / 2); - cairo_line_to (cr, WIDTH, 0); - cairo_close_path (cr); - cairo_clip (cr); - - cairo_set_rgb_color (cr, 0, 0, 0.6); - - cairo_new_path (cr); - cairo_move_to (cr, 0, 0); - cairo_line_to (cr, 0, HEIGHT); - cairo_line_to (cr, WIDTH / 2, 3 * HEIGHT / 4); - cairo_line_to (cr, WIDTH, HEIGHT); - cairo_line_to (cr, WIDTH, 0); - cairo_line_to (cr, WIDTH / 2, HEIGHT / 4); - cairo_close_path (cr); - cairo_fill (cr); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/coverage.c b/test/coverage.c index e11c99b82..1928e221e 100644 --- a/test/coverage.c +++ b/test/coverage.c @@ -24,7 +24,7 @@ */ #include -#include "cairo_test.h" +#include "cairo-test.h" #define WIDTH 64 #define HEIGHT 64 diff --git a/test/fill-rule.c b/test/fill-rule.c index 20a74eb93..6d5f3b46e 100644 --- a/test/fill-rule.c +++ b/test/fill-rule.c @@ -61,13 +61,13 @@ * */ -#include "cairo_test.h" +#include "cairo-test.h" #define LITTLE_STAR_SIZE 20 #define BIG_STAR_SIZE 80 cairo_test_t test = { - "fill_rule", + "fill-rule", "Tests cairo_set_full_rule with some star shapes", BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3 }; diff --git a/test/fill_rule-ref.png b/test/fill_rule-ref.png deleted file mode 100644 index e2e10d4a89fa2d46ac86c3b7d94ea5d91e2220d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1979 zcmV;s2SoUZP)y!zc{`=LwwGKBiGFM*{A9!`=QS`1mQtG=>g=mjqsFAJZ5(1Wpt9*TreA zV;W_%=6Szs0FJu2CiK`T#xx4XcQW2+_&J6YV;Vz-z)=Fb1n6Ry(|0pfV;UoXz?I6R znZ*@tV;beN1^@)^68NWPf)MrJc3;-r*Nt)4W6X;aU{VbL7gvpGj06G~2)t{U5I*sa zzy;4Smo~cH2KdS`jgdg$1c9d=CgM{9Cp^b|-}3nHea19KMB5VEbqTGE`KaYSk8D{s zmT*h#Zp%d64P8RrnAcnW{kkp7#u7ZNkTgxk;L3>`bFc25&%JZ*g^p>A00MVBmgzeY zV?K4CCl^0c290Tq00PfyzS%B*Gkz91=9Y`jV;Td8%N3HQcQNnENs2Lz5x~O=N$oe= zg>Tzlm6H@>8Y94Mv9xYD^Ke7EajPcvn8vVZa_#&DU}FOO+VmgYziqht`jBEw!!V2y zLOZk-O(`0N9LUPWO?PXDwz^{)NI!2)R$-WbV95qBIRPFVoim9IO2K80>s? zC`D!kw1_y1jof)^rc@0zzB+uC5L;&2F%2c)d{>F4 zXzWU1n1&*-zTZw$sQ2gPpkxiTEz>tw-=))i$AoDp0jIt@-&eKy^J*{+1>m9Y&R0nF z{=B{^T|-UF^vrkXi}~}GDOy8Kld;QIgKbaDV;aW7W#64|sP^ae$q+Qu^3J&EyYof0 zKd)zs*HFu3j9DsdnVDi5#=>Uboo|fZpEnc@HM}!!BJMNGNjJur*~9=e)G!$(mWZ)0 zGp1oITUc}w zoMH`=8XFjIyhy5HHPPb)o+y|wsp1KN-qcpN7306JYo;hHM&ElP;s(KK1p+>``A3bV5TJ@q~ALnF4dj?9Qss~|57ByT4@Fv9<3OD8(%$N3tpdms^ zN-3l0>nyiuD7MwY)!T7JYZ%irP&(A~APmJ*!>CPY`V}gQ)er!>+K^I3a@$o30yOMY zo?}=Ew@3{EAl9HM9XYp`Iuod&w{d~p%q>M~C}mxj3>7^HLx|9@)zZc8w!h*u1OUlH zJ(8jFI?GK&YFKM_WxOFenT9F1Tr~Fk)0k5mG5MYY@S2sXjr;jE;`S($X_&+m$>}8j z12P+>`|ehv>hLFk?ga`0pt4I9>nje)E@2UZX(#~aFJhyY#PcXHuK#T)uoE_6^E?; zJkwAvp@%HA(-#jb4q5$qrr{Kcx7NP_Tq?0kmCN}OroTf@Ohd!a#Q!v$2Vn{*l;HpX N002ovPDHLkV1l&!uyFtY diff --git a/test/fill_rule.c b/test/fill_rule.c deleted file mode 100644 index 20a74eb93..000000000 --- a/test/fill_rule.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -/* Bug history - * - * 2004-10-27 Carl Worth - * - * There's currently a regression bug in the tessellation code. This - * causes each of these simple star shapes to be filled incorrectly. - * - * It looks like right now we can get this test to pass by doing: - * - * cvs update -r 1.16 src/cairo_traps.c - * - * But we don't want to revert that change permanently since it - * really does correct some bugs. It must be that the old version of - * the code is masking some other bugs in the tessellation code. My - * current plan is to back this revision up for the next snapshot, - * but not to list the test as an expected failure since I'm - * planning on doing the new tessellator which should fix this - * problem. - * - * 2005-01-11 Carl Worth - * - * Keith committed some fixes that fix the original size-20 - * star_path: - * - * * src/cairo_wideint.c: (_cairo_int32x32_64_mul), - * (_cairo_int64x64_128_mul): - * * src/cairo_wideint.h: - * int32x32_64_mul and int64x64_128_mul are different from their - * unsigned compatriots - * - * 2005-01-12 Carl Worth - * - * Going back to the SVG test suite, however, the original star - * shape is still broken. Adding both shapes now as little_star_path - * and big_star_path. - * - */ - -#include "cairo_test.h" - -#define LITTLE_STAR_SIZE 20 -#define BIG_STAR_SIZE 80 - -cairo_test_t test = { - "fill_rule", - "Tests cairo_set_full_rule with some star shapes", - BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3 -}; - -/* The SVG start trimmed down, but still showing the bug (originally) */ -static void -little_star_path (cairo_t *cr) -{ - cairo_move_to (cr, 10, 0); - cairo_rel_line_to (cr, 6, 20); - cairo_rel_line_to (cr, -16, -12); - cairo_rel_line_to (cr, 20, 0); - cairo_rel_line_to (cr, -16, 12); -} - -/* The star shape from the SVG test suite. This was is still buggy even after - we got little_star_path working. */ -static void -big_star_path (cairo_t *cr) -{ - cairo_move_to (cr, 40, 0); - cairo_rel_line_to (cr, 25, 80); - cairo_rel_line_to (cr, -65, -50); - cairo_rel_line_to (cr, 80, 0); - cairo_rel_line_to (cr, -65, 50); - cairo_close_path (cr); -} - -/* Fill the same path twice, once with each fill rule */ -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_set_rgb_color (cr, 1, 0, 0); - - cairo_translate (cr, 1, 1); - little_star_path (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); - cairo_fill (cr); - - cairo_translate (cr, LITTLE_STAR_SIZE + 1, 0); - little_star_path (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill (cr); - - cairo_translate (cr, -(LITTLE_STAR_SIZE + 1), LITTLE_STAR_SIZE + 1); - big_star_path (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); - cairo_fill (cr); - - cairo_translate (cr, BIG_STAR_SIZE + 1, 0); - big_star_path (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill (cr); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/get-and-set.c b/test/get-and-set.c index 05643ca27..c7d54a67d 100644 --- a/test/get-and-set.c +++ b/test/get-and-set.c @@ -23,10 +23,10 @@ * Author: Carl D. Worth */ -#include "cairo_test.h" +#include "cairo-test.h" cairo_test_t test = { - "get_and_set", + "get-and-set", "Tests calls to the most trivial cairo_get and cairo_set functions", 0, 0 }; diff --git a/test/get_and_set.c b/test/get_and_set.c deleted file mode 100644 index 05643ca27..000000000 --- a/test/get_and_set.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#include "cairo_test.h" - -cairo_test_t test = { - "get_and_set", - "Tests calls to the most trivial cairo_get and cairo_set functions", - 0, 0 -}; - -typedef struct { - cairo_operator_t operator; - double tolerance; - double point_x; - double point_y; - cairo_fill_rule_t fill_rule; - double line_width; - cairo_line_cap_t line_cap; - cairo_line_join_t line_join; - double miter_limit; - /* XXX: Add cairo_matrix_t here when it is exposed */ -} settings_t; - -/* Two sets of settings, no defaults */ -settings_t settings[] = { - { - CAIRO_OPERATOR_IN, - 2.0, - 12.3, - 4.56, - CAIRO_FILL_RULE_EVEN_ODD, - 7.7, - CAIRO_LINE_CAP_SQUARE, - CAIRO_LINE_JOIN_ROUND, - 3.14 - }, - { - CAIRO_OPERATOR_ATOP, - 5.25, - 99.99, - 0.001, - CAIRO_FILL_RULE_WINDING, - 2.17, - CAIRO_LINE_CAP_ROUND, - CAIRO_LINE_JOIN_BEVEL, - 1000.0 - } -}; - -static void -settings_set (cairo_t *cr, settings_t *settings) -{ - cairo_set_operator (cr, settings->operator); - cairo_set_tolerance (cr, settings->tolerance); - cairo_move_to (cr, settings->point_x, settings->point_y); - cairo_set_fill_rule (cr, settings->fill_rule); - cairo_set_line_width (cr, settings->line_width); - cairo_set_line_cap (cr, settings->line_cap); - cairo_set_line_join (cr, settings->line_join); - cairo_set_miter_limit (cr, settings->miter_limit); -} - -static void -settings_get (cairo_t *cr, settings_t *settings) -{ - settings->operator = cairo_get_operator (cr); - settings->tolerance = cairo_get_tolerance (cr); - cairo_get_current_point (cr, &settings->point_x, &settings->point_y); - settings->fill_rule = cairo_get_fill_rule (cr); - settings->line_width = cairo_get_line_width (cr); - settings->line_cap = cairo_get_line_cap (cr); - settings->line_join = cairo_get_line_join (cr); - settings->miter_limit = cairo_get_miter_limit (cr); -} - -/* Maximum error is one part of our fixed-point grid */ -#define EPSILON (1.0 / 65536.0) - -static int -DOUBLES_WITHIN_EPSILON(double a, double b) { - double delta = fabs(a - b); - return delta < EPSILON; -} - -static int -settings_equal (settings_t *a, settings_t *b) -{ - return (a->operator == b->operator && - a->tolerance == b->tolerance && - DOUBLES_WITHIN_EPSILON (a->point_x, b->point_x) && - DOUBLES_WITHIN_EPSILON (a->point_y, b->point_y) && - a->fill_rule == b->fill_rule && - a->line_width == b->line_width && - a->line_cap == b->line_cap && - a->line_join == b->line_join && - a->miter_limit == b->miter_limit); -} - -static cairo_test_status_t -get_and_set (cairo_t *cr, int width, int height) -{ - settings_t check; - - settings_set (cr, &settings[0]); - - cairo_save (cr); - { - settings_set (cr, &settings[1]); - settings_get (cr, &check); - - if (!settings_equal (&settings[1], &check)) - return CAIRO_TEST_FAILURE; - } - cairo_restore (cr); - - settings_get (cr, &check); - - if (!settings_equal (&settings[0], &check)) - return CAIRO_TEST_FAILURE; - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, get_and_set); -} diff --git a/test/imagediff.c b/test/imagediff.c index 36962f11f..52ea7d412 100644 --- a/test/imagediff.c +++ b/test/imagediff.c @@ -26,9 +26,9 @@ #include #include -#include "buffer_diff.h" -#include "read_png.h" -#include "write_png.h" +#include "buffer-diff.h" +#include "read-png.h" +#include "write-png.h" #include "xmalloc.h" int diff --git a/test/leaky-polygon.c b/test/leaky-polygon.c index 6ac3698e4..575311ee9 100644 --- a/test/leaky-polygon.c +++ b/test/leaky-polygon.c @@ -51,13 +51,13 @@ * */ -#include "cairo_test.h" +#include "cairo-test.h" #define WIDTH 21 #define HEIGHT 21 cairo_test_t test = { - "leaky_polygon", + "leaky-polygon", "Exercises a corner case in the trapezoid rasterization in which pixels outside the trapezoids received a non-zero alpha", WIDTH, HEIGHT }; diff --git a/test/leaky_polygon-ref.png b/test/leaky_polygon-ref.png deleted file mode 100644 index 0daabe15ab3ffa15afbeddeb749b2c5bb81b365b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{1|(OCFP#RY*pj^6T^Rm@;DWu&Cj&*cc)B=- zSoChavY)FlQKIc*{63=-Dq^0Bi_hk4I`M>MjbF#fM?OAYeT_#GCfcVTIH2(I_3O|3 zu7A36`*Y0R!*_jCPI)ACNE3(arWnYrfs+%;4a-B5OgEC$@-jRzR|>l#wZWXkc~o$g0*KZi+$R1>E!APwj0lO z_@{OjW@K_^e{t%*edDLsk^R2)hXs{${*^5K%<^Zdi0 - */ - -/* Bug history - * - * 2005-01-07 Carl Worth - * - * Bug reported: - * - * From: Chris - * Subject: [cairo] Render to image buffer artifacts - * To: cairo@cairographics.org - * Date: Fri, 07 Jan 2005 02:22:28 -0500 - * - * I've attached the code and image that shows this off. Scaling at - * different levels seems to change the corruption. - * - * For some reason there are artifacts in the alpha channel. I don't know - * if that's the only place, but the alpha channel looks bad. - * - * If you run the code and parse the attached image, directing stdout to a - * file, you can see in the lower left corner there are alpha values where - * it should be transparent. - * [...] - * - * 2005-01-11 Carl Worth - * - * I trimmed the original test case down to the code that appears here. - * - */ - -#include "cairo_test.h" - -#define WIDTH 21 -#define HEIGHT 21 - -cairo_test_t test = { - "leaky_polygon", - "Exercises a corner case in the trapezoid rasterization in which pixels outside the trapezoids received a non-zero alpha", - WIDTH, HEIGHT -}; - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_scale (cr, 1.0/(1<<16), 1.0/(1<<16)); - - cairo_move_to (cr, 131072,39321); - cairo_line_to (cr, 1103072,1288088); - cairo_line_to (cr, 1179648,1294990); - cairo_close_path (cr); - - cairo_fill (cr); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/line-width.c b/test/line-width.c index 41e741991..285b66b84 100644 --- a/test/line-width.c +++ b/test/line-width.c @@ -23,7 +23,7 @@ * Author: Carl D. Worth */ -#include "cairo_test.h" +#include "cairo-test.h" #define LINES 5 #define LINE_LENGTH 10 @@ -31,7 +31,7 @@ #define IMAGE_HEIGHT ((LINES+4)*LINES)/2 + 2 cairo_test_t test = { - "line_width", + "line-width", "Tests cairo_set_line_width", IMAGE_WIDTH, IMAGE_HEIGHT }; diff --git a/test/line_width-ref.png b/test/line_width-ref.png deleted file mode 100644 index ddcd929d8e679358ee35541c567a93c4dca4fde7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^Qa~)h!3HFsG`&3vq}Y|gW!U_%O?Xx5mdKI;Vst0Lj5Q1ONa4 diff --git a/test/line_width.c b/test/line_width.c deleted file mode 100644 index 41e741991..000000000 --- a/test/line_width.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#include "cairo_test.h" - -#define LINES 5 -#define LINE_LENGTH 10 -#define IMAGE_WIDTH 2 * LINE_LENGTH + 6 -#define IMAGE_HEIGHT ((LINES+4)*LINES)/2 + 2 - -cairo_test_t test = { - "line_width", - "Tests cairo_set_line_width", - IMAGE_WIDTH, IMAGE_HEIGHT -}; - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - int i; - - cairo_set_rgb_color (cr, 0, 0, 0); - cairo_translate (cr, 2, 2); - - for (i=0; i < LINES; i++) { - cairo_set_line_width (cr, i+1); - cairo_move_to (cr, 0, 0); - cairo_rel_line_to (cr, LINE_LENGTH, 0); - cairo_stroke (cr); - cairo_move_to (cr, LINE_LENGTH + 2, 0.5); - cairo_rel_line_to (cr, LINE_LENGTH, 0); - cairo_stroke (cr); - cairo_translate (cr, 0, i+3); - } - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/linear-gradient.c b/test/linear-gradient.c index 5711d15bc..418ddf2fe 100644 --- a/test/linear-gradient.c +++ b/test/linear-gradient.c @@ -23,7 +23,7 @@ * Author: Owen Taylor */ -#include "cairo_test.h" +#include "cairo-test.h" #include "stdio.h" /* The test matrix is @@ -55,7 +55,7 @@ static const int n_stops[] = { 2, 3 }; #define HEIGHT N_N_STOPS * N_ROTATE_ANGLES * UNIT_SIZE + (N_N_STOPS * N_ROTATE_ANGLES + 1) * PAD cairo_test_t test = { - "linear_gradient", + "linear-gradient", "Tests the drawing of linear gradients", WIDTH, HEIGHT }; diff --git a/test/linear_gradient-ref.png b/test/linear_gradient-ref.png deleted file mode 100644 index 77904144d50fd38a70da37b78d7a1efff9e102c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12724 zcm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,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Owen Taylor - */ - -#include "cairo_test.h" -#include "stdio.h" - -/* The test matrix is - * - * A) Horizontal B) 5° C) 45° D) Vertical - * 1) Rotated 0° 2) Rotated 45° C) Rotated 90° - * a) 2 stop b) 3 stop - * - * A1a B1a C1a D1a - * A2a B2a C2a D2a - * A3a B3a C3a D3a - * A1b B1b C1b D1b - * A2b B2b C2b D2b - * A3b B3b C3b D3b - */ - -static const double gradient_angles[] = { 0, 45, 90 }; -#define N_GRADIENT_ANGLES 3 -static const double rotate_angles[] = { 0, 45, 90 }; -#define N_ROTATE_ANGLES 3 -static const int n_stops[] = { 2, 3 }; -#define N_N_STOPS 2 - -#define UNIT_SIZE 75 -#define UNIT_SIZE 75 -#define PAD 5 - -#define WIDTH N_GRADIENT_ANGLES * UNIT_SIZE + (N_GRADIENT_ANGLES + 1) * PAD -#define HEIGHT N_N_STOPS * N_ROTATE_ANGLES * UNIT_SIZE + (N_N_STOPS * N_ROTATE_ANGLES + 1) * PAD - -cairo_test_t test = { - "linear_gradient", - "Tests the drawing of linear gradients", - WIDTH, HEIGHT -}; - -static void -draw_unit (cairo_t *cr, - double gradient_angle, - double rotate_angle, - int n_stops) -{ - cairo_pattern_t *pattern; - - cairo_rectangle (cr, 0, 0, 1, 1); - cairo_clip (cr); - cairo_new_path(cr); - - cairo_set_rgb_color (cr, 0.0, 0.0, 0.0); - cairo_rectangle (cr, 0, 0, 1, 1); - cairo_fill (cr); - - cairo_translate (cr, 0.5, 0.5); - cairo_scale (cr, 1 / 1.5, 1 / 1.5); - cairo_rotate (cr, rotate_angle); - - pattern = cairo_pattern_create_linear (-0.5 * cos (gradient_angle), -0.5 * sin (gradient_angle), - 0.5 * cos (gradient_angle), 0.5 * sin (gradient_angle)); - - if (n_stops == 2) { - cairo_pattern_add_color_stop (pattern, 0., - 0.3, 0.3, 0.3, - 1.0); - cairo_pattern_add_color_stop (pattern, 1., - 1.0, 1.0, 1.0, - 1.0); - } else { - cairo_pattern_add_color_stop (pattern, 0., - 1.0, 0.0, 0.0, - 1.0); - cairo_pattern_add_color_stop (pattern, 0.5, - 1.0, 1.0, 1.0, - 1.0); - cairo_pattern_add_color_stop (pattern, 1., - 0.0, 0.0, 1.0, - 1.0); - } - - cairo_set_pattern (cr, pattern); - cairo_pattern_destroy (pattern); - cairo_rectangle (cr, -0.5, -0.5, 1, 1); - cairo_fill (cr); -} - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - int i, j, k; - - cairo_set_rgb_color (cr, 0.5, 0.5, 0.5); - cairo_rectangle (cr, 0, 0, width, height); - cairo_fill (cr); - - for (i = 0; i < N_GRADIENT_ANGLES; i++) - for (j = 0; j < N_ROTATE_ANGLES; j++) - for (k = 0; k < N_N_STOPS; k++) { - cairo_save (cr); - cairo_translate (cr, - PAD + (PAD + UNIT_SIZE) * i, - PAD + (PAD + UNIT_SIZE) * (N_ROTATE_ANGLES * k + j)); - cairo_scale (cr, UNIT_SIZE, UNIT_SIZE); - - draw_unit (cr, - gradient_angles[i] * M_PI / 180., - rotate_angles[j] * M_PI / 180., - n_stops[k]); - cairo_restore (cr); - } - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/move-to-show-surface.c b/test/move-to-show-surface.c index a52c18ea0..48e3b16a3 100644 --- a/test/move-to-show-surface.c +++ b/test/move-to-show-surface.c @@ -35,10 +35,10 @@ */ -#include "cairo_test.h" +#include "cairo-test.h" cairo_test_t test = { - "move_to_show_surface", + "move-to-show-surface", "Tests calls to cairo_show_surface after cairo_move_to", 2, 2 }; diff --git a/test/move_to_show_surface-ref.png b/test/move_to_show_surface-ref.png deleted file mode 100644 index 765adc4a48835d273043c0d18be61eda17d88088..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^Od!m`1|*BN@u~nRwj^(N7l!{JxM1({$v_cFPZ!6K uiaD$Y8F?8Pcn&K}yR-kPT!^c=vs~C)c7~6?-pvInV(@hJb6Mw<&;$Tgh#N!z diff --git a/test/move_to_show_surface.c b/test/move_to_show_surface.c deleted file mode 100644 index a52c18ea0..000000000 --- a/test/move_to_show_surface.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -/* Bug history - * - * 2004-10-25 Carl Worth - * - * It looks like cairo_show_surface has no effect if it follows a - * call to cairo_move_to to any coordinate other than 0,0. A little - * bit of poking around suggests this isn't a regression, (at least - * not since the last pixman snapshot). - * - */ - - -#include "cairo_test.h" - -cairo_test_t test = { - "move_to_show_surface", - "Tests calls to cairo_show_surface after cairo_move_to", - 2, 2 -}; - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_surface_t *surface; - uint32_t colors[4] = { - 0xffffffff, 0xffff0000, - 0xff00ff00, 0xff0000ff - }; - int i; - - for (i=0; i < 4; i++) { - surface = cairo_surface_create_for_image ((char *) &colors[i], - CAIRO_FORMAT_ARGB32, 1, 1, 4); - cairo_move_to (cr, i % 2, i / 2); - cairo_show_surface (cr, surface, 1, 1); - cairo_surface_destroy (surface); - } - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/path-data.c b/test/path-data.c index 548d205e1..db30e8f52 100644 --- a/test/path-data.c +++ b/test/path-data.c @@ -24,10 +24,10 @@ */ #include -#include "cairo_test.h" +#include "cairo-test.h" cairo_test_t test = { - "path_data", + "path-data", "Tests calls to path_data functions: cairo_copy_path_data, cairo_copy_path_data_flat, and cairo_append_path_data", 45, 53 }; diff --git a/test/path_data-ref.png b/test/path_data-ref.png deleted file mode 100644 index f8bc64758879a74ed24c655ce0d0fcb5553b77c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 387 zcmV-}0et?6P)_gXE{@|E zpv3g>UDF!UzH3@bdbVBDCbFhB=M6XlE8v-l%_)_U*2TUa-@tZMv%I_C=89`e#~Sf| zm-G;+$!bn*>Db6yj_z;yee#o - */ - -#include -#include "cairo_test.h" - -cairo_test_t test = { - "path_data", - "Tests calls to path_data functions: cairo_copy_path_data, cairo_copy_path_data_flat, and cairo_append_path_data", - 45, 53 -}; - -static void -scale_by_two (double *x, double *y) -{ - *x = *x * 2.0; - *y = *y * 2.0; -} - -typedef void (*munge_func_t) (double *x, double *y); - -static void -munge_and_set_path (cairo_t *cr, - cairo_path_t *path, - munge_func_t munge) -{ - int i; - cairo_path_data_t *p; - double x1, y1, x2, y2, x3, y3; - - for (i=0; i < path->num_data; i += path->data[i].header.length) { - p = &path->data[i]; - switch (p->header.type) { - case CAIRO_PATH_MOVE_TO: - x1 = p[1].point.x; y1 = p[1].point.y; - (munge) (&x1, &y1); - cairo_move_to (cr, x1, y1); - break; - case CAIRO_PATH_LINE_TO: - x1 = p[1].point.x; y1 = p[1].point.y; - (munge) (&x1, &y1); - cairo_line_to (cr, x1, y1); - break; - case CAIRO_PATH_CURVE_TO: - x1 = p[1].point.x; y1 = p[1].point.y; - x2 = p[2].point.x; y2 = p[2].point.y; - x3 = p[3].point.x; y3 = p[3].point.y; - (munge) (&x1, &y1); - (munge) (&x2, &y2); - (munge) (&x3, &y3); - cairo_curve_to (cr, - x1, y1, - x2, y2, - x3, y3); - break; - case CAIRO_PATH_CLOSE_PATH: - cairo_close_path (cr); - break; - } - } -} - -static void -make_path (cairo_t *cr) -{ - cairo_rectangle (cr, 0, 0, 5, 5); - cairo_move_to (cr, 15, 2.5); - cairo_arc (cr, 12.5, 2.5, 2.5, 0, 2 * M_PI); -} - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_path_t *path; - - /* copy path, munge, and fill */ - cairo_translate (cr, 5, 5); - make_path (cr); - path = cairo_copy_path (cr); - - cairo_new_path (cr); - munge_and_set_path (cr, path, scale_by_two); - cairo_path_destroy (path); - cairo_fill (cr); - - /* copy flattened path, munge, and fill */ - cairo_translate (cr, 0, 15); - make_path (cr); - path = cairo_copy_path_flat (cr); - - cairo_new_path (cr); - munge_and_set_path (cr, path, scale_by_two); - cairo_path_destroy (path); - cairo_fill (cr); - - /* append two copies of path, and fill */ - cairo_translate (cr, 0, 15); - cairo_scale (cr, 2.0, 2.0); - make_path (cr); - path = cairo_copy_path (cr); - - cairo_new_path (cr); - cairo_append_path (cr, path); - cairo_translate (cr, 2.5, 2.5); - cairo_append_path (cr, path); - - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill (cr); - - cairo_path_destroy (path); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - cairo_t *cr; - cairo_path_data_t data; - cairo_path_t path; - - /* Test a few error cases for cairo_append_path_data */ - cr = cairo_create (); - cairo_append_path (cr, NULL); - if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER) - return 1; - cairo_destroy (cr); - - cr = cairo_create (); - path.data = NULL; - path.num_data = 0; - cairo_append_path (cr, &path); - if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER) - return 1; - cairo_destroy (cr); - - cr = cairo_create (); - /* Intentionally insert bogus header.length value (otherwise would be 2) */ - data.header.type = CAIRO_PATH_MOVE_TO; - data.header.length = 1; - path.data = &data; - path.num_data = 1; - cairo_append_path (cr, &path); - if (cairo_status (cr) != CAIRO_STATUS_INVALID_PATH_DATA) - return 1; - cairo_destroy (cr); - - /* And test the degnerate case */ - cr = cairo_create (); - path.num_data = 0; - cairo_append_path (cr, &path); - if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) - return 1; - cairo_destroy (cr); - - return cairo_test (&test, draw); -} diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c index d2848dd07..a5e52d2c9 100644 --- a/test/pixman-rotate.c +++ b/test/pixman-rotate.c @@ -7,7 +7,7 @@ #include #include -#include "cairo_test.h" +#include "cairo-test.h" #define WIDTH 32 #define HEIGHT WIDTH @@ -16,7 +16,7 @@ #define IMAGE_HEIGHT IMAGE_WIDTH cairo_test_t test = { - "pixman_rotate", + "pixman-rotate", "Exposes pixman off-by-one error when rotating", IMAGE_WIDTH, IMAGE_HEIGHT }; diff --git a/test/pixman_rotate-ref.png b/test/pixman_rotate-ref.png deleted file mode 100644 index 7e47a4d8f52eec624af0eff8b651e32ca2c4a6ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoY)RhkE)4%caKYZ?lYt^TJzX3_ zD(1Ysb&&IrgMh=u&WOg^$eyVYJ+(KTY&hrbarr5De|LN2x6K<=W-gTe~DWM4f_{CVn diff --git a/test/pixman_rotate.c b/test/pixman_rotate.c deleted file mode 100644 index d2848dd07..000000000 --- a/test/pixman_rotate.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include "cairo_test.h" - -#define WIDTH 32 -#define HEIGHT WIDTH - -#define IMAGE_WIDTH (3 * WIDTH) -#define IMAGE_HEIGHT IMAGE_WIDTH - -cairo_test_t test = { - "pixman_rotate", - "Exposes pixman off-by-one error when rotating", - IMAGE_WIDTH, IMAGE_HEIGHT -}; - -/* Draw the word cairo at NUM_TEXT different angles */ -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - cairo_surface_t *target, *stamp; - - target = cairo_get_target_surface (cr); - cairo_surface_reference (target); - - stamp = cairo_surface_create_similar (target, CAIRO_FORMAT_ARGB32, - WIDTH, HEIGHT); - cairo_set_target_surface (cr, stamp); - cairo_new_path (cr); - cairo_rectangle (cr, WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2); - cairo_set_rgb_color (cr, 1, 0, 0); - cairo_set_alpha (cr, 0.8); - cairo_fill (cr); - - cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT); - cairo_set_line_width (cr, 2); - cairo_set_rgb_color (cr, 0, 0, 0); - cairo_set_alpha (cr, 1); - cairo_stroke (cr); - - cairo_set_target_surface (cr, target); - - /* Draw a translucent rectangle for reference where the rotated - * image should be. */ - cairo_new_path (cr); - cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT); - cairo_set_rgb_color (cr, 1, 1, 0); - cairo_set_alpha (cr, 0.3); - cairo_fill (cr); - -#if 1 /* Set to 0 to generate reference image */ - cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT); - cairo_rotate (cr, M_PI); -#else - cairo_translate (cr, WIDTH, HEIGHT); -#endif - - cairo_set_alpha (cr, 1); - cairo_show_surface (cr, stamp, WIDTH + 2, HEIGHT + 2); - - cairo_show_page (cr); - - cairo_surface_destroy (stamp); - cairo_surface_destroy (target); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/read-png.c b/test/read-png.c index e7e2a92ca..6f4d3e1c6 100644 --- a/test/read-png.c +++ b/test/read-png.c @@ -29,7 +29,7 @@ #include #include -#include "read_png.h" +#include "read-png.h" #include "xmalloc.h" static void diff --git a/test/read_png.c b/test/read_png.c deleted file mode 100644 index e7e2a92ca..000000000 --- a/test/read_png.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright © 2003 USC, Information Sciences Institute - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of the - * University of Southern California not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. The University of Southern - * California makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF - * SOUTHERN CALIFORNIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#include -#include -#include - -#include "read_png.h" -#include "xmalloc.h" - -static void -premultiply_data (png_structp png, - png_row_infop row_info, - png_bytep data) -{ - int i; - - for (i = 0; i < row_info->rowbytes; i += 4) { - unsigned char *base = &data[i]; - unsigned char blue = base[0]; - unsigned char green = base[1]; - unsigned char red = base[2]; - unsigned char alpha = base[3]; - unsigned long p; - - red = ((unsigned) red * (unsigned) alpha + 127) / 255; - green = ((unsigned) green * (unsigned) alpha + 127) / 255; - blue = ((unsigned) blue * (unsigned) alpha + 127) / 255; - p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); - memcpy (base, &p, sizeof (unsigned long)); - } -} - -read_png_status_t -read_png_argb32 (const char *filename, - unsigned char **data, - unsigned int *width, - unsigned int *height, - unsigned int *stride) -{ - int i; - FILE *file; - static const int PNG_SIG_SIZE = 8; - unsigned char png_sig[PNG_SIG_SIZE]; - int sig_bytes; - png_struct *png; - png_info *info; - png_uint_32 png_width, png_height; - int depth, color_type, interlace; - unsigned int pixel_size; - png_byte **row_pointers; - - file = fopen (filename, "rb"); - if (file == NULL) { - return READ_PNG_FILE_NOT_FOUND; - } - - sig_bytes = fread (png_sig, 1, PNG_SIG_SIZE, file); - if (png_check_sig (png_sig, sig_bytes) == 0) { - fclose (file); - return READ_PNG_FILE_NOT_PNG; - } - - /* XXX: Perhaps we'll want some other error handlers? */ - png = png_create_read_struct (PNG_LIBPNG_VER_STRING, - NULL, - NULL, - NULL); - if (png == NULL) { - fclose (file); - return READ_PNG_NO_MEMORY; - } - - info = png_create_info_struct (png); - if (info == NULL) { - fclose (file); - png_destroy_read_struct (&png, NULL, NULL); - return READ_PNG_NO_MEMORY; - } - - png_init_io (png, file); - png_set_sig_bytes (png, sig_bytes); - - png_read_info (png, info); - - png_get_IHDR (png, info, - &png_width, &png_height, &depth, - &color_type, &interlace, NULL, NULL); - *width = png_width; - *height = png_height; - *stride = 4 * png_width; - - - /* convert palette/gray image to rgb */ - if (color_type == PNG_COLOR_TYPE_PALETTE) - png_set_palette_to_rgb (png); - - /* expand gray bit depth if needed */ - if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8) - png_set_gray_1_2_4_to_8 (png); - /* transform transparency to alpha */ - if (png_get_valid(png, info, PNG_INFO_tRNS)) - png_set_tRNS_to_alpha (png); - - if (depth == 16) - png_set_strip_16 (png); - - if (depth < 8) - png_set_packing (png); - - /* convert grayscale to RGB */ - if (color_type == PNG_COLOR_TYPE_GRAY - || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - png_set_gray_to_rgb (png); - - if (interlace != PNG_INTERLACE_NONE) - png_set_interlace_handling (png); - - png_set_bgr (png); - png_set_filler (png, 0xff, PNG_FILLER_AFTER); - - png_set_read_user_transform_fn (png, premultiply_data); - - png_read_update_info (png, info); - - pixel_size = 4; - *data = xmalloc (png_width * png_height * pixel_size); - - row_pointers = malloc (png_height * sizeof(char *)); - for (i=0; i < png_height; i++) - row_pointers[i] = (png_byte *) (*data + i * png_width * pixel_size); - - png_read_image (png, row_pointers); - png_read_end (png, info); - - free (row_pointers); - fclose (file); - - png_destroy_read_struct (&png, &info, NULL); - - return READ_PNG_SUCCESS; -} diff --git a/test/read_png.h b/test/read_png.h deleted file mode 100644 index 9c9ba433d..000000000 --- a/test/read_png.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2003 USC, Information Sciences Institute - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of the - * University of Southern California not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. The University of Southern - * California makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF - * SOUTHERN CALIFORNIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#ifndef READ_PNG_H -#define READ_PNG_H - -typedef enum { - READ_PNG_SUCCESS = 0, - READ_PNG_FILE_NOT_FOUND, - READ_PNG_FILE_NOT_PNG, - READ_PNG_NO_MEMORY -} read_png_status_t; - -read_png_status_t -read_png_argb32 (const char *filename, - unsigned char **data, - unsigned int *width, - unsigned int *height, - unsigned int *stride); - -#endif diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c index abf205810..68348cf64 100644 --- a/test/text-cache-crash.c +++ b/test/text-cache-crash.c @@ -60,10 +60,10 @@ * fixed the orginal test case. */ -#include "cairo_test.h" +#include "cairo-test.h" cairo_test_t test = { - "text_cache_crash", + "text-cache-crash", "Test case for bug causing an assertion failure in _cairo_cache_lookup", 0, 0, }; diff --git a/test/text-rotate.c b/test/text-rotate.c index 2597a0533..f7c287758 100644 --- a/test/text-rotate.c +++ b/test/text-rotate.c @@ -57,7 +57,7 @@ * builtin font to cairo for pixel-perfect tests with text. */ -#include "cairo_test.h" +#include "cairo-test.h" #define WIDTH 150 #define HEIGHT 150 @@ -65,7 +65,7 @@ #define TEXT_SIZE 12 cairo_test_t test = { - "text_rotate", + "text-rotate", "Tests show_text under various rotations", WIDTH, HEIGHT }; diff --git a/test/text_cache_crash.c b/test/text_cache_crash.c deleted file mode 100644 index abf205810..000000000 --- a/test/text_cache_crash.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -/* Bug history - * - * 2004-11-04 Ned Konz - * - * Reported bug on mailing list: - * - * From: Ned Konz - * To: cairo@cairographics.org - * Date: Thu, 4 Nov 2004 09:49:38 -0800 - * Subject: [cairo] getting assertions [cairo_cache.c:143: _entry_destroy: - * Assertion `cache->used_memory > entry->memory' failed] - * - * The attached program dies on me with the assert - * - * $ ./testCairo - * testCairo: cairo_cache.c:143: _entry_destroy: Assertion `cache->used_memory > entry->memory' failed. - * - * 2004-11-04 Carl Worth - * - * I trimmed down Ned's example to the folllowing test while still - * maintaining the assertion. - * - * Oh, actually, it looks like I may have triggered something - * slightly different: - * - * text_cache_crash: cairo_cache.c:422: _cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed. - * - * I'll have to go back and try the original test after I fix this. - * - * 2004-11-13 Carl Worth - * - * Found the bug. cairo_gstate_select_font was noticing when the - * same font was selected twice in a row and was erroneously failing - * to free the old reference. Committed a fix and verified it also - * fixed the orginal test case. - */ - -#include "cairo_test.h" - -cairo_test_t test = { - "text_cache_crash", - "Test case for bug causing an assertion failure in _cairo_cache_lookup", - 0, 0, -}; -#include - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - /* Once there was a bug that choked when selecting the same font twice. */ - cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_scale_font(cr, 40.0); - - cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_scale_font(cr, 40.0); - cairo_move_to(cr, 10, 50); - cairo_show_text(cr, "hello"); - - /* Then there was a bug that choked when selecting a font too big - * for the cache. */ - -/* XXX: Sometimes this leads to an assertion: - -_cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed. -Aborted - - But other times my machine hangs completely only to return to life - several minutes later with some programs missing. This seems like - the out-of-memory killer to me. - - It seems like I usually get the assertion when I run - ./text_cache_crash directly and I usually get the machine hang when - I run "make check" but I don't know if there's a perfect - correlation there. - - So there's a bad bug here somewhere that really needs to be fixed. - But in the meantime, I need "make check" not to destory work, so - I'm commenting this test out for now. - - cairo_scale_font (cr, 500); - cairo_show_text (cr, "hello"); -*/ - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - int ret; - - ret = cairo_test (&test, draw); - - /* It's convenient to be able to free all memory (including - * statically allocated memory). This makes it quite easy to use - * tools such as valgrind to verify that there are no memory leaks - * whatsoever. - * - * But I'm not sure what would be a sensible cairo API function - * for this. The cairo_destroy_caches call below is just something - * I made as a local modification to cairo. - */ - /* - cairo_destroy_caches (); - FcFini (); - */ - - return ret; -} - diff --git a/test/text_rotate.c b/test/text_rotate.c deleted file mode 100644 index 2597a0533..000000000 --- a/test/text_rotate.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -/* Bug history - * - * 2004-11-03 Steve Chaplin - * - * Reported bug on mailing list: - * - * From: Steve Chaplin - * To: cairo@cairographics.org - * Date: Thu, 04 Nov 2004 00:00:17 +0800 - * Subject: [cairo] Rotated text bug on drawable target - * - * The attached file draws text rotated 90 degrees first to a PNG file and - * then to a drawable. The PNG file looks fine, the text on the drawable is - * unreadable. - * - * Steve - * - * 2004-11-03 Carl Worth - * - * Looks like the major problems with this bg appeared in the great - * font rework between 0.1.23 and 0.2.0. And it looks like we need - * to fix the regression test suite to test the xlib target (since - * the bug does not show up in the png backend). - * - * Hmm... Actually, things don't look perfect even in the PNG - * output. Look at how that 'o' moves around. It's particularly off - * in the case where it's rotated by PI. - * - * And I'm still not sure about what to do for test cases with - * text--a new version of freetype will change everything. We may - * need to add a simple backend for stroked fonts and add a simple - * builtin font to cairo for pixel-perfect tests with text. - */ - -#include "cairo_test.h" - -#define WIDTH 150 -#define HEIGHT 150 -#define NUM_TEXT 20 -#define TEXT_SIZE 12 - -cairo_test_t test = { - "text_rotate", - "Tests show_text under various rotations", - WIDTH, HEIGHT -}; - -/* Draw the word cairo at NUM_TEXT different angles */ -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - int i, x_off, y_off; - cairo_text_extents_t extents; - static char text[] = "cairo"; - - cairo_select_font (cr, "Bitstream Vera Sans", - CAIRO_FONT_SLANT_NORMAL, - CAIRO_FONT_WEIGHT_NORMAL); - cairo_scale_font (cr, TEXT_SIZE); - - cairo_set_rgb_color (cr, 0,0,0); - - cairo_translate (cr, WIDTH/2.0, HEIGHT/2.0); - - cairo_text_extents (cr, text, &extents); - - if (NUM_TEXT == 1) { - x_off = y_off = 0; - } else { - y_off = - round (extents.height / 2.0); - x_off = round ((extents.height+1) / (2 * tan (M_PI/NUM_TEXT))); - } - - for (i=0; i < NUM_TEXT; i++) { - cairo_save (cr); - cairo_rotate (cr, 2*M_PI*i/NUM_TEXT); - cairo_set_line_width (cr, 1.0); - cairo_rectangle (cr, x_off - 0.5, y_off - 0.5, extents.width + 1, extents.height + 1); - cairo_set_rgb_color (cr, 1, 0, 0); - cairo_stroke (cr); - cairo_move_to (cr, x_off - extents.x_bearing, y_off - extents.y_bearing); - cairo_set_rgb_color (cr, 0, 0, 0); - cairo_show_text (cr, "cairo"); - cairo_restore (cr); - } - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/user_data.c b/test/user_data.c deleted file mode 100644 index 88a706afa..000000000 --- a/test/user_data.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Kristian Høgsberg - */ - -#include -#include -#include - -static void -destroy_data1 (void *p) -{ - *(int *) p = 1; -} - -static void -destroy_data2 (void *p) -{ - *(int *) p = 2; -} - -int -main (void) -{ - cairo_surface_t *surface; - static const cairo_user_data_key_t key1, key2; - int data1, data2; - - data1 = 0; - data2 = 0; - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1); - assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1) - == CAIRO_STATUS_SUCCESS); - assert (cairo_surface_set_user_data (surface, &key2, &data2, destroy_data2) - == CAIRO_STATUS_SUCCESS); - assert (cairo_surface_get_user_data (surface, &key1) == &data1); - assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL) - == CAIRO_STATUS_SUCCESS); - assert (cairo_surface_get_user_data (surface, &key1) == NULL); - assert (data1 == 1); - assert (data2 == 0); - - data1 = 0; - assert (cairo_surface_set_user_data (surface, &key1, &data1, NULL) - == CAIRO_STATUS_SUCCESS); - assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL) - == CAIRO_STATUS_SUCCESS); - assert (data1 == 0); - assert (cairo_surface_get_user_data (surface, &key1) == NULL); - - assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1) - == CAIRO_STATUS_SUCCESS); - cairo_surface_destroy (surface); - assert (data1 == 1); - assert (data2 == 2); - - return 0; -} diff --git a/test/write-png.c b/test/write-png.c index 0ff5bcd3a..a5494b461 100644 --- a/test/write-png.c +++ b/test/write-png.c @@ -29,7 +29,7 @@ #include #include -#include "write_png.h" +#include "write-png.h" static void unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data) diff --git a/test/write_png.c b/test/write_png.c deleted file mode 100644 index 0ff5bcd3a..000000000 --- a/test/write_png.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright © 2003 USC, Information Sciences Institute - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of the - * University of Southern California not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. The University of Southern - * California makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF - * SOUTHERN CALIFORNIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#include -#include -#include - -#include "write_png.h" - -static void -unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data) -{ - int i; - - for (i = 0; i < row_info->rowbytes; i += 4) { - unsigned char *b = &data[i]; - unsigned int pixel; - unsigned char alpha; - - memcpy (&pixel, b, sizeof (unsigned int)); - alpha = (pixel & 0xff000000) >> 24; - if (alpha == 0) { - b[0] = b[1] = b[2] = b[3] = 0; - } else { - b[0] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; - b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha; - b[2] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; - b[3] = alpha; - } - } -} - -void -write_png_argb32 (char *buffer, FILE *file, - int width, int height, int stride) -{ - int i; - png_struct *png; - png_info *info; - png_byte **rows; - png_color_16 white; - - rows = malloc (height * sizeof(png_byte*)); - - for (i = 0; i < height; i++) { - rows[i] = buffer + i * stride; - } - - png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - info = png_create_info_struct (png); - - png_init_io (png, file); - png_set_IHDR (png, info, - width, height, 8, - PNG_COLOR_TYPE_RGB_ALPHA, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - - white.red = 0xff; - white.blue = 0xff; - white.green = 0xff; - png_set_bKGD (png, info, &white); - - png_set_write_user_transform_fn (png, unpremultiply_data); - png_set_bgr (png); - - png_write_info (png, info); - png_write_image (png, rows); - png_write_end (png, info); - - png_destroy_write_struct (&png, &info); - - free (rows); -} diff --git a/test/write_png.h b/test/write_png.h deleted file mode 100644 index fe0e92b20..000000000 --- a/test/write_png.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright © 2003 USC, Information Sciences Institute - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of the - * University of Southern California not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. The University of Southern - * California makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF - * SOUTHERN CALIFORNIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth - */ - -#ifndef WRITE_PNG_H -#define WRITE_PNG_H - -void -write_png_argb32 (char *buffer, FILE * file, - int width, int height, int stride); - -#endif