Add a negative test for bitwise not used in a larger expression.
[piglit/hramrach.git] / tests / bugs / fdo20701.c
blob9d52ba4a075ae7d6819dd2afe2fab96bfab2416c
1 /*
2 * Copyright © 2009 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.
23 * Authors:
24 * Ian Romanick <ian.d.romanick@intel.com>
28 /**
29 * \file fdo20701.c
30 * Test case from fd.o bug #20701
32 * Configure an FBO for rendering to a color texture with border. Call
33 * glFinish while that FBO is bound. If it doesn't segfault, then the test
34 * passes.
37 #include "piglit-util.h"
39 static int Automatic = 0;
40 static int Width = 128, Height = 128;
41 static GLuint fb;
42 static GLuint tex;
44 static void Display(void)
46 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
47 glClearColor(1.0, 0.0, 0.0, 1.0);
49 glClear(GL_COLOR_BUFFER_BIT);
50 glFinish();
52 if (Automatic) {
53 printf("PIGLIT: {'result': 'pass' }\n");
54 exit(0);
59 static void Reshape(int width, int height)
61 (void) width;
62 (void) height;
66 static void Key(unsigned char key, int x, int y)
68 (void) x;
69 (void) y;
70 switch (key) {
71 case 27:
72 exit(0);
73 break;
75 glutPostRedisplay();
79 static void
80 init(void)
82 GLenum status;
84 glewInit();
86 piglit_require_extension("GL_EXT_framebuffer_object");
88 glGenFramebuffersEXT(1, &fb);
89 glGenTextures(1, &tex);
91 glBindTexture(GL_TEXTURE_2D, tex);
92 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 66, 66, 1, GL_RGBA,
93 GL_UNSIGNED_BYTE, NULL);
94 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
96 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
97 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
98 GL_COLOR_ATTACHMENT0_EXT,
99 GL_TEXTURE_2D, tex, 0);
101 status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
102 if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
103 printf("%s:%u: framebuffer status = 0x%04x\n",
104 __FUNCTION__, __LINE__, status);
105 printf("PIGLIT: {'result': 'fail' }\n");
106 exit(1);
111 int main(int argc, char**argv)
113 glutInit(&argc, argv);
114 if (argc == 2 && !strcmp(argv[1], "-auto"))
115 Automatic = 1;
116 glutInitDisplayMode(GLUT_RGB);
117 glutInitWindowSize(Width, Height);
118 glutCreateWindow("FD.O bug #20701 test");
119 glutReshapeFunc(Reshape);
120 glutKeyboardFunc(Key);
121 glutDisplayFunc(Display);
122 if (!Automatic)
123 printf("If the test doesn't crash, then it passes.\n");
124 init();
125 glutMainLoop();
126 return 0;