[Piglit] [PATCH] glean/tdepthstencil: Print what error was expected

Matt Turner mattst88 at gmail.com
Tue Jan 29 16:37:40 PST 2013


---
 tests/glean/tdepthstencil.cpp |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/tests/glean/tdepthstencil.cpp b/tests/glean/tdepthstencil.cpp
index 7de5d34..272e904 100644
--- a/tests/glean/tdepthstencil.cpp
+++ b/tests/glean/tdepthstencil.cpp
@@ -36,6 +36,7 @@
 #include "tdepthstencil.h"
 #include "rand.h"
 #include "image.h"
+#include "piglit-util-gl-common.h"
 
 namespace GLEAN {
 
@@ -120,34 +121,22 @@ DepthStencilTest::testErrorDetection(void)
 	GLuint p[1];
 
 	glDrawPixels(1, 1, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT, p);
-	if (glGetError() != GL_INVALID_ENUM) {
-		sprintf(errorMsg,
-			"glDrawPixels(GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT)"
-			" failed to generate GL_INVALID_ENUM.");
+	if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 		return false;
 	}
 
 	glDrawPixels(1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8_EXT, p);
-	if (glGetError() != GL_INVALID_OPERATION) {
-		sprintf(errorMsg,
-			"glDrawPixels(GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8_EXT)"
-			" failed to generate GL_INVALID_OPERATION.");
+	if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 		return false;
 	}
 
 	glReadPixels(0, 0, 1, 1, GL_DEPTH_STENCIL_EXT, GL_FLOAT, p);
-	if (glGetError() != GL_INVALID_ENUM) {
-		sprintf(errorMsg,
-			"glReadPixels(GL_DEPTH_STENCIL_EXT, GL_FLOAT)"
-			" failed to generate GL_INVALID_ENUM.");
+	if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 		return false;
 	}
 
 	glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_INT_24_8_EXT, p);
-	if (glGetError() != GL_INVALID_OPERATION) {
-		sprintf(errorMsg,
-			"glReadPixels(GL_STENCIL_INDEX, GL_UNSIGNED_INT_24_8_EXT)"
-			" failed to generate GL_INVALID_OPERATION.");
+	if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
 		return false;
 	}
 
-- 
1.7.8.6



More information about the Piglit mailing list