mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 14:38:13 +02:00
test: Add a1-sample
Ensures that only a box that covers the centre pixel is filled with antialiasing disabled. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
307cb2a973
commit
37e1a1b3ed
4 changed files with 61 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ REFERENCE_IMAGES = \
|
|||
a1-rasterisation-rectangles.ref.png \
|
||||
a1-rasterisation-triangles.quartz.xfail.png \
|
||||
a1-rasterisation-triangles.ref.png \
|
||||
a1-sample.ref.png \
|
||||
a1-traps-sample.quartz.xfail.png \
|
||||
a1-traps-sample.ref.png \
|
||||
a8-clear.quartz.ref.png \
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ test_sources = \
|
|||
a1-image-sample.c \
|
||||
a1-mask.c \
|
||||
a1-mask-sample.c \
|
||||
a1-sample.c \
|
||||
a1-traps-sample.c \
|
||||
a1-rasterisation.c \
|
||||
a8-clear.c \
|
||||
|
|
|
|||
59
test/a1-sample.c
Normal file
59
test/a1-sample.c
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright © 2011 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Author: Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#include "cairo-test.h"
|
||||
|
||||
#define WIDTH (256) //CAIRO_FIXED_ONE
|
||||
#define HEIGHT (WIDTH)
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
/* Fill background white */
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
|
||||
/* Only the single rectangle that covers the centre pixel should be filled*/
|
||||
for (i = 0; i < 256; i++)
|
||||
for (j = 0; j < 256; j++) {
|
||||
cairo_rectangle (cr, i + i/256., j + j/256., 1/256., 1/256.);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
CAIRO_TEST (a1_sample,
|
||||
"Tests unantialiased rendering of a quantum box",
|
||||
" alpha", /* keywords */
|
||||
"target=raster", /* requirements */
|
||||
WIDTH, HEIGHT,
|
||||
NULL, draw)
|
||||
BIN
test/a1-sample.ref.png
Normal file
BIN
test/a1-sample.ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 786 B |
Loading…
Add table
Reference in a new issue