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

Unified Diff: ui/gfx/color_transform_unittest.cc

Issue 2705203003: color: Tests for fix accidental partial color conversion (Closed)
Patch Set: Use smaller ICC profile Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/icc_profile.h » ('j') | ui/gfx/icc_profile.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_transform_unittest.cc
diff --git a/ui/gfx/color_transform_unittest.cc b/ui/gfx/color_transform_unittest.cc
index 36e3ab21e958862b229fd21559793cb1c818f4f3..81a9be407b8090720e49d47c7acabdd718dfabdc 100644
--- a/ui/gfx/color_transform_unittest.cc
+++ b/ui/gfx/color_transform_unittest.cc
@@ -219,6 +219,51 @@ TEST(SimpleColorSpace, UnknownVideoToSRGB) {
EXPECT_GT(tmp.z(), tmp.y());
}
+TEST(SimpleColorSpace, ToUndefined) {
+ ColorSpace null;
+ ColorSpace nonnull = gfx::ColorSpace::CreateSRGB();
+ // Video should have 1 step: YUV to RGB.
+ // Anything else should have 0 steps.
+ ColorSpace video = gfx::ColorSpace::CreateREC709();
+ std::unique_ptr<ColorTransform> video_to_null(
+ ColorTransform::NewColorTransform(
+ video, null, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(video_to_null->NumberOfStepsForTesting(), 1u);
+
+ // Test with an ICC profile that can't be represented as matrix+transfer.
+ ColorSpace luttrcicc = ICCProfileForTestingNoAnalyticTrFn().GetColorSpace();
+ std::unique_ptr<ColorTransform> luttrcicc_to_null(
+ ColorTransform::NewColorTransform(
+ luttrcicc, null, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(luttrcicc_to_null->NumberOfStepsForTesting(), 0u);
+ std::unique_ptr<ColorTransform> luttrcicc_to_nonnull(
+ ColorTransform::NewColorTransform(
+ luttrcicc, nonnull, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_GT(luttrcicc_to_nonnull->NumberOfStepsForTesting(), 0u);
+
+ // Test with an ICC profile that can.
+ ColorSpace adobeicc = ICCProfileForTestingAdobeRGB().GetColorSpace();
+ std::unique_ptr<ColorTransform> adobeicc_to_null(
+ ColorTransform::NewColorTransform(
+ adobeicc, null, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(adobeicc_to_null->NumberOfStepsForTesting(), 0u);
+ std::unique_ptr<ColorTransform> adobeicc_to_nonnull(
+ ColorTransform::NewColorTransform(
+ adobeicc, nonnull, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_GT(adobeicc_to_nonnull->NumberOfStepsForTesting(), 0u);
+
+ // And with something analytic.
+ ColorSpace srgb = gfx::ColorSpace::CreateXYZD50();
+ std::unique_ptr<ColorTransform> srgb_to_null(
+ ColorTransform::NewColorTransform(
+ srgb, null, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(srgb_to_null->NumberOfStepsForTesting(), 0u);
+ std::unique_ptr<ColorTransform> srgb_to_nonnull(
+ ColorTransform::NewColorTransform(
+ srgb, nonnull, ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_GT(srgb_to_nonnull->NumberOfStepsForTesting(), 0u);
+}
+
TEST(SimpleColorSpace, DefaultToSRGB) {
// The default value should do no transformation, regardless of destination.
ColorSpace unknown;
« no previous file with comments | « no previous file | ui/gfx/icc_profile.h » ('j') | ui/gfx/icc_profile.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698