2 * Copyright © 2012 Igalia S.L.
3 * Copyright © 2009 Eric Anholt
4 * Copyright © 2009 Chris Wilson
5 * Copyright © 2005 Red Hat, Inc
7 * Permission to use, copy, modify, distribute, and sell this software
8 * and its documentation for any purpose is hereby granted without
9 * fee, provided that the above copyright notice appear in all copies
10 * and that both that copyright notice and this permission notice
11 * appear in supporting documentation, and that the name of
12 * Chris Wilson not be used in advertising or publicity pertaining to
13 * distribution of the software without specific, written prior
14 * permission. Chris Wilson makes no representations about the
15 * suitability of this software for any purpose. It is provided "as
16 * is" without express or implied warranty.
18 * IGALIA S.L. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
19 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
21 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
22 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
23 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
24 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26 * Author: Martin Robinson <mrobinson@igalia.com>
29 #include "cairo-test.h"
34 static cairo_test_status_t
35 preamble (cairo_test_context_t *test_ctx)
37 int rgba_attribs[] = {
48 XVisualInfo *visual_info;
49 GLXContext glx_context;
50 cairo_device_t *device;
51 cairo_surface_t *oversized_surface;
52 cairo_test_status_t test_status = CAIRO_TEST_SUCCESS;
54 display = XOpenDisplay (NULL);
56 return CAIRO_TEST_UNTESTED;
58 visual_info = glXChooseVisual (display, DefaultScreen (display), rgba_attribs);
59 if (visual_info == NULL) {
60 XCloseDisplay (display);
61 return CAIRO_TEST_UNTESTED;
64 glx_context = glXCreateContext (display, visual_info, NULL, True);
65 if (glx_context == NULL) {
66 XCloseDisplay (display);
67 return CAIRO_TEST_UNTESTED;
70 device = cairo_glx_device_create (display, glx_context);
72 oversized_surface = cairo_gl_surface_create (device, CAIRO_CONTENT_COLOR_ALPHA, INT_MAX, INT_MAX);
73 if (cairo_surface_status (oversized_surface) != CAIRO_STATUS_INVALID_SIZE)
74 test_status = CAIRO_TEST_FAILURE;
76 cairo_device_destroy (device);
77 glXDestroyContext(display, glx_context);
78 XCloseDisplay (display);
83 CAIRO_TEST (gl_oversized_surface,
84 "Test that creating a surface beyond texture limits results in an error surface",
86 NULL, /* requirements */