From 16f66dc31499afbf64e319562f01aac96edae52e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 18 Aug 2005 16:22:23 +0000 Subject: [PATCH] Add a test for bug #2333 (Tim Rowley) --- ChangeLog | 4 +++ test/Makefile.am | 3 ++ test/text-pattern-ref.png | Bin 0 -> 2869 bytes test/text-pattern.c | 74 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 test/text-pattern-ref.png create mode 100644 test/text-pattern.c diff --git a/ChangeLog b/ChangeLog index 2f48d7f82..298ca0c19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-18 Owen Taylor + + * test/text-pattern.c: Add a test for bug #2333 (Tim Rowley) + 2005-08-17 Owen Taylor * src/cairo-gstate.c: Implement new equations for CLEAR and SOURCE diff --git a/test/Makefile.am b/test/Makefile.am index dc3c902c3..4891cf2bd 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -40,6 +40,7 @@ text-antialias-gray \ text-antialias-none \ text-antialias-subpixel \ text-cache-crash \ +text-pattern \ text-rotate \ transforms \ translate-show-surface \ @@ -105,6 +106,7 @@ source-surface-scale-paint-ref.png \ surface-pattern-ref.png \ text-antialias-gray-ref.png \ text-antialias-none-ref.png \ +text-pattern-ref.png \ transforms-ref.png \ translate-show-surface-ref.png \ trap-clip-ref.png \ @@ -214,6 +216,7 @@ text_antialias_gray_LDADD = $(LDADDS) text_antialias_none_LDADD = $(LDADDS) text_antialias_subpixel_LDADD = $(LDADDS) text_cache_crash_LDADD = $(LDADDS) +text_pattern_LDADD = $(LDADDS) text_rotate_LDADD = $(LDADDS) transforms_LDADD = $(LDADDS) translate_show_surface_LDADD = $(LDADDS) diff --git a/test/text-pattern-ref.png b/test/text-pattern-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..52eed0ac8087aba802d60a4fa672dbf2e4083e1e GIT binary patch literal 2869 zcmb`Jc{CJ^8pbVS>=Y(jjjbA$Fj>QlJ!FkZYS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iGBtv!nD4cZ z(({0M__>0c7go?K?BVogD(27WqbUOgQzmK&AUCnzg{jIO9zX3GZf|@ldWnW literal 0 HcmV?d00001 diff --git a/test/text-pattern.c b/test/text-pattern.c new file mode 100644 index 000000000..347d83ba7 --- /dev/null +++ b/test/text-pattern.c @@ -0,0 +1,74 @@ +/* + * 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 IMAGE_WIDTH 100 +#define IMAGE_HEIGHT 100 + +cairo_test_t test = { + "text-pattern", + "Patterned Text", + IMAGE_WIDTH, IMAGE_HEIGHT +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_font_options_t *font_options; + cairo_pattern_t *pat; + + font_options = cairo_font_options_create (); + + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); + + cairo_set_font_options (cr, font_options); + cairo_font_options_destroy (font_options); + + cairo_scale (cr, width, height); + + pat = cairo_pattern_create_linear (0.0, 0.0, 1, 1); + cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 1); + cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 1, 1); + cairo_set_source (cr, pat); + + /* test rectangle - make sure the gradient is set correctly */ + cairo_rectangle (cr, 0, 0, 0.1, 1); + cairo_fill (cr); + + cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size (cr, 0.4); + cairo_move_to (cr, 0.1, 0.6); + cairo_show_text (cr, "cairo"); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +}