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

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

Issue 2877093002: color: Add command line flag to force output color space (Closed)
Patch Set: Fix windows again 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 EXPECT_FALSE(garbage_profile.IsValid()); 132 EXPECT_FALSE(garbage_profile.IsValid());
132 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid()); 133 EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid());
133 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid()); 134 EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid());
134 135
135 ICCProfile default_ctor_profile; 136 ICCProfile default_ctor_profile;
136 EXPECT_FALSE(default_ctor_profile.IsValid()); 137 EXPECT_FALSE(default_ctor_profile.IsValid());
137 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid()); 138 EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid());
138 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid()); 139 EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid());
139 } 140 }
140 141
142 TEST(ICCProfile, GenericRGB) {
143 ColorSpace icc_profile = ICCProfileForTestingGenericRGB().GetColorSpace();
144 ColorSpace color_space(ColorSpace::PrimaryID::APPLE_GENERIC_RGB,
145 ColorSpace::TransferID::GAMMA18);
146
147 SkMatrix44 icc_profile_matrix;
148 SkMatrix44 color_space_matrix;
149
150 icc_profile.GetPrimaryMatrix(&icc_profile_matrix);
151 color_space.GetPrimaryMatrix(&color_space_matrix);
152
153 SkMatrix44 eye;
154 icc_profile_matrix.invert(&eye);
155 eye.postConcat(color_space_matrix);
156 EXPECT_TRUE(SkMatrixIsApproximatelyIdentity(eye));
157 }
158
141 } // namespace gfx 159 } // 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