Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils_unittest.cc

Issue 10894023: Merge 152707 - Fix Uniform Name Parsing (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1229/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/gles2_cmd_utils_unittest.cc
===================================================================
--- gpu/command_buffer/common/gles2_cmd_utils_unittest.cc (revision 153741)
+++ gpu/command_buffer/common/gles2_cmd_utils_unittest.cc (working copy)
@@ -181,6 +181,48 @@
EXPECT_EQ(0u, GLES2Util::RenderbufferBytesPerPixel(-1));
}
+namespace {
+
+void CheckParseUniformName(
+ const char* name,
+ bool expected_success,
+ size_t expected_array_pos,
+ int expected_index,
+ bool expected_getting_array) {
+ int index = 1234;
+ size_t array_pos = 1244;
+ bool getting_array = false;
+ bool success = GLES2Util::ParseUniformName(
+ name, &array_pos, &index, &getting_array);
+ EXPECT_EQ(expected_success, success);
+ if (success) {
+ EXPECT_EQ(expected_array_pos, array_pos);
+ EXPECT_EQ(expected_index, index);
+ EXPECT_EQ(expected_getting_array, getting_array);
+ }
+}
+
+} // anonymous namespace
+
+TEST_F(GLES2UtilTest, ParseUniformName) {
+ CheckParseUniformName("u_name", true, std::string::npos, 0, false);
+ CheckParseUniformName("u_name[]", false, std::string::npos, 0, false);
+ CheckParseUniformName("u_name]", false, std::string::npos, 0, false);
+ CheckParseUniformName("u_name[0a]", false, std::string::npos, 0, false);
+ CheckParseUniformName("u_name[a0]", false, std::string::npos, 0, false);
+ CheckParseUniformName("u_name[0a0]", false, std::string::npos, 0, false);
+ CheckParseUniformName("u_name[0]", true, 6u, 0, true);
+ CheckParseUniformName("u_name[2]", true, 6u, 2, true);
+ CheckParseUniformName("u_name[02]", true, 6u, 2, true);
+ CheckParseUniformName("u_name[20]", true, 6u, 20, true);
+ CheckParseUniformName("u_name[020]", true, 6u, 20, true);
+ CheckParseUniformName("u_name[0][0]", true, 9u, 0, true);
+ CheckParseUniformName("u_name[3][2]", true, 9u, 2, true);
+ CheckParseUniformName("u_name[03][02]", true, 10u, 2, true);
+ CheckParseUniformName("u_name[30][20]", true, 10u, 20, true);
+ CheckParseUniformName("u_name[030][020]", true, 11u, 20, true);
+}
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698