test: Add white-in-noop

Exercise an incorrect optimization in cairo-surface.c. It replaces
with a noop any region-based fill with solid white source and an IN
operator.
This commit is contained in:
Andrea Canciani 2011-01-17 10:21:06 +01:00
parent a351807147
commit 2af0b0f5da
3 changed files with 53 additions and 0 deletions

View file

@ -293,6 +293,7 @@ test_sources = \
user-font-mask.c \
user-font-proxy.c \
user-font-rescale.c \
white-in-noop.c \
xcomposite-projection.c \
xlib-expose-event.c \
zero-alpha.c \

52
test/white-in-noop.c Normal file
View file

@ -0,0 +1,52 @@
/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
/*
* Copyright 2011 Andrea Canciani
*
* 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: Andrea Canciani <ranma42@gmail.com>
*/
#include "cairo-test.h"
#define HEIGHT 4
#define WIDTH 4
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_IN);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
return CAIRO_TEST_SUCCESS;
}
CAIRO_TEST (white_in_noop,
"Test an invalid optimization of the IN operator with white sources",
"operator", /* keywords */
NULL, /* requirements */
WIDTH, HEIGHT,
NULL, draw)

BIN
test/white-in-noop.ref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B