1
/*
2
 * Copyright © 2006 Red Hat, Inc.
3
 * Copyright © 2010 Intel Corporation
4
 *
5
 * Permission to use, copy, modify, distribute, and sell this software
6
 * and its documentation for any purpose is hereby granted without
7
 * fee, provided that the above copyright notice appear in all copies
8
 * and that both that copyright notice and this permission notice
9
 * appear in supporting documentation, and that the name of
10
 * Red Hat, Inc. not be used in advertising or publicity pertaining to
11
 * distribution of the software without specific, written prior
12
 * permission. Red Hat, Inc. makes no representations about the
13
 * suitability of this software for any purpose.  It is provided "as
14
 * is" without express or implied warranty.
15
 *
16
 * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18
 * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
19
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
22
 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
 *
24
 * Author: Carl D. Worth <cworth@cworth.org>
25
 *         Chris Wilson <chris@chris-wilson.co.uk>
26
 */
27

            
28
#include "cairo-test.h"
29

            
30
#define TEXT_SIZE 12
31

            
32
static cairo_test_status_t
33
3
draw (cairo_t *cr, int width, int height)
34
{
35
    /* This is just the inverse of select-font-face.c */
36
3
    cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
37
3
    cairo_paint (cr);
38

            
39
3
    cairo_set_source_rgb (cr, 1, 1, 1);
40

            
41
3
    cairo_set_font_size (cr, TEXT_SIZE);
42
3
    cairo_move_to (cr, 0, TEXT_SIZE);
43

            
44
3
    cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Serif",
45
			    CAIRO_FONT_SLANT_NORMAL,
46
			    CAIRO_FONT_WEIGHT_NORMAL);
47
3
    cairo_show_text (cr, "i-am-serif");
48

            
49
3
    cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
50
			    CAIRO_FONT_SLANT_NORMAL,
51
			    CAIRO_FONT_WEIGHT_NORMAL);
52
3
    cairo_show_text (cr, " i-am-sans");
53

            
54
3
    cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans Mono",
55
			    CAIRO_FONT_SLANT_NORMAL,
56
			    CAIRO_FONT_WEIGHT_NORMAL);
57
3
    cairo_show_text (cr, " i-am-mono");
58

            
59
3
    return CAIRO_TEST_SUCCESS;
60
}
61

            
62
1
CAIRO_TEST (inverse_text,
63
	    "Tests rendering of inverse text (white-on-black)",
64
	    "font, text", /* keywords */
65
	    NULL, /* requirements */
66
	    192, TEXT_SIZE + 4,
67
	    NULL, draw)