Blame test/linear-uniform.c

Packit 324a5c
/*
Packit 324a5c
 * Copyright © 2010 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_pattern_t *pattern;
Packit 324a5c
Packit 324a5c
    cairo_set_source_rgb (cr, 0, 0, 0);
Packit 324a5c
    cairo_paint (cr);
Packit 324a5c
Packit 324a5c
    /* with alpha */
Packit 324a5c
    pattern = cairo_pattern_create_linear (0, 0, 0, height);
Packit 324a5c
    cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, .5);
Packit 324a5c
    cairo_pattern_add_color_stop_rgba (pattern, 1, 1, 1, 1, .5);
Packit 324a5c
    cairo_set_source (cr, pattern);
Packit 324a5c
    cairo_pattern_destroy (pattern);
Packit 324a5c
    cairo_rectangle (cr, 0, 0, width/2, height);
Packit 324a5c
    cairo_fill (cr);
Packit 324a5c
Packit 324a5c
    /* without alpha */
Packit 324a5c
    pattern = cairo_pattern_create_linear (0, 0, 0, height);
Packit 324a5c
    cairo_pattern_add_color_stop_rgb (pattern, 0, 1, 1, 1);
Packit 324a5c
    cairo_pattern_add_color_stop_rgb (pattern, 1, 1, 1, 1);
Packit 324a5c
    cairo_set_source (cr, pattern);
Packit 324a5c
    cairo_pattern_destroy (pattern);
Packit 324a5c
    cairo_rectangle (cr, width/2, 0, width/2, height);
Packit 324a5c
    cairo_fill (cr);
Packit 324a5c
Packit 324a5c
    return CAIRO_TEST_SUCCESS;
Packit 324a5c
}
Packit 324a5c
Packit 324a5c
CAIRO_TEST (linear_uniform,
Packit 324a5c
	    "Tests handling of \"solid\" linear gradients",
Packit 324a5c
	    "gradient, linear", /* keywords */
Packit 324a5c
	    NULL, /* requirements */
Packit 324a5c
	    40, 40,
Packit 324a5c
	    NULL, draw)