mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 13:48:02 +02:00
[test] Add group-clip
Larry Ewing found an ancient and nasty bug whereby a path was not corrected whilst pushing and popping groups.
This commit is contained in:
parent
0a34abace7
commit
851c883962
5 changed files with 60 additions and 0 deletions
1
AUTHORS
1
AUTHORS
|
|
@ -23,6 +23,7 @@ John Ellson <ellson@research.att.com> First font/glyph extents functions
|
|||
Michael Emmel <mike.emmel@gmail.com> DirectFB backend
|
||||
Miklós Erdélyi <erdelyim@gmail.com> Fix typo leading to a crash
|
||||
Behdad Esfahbod <behdad@behdad.org> Huge piles of bug fixes, improvements, and general maintenance
|
||||
Larry Ewing <lewing@novell.com> Test case for group-clip
|
||||
Brian Ewins <Brian.Ewins@gmail.com> ATSUI maintenance (first success at making it really work)
|
||||
Bertram Felgenhauer <int-e@gmx.de> Fixes for subtle arithmetic errors
|
||||
Damian Frank <damian.frank@gmail.com> Build system improvements for win32
|
||||
|
|
|
|||
|
|
@ -500,6 +500,7 @@ REFERENCE_IMAGES = \
|
|||
gradient-constant-alpha.rgb24.ref.png \
|
||||
gradient-zero-stops.ref.png \
|
||||
gradient-zero-stops.rgb24.ref.png \
|
||||
group-clip.ref.png \
|
||||
group-paint.ref.png \
|
||||
huge-linear.ps3.ref.png \
|
||||
huge-linear.ref.png \
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ test_sources = \
|
|||
gradient-alpha.c \
|
||||
gradient-constant-alpha.c \
|
||||
gradient-zero-stops.c \
|
||||
group-clip.c \
|
||||
group-paint.c \
|
||||
huge-linear.c \
|
||||
huge-radial.c \
|
||||
|
|
|
|||
57
test/group-clip.c
Normal file
57
test/group-clip.c
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright © Chris Wilson, 2008
|
||||
*
|
||||
* 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
|
||||
* Chris Wilson 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.
|
||||
*
|
||||
* CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL CHRIS WILSON 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.
|
||||
*
|
||||
* Authors: Chris Wilson <chris@chris-wilson.co.uk>
|
||||
* Larry Ewing <lewing@novell.com>
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_rectangle (cr, 25, 25, width, height);
|
||||
cairo_clip_preserve (cr);
|
||||
cairo_push_group (cr);
|
||||
cairo_set_source_rgb (cr, 0, 0, 1);
|
||||
cairo_fill (cr);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_pop_group_to_source (cr);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_reset_clip (cr);
|
||||
cairo_clip_preserve (cr);
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, .5);
|
||||
cairo_paint (cr);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
CAIRO_TEST (group_clip,
|
||||
"test preserving paths across groups",
|
||||
"group", /* keywords */
|
||||
NULL, /* requirements */
|
||||
40 + 25, 40 + 25,
|
||||
NULL, draw)
|
||||
BIN
test/group-clip.ref.png
Normal file
BIN
test/group-clip.ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 B |
Loading…
Add table
Reference in a new issue