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

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

Issue 2349923002: Add getters for gfx::ColorSpace components (Closed)
Patch Set: Added tests for getters Created 4 years, 3 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
« no previous file with comments | « ui/gfx/color_space.h ('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/transform.h" 10 #include "ui/gfx/transform.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 }; 483 };
484 484
485 TEST_P(ColorSpaceTest, testNullTransform) { 485 TEST_P(ColorSpaceTest, testNullTransform) {
486 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( 486 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform(
487 color_space_, color_space_, ColorTransform::Intent::INTENT_ABSOLUTE)); 487 color_space_, color_space_, ColorTransform::Intent::INTENT_ABSOLUTE));
488 ColorTransform::TriStim tristim(0.4f, 0.5f, 0.6f); 488 ColorTransform::TriStim tristim(0.4f, 0.5f, 0.6f);
489 t->transform(&tristim, 1); 489 t->transform(&tristim, 1);
490 EXPECT_NEAR(tristim.x(), 0.4f, 0.001f); 490 EXPECT_NEAR(tristim.x(), 0.4f, 0.001f);
491 EXPECT_NEAR(tristim.y(), 0.5f, 0.001f); 491 EXPECT_NEAR(tristim.y(), 0.5f, 0.001f);
492 EXPECT_NEAR(tristim.z(), 0.6f, 0.001f); 492 EXPECT_NEAR(tristim.z(), 0.6f, 0.001f);
493
494 EXPECT_EQ(color_space_.primaries(), std::tr1::get<0>(GetParam()));
495 EXPECT_EQ(color_space_.transfer_function(), std::tr1::get<1>(GetParam()));
496 EXPECT_EQ(color_space_.matrix(), std::tr1::get<2>(GetParam()));
497 EXPECT_EQ(color_space_.range(), std::tr1::get<3>(GetParam()));
493 } 498 }
494 499
495 TEST_P(ColorSpaceTest, toXYZandBack) { 500 TEST_P(ColorSpaceTest, toXYZandBack) {
496 std::unique_ptr<ColorTransform> t1(ColorTransform::NewColorTransform( 501 std::unique_ptr<ColorTransform> t1(ColorTransform::NewColorTransform(
497 color_space_, ColorSpace::CreateXYZD50(), 502 color_space_, ColorSpace::CreateXYZD50(),
498 ColorTransform::Intent::INTENT_ABSOLUTE)); 503 ColorTransform::Intent::INTENT_ABSOLUTE));
499 std::unique_ptr<ColorTransform> t2(ColorTransform::NewColorTransform( 504 std::unique_ptr<ColorTransform> t2(ColorTransform::NewColorTransform(
500 ColorSpace::CreateXYZD50(), color_space_, 505 ColorSpace::CreateXYZD50(), color_space_,
501 ColorTransform::Intent::INTENT_ABSOLUTE)); 506 ColorTransform::Intent::INTENT_ABSOLUTE));
502 ColorTransform::TriStim tristim(0.4f, 0.5f, 0.6f); 507 ColorTransform::TriStim tristim(0.4f, 0.5f, 0.6f);
(...skipping 21 matching lines...) Expand all
524 testing::ValuesIn(all_ranges))); 529 testing::ValuesIn(all_ranges)));
525 530
526 INSTANTIATE_TEST_CASE_P( 531 INSTANTIATE_TEST_CASE_P(
527 C, 532 C,
528 ColorSpaceTest, 533 ColorSpaceTest,
529 testing::Combine(testing::ValuesIn(all_primaries), 534 testing::Combine(testing::ValuesIn(all_primaries),
530 testing::Values(ColorSpace::TransferID::BT709), 535 testing::Values(ColorSpace::TransferID::BT709),
531 testing::ValuesIn(all_matrices), 536 testing::ValuesIn(all_matrices),
532 testing::ValuesIn(all_ranges))); 537 testing::ValuesIn(all_ranges)));
533 } // namespace 538 } // namespace
OLDNEW
« no previous file with comments | « ui/gfx/color_space.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698