| Index: ui/gfx/icc_profile_unittest.cc
|
| diff --git a/ui/gfx/icc_profile_unittest.cc b/ui/gfx/icc_profile_unittest.cc
|
| index c4e3db8026b9ca8bfa0faf54bb0392589784562a..35d8edcffac2ae072a35b50fb008d811f967867f 100644
|
| --- a/ui/gfx/icc_profile_unittest.cc
|
| +++ b/ui/gfx/icc_profile_unittest.cc
|
| @@ -64,4 +64,59 @@ TEST(ICCProfile, Equality) {
|
| adobe_space.ToSkColorSpace().get()));
|
| }
|
|
|
| +TEST(ICCProfile, ParametricVersusExact) {
|
| + // This ICC profile has three transfer functions that differ enough that the
|
| + // parametric color space is considered inaccurate.
|
| + ICCProfile inaccurate = ICCProfileForTestingNoAnalyticTrFn();
|
| + EXPECT_NE(inaccurate.GetColorSpace(), inaccurate.GetParametricColorSpace());
|
| +
|
| + ICCProfile inaccurate_color_space;
|
| + EXPECT_TRUE(
|
| + inaccurate.GetColorSpace().GetICCProfile(&inaccurate_color_space));
|
| + EXPECT_EQ(inaccurate_color_space, inaccurate);
|
| +
|
| + ICCProfile inaccurate_parametric_color_space;
|
| + EXPECT_TRUE(inaccurate.GetParametricColorSpace().GetICCProfile(
|
| + &inaccurate_parametric_color_space));
|
| + EXPECT_NE(inaccurate_parametric_color_space, inaccurate);
|
| +
|
| + // This ICC profile is precisely represented by the parametric color space.
|
| + ICCProfile accurate = ICCProfileForTestingAdobeRGB();
|
| + EXPECT_EQ(accurate.GetColorSpace(), accurate.GetParametricColorSpace());
|
| +
|
| + ICCProfile accurate_color_space;
|
| + EXPECT_TRUE(accurate.GetColorSpace().GetICCProfile(&accurate_color_space));
|
| + EXPECT_EQ(accurate_color_space, accurate);
|
| +
|
| + ICCProfile accurate_parametric_color_space;
|
| + EXPECT_TRUE(accurate.GetParametricColorSpace().GetICCProfile(
|
| + &accurate_parametric_color_space));
|
| + EXPECT_EQ(accurate_parametric_color_space, accurate);
|
| +
|
| + // This ICC profile has only an A2B representation. For now, this means that
|
| + // the parametric representation will be sRGB. We will eventually want to get
|
| + // some sense of the gamut.
|
| + ICCProfile a2b = ICCProfileForTestingA2BOnly();
|
| + EXPECT_TRUE(a2b.GetColorSpace().IsValid());
|
| + EXPECT_NE(a2b.GetColorSpace(), a2b.GetParametricColorSpace());
|
| + EXPECT_EQ(ColorSpace::CreateSRGB(), a2b.GetParametricColorSpace());
|
| +}
|
| +
|
| +TEST(ICCProfile, GarbageData) {
|
| + std::vector<char> bad_data(10 * 1024);
|
| + const char* bad_data_string = "deadbeef";
|
| + for (size_t i = 0; i < bad_data.size(); ++i)
|
| + bad_data[i] = bad_data_string[i % 8];
|
| + ICCProfile garbage_profile =
|
| + ICCProfile::FromData(bad_data.data(), bad_data.size());
|
| + EXPECT_FALSE(garbage_profile.IsValid());
|
| + EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid());
|
| + EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid());
|
| +
|
| + ICCProfile default_ctor_profile;
|
| + EXPECT_FALSE(default_ctor_profile.IsValid());
|
| + EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid());
|
| + EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid());
|
| +}
|
| +
|
| } // namespace gfx
|
|
|