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

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

Issue 2602563002: Refactor DrawTextureQuad and CheckPixels in gl_tests util (Closed)
Patch Set: git cl format Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); 104 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_);
105 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, 105 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target,
106 texture_, 0); 106 texture_, 0);
107 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 107 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
108 108
109 // Check that FB is complete. 109 // Check that FB is complete.
110 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 110 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
111 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 111 glCheckFramebufferStatus(GL_FRAMEBUFFER));
112 112
113 GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_); 113 GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_, nullptr);
114 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 114 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
115 } 115 }
116 116
117 117
118 TEST_P(GLCubeMapTextureTest, ReadPixelsFromIncompleteCubeTexture) { 118 TEST_P(GLCubeMapTextureTest, ReadPixelsFromIncompleteCubeTexture) {
119 GLenum cube_map_target = GetParam(); 119 GLenum cube_map_target = GetParam();
120 120
121 glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); 121 glBindTexture(GL_TEXTURE_CUBE_MAP, texture_);
122 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); 122 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
123 123
(...skipping 13 matching lines...) Expand all
137 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), 137 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
138 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 138 glCheckFramebufferStatus(GL_FRAMEBUFFER));
139 GLsizei size = width_ * width_ * 4; 139 GLsizei size = width_ * width_ * 4;
140 std::unique_ptr<uint8_t[]> pixels(new uint8_t[size]); 140 std::unique_ptr<uint8_t[]> pixels(new uint8_t[size]);
141 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); 141 glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
142 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_FRAMEBUFFER_OPERATION), 142 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_FRAMEBUFFER_OPERATION),
143 glGetError()); 143 glGetError());
144 } 144 }
145 145
146 } // namespace gpu 146 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698