2 * Copyright © 2010 Red Hat Inc.
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Red Hat, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior
11 * permission. Red Hat, Inc. makes no representations about the
12 * suitability of this software for any purpose. It is provided "as
13 * is" without express or implied warranty.
15 * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
18 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
21 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Benjamin Otte <otte@redhat.com>
32 #include "cairo-test.h"
34 #if CAIRO_HAS_GL_SURFACE
37 #if CAIRO_HAS_OS2_SURFACE
38 #include <cairo-os2.h>
40 #if CAIRO_HAS_PDF_SURFACE
41 #include <cairo-pdf.h>
43 #if CAIRO_HAS_PS_SURFACE
46 #if CAIRO_HAS_XCB_SURFACE
47 #include <cairo-xcb.h>
49 #if CAIRO_HAS_XLIB_SURFACE
50 #include <cairo-xlib.h>
53 static cairo_test_status_t
54 preamble (cairo_test_context_t *ctx)
56 cairo_surface_t *surface;
58 /* get the error surface */
59 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, INT_MAX, INT_MAX);
61 #if CAIRO_HAS_GL_SURFACE
62 cairo_gl_surface_set_size (surface, 0, 0);
63 cairo_gl_surface_swapbuffers (surface);
66 #if CAIRO_HAS_OS2_SURFACE
67 cairo_os2_surface_set_hwnd (surface, 0);
68 cairo_os2_surface_set_size (surface, 0, 0, 0);
69 cairo_os2_surface_set_manual_window_refresh (surface, FALSE);
72 #if CAIRO_HAS_PDF_SURFACE
73 cairo_pdf_surface_restrict_to_version (surface, CAIRO_PDF_VERSION_1_4);
74 cairo_pdf_surface_set_size (surface, 0, 0);
77 #if CAIRO_HAS_PS_SURFACE
78 cairo_ps_surface_set_eps (surface, FALSE);
79 cairo_ps_surface_set_size (surface, 0, 0);
80 cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_2);
81 cairo_ps_surface_dsc_comment (surface, NULL);
82 cairo_ps_surface_dsc_begin_setup (surface);
83 cairo_ps_surface_dsc_begin_page_setup (surface);
86 #if CAIRO_HAS_XCB_SURFACE
87 cairo_xcb_surface_set_size (surface, 0, 0);
90 #if CAIRO_HAS_XLIB_SURFACE
91 cairo_xlib_surface_set_size (surface, 0, 0);
92 cairo_xlib_surface_set_drawable (surface, 0, 0, 0);
95 cairo_surface_set_mime_data (surface, NULL, NULL, 0, NULL, 0);
96 cairo_surface_set_device_offset (surface, 0, 0);
97 cairo_surface_set_fallback_resolution (surface, 0, 0);
99 cairo_surface_destroy (surface);
101 return CAIRO_TEST_SUCCESS;
104 CAIRO_TEST (error_setters,
105 "Check setters properly error out on read-only error surfaces",
107 NULL, /* requirements */