diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | RELEASING | 2 | ||||
-rw-r--r-- | test/.cvsignore | 2 | ||||
-rw-r--r-- | test/Makefile.am | 13 | ||||
-rw-r--r-- | test/cairo-test.h | 1 | ||||
-rw-r--r-- | test/cairo_test.h | 1 | ||||
-rw-r--r-- | test/text-cache-crash.c | 85 | ||||
-rw-r--r-- | test/text-rotate.c | 113 | ||||
-rw-r--r-- | test/text_cache_crash.c | 85 | ||||
-rw-r--r-- | test/text_rotate.c | 113 |
11 files changed, 419 insertions, 5 deletions
@@ -1,3 +1,11 @@ +2004-11-04 Carl Worth <cworth@cworth.org> + + * test/text_cache_crash.c: Add new test demonstrating assertion + failure in cairo_cache_lookup. + + * test/text_rotate.c: Add new test showing problems with rotated + text. + 2004-11-04 David Reveman <c99drn@cs.umu.se> * src/cairo_glitz_surface.c (cairo_set_target_glitz): diff --git a/Makefile.am b/Makefile.am index f8bb1949..aaddd9e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,4 +57,3 @@ release-publish: release-verify-newer release-check @cat releases/$(md5_file) @echo "" @echo "Also, please include the new entries from the NEWS file." - @@ -58,7 +58,7 @@ fixes are committed. Here are the steps to follow: 6) Run "make release-publish" which will perform the following steps for you: - * Check that no release exist with the current version + * Check that no release exists with the current version * Verify that make distcheck completes successfully * Generate the final tar file * Generate an md5sum file diff --git a/test/.cvsignore b/test/.cvsignore index 3b530421..ca4c6e56 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -5,6 +5,8 @@ Makefile.in fill_rule line_width move_to_show_surface +text_cache_crash +text_rotate *-out.png *-diff.png diff --git a/test/Makefile.am b/test/Makefile.am index 2f80f9f8..2ddd2580 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,9 @@ TESTS = \ fill_rule \ line_width \ -move_to_show_surface +move_to_show_surface \ +text_cache_crash \ +text_rotate # And all new test 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 @@ -10,7 +12,9 @@ move_to_show_surface EXTRA_DIST = \ fill_rule-ref.png \ line_width-ref.png \ -move_to_show_surface-ref.png +move_to_show_surface-ref.png \ +text_cache_crash-ref.png \ +text_rotate-ref.png # 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 @@ -21,7 +25,8 @@ move_to_show_surface-ref.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 +move_to_show_surface \ +text_rotate check_PROGRAMS = $(TESTS) @@ -49,5 +54,7 @@ xmalloc.h fill_rule_SOURCES = fill_rule.c $(cairo_test_lib) line_width_SOURCES = line_width.c $(cairo_test_lib) move_to_show_surface_SOURCES = move_to_show_surface.c $(cairo_test_lib) +text_cache_crash_SOURCES = text_cache_crash.c $(cairo_test_lib) +text_rotate_SOURCES = text_rotate.c $(cairo_test_lib) CLEANFILES = *-out.png *-diff.png diff --git a/test/cairo-test.h b/test/cairo-test.h index 7062f029..58936d56 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -26,6 +26,7 @@ #ifndef _CAIRO_TEST_H_ #define _CAIRO_TEST_H_ +#include <math.h> #include <cairo.h> typedef enum cairo_test_status { diff --git a/test/cairo_test.h b/test/cairo_test.h index 7062f029..58936d56 100644 --- a/test/cairo_test.h +++ b/test/cairo_test.h @@ -26,6 +26,7 @@ #ifndef _CAIRO_TEST_H_ #define _CAIRO_TEST_H_ +#include <math.h> #include <cairo.h> typedef enum cairo_test_status { diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c new file mode 100644 index 00000000..56502345 --- /dev/null +++ b/test/text-cache-crash.c @@ -0,0 +1,85 @@ +/* + * 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 <cworth@cworth.org> + */ + +/* Bug history + * + * 2004-11-04 Ned Konz <ned@squeakland.org> + * + * Reported bug on mailing list: + * + * From: Ned Konz <ned@squeakland.org> + * 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 <cworth@cworth.org> + * + * 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. + */ + +#include "cairo_test.h" + +#define WIDTH 100 +#define HEIGHT 60 + +cairo_test_t test = { + "text_cache_crash", + "Test case for bug causing an assertion failure in _cairo_cache_lookup", + WIDTH, HEIGHT +}; +#include <cairo.h> + +static void +draw (cairo_t *cr, int width, int height) +{ + 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"); +} + +int +main (void) +{ + return cairo_test (&test, draw); +} + diff --git a/test/text-rotate.c b/test/text-rotate.c new file mode 100644 index 00000000..15652397 --- /dev/null +++ b/test/text-rotate.c @@ -0,0 +1,113 @@ +/* + * 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 <cworth@cworth.org> + */ + +/* Bug history + * + * 2004-11-03 Steve Chaplin <stevech1097@yahoo.com.au> + * + * Reported bug on mailing list: + * + * From: Steve Chaplin <stevech1097@yahoo.com.au> + * 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 <cworth@cworth.org> + * + * 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 100 +#define HEIGHT 100 +#define NUM_TEXT 8 +#define TEXT_SIZE 10 + +cairo_test_t test = { + "text_rotate", + "Tests show_text under various rotations", + WIDTH, HEIGHT +}; + +/* Draw the word cairo at NUM_TEXT different angles */ +static void +draw (cairo_t *cr, int width, int height) +{ + int i; + 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); + + for (i=0; i < 8; i++) { + cairo_save (cr); + cairo_rotate (cr, 2*M_PI*i/NUM_TEXT); + /* XXX: extents.height / 4.0 gets the right result here, but I + * would think it should be extents.height / 2.0. Perhaps I'm + * using the extents incorrectly, (really need to go write + * that reference on cairo_text_extents with a good + * diagram...). + */ + cairo_move_to (cr, + extents.height / (2 * tan (2*M_PI/NUM_TEXT)), + extents.height / 4.0); + cairo_show_text (cr, "cairo"); + cairo_restore (cr); + } +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/text_cache_crash.c b/test/text_cache_crash.c new file mode 100644 index 00000000..56502345 --- /dev/null +++ b/test/text_cache_crash.c @@ -0,0 +1,85 @@ +/* + * 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 <cworth@cworth.org> + */ + +/* Bug history + * + * 2004-11-04 Ned Konz <ned@squeakland.org> + * + * Reported bug on mailing list: + * + * From: Ned Konz <ned@squeakland.org> + * 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 <cworth@cworth.org> + * + * 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. + */ + +#include "cairo_test.h" + +#define WIDTH 100 +#define HEIGHT 60 + +cairo_test_t test = { + "text_cache_crash", + "Test case for bug causing an assertion failure in _cairo_cache_lookup", + WIDTH, HEIGHT +}; +#include <cairo.h> + +static void +draw (cairo_t *cr, int width, int height) +{ + 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"); +} + +int +main (void) +{ + return cairo_test (&test, draw); +} + diff --git a/test/text_rotate.c b/test/text_rotate.c new file mode 100644 index 00000000..15652397 --- /dev/null +++ b/test/text_rotate.c @@ -0,0 +1,113 @@ +/* + * 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 <cworth@cworth.org> + */ + +/* Bug history + * + * 2004-11-03 Steve Chaplin <stevech1097@yahoo.com.au> + * + * Reported bug on mailing list: + * + * From: Steve Chaplin <stevech1097@yahoo.com.au> + * 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 <cworth@cworth.org> + * + * 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 100 +#define HEIGHT 100 +#define NUM_TEXT 8 +#define TEXT_SIZE 10 + +cairo_test_t test = { + "text_rotate", + "Tests show_text under various rotations", + WIDTH, HEIGHT +}; + +/* Draw the word cairo at NUM_TEXT different angles */ +static void +draw (cairo_t *cr, int width, int height) +{ + int i; + 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); + + for (i=0; i < 8; i++) { + cairo_save (cr); + cairo_rotate (cr, 2*M_PI*i/NUM_TEXT); + /* XXX: extents.height / 4.0 gets the right result here, but I + * would think it should be extents.height / 2.0. Perhaps I'm + * using the extents incorrectly, (really need to go write + * that reference on cairo_text_extents with a good + * diagram...). + */ + cairo_move_to (cr, + extents.height / (2 * tan (2*M_PI/NUM_TEXT)), + extents.height / 4.0); + cairo_show_text (cr, "cairo"); + cairo_restore (cr); + } +} + +int +main (void) +{ + return cairo_test (&test, draw); +} |