| 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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 EXPECT_TRUE(!!spin_space.ToSkColorSpace()); | 60 EXPECT_TRUE(!!spin_space.ToSkColorSpace()); |
| 61 EXPECT_TRUE(!!adobe_space.ToSkColorSpace()); | 61 EXPECT_TRUE(!!adobe_space.ToSkColorSpace()); |
| 62 EXPECT_FALSE(SkColorSpace::Equals( | 62 EXPECT_FALSE(SkColorSpace::Equals( |
| 63 spin_space.ToSkColorSpace().get(), | 63 spin_space.ToSkColorSpace().get(), |
| 64 adobe_space.ToSkColorSpace().get())); | 64 adobe_space.ToSkColorSpace().get())); |
| 65 } | 65 } |
| 66 | 66 |
| 67 TEST(ICCProfile, ParametricVersusExact) { | 67 TEST(ICCProfile, ParametricVersusExact) { |
| 68 // This ICC profile has three transfer functions that differ enough that the | 68 // This ICC profile has three transfer functions that differ enough that the |
| 69 // parametric color space is considered inaccurate. | 69 // parametric color space is considered inaccurate. |
| 70 ICCProfile inaccurate = ICCProfileForTestingNoAnalyticTrFn(); | 70 ICCProfile multi_tr_fn = ICCProfileForTestingNoAnalyticTrFn(); |
| 71 EXPECT_NE(inaccurate.GetColorSpace(), inaccurate.GetParametricColorSpace()); | 71 EXPECT_NE(multi_tr_fn.GetColorSpace(), multi_tr_fn.GetParametricColorSpace()); |
| 72 | 72 |
| 73 ICCProfile inaccurate_color_space; | 73 ICCProfile multi_tr_fn_color_space; |
| 74 EXPECT_TRUE( | 74 EXPECT_TRUE( |
| 75 inaccurate.GetColorSpace().GetICCProfile(&inaccurate_color_space)); | 75 multi_tr_fn.GetColorSpace().GetICCProfile(&multi_tr_fn_color_space)); |
| 76 EXPECT_EQ(inaccurate_color_space, inaccurate); | 76 EXPECT_EQ(multi_tr_fn_color_space, multi_tr_fn); |
| 77 | 77 |
| 78 ICCProfile inaccurate_parametric_color_space; | 78 ICCProfile multi_tr_fn_parametric_color_space; |
| 79 EXPECT_TRUE(inaccurate.GetParametricColorSpace().GetICCProfile( | 79 EXPECT_TRUE(multi_tr_fn.GetParametricColorSpace().GetICCProfile( |
| 80 &inaccurate_parametric_color_space)); | 80 &multi_tr_fn_parametric_color_space)); |
| 81 EXPECT_NE(inaccurate_parametric_color_space, inaccurate); | 81 EXPECT_NE(multi_tr_fn_parametric_color_space, multi_tr_fn); |
| 82 |
| 83 // This ICC profile has a transfer function with T(1) that is greater than 1 |
| 84 // in the approximation, but is still close enough to be considered accurate. |
| 85 ICCProfile overshoot = ICCProfileForTestingOvershoot(); |
| 86 EXPECT_EQ(overshoot.GetColorSpace(), overshoot.GetParametricColorSpace()); |
| 87 |
| 88 ICCProfile overshoot_color_space; |
| 89 EXPECT_TRUE(overshoot.GetColorSpace().GetICCProfile(&overshoot_color_space)); |
| 90 EXPECT_EQ(overshoot_color_space, overshoot); |
| 91 |
| 92 ICCProfile overshoot_parametric_color_space; |
| 93 EXPECT_TRUE(overshoot.GetParametricColorSpace().GetICCProfile( |
| 94 &overshoot_parametric_color_space)); |
| 95 EXPECT_EQ(overshoot_parametric_color_space, overshoot); |
| 82 | 96 |
| 83 // This ICC profile is precisely represented by the parametric color space. | 97 // This ICC profile is precisely represented by the parametric color space. |
| 84 ICCProfile accurate = ICCProfileForTestingAdobeRGB(); | 98 ICCProfile accurate = ICCProfileForTestingAdobeRGB(); |
| 85 EXPECT_EQ(accurate.GetColorSpace(), accurate.GetParametricColorSpace()); | 99 EXPECT_EQ(accurate.GetColorSpace(), accurate.GetParametricColorSpace()); |
| 86 | 100 |
| 87 ICCProfile accurate_color_space; | 101 ICCProfile accurate_color_space; |
| 88 EXPECT_TRUE(accurate.GetColorSpace().GetICCProfile(&accurate_color_space)); | 102 EXPECT_TRUE(accurate.GetColorSpace().GetICCProfile(&accurate_color_space)); |
| 89 EXPECT_EQ(accurate_color_space, accurate); | 103 EXPECT_EQ(accurate_color_space, accurate); |
| 90 | 104 |
| 91 ICCProfile accurate_parametric_color_space; | 105 ICCProfile accurate_parametric_color_space; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); | 125 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); |
| 112 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); | 126 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); |
| 113 | 127 |
| 114 ICCProfile default_ctor_profile; | 128 ICCProfile default_ctor_profile; |
| 115 EXPECT_FALSE(default_ctor_profile.IsValid()); | 129 EXPECT_FALSE(default_ctor_profile.IsValid()); |
| 116 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); | 130 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); |
| 117 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); | 131 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); |
| 118 } | 132 } |
| 119 | 133 |
| 120 } // namespace gfx | 134 } // namespace gfx |
| OLD | NEW |