| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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/icc_profile.h" | 8 #include "ui/gfx/icc_profile.h" |
| 9 #include "ui/gfx/test/icc_profiles.h" | 9 #include "ui/gfx/test/icc_profiles.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 TEST(ICCProfile, Conversions) { | 13 TEST(ICCProfile, Conversions) { |
| 14 ICCProfile icc_profile = ICCProfileForTestingColorSpin(); | 14 ICCProfile icc_profile = ICCProfileForTestingColorSpin(); |
| 15 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace(); | 15 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace(); |
| 16 | 16 |
| 17 ICCProfile icc_profile_from_color_space = | 17 ICCProfile icc_profile_from_color_space = |
| 18 ICCProfile::FromColorSpace(color_space_from_icc_profile); | 18 ICCProfile::FromColorSpace(color_space_from_icc_profile); |
| 19 EXPECT_TRUE(icc_profile == icc_profile_from_color_space); | 19 EXPECT_TRUE(icc_profile == icc_profile_from_color_space); |
| 20 } | 20 } |
| 21 | 21 |
| 22 TEST(ICCProfile, SRGB) { | 22 TEST(ICCProfile, SRGB) { |
| 23 ColorSpace color_space = ColorSpace::CreateSRGB(); | 23 ColorSpace color_space = ColorSpace::CreateSRGB(); |
| 24 sk_sp<SkColorSpace> sk_color_space = | 24 sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB(); |
| 25 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); | |
| 26 | 25 |
| 27 // These should be the same pointer, not just equal. | 26 // These should be the same pointer, not just equal. |
| 28 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get()); | 27 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get()); |
| 29 } | 28 } |
| 30 | 29 |
| 31 TEST(ICCProfile, Equality) { | 30 TEST(ICCProfile, Equality) { |
| 32 ICCProfile spin_profile = ICCProfileForTestingColorSpin(); | 31 ICCProfile spin_profile = ICCProfileForTestingColorSpin(); |
| 33 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB(); | 32 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB(); |
| 34 EXPECT_TRUE(spin_profile == spin_profile); | 33 EXPECT_TRUE(spin_profile == spin_profile); |
| 35 EXPECT_FALSE(spin_profile != spin_profile); | 34 EXPECT_FALSE(spin_profile != spin_profile); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 49 EXPECT_TRUE(spin_profile != ICCProfile::FromColorSpace(adobe_space)); | 48 EXPECT_TRUE(spin_profile != ICCProfile::FromColorSpace(adobe_space)); |
| 50 | 49 |
| 51 EXPECT_TRUE(!!spin_space.ToSkColorSpace()); | 50 EXPECT_TRUE(!!spin_space.ToSkColorSpace()); |
| 52 EXPECT_TRUE(!!adobe_space.ToSkColorSpace()); | 51 EXPECT_TRUE(!!adobe_space.ToSkColorSpace()); |
| 53 EXPECT_FALSE(SkColorSpace::Equals( | 52 EXPECT_FALSE(SkColorSpace::Equals( |
| 54 spin_space.ToSkColorSpace().get(), | 53 spin_space.ToSkColorSpace().get(), |
| 55 adobe_space.ToSkColorSpace().get())); | 54 adobe_space.ToSkColorSpace().get())); |
| 56 } | 55 } |
| 57 | 56 |
| 58 } // namespace gfx | 57 } // namespace gfx |
| OLD | NEW |