mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 04:40:07 +01:00
test: Add the PS tiger
The classic tiger's head; a simple example of a reasonably complex shape consisting of multiple layers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
8a80bbf78d
commit
9f605b0c84
7 changed files with 2422 additions and 5 deletions
|
|
@ -127,7 +127,7 @@ cairo_test_trace_DEPENDENCIES = \
|
|||
endif
|
||||
|
||||
BUILT_SOURCES += cairo-test-constructors.c
|
||||
EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING make-cairo-test-constructors.sh run-cairo-test-suite.sh generate_refs.sh
|
||||
EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING make-cairo-test-constructors.sh run-cairo-test-suite.sh generate_refs.sh tiger.inc
|
||||
CLEANFILES += $(BUILT_SOURCES)
|
||||
|
||||
EXTRA_DIST += \
|
||||
|
|
|
|||
|
|
@ -13,8 +13,12 @@ REFERENCE_IMAGES = \
|
|||
a1-clip-stroke.ref.png \
|
||||
a1-image-sample.gl.xfail.png \
|
||||
a1-image-sample.ref.png \
|
||||
a1-line-width.pdf.ref.png \
|
||||
a1-line-width.ps.ref.png \
|
||||
a1-line-width.ref.png \
|
||||
a1-mask-sample.ref.png \
|
||||
a1-mask.pdf.ref.png \
|
||||
a1-mask.ps.ref.png \
|
||||
a1-mask.ref.png \
|
||||
a1-rasterisation-rectangles.quartz.xfail.png \
|
||||
a1-rasterisation-rectangles.ref.png \
|
||||
|
|
@ -22,6 +26,7 @@ REFERENCE_IMAGES = \
|
|||
a1-rasterisation-triangles.ref.png \
|
||||
a1-rectilinear-grid.ref.png \
|
||||
a1-sample.ref.png \
|
||||
a1-tiger.ref.png \
|
||||
a1-traps-sample.quartz.xfail.png \
|
||||
a1-traps-sample.ref.png \
|
||||
a8-clear.quartz.ref.png \
|
||||
|
|
@ -90,6 +95,7 @@ REFERENCE_IMAGES = \
|
|||
caps-sub-paths.image16.ref.png \
|
||||
caps-sub-paths.ps.ref.png \
|
||||
caps-sub-paths.ref.png \
|
||||
caps-tails-curve.ps.ref.png \
|
||||
caps-tails-curve.ref.png \
|
||||
caps.image16.ref.png \
|
||||
caps.ps.ref.png \
|
||||
|
|
@ -160,6 +166,7 @@ REFERENCE_IMAGES = \
|
|||
clip-fill.xlib-fallback.ref.png \
|
||||
clip-fill.xlib.ref.png \
|
||||
clip-group-shapes-aligned-rectangles.ref.png \
|
||||
clip-group-shapes-circles.ps.ref.png \
|
||||
clip-group-shapes-circles.quartz.ref.png \
|
||||
clip-group-shapes-circles.ref.png \
|
||||
clip-group-shapes-circles.xlib.ref.png \
|
||||
|
|
@ -324,6 +331,7 @@ REFERENCE_IMAGES = \
|
|||
dash-infinite-loop.ps.ref.png \
|
||||
dash-infinite-loop.ref.png \
|
||||
dash-no-dash.ref.png \
|
||||
dash-offset-negative.pdf.ref.png \
|
||||
dash-offset-negative.ref.png \
|
||||
dash-offset.ref.png \
|
||||
dash-scale.image16.ref.png \
|
||||
|
|
@ -384,8 +392,10 @@ REFERENCE_IMAGES = \
|
|||
device-offset-scale.svg.xfail.png \
|
||||
device-offset.ref.png \
|
||||
device-offset.rgb24.ref.png \
|
||||
drunkard-tails.ps.ref.png \
|
||||
drunkard-tails.ref.png \
|
||||
extend-pad-border.image16.ref.png \
|
||||
extend-pad-border.pdf.ref.png \
|
||||
extend-pad-border.ps.ref.png \
|
||||
extend-pad-border.quartz.ref.png \
|
||||
extend-pad-border.ref.png \
|
||||
|
|
@ -459,13 +469,13 @@ REFERENCE_IMAGES = \
|
|||
fallback-resolution.ppi72x576.ref.png \
|
||||
fallback-resolution.ppi72x72.ref.png \
|
||||
fill-alpha-pattern.image16.ref.png \
|
||||
fill-alpha-pattern.pdf.ref.png \
|
||||
fill-alpha-pattern.ps3.argb32.ref.png \
|
||||
fill-alpha-pattern.ps3.ref.png \
|
||||
fill-alpha-pattern.ps3.rgb24.ref.png \
|
||||
fill-alpha-pattern.quartz.ref.png \
|
||||
fill-alpha-pattern.ref.png \
|
||||
fill-alpha-pattern.xlib.ref.png \
|
||||
fill-alpha.image16.ref.png \
|
||||
fill-alpha.ps.argb32.ref.png \
|
||||
fill-alpha.quartz.ref.png \
|
||||
fill-alpha.ref.png \
|
||||
fill-alpha.xlib.ref.png \
|
||||
|
|
@ -1319,6 +1329,8 @@ REFERENCE_IMAGES = \
|
|||
text-glyph-range.ref.png \
|
||||
text-pattern.pdf.argb32.ref.png \
|
||||
text-pattern.pdf.rgb24.ref.png \
|
||||
text-pattern.ps2.argb32.ref.png \
|
||||
text-pattern.ps2.rgb24.ref.png \
|
||||
text-pattern.ps3.argb32.ref.png \
|
||||
text-pattern.ps3.rgb24.ref.png \
|
||||
text-pattern.quartz.argb32.ref.png \
|
||||
|
|
@ -1336,10 +1348,13 @@ REFERENCE_IMAGES = \
|
|||
text-rotate.xlib-fallback.ref.png \
|
||||
text-rotate.xlib.ref.png \
|
||||
text-transform.image16.ref.png \
|
||||
text-transform.pdf.ref.png \
|
||||
text-transform.ps.ref.png \
|
||||
text-transform.pdf.argb32.ref.png \
|
||||
text-transform.pdf.rgb24.ref.png \
|
||||
text-transform.ps2.ref.png \
|
||||
text-transform.ps3.ref.png \
|
||||
text-transform.ref.png \
|
||||
text-transform.svg.ref.png \
|
||||
tiger.ref.png \
|
||||
tighten-bounds.ref.png \
|
||||
transforms.image16.ref.png \
|
||||
transforms.ps2.ref.png \
|
||||
|
|
|
|||
|
|
@ -312,6 +312,7 @@ test_sources = \
|
|||
text-transform.c \
|
||||
text-zero-len.c \
|
||||
tighten-bounds.c \
|
||||
tiger.c \
|
||||
toy-font-face.c \
|
||||
transforms.c \
|
||||
translate-show-surface.c \
|
||||
|
|
|
|||
BIN
test/a1-tiger.ref.png
Normal file
BIN
test/a1-tiger.ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
85
test/tiger.c
Normal file
85
test/tiger.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
#include "tiger.inc"
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_rgba (cr, 0.1, 0.2, 0.3, 1.0);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
|
||||
cairo_translate (cr, width/2, height/2);
|
||||
cairo_scale (cr, .85, .85);
|
||||
|
||||
for (i = 0; i < sizeof (tiger_commands)/sizeof(tiger_commands[0]);i++) {
|
||||
const struct command *cmd = &tiger_commands[i];
|
||||
switch (cmd->type) {
|
||||
case 'm':
|
||||
cairo_move_to (cr, cmd->x0, cmd->y0);
|
||||
break;
|
||||
case 'l':
|
||||
cairo_line_to (cr, cmd->x0, cmd->y0);
|
||||
break;
|
||||
case 'c':
|
||||
cairo_curve_to (cr,
|
||||
cmd->x0, cmd->y0,
|
||||
cmd->x1, cmd->y1,
|
||||
cmd->x2, cmd->y2);
|
||||
break;
|
||||
case 'f':
|
||||
cairo_set_source_rgba (cr,
|
||||
cmd->x0, cmd->y0, cmd->x1, cmd->y1);
|
||||
cairo_fill (cr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
a1_draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
|
||||
return draw (cr, width, height);
|
||||
}
|
||||
|
||||
CAIRO_TEST (tiger,
|
||||
"Check the fidelity of the rasterisation.",
|
||||
"raster", /* keywords */
|
||||
NULL, /* requirements */
|
||||
500, 500,
|
||||
NULL, draw)
|
||||
|
||||
CAIRO_TEST (a1_tiger,
|
||||
"Check the fidelity of the rasterisation.",
|
||||
"fill", /* keywords */
|
||||
"target=raster", /* requirements */
|
||||
500, 500,
|
||||
NULL, a1_draw)
|
||||
2316
test/tiger.inc
Normal file
2316
test/tiger.inc
Normal file
File diff suppressed because it is too large
Load diff
BIN
test/tiger.ref.png
Normal file
BIN
test/tiger.ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Loading…
Add table
Reference in a new issue