framework/replay: disable AA accounting when comparing with no tolerance
[piglit.git] / tests / glx / glx-fbconfig-bad.c
blobcec2d0a7fddb159f430fea4c31b1f1e4f1954601
1 /*
2 * Copyright © 2016 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
26 /** @file glx-fbconfig-bad.c
28 * Tests that driver sets error correctly (GLXBadFBConfig) when calling
29 * glXCreateNewContext with an invalid GLXFBConfig.
32 #include "piglit-util-gl.h"
33 #include "piglit-glx-util.h"
34 #include <GL/glxint.h>
36 static bool bad_config_error = false;
38 static int
39 error_handler(Display *dpy, XErrorEvent *event)
41 if (piglit_glx_get_error(dpy, event) == GLXBadFBConfig) {
42 bad_config_error = true;
43 } else {
44 bad_config_error = false;
46 return 0;
49 int
50 main(int argc, char **argv)
52 Display *dpy;
53 __GLXFBConfig bad_config;
54 memset(&bad_config, 0, sizeof(__GLXFBConfig));
56 dpy = XOpenDisplay(NULL);
57 if (dpy == NULL) {
58 fprintf(stderr, "couldn't open display\n");
59 piglit_report_result(PIGLIT_FAIL);
62 XSetErrorHandler(error_handler);
64 glXCreateNewContext(dpy, NULL, GLX_RGBA_TYPE, NULL, True);
65 XFlush(dpy);
66 if (!bad_config_error) {
67 piglit_report_result(PIGLIT_FAIL);
70 glXCreateNewContext(dpy, &bad_config, GLX_RGBA_TYPE, NULL, True);
71 XFlush(dpy);
72 if (!bad_config_error) {
73 piglit_report_result(PIGLIT_FAIL);
75 XCloseDisplay(dpy);
76 piglit_report_result(PIGLIT_PASS);