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

Side by Side Diff: ui/gfx/icc_profile_unittest.cc

Issue 2873203003: color: Add --force-color-profile command line flag (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/icc_profile_mac.mm ('k') | ui/gfx/icc_profile_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/icc_profile.h"
5 #include "base/logging.h" 6 #include "base/logging.h"
6 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/color_space.h" 8 #include "ui/gfx/color_space.h"
8 #include "ui/gfx/icc_profile.h" 9 #include "ui/gfx/skia_color_space_util.h"
9 #include "ui/gfx/test/icc_profiles.h" 10 #include "ui/gfx/test/icc_profiles.h"
10 11
11 namespace gfx { 12 namespace gfx {
12 13
13 TEST(ICCProfile, Conversions) { 14 TEST(ICCProfile, Conversions) {
14 ICCProfile icc_profile = ICCProfileForTestingColorSpin(); 15 ICCProfile icc_profile = ICCProfileForTestingColorSpin();
15 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace(); 16 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace();
16 17
17 ICCProfile icc_profile_from_color_space; 18 ICCProfile icc_profile_from_color_space;
18 bool result = 19 bool result =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 EXPECT_FALSE(garbage_profile.IsValid()); 125 EXPECT_FALSE(garbage_profile.IsValid());
125 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); 126 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid());
126 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); 127 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid());
127 128
128 ICCProfile default_ctor_profile; 129 ICCProfile default_ctor_profile;
129 EXPECT_FALSE(default_ctor_profile.IsValid()); 130 EXPECT_FALSE(default_ctor_profile.IsValid());
130 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); 131 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid());
131 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); 132 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid());
132 } 133 }
133 134
135 TEST(ICCProfile, GenericRGB) {
136 ColorSpace icc_profile = ICCProfileForTestingGenericRGB().GetColorSpace();
137 ColorSpace color_space(ColorSpace::PrimaryID::SMPTE240M,
138 ColorSpace::TransferID::GAMMA18);
139
140 SkMatrix44 icc_profile_matrix;
141 SkMatrix44 color_space_matrix;
142
143 icc_profile.GetPrimaryMatrix(&icc_profile_matrix);
144 color_space.GetPrimaryMatrix(&color_space_matrix);
145
146 SkMatrix44 eye;
147 icc_profile_matrix.invert(&eye);
148 eye.postConcat(color_space_matrix);
149 EXPECT_TRUE(SkMatrixIsApproximatelyIdentity(eye));
150 }
151
134 } // namespace gfx 152 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icc_profile_mac.mm ('k') | ui/gfx/icc_profile_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698