mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-25 09:40:47 +02:00
Add new set-surface-no-show-text test.
Be sure to call cairo_destroy even if the image size is 0,0 so that we can test bugs triggered during cleanup.
This commit is contained in:
parent
f3af02bb0e
commit
f4b2f59c05
5 changed files with 76 additions and 0 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
|||
2005-04-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* test/.cvsignore:
|
||||
* test/Makefile.am:
|
||||
* test/select-font-no-show-text.c: (draw), (main): Add new
|
||||
set-surface-no-show-text test.
|
||||
|
||||
* test/cairo-test.c: (cairo_test): Be sure to call cairo_destroy
|
||||
even if the image size is 0,0 so that we can test bugs triggered
|
||||
during cleanup.
|
||||
|
||||
2005-04-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* test/coverage-ref.png:
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ linear-gradient
|
|||
move-to-show-surface
|
||||
path-data
|
||||
pixman-rotate
|
||||
select-font-no-show-text
|
||||
text-cache-crash
|
||||
text-rotate
|
||||
transforms
|
||||
translate-show-surface
|
||||
trap-clip
|
||||
user-data
|
||||
*-out.png
|
||||
*-diff.png
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ linear-gradient \
|
|||
move-to-show-surface \
|
||||
path-data \
|
||||
pixman-rotate \
|
||||
select-font-no-show-text\
|
||||
text-cache-crash \
|
||||
text-rotate \
|
||||
transforms \
|
||||
|
|
@ -90,6 +91,7 @@ linear_gradient_LDADD = $(LDADDS)
|
|||
move_to_show_surface_LDADD = $(LDADDS)
|
||||
path_data_LDADD = $(LDADDS)
|
||||
pixman_rotate_LDADD = $(LDADDS)
|
||||
select_font_no_show_text_LDADD = $(LDADDS)
|
||||
text_cache_crash_LDADD = $(LDADDS)
|
||||
text_rotate_LDADD = $(LDADDS)
|
||||
transforms_LDADD = $(LDADDS)
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
|
|||
|
||||
/* Skip image check for tests with no image (width,height == 0,0) */
|
||||
if (test->width == 0 || test->height == 0) {
|
||||
cairo_destroy (cr);
|
||||
free (png_buf);
|
||||
free (diff_buf);
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
|
|
|
|||
60
test/select-font-no-show-text.c
Normal file
60
test/select-font-no-show-text.c
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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 Worth <cworth@redhat.com>
|
||||
*/
|
||||
|
||||
/* Bug history
|
||||
*
|
||||
* 2005-04-12 Carl Worth <cworth@cworth.org>
|
||||
*
|
||||
* I noticed that if we call cairo_select_font, but then do a
|
||||
* cairo_destroy before ever drawing any text, then we get:
|
||||
*
|
||||
* *** glibc detected *** double free or corruption (fasttop): 0x083274d0 ***
|
||||
* Aborted
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "cairo-test.h"
|
||||
|
||||
static cairo_test_t test = {
|
||||
"select-font-no-show-text",
|
||||
"Exercise a bug in calling cairo_select_font but never drawing text.",
|
||||
0, 0
|
||||
};
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_select_font (cr, "Bitstream Vera Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_BOLD);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return cairo_test (&test, draw);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue