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

Unified Diff: ui/gfx/color_transform_unittest.cc

Issue 2697863003: color: Clarify default behaviors (Closed)
Patch Set: Incorporate review feedback 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 | « ui/gfx/color_transform.cc ('k') | no next file » | no next file with comments »
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 5a8882672f7ffb9933581876b9e30bc86ba7d9ae..e566ff928799e8099c7745915173fc4797b41ef4 100644
--- a/ui/gfx/color_transform_unittest.cc
+++ b/ui/gfx/color_transform_unittest.cc
@@ -39,7 +39,6 @@ ColorSpace::TransferID all_transfers[] = {
ColorSpace::MatrixID all_matrices[] = {
ColorSpace::MatrixID::RGB, ColorSpace::MatrixID::BT709,
- ColorSpace::MatrixID::UNSPECIFIED, ColorSpace::MatrixID::RESERVED,
ColorSpace::MatrixID::FCC, ColorSpace::MatrixID::BT470BG,
ColorSpace::MatrixID::SMPTE170M, ColorSpace::MatrixID::SMPTE240M,
@@ -51,8 +50,7 @@ ColorSpace::MatrixID all_matrices[] = {
ColorSpace::MatrixID::YDZDX,
};
-ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::UNSPECIFIED,
- ColorSpace::RangeID::FULL,
+ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::FULL,
ColorSpace::RangeID::LIMITED,
ColorSpace::RangeID::DERIVED};
@@ -194,8 +192,10 @@ TEST(SimpleColorSpace, GetColorSpace) {
EXPECT_NEAR(tmp.z(), 1.0f, kEpsilon);
}
-TEST(SimpleColorSpace, UnknownToSRGB) {
- ColorSpace unknown;
+TEST(SimpleColorSpace, UnknownVideoToSRGB) {
+ // Invalid video spaces should be BT709.
+ ColorSpace unknown = gfx::ColorSpace::CreateVideo(
+ -1, -1, -1, gfx::ColorSpace::RangeID::LIMITED);
ColorSpace sRGB = ColorSpace::CreateSRGB();
std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform(
unknown, sRGB, ColorTransform::Intent::INTENT_PERCEPTUAL));
@@ -219,6 +219,19 @@ TEST(SimpleColorSpace, UnknownToSRGB) {
EXPECT_GT(tmp.z(), tmp.y());
}
+TEST(SimpleColorSpace, DefaultToSRGB) {
+ // The default value should do no transformation, regardless of destination.
+ ColorSpace unknown;
+ std::unique_ptr<ColorTransform> t1(ColorTransform::NewColorTransform(
+ unknown, ColorSpace::CreateSRGB(),
+ ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(t1->NumberOfStepsForTesting(), 0u);
+ std::unique_ptr<ColorTransform> t2(ColorTransform::NewColorTransform(
+ unknown, ColorSpace::CreateXYZD50(),
+ ColorTransform::Intent::INTENT_PERCEPTUAL));
+ EXPECT_EQ(t2->NumberOfStepsForTesting(), 0u);
+}
+
class TransferTest : public testing::TestWithParam<ColorSpace::TransferID> {};
TEST_P(TransferTest, basicTest) {
« no previous file with comments | « ui/gfx/color_transform.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698