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

Side by Side Diff: ui/gfx/color_transform_unittest.cc

Issue 2841813002: Converting video color space enums to their corresponding gfx:color space eqvivalent. (Closed)
Patch Set: Removed gfx::ColorSpace::CreateVideo() Created 3 years, 7 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
« media/filters/ffmpeg_video_decoder.cc ('K') | « ui/gfx/color_space.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/color_space.h" 7 #include "ui/gfx/color_space.h"
8 #include "ui/gfx/color_transform.h" 8 #include "ui/gfx/color_transform.h"
9 #include "ui/gfx/icc_profile.h" 9 #include "ui/gfx/icc_profile.h"
10 #include "ui/gfx/test/icc_profiles.h" 10 #include "ui/gfx/test/icc_profiles.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 tmp = ColorTransform::TriStim(0.0f, 0.0f, 1.0f); 307 tmp = ColorTransform::TriStim(0.0f, 0.0f, 1.0f);
308 t->Transform(&tmp, 1); 308 t->Transform(&tmp, 1);
309 EXPECT_NEAR(tmp.x(), 0.0f, kEpsilon); 309 EXPECT_NEAR(tmp.x(), 0.0f, kEpsilon);
310 EXPECT_NEAR(tmp.y(), 0.0f, kEpsilon); 310 EXPECT_NEAR(tmp.y(), 0.0f, kEpsilon);
311 EXPECT_NEAR(tmp.z(), 1.0f, kEpsilon); 311 EXPECT_NEAR(tmp.z(), 1.0f, kEpsilon);
312 } 312 }
313 313
314 TEST(SimpleColorSpace, UnknownVideoToSRGB) { 314 TEST(SimpleColorSpace, UnknownVideoToSRGB) {
315 // Invalid video spaces should be BT709. 315 // Invalid video spaces should be BT709.
316 ColorSpace unknown = gfx::ColorSpace::CreateVideo( 316 ColorSpace unknown = gfx::ColorSpace(
317 -1, -1, -1, gfx::ColorSpace::RangeID::LIMITED); 317 gfx::ColorSpace::PrimaryID::INVALID, gfx::ColorSpace::TransferID::INVALID,
318 gfx::ColorSpace::MatrixID::INVALID, gfx::ColorSpace::RangeID::LIMITED);
ccameron 2017/05/03 14:56:24 I think that this test will fail because INVALID w
318 ColorSpace sRGB = ColorSpace::CreateSRGB(); 319 ColorSpace sRGB = ColorSpace::CreateSRGB();
319 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( 320 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform(
320 unknown, sRGB, ColorTransform::Intent::INTENT_PERCEPTUAL)); 321 unknown, sRGB, ColorTransform::Intent::INTENT_PERCEPTUAL));
321 322
322 ColorTransform::TriStim tmp(16.0f / 255.0f, 0.5f, 0.5f); 323 ColorTransform::TriStim tmp(16.0f / 255.0f, 0.5f, 0.5f);
323 t->Transform(&tmp, 1); 324 t->Transform(&tmp, 1);
324 EXPECT_NEAR(tmp.x(), 0.0f, 0.001f); 325 EXPECT_NEAR(tmp.x(), 0.0f, 0.001f);
325 EXPECT_NEAR(tmp.y(), 0.0f, 0.001f); 326 EXPECT_NEAR(tmp.y(), 0.0f, 0.001f);
326 EXPECT_NEAR(tmp.z(), 0.0f, 0.001f); 327 EXPECT_NEAR(tmp.z(), 0.0f, 0.001f);
327 328
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 628
628 INSTANTIATE_TEST_CASE_P( 629 INSTANTIATE_TEST_CASE_P(
629 C, 630 C,
630 ColorSpaceTest, 631 ColorSpaceTest,
631 testing::Combine(testing::ValuesIn(all_primaries), 632 testing::Combine(testing::ValuesIn(all_primaries),
632 testing::Values(ColorSpace::TransferID::BT709), 633 testing::Values(ColorSpace::TransferID::BT709),
633 testing::ValuesIn(all_matrices), 634 testing::ValuesIn(all_matrices),
634 testing::ValuesIn(all_ranges), 635 testing::ValuesIn(all_ranges),
635 testing::ValuesIn(intents))); 636 testing::ValuesIn(intents)));
636 } // namespace 637 } // namespace
OLDNEW
« media/filters/ffmpeg_video_decoder.cc ('K') | « ui/gfx/color_space.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698