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

Side by Side Diff: gpu/command_buffer/tests/compressed_texture_test.cc

Issue 2602563002: Refactor DrawTextureQuad and CheckPixels in gl_tests util (Closed)
Patch Set: git cl format Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h> 7 #include <GLES2/gl2extchromium.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "gpu/command_buffer/tests/gl_manager.h" 10 #include "gpu/command_buffer/tests/gl_manager.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Draw. 226 // Draw.
227 glDrawArrays(GL_TRIANGLES, 0, 6); 227 glDrawArrays(GL_TRIANGLES, 0, 6);
228 glFlush(); 228 glFlush();
229 229
230 // Verify results. 230 // Verify results.
231 int origin[] = {0, 0}; 231 int origin[] = {0, 0};
232 uint8_t expected_rgba[] = {0, 0, 0, 255}; 232 uint8_t expected_rgba[] = {0, 0, 0, 255};
233 for (unsigned i = 0; i < kPaletteSize; ++i) { 233 for (unsigned i = 0; i < kPaletteSize; ++i) {
234 origin[0] = kBlockSize * i; 234 origin[0] = kBlockSize * i;
235 ToRGB888(kPalette[i], expected_rgba); 235 ToRGB888(kPalette[i], expected_rgba);
236 EXPECT_TRUE(GLTestHelper::CheckPixels(origin[0], origin[1], 236 EXPECT_TRUE(GLTestHelper::CheckPixels(origin[0], origin[1], kBlockSize,
237 kBlockSize, kBlockSize, 237 kBlockSize, 0, expected_rgba,
238 0, expected_rgba)); 238 nullptr));
239 } 239 }
240 GLTestHelper::CheckGLError("CompressedTextureTest.Draw", __LINE__); 240 GLTestHelper::CheckGLError("CompressedTextureTest.Draw", __LINE__);
241 } 241 }
242 242
243 static const GLenum kFormats[] = { 243 static const GLenum kFormats[] = {
244 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 244 GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
245 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 245 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
246 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 246 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
247 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 247 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
248 }; 248 };
249 INSTANTIATE_TEST_CASE_P(Format, 249 INSTANTIATE_TEST_CASE_P(Format,
250 CompressedTextureTest, 250 CompressedTextureTest,
251 ::testing::ValuesIn(kFormats)); 251 ::testing::ValuesIn(kFormats));
252 252
253 } // namespace gpu 253 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698