| 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 bool result = | 18 bool result = |
| 19 color_space_from_icc_profile.GetICCProfile(&icc_profile_from_color_space); | 19 color_space_from_icc_profile.GetICCProfile(&icc_profile_from_color_space); |
| 20 EXPECT_TRUE(result); | 20 EXPECT_TRUE(result); |
| 21 EXPECT_TRUE(icc_profile == icc_profile_from_color_space); | 21 EXPECT_TRUE(icc_profile == icc_profile_from_color_space); |
| 22 } | 22 } |
| 23 | 23 |
| 24 TEST(ICCProfile, SRGB) { | 24 TEST(ICCProfile, SRGB) { |
| 25 ICCProfile icc_profile = ICCProfileForTestingSRGB(); |
| 25 ColorSpace color_space = ColorSpace::CreateSRGB(); | 26 ColorSpace color_space = ColorSpace::CreateSRGB(); |
| 26 sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB(); | 27 sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB(); |
| 27 | 28 |
| 28 // These should be the same pointer, not just equal. | 29 // The ICC profile parser should note that this is SRGB. |
| 30 EXPECT_EQ(icc_profile.GetColorSpace().ToSkColorSpace().get(), |
| 31 sk_color_space.get()); |
| 32 // The parametric generating code should recognize that this is SRGB. |
| 33 EXPECT_EQ(icc_profile.GetParametricColorSpace().ToSkColorSpace().get(), |
| 34 sk_color_space.get()); |
| 35 // The generated color space should recognize that this is SRGB. |
| 29 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get()); | 36 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get()); |
| 30 } | 37 } |
| 31 | 38 |
| 32 TEST(ICCProfile, Equality) { | 39 TEST(ICCProfile, Equality) { |
| 33 ICCProfile spin_profile = ICCProfileForTestingColorSpin(); | 40 ICCProfile spin_profile = ICCProfileForTestingColorSpin(); |
| 34 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB(); | 41 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB(); |
| 35 EXPECT_TRUE(spin_profile == spin_profile); | 42 EXPECT_TRUE(spin_profile == spin_profile); |
| 36 EXPECT_FALSE(spin_profile != spin_profile); | 43 EXPECT_FALSE(spin_profile != spin_profile); |
| 37 EXPECT_FALSE(spin_profile == adobe_profile); | 44 EXPECT_FALSE(spin_profile == adobe_profile); |
| 38 EXPECT_TRUE(spin_profile != adobe_profile); | 45 EXPECT_TRUE(spin_profile != adobe_profile); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); | 132 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); |
| 126 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); | 133 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); |
| 127 | 134 |
| 128 ICCProfile default_ctor_profile; | 135 ICCProfile default_ctor_profile; |
| 129 EXPECT_FALSE(default_ctor_profile.IsValid()); | 136 EXPECT_FALSE(default_ctor_profile.IsValid()); |
| 130 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); | 137 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); |
| 131 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); | 138 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); |
| 132 } | 139 } |
| 133 | 140 |
| 134 } // namespace gfx | 141 } // namespace gfx |
| OLD | NEW |