diff options
Diffstat (limited to 'tests/bugs/fdo9833.c')
-rw-r--r-- | tests/bugs/fdo9833.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/bugs/fdo9833.c b/tests/bugs/fdo9833.c new file mode 100644 index 000000000..c14c0a657 --- /dev/null +++ b/tests/bugs/fdo9833.c @@ -0,0 +1,51 @@ +/** + * Test case from fd.o bug #9833. + * https://bugs.freedesktop.org/show_bug.cgi?id=9833 + */ + +#include <stdlib.h> +#include <stdio.h> +#include <GL/glut.h> + +static int Automatic = 0; + +static void display(void) +{ + static int goterrors = 0; + static int frame = 0; + GLuint error; + + frame++; + glClear(GL_COLOR_BUFFER_BIT); + + glPushAttrib(GL_TEXTURE_BIT); + while ( (error = glGetError()) != GL_NO_ERROR) { + fprintf(stderr, "OpenGL error 0x%0x occured after glPushAttrib!\n", error); + goterrors++; + } + + + glPopAttrib(); + while ( (error = glGetError()) != GL_NO_ERROR) { + fprintf(stderr, "OpenGL error 0x%0x occured after glPopAttrib!\n", error); + goterrors++; + } + + if (Automatic && frame > 2) { + printf("PIGLIT: {'result': '%s' }\n", goterrors ? "fail" : "pass"); + exit(0); + } + + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + if (argc == 2 && !strcmp(argv[1], "-auto")) + Automatic = 1; + glutCreateWindow("fdo9833"); + glutDisplayFunc(display); + glutMainLoop(); + return 0; +} |