Blame test/bug-bo-collins.c

Packit 324a5c
/*
Packit 324a5c
 * Copyright © 2012 Intel Corporation
Packit 324a5c
 *
Packit 324a5c
 * Permission is hereby granted, free of charge, to any person
Packit 324a5c
 * obtaining a copy of this software and associated documentation
Packit 324a5c
 * files (the "Software"), to deal in the Software without
Packit 324a5c
 * restriction, including without limitation the rights to use, copy,
Packit 324a5c
 * modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 324a5c
 * of the Software, and to permit persons to whom the Software is
Packit 324a5c
 * furnished to do so, subject to the following conditions:
Packit 324a5c
 *
Packit 324a5c
 * The above copyright notice and this permission notice shall be
Packit 324a5c
 * included in all copies or substantial portions of the Software.
Packit 324a5c
 *
Packit 324a5c
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 324a5c
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 324a5c
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 324a5c
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 324a5c
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 324a5c
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 324a5c
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 324a5c
 * SOFTWARE.
Packit 324a5c
 *
Packit 324a5c
 * Author: Chris Wilson <chris@chris-wilson.co.uk>
Packit 324a5c
 */
Packit 324a5c
Packit 324a5c
#include "cairo-test.h"
Packit 324a5c
Packit 324a5c
static cairo_test_status_t
Packit 324a5c
draw (cairo_t *cr, int width, int height)
Packit 324a5c
{
Packit 324a5c
    cairo_set_source_rgb (cr, 1, 1, 1);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
    cairo_set_source_rgb (cr, 0, 0, 0);
Packit 324a5c
Packit 324a5c
    cairo_translate (cr, 0, 0);
Packit 324a5c
    cairo_save (cr);
Packit 324a5c
    cairo_rectangle (cr, 10, 10, 20, 20);
Packit 324a5c
    cairo_rectangle (cr, 20, 10, -10, 10);
Packit 324a5c
    cairo_clip (cr);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
    cairo_restore (cr);
Packit 324a5c
Packit 324a5c
    cairo_translate (cr, 40, 0);
Packit 324a5c
    cairo_save (cr);
Packit 324a5c
    cairo_rectangle (cr, 10, 10, 20, 20);
Packit 324a5c
    cairo_rectangle (cr, 30, 10, -10, 10);
Packit 324a5c
    cairo_clip (cr);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
    cairo_restore (cr);
Packit 324a5c
Packit 324a5c
    cairo_translate (cr, 0, 40);
Packit 324a5c
    cairo_save (cr);
Packit 324a5c
    cairo_rectangle (cr, 10, 10, 20, 20);
Packit 324a5c
    cairo_rectangle (cr, 30, 20, -10, 10);
Packit 324a5c
    cairo_clip (cr);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
    cairo_restore (cr);
Packit 324a5c
Packit 324a5c
    cairo_translate (cr, -40, 0);
Packit 324a5c
    cairo_save (cr);
Packit 324a5c
    cairo_rectangle (cr, 10, 10, 20, 20);
Packit 324a5c
    cairo_rectangle (cr, 20, 20, -10, 10);
Packit 324a5c
    cairo_clip (cr);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
    cairo_restore (cr);
Packit 324a5c
Packit 324a5c
    return CAIRO_TEST_SUCCESS;
Packit 324a5c
}
Packit 324a5c
Packit 324a5c
CAIRO_TEST (bug_bo_collins,
Packit 324a5c
	    "Exercises a bug discovered by S. Christian Collins",
Packit 324a5c
	    "clip, rectangular", /* keywords */
Packit 324a5c
	    NULL, /* requirements */
Packit 324a5c
	    80, 80,
Packit 324a5c
	    NULL, draw)