Code refactoring for angle::BitSet and EXPECT_GL_TRUE/FALSE.
This change refactors two style issues to make it be consistent.
1) This CL uses "using" to replace "typedef" for all angle::BitSet<...>.
2) This CL uses EXPECT_GL_TRUE/FALSE to replace EXPECT_EQ for bool comparison.
BUG=angleproject:2005
Change-Id: I4afad92313ea2457bbfedf80f917a5873d7f29ee
Reviewed-on: https://chromium-review.googlesource.com/795871
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/BindGeneratesResourceTest.cpp b/src/tests/gl_tests/BindGeneratesResourceTest.cpp
index e8ae739..eb5815e 100644
--- a/src/tests/gl_tests/BindGeneratesResourceTest.cpp
+++ b/src/tests/gl_tests/BindGeneratesResourceTest.cpp
@@ -30,7 +30,7 @@
GLint intValue = 2;
glGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &intValue);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(intValue, GL_FALSE);
+ EXPECT_GL_FALSE(intValue);
float floatValue = 2.0f;
glGetFloatv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &floatValue);
@@ -40,11 +40,11 @@
GLboolean boolValue = GL_TRUE;
glGetBooleanv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &boolValue);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(boolValue, GL_FALSE);
+ EXPECT_GL_FALSE(boolValue);
boolValue = glIsEnabled(GL_BIND_GENERATES_RESOURCE_CHROMIUM);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(boolValue, GL_FALSE);
+ EXPECT_GL_FALSE(boolValue);
glEnable(GL_BIND_GENERATES_RESOURCE_CHROMIUM);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
diff --git a/src/tests/gl_tests/ClientArraysTest.cpp b/src/tests/gl_tests/ClientArraysTest.cpp
index a88821e..6b854ed 100644
--- a/src/tests/gl_tests/ClientArraysTest.cpp
+++ b/src/tests/gl_tests/ClientArraysTest.cpp
@@ -51,7 +51,7 @@
GLboolean boolValue = GL_TRUE;
glGetBooleanv(GL_CLIENT_ARRAYS_ANGLE, &boolValue);
EXPECT_GL_NO_ERROR();
- EXPECT_GL_FALSE(GL_FALSE);
+ EXPECT_GL_FALSE(boolValue);
EXPECT_GL_FALSE(glIsEnabled(GL_CLIENT_ARRAYS_ANGLE));
EXPECT_GL_NO_ERROR();
diff --git a/src/tests/gl_tests/ComputeShaderTest.cpp b/src/tests/gl_tests/ComputeShaderTest.cpp
index d516ef1..1e8b855 100644
--- a/src/tests/gl_tests/ComputeShaderTest.cpp
+++ b/src/tests/gl_tests/ComputeShaderTest.cpp
@@ -64,7 +64,7 @@
glLinkProgram(program);
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- EXPECT_EQ(GL_TRUE, linkStatus);
+ EXPECT_GL_TRUE(linkStatus);
glDetachShader(program, cs);
EXPECT_GL_NO_ERROR();
@@ -167,7 +167,7 @@
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- EXPECT_EQ(GL_FALSE, linkStatus);
+ EXPECT_GL_FALSE(linkStatus);
EXPECT_GL_NO_ERROR();
}
@@ -275,7 +275,7 @@
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
- EXPECT_EQ(GL_TRUE, linkStatus);
+ EXPECT_GL_TRUE(linkStatus);
EXPECT_GL_NO_ERROR();
diff --git a/src/tests/gl_tests/FenceSyncTests.cpp b/src/tests/gl_tests/FenceSyncTests.cpp
index c4ecf11..e686bf6 100644
--- a/src/tests/gl_tests/FenceSyncTests.cpp
+++ b/src/tests/gl_tests/FenceSyncTests.cpp
@@ -51,13 +51,13 @@
glGenFencesNV(1, &fence);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GL_FALSE, glIsFenceNV(fence));
+ EXPECT_GL_FALSE(glIsFenceNV(fence));
EXPECT_GL_NO_ERROR();
glSetFenceNV(fence, GL_ALL_COMPLETED_NV);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GL_TRUE, glIsFenceNV(fence));
+ EXPECT_GL_TRUE(glIsFenceNV(fence));
EXPECT_GL_NO_ERROR();
}
@@ -71,7 +71,7 @@
}
// glTestFenceNV should still return TRUE for an invalid fence and generate an INVALID_OPERATION
- EXPECT_EQ(GL_TRUE, glTestFenceNV(10));
+ EXPECT_GL_TRUE(glTestFenceNV(10));
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
GLuint fence = 20;
@@ -86,7 +86,7 @@
EXPECT_GL_NO_ERROR();
// glTestFenceNV should still return TRUE for a fence that is not started and generate an INVALID_OPERATION
- EXPECT_EQ(GL_TRUE, glTestFenceNV(fence));
+ EXPECT_GL_TRUE(glTestFenceNV(fence));
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
// glGetFenceivNV should generate an INVALID_OPERATION for an invalid or unstarted fence and not modify the params
@@ -139,7 +139,7 @@
EXPECT_GL_NO_ERROR();
// Fence should be complete now that Finish has been called
- EXPECT_EQ(GL_TRUE, status);
+ EXPECT_GL_TRUE(status);
}
EXPECT_PIXEL_EQ(0, 0, 255, 0, 255, 255);
@@ -151,8 +151,8 @@
GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GL_TRUE, glIsSync(sync));
- EXPECT_EQ(GL_FALSE, glIsSync(reinterpret_cast<GLsync>(40)));
+ EXPECT_GL_TRUE(glIsSync(sync));
+ EXPECT_GL_FALSE(glIsSync(reinterpret_cast<GLsync>(40)));
}
// Test error cases for all Sync function
diff --git a/src/tests/gl_tests/OcclusionQueriesTest.cpp b/src/tests/gl_tests/OcclusionQueriesTest.cpp
index e33429f..1e7cf33 100644
--- a/src/tests/gl_tests/OcclusionQueriesTest.cpp
+++ b/src/tests/gl_tests/OcclusionQueriesTest.cpp
@@ -101,7 +101,7 @@
glDeleteQueriesEXT(1, &query);
- EXPECT_GLENUM_EQ(GL_FALSE, result);
+ EXPECT_GL_FALSE(result);
}
TEST_P(OcclusionQueriesTest, IsNotOccluded)
@@ -135,7 +135,7 @@
glDeleteQueriesEXT(1, &query);
- EXPECT_GLENUM_EQ(GL_TRUE, result);
+ EXPECT_GL_TRUE(result);
}
TEST_P(OcclusionQueriesTest, Errors)
@@ -156,8 +156,8 @@
GLuint query2 = 0;
glGenQueriesEXT(1, &query);
- EXPECT_EQ(glIsQueryEXT(query), GL_FALSE);
- EXPECT_EQ(glIsQueryEXT(query2), GL_FALSE);
+ EXPECT_GL_FALSE(glIsQueryEXT(query));
+ EXPECT_GL_FALSE(glIsQueryEXT(query2));
glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, 0); // can't pass 0 as query id
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
@@ -166,8 +166,8 @@
glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, query2); // can't initiate a query while one's already active
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
- EXPECT_EQ(glIsQueryEXT(query), GL_TRUE);
- EXPECT_EQ(glIsQueryEXT(query2), GL_FALSE); // have not called begin
+ EXPECT_GL_TRUE(glIsQueryEXT(query));
+ EXPECT_GL_FALSE(glIsQueryEXT(query2)); // have not called begin
drawQuad(mProgram, "position", 0.8f); // this quad should not be occluded
glEndQueryEXT(GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT); // no active query for this target
@@ -182,7 +182,7 @@
glGenQueriesEXT(1, &query2);
glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, query2); // should be ok now
- EXPECT_EQ(glIsQueryEXT(query2), GL_TRUE);
+ EXPECT_GL_TRUE(glIsQueryEXT(query2));
drawQuad(mProgram, "position", 0.3f); // this should draw in front of other quad
glDeleteQueriesEXT(1, &query2); // should delete when query becomes inactive
diff --git a/src/tests/gl_tests/PathRenderingTest.cpp b/src/tests/gl_tests/PathRenderingTest.cpp
index 62f38b3..5294082 100644
--- a/src/tests/gl_tests/PathRenderingTest.cpp
+++ b/src/tests/gl_tests/PathRenderingTest.cpp
@@ -262,7 +262,7 @@
GLfloat coords[] = {50.0f, 50.0f};
glPathCommandsCHROMIUM(path, 2, commands, 2, GL_FLOAT, coords);
ASSERT_GL_NO_ERROR();
- EXPECT_TRUE(glIsPathCHROMIUM(path) == GL_TRUE);
+ EXPECT_GL_TRUE(glIsPathCHROMIUM(path));
static const GLenum kEndCaps[] = {GL_FLAT_CHROMIUM, GL_SQUARE_CHROMIUM, GL_ROUND_CHROMIUM};
for (std::size_t i = 0; i < 3; ++i)
@@ -360,7 +360,7 @@
GLuint non_existing_paths[] = {0, 55, 74744};
for (auto &p : non_existing_paths)
{
- EXPECT_TRUE(glIsPathCHROMIUM(p) == GL_FALSE);
+ EXPECT_GL_FALSE(glIsPathCHROMIUM(p));
ASSERT_GL_NO_ERROR();
tryAllDrawFunctions(p, GL_NO_ERROR);
}
@@ -368,7 +368,7 @@
// Path name marked as used but without path object state causes
// a GL error upon any draw command.
GLuint path = glGenPathsCHROMIUM(1);
- EXPECT_TRUE(glIsPathCHROMIUM(path) == GL_FALSE);
+ EXPECT_GL_FALSE(glIsPathCHROMIUM(path));
tryAllDrawFunctions(path, GL_INVALID_OPERATION);
glDeletePathsCHROMIUM(path, 1);
@@ -377,15 +377,15 @@
// Path name that had path object state, but then was "cleared", still has a
// path object state, even though the state is empty.
path = glGenPathsCHROMIUM(1);
- EXPECT_TRUE(glIsPathCHROMIUM(path) == GL_FALSE);
+ EXPECT_GL_FALSE(glIsPathCHROMIUM(path));
GLubyte commands[] = {GL_MOVE_TO_CHROMIUM, GL_CLOSE_PATH_CHROMIUM};
GLfloat coords[] = {50.0f, 50.0f};
glPathCommandsCHROMIUM(path, 2, commands, 2, GL_FLOAT, coords);
- EXPECT_TRUE(glIsPathCHROMIUM(path) == GL_TRUE);
+ EXPECT_GL_TRUE(glIsPathCHROMIUM(path));
glPathCommandsCHROMIUM(path, 0, nullptr, 0, GL_FLOAT, nullptr);
- EXPECT_TRUE(glIsPathCHROMIUM(path) == GL_TRUE); // The surprise.
+ EXPECT_GL_TRUE(glIsPathCHROMIUM(path)); // The surprise.
tryAllDrawFunctions(path, GL_NO_ERROR);
glDeletePathsCHROMIUM(path, 1);
@@ -1634,7 +1634,7 @@
glDeleteProgram(mProgram);
// Test that using invalid (deleted) program is an invalid operation.
- EXPECT_FALSE(glIsProgram(mProgram) == GL_FALSE);
+ EXPECT_GL_TRUE(glIsProgram(mProgram));
glProgramPathFragmentInputGenCHROMIUM(mProgram, -1, kValidGenMode, kValidComponents,
kCoefficients16);
@@ -1981,4 +1981,4 @@
ES2_OPENGL(),
ES2_OPENGLES(),
ES3_OPENGL(),
- ES3_OPENGLES());
\ No newline at end of file
+ ES3_OPENGLES());
diff --git a/src/tests/gl_tests/ProgramPipelineTest.cpp b/src/tests/gl_tests/ProgramPipelineTest.cpp
index 059b503..cff14d3 100644
--- a/src/tests/gl_tests/ProgramPipelineTest.cpp
+++ b/src/tests/gl_tests/ProgramPipelineTest.cpp
@@ -88,21 +88,21 @@
// Test IsProgramPipeline
TEST_P(ProgramPipelineTest31, IsProgramPipelineTest)
{
- EXPECT_EQ(GL_FALSE, glIsProgramPipeline(0));
+ EXPECT_GL_FALSE(glIsProgramPipeline(0));
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GL_FALSE, glIsProgramPipeline(2));
+ EXPECT_GL_FALSE(glIsProgramPipeline(2));
EXPECT_GL_NO_ERROR();
GLuint pipeline;
glGenProgramPipelines(1, &pipeline);
glBindProgramPipeline(pipeline);
- EXPECT_EQ(GL_TRUE, glIsProgramPipeline(pipeline));
+ EXPECT_GL_TRUE(glIsProgramPipeline(pipeline));
EXPECT_GL_NO_ERROR();
glBindProgramPipeline(0);
glDeleteProgramPipelines(1, &pipeline);
- EXPECT_EQ(GL_FALSE, glIsProgramPipeline(pipeline));
+ EXPECT_GL_FALSE(glIsProgramPipeline(pipeline));
EXPECT_GL_NO_ERROR();
}
diff --git a/src/tests/gl_tests/SRGBFramebufferTest.cpp b/src/tests/gl_tests/SRGBFramebufferTest.cpp
index 47ff2f3..57169eb 100644
--- a/src/tests/gl_tests/SRGBFramebufferTest.cpp
+++ b/src/tests/gl_tests/SRGBFramebufferTest.cpp
@@ -77,7 +77,7 @@
EXPECT_GL_ERROR(expectedError);
if (expectedError == GL_NO_ERROR)
{
- EXPECT_EQ(GL_TRUE, value);
+ EXPECT_GL_TRUE(value);
}
glDisable(GL_FRAMEBUFFER_SRGB_EXT);
@@ -87,7 +87,7 @@
EXPECT_GL_ERROR(expectedError);
if (expectedError == GL_NO_ERROR)
{
- EXPECT_EQ(GL_FALSE, value);
+ EXPECT_GL_FALSE(value);
}
}
diff --git a/src/tests/gl_tests/SyncQueriesTest.cpp b/src/tests/gl_tests/SyncQueriesTest.cpp
index b363112..9833e97 100644
--- a/src/tests/gl_tests/SyncQueriesTest.cpp
+++ b/src/tests/gl_tests/SyncQueriesTest.cpp
@@ -60,7 +60,7 @@
glFlush();
GLuint result = 0;
glGetQueryObjectuivEXT(mQuery, GL_QUERY_RESULT_EXT, &result);
- EXPECT_EQ(static_cast<GLuint>(GL_TRUE), result);
+ EXPECT_GL_TRUE(result);
EXPECT_GL_NO_ERROR();
}