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

Unified Diff: ui/gl/test/gl_image_test_template.h

Issue 1484473003: gl, ozone: enable GLImageBindTest unittests Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase based on crrev.com/1879243002 Created 4 years, 8 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
Index: ui/gl/test/gl_image_test_template.h
diff --git a/ui/gl/test/gl_image_test_template.h b/ui/gl/test/gl_image_test_template.h
index 4459200bf20109f51f2c3e4ee47717f26ed93350..507ecdf2b598f352c5f46f7ead7deb3425d23767 100644
--- a/ui/gl/test/gl_image_test_template.h
+++ b/ui/gl/test/gl_image_test_template.h
@@ -146,6 +146,9 @@ class GLImageTest : public testing::Test {
TYPED_TEST_CASE_P(GLImageTest);
TYPED_TEST_P(GLImageTest, CreateAndDestroy) {
+ if (!this->delegate_.IsSupported())
+ return;
+
const gfx::Size small_image_size(4, 4);
const gfx::Size large_image_size(512, 512);
const uint8_t image_color[] = {0, 0xff, 0, 0xff};
@@ -184,6 +187,9 @@ class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {};
TYPED_TEST_CASE_P(GLImageZeroInitializeTest);
TYPED_TEST_P(GLImageZeroInitializeTest, ZeroInitialize) {
+ // Ozone platform knows the supported format in runtime.
+ if (!this->delegate_.IsSupported())
+ return;
#if defined(OS_MACOSX)
// This functionality is disabled on Mavericks because it breaks PDF
// rendering. https://crbug.com/594343.
@@ -236,8 +242,17 @@ class GLImageBindTest : public GLImageTest<GLImageTestDelegate> {};
TYPED_TEST_CASE_P(GLImageBindTest);
TYPED_TEST_P(GLImageBindTest, BindTexImage) {
+ if (!this->delegate_.IsSupported())
+ return;
+
const gfx::Size image_size(256, 256);
- const uint8_t image_color[] = {0x10, 0x20, 0, 0xff};
+ // These values are picked so that RGB -> YUV on the CPU converted
+ // back to RGB on the GPU produces the original RGB values without
+ // any error.
+ uint8_t image_color[] = {0x10, 0x20, 0x00, 0xff};
+ // glReadPixels(.., GL_RGBA, ..) for RED texture returns (R, 0x00, 0x00, 0xff)
+ if (gfx::BufferFormat::R_8 == this->delegate_.GetBufferFormat())
+ image_color[1] = 0x00;
GLuint framebuffer =
GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height());
@@ -283,11 +298,17 @@ class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {};
TYPED_TEST_CASE_P(GLImageCopyTest);
TYPED_TEST_P(GLImageCopyTest, CopyTexImage) {
+ if (!this->delegate_.IsSupported())
+ return;
+
const gfx::Size image_size(256, 256);
// These values are picked so that RGB -> YUV on the CPU converted
// back to RGB on the GPU produces the original RGB values without
// any error.
- const uint8_t image_color[] = {0x10, 0x20, 0, 0xff};
+ uint8_t image_color[] = {0x10, 0x20, 0x00, 0xff};
+ // glReadPixels(.., GL_RGBA, ..) for RED texture returns (R, 0x00, 0x00, 0xff)
+ if (gfx::BufferFormat::R_8 == this->delegate_.GetBufferFormat())
+ image_color[1] = 0x00;
const uint8_t texture_color[] = {0, 0, 0xff, 0xff};
GLuint framebuffer =

Powered by Google App Engine
This is Rietveld 408576698