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

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

Issue 2691213007: color: Don't use QCMS for transforms unless necessary (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 unified diff | Download patch
« no previous file with comments | « ui/gfx/icc_profile.cc ('k') | no next file » | 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/color_space.h" 7 #include "ui/gfx/color_space.h"
8 #include "ui/gfx/icc_profile.h" 8 #include "ui/gfx/icc_profile.h"
9 #include "ui/gfx/test/icc_profiles.h" 9 #include "ui/gfx/test/icc_profiles.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 TEST(ICCProfile, Conversions) { 13 TEST(ICCProfile, Conversions) {
14 ICCProfile icc_profile = ICCProfileForTestingColorSpin(); 14 ICCProfile icc_profile = ICCProfileForTestingColorSpin();
15 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace(); 15 ColorSpace color_space_from_icc_profile = icc_profile.GetColorSpace();
16 16
17 ICCProfile icc_profile_from_color_space = 17 ICCProfile icc_profile_from_color_space;
18 ICCProfile::FromColorSpace(color_space_from_icc_profile); 18 bool result =
19 color_space_from_icc_profile.GetICCProfile(&icc_profile_from_color_space);
20 EXPECT_TRUE(result);
19 EXPECT_TRUE(icc_profile == icc_profile_from_color_space); 21 EXPECT_TRUE(icc_profile == icc_profile_from_color_space);
20 } 22 }
21 23
22 TEST(ICCProfile, SRGB) { 24 TEST(ICCProfile, SRGB) {
23 ColorSpace color_space = ColorSpace::CreateSRGB(); 25 ColorSpace color_space = ColorSpace::CreateSRGB();
24 sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB(); 26 sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB();
25 27
26 // These should be the same pointer, not just equal. 28 // These should be the same pointer, not just equal.
27 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get()); 29 EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get());
28 } 30 }
29 31
30 TEST(ICCProfile, Equality) { 32 TEST(ICCProfile, Equality) {
31 ICCProfile spin_profile = ICCProfileForTestingColorSpin(); 33 ICCProfile spin_profile = ICCProfileForTestingColorSpin();
32 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB(); 34 ICCProfile adobe_profile = ICCProfileForTestingAdobeRGB();
33 EXPECT_TRUE(spin_profile == spin_profile); 35 EXPECT_TRUE(spin_profile == spin_profile);
34 EXPECT_FALSE(spin_profile != spin_profile); 36 EXPECT_FALSE(spin_profile != spin_profile);
35 EXPECT_FALSE(spin_profile == adobe_profile); 37 EXPECT_FALSE(spin_profile == adobe_profile);
36 EXPECT_TRUE(spin_profile != adobe_profile); 38 EXPECT_TRUE(spin_profile != adobe_profile);
37 39
38 gfx::ColorSpace spin_space = spin_profile.GetColorSpace(); 40 gfx::ColorSpace spin_space = spin_profile.GetColorSpace();
39 gfx::ColorSpace adobe_space = adobe_profile.GetColorSpace(); 41 gfx::ColorSpace adobe_space = adobe_profile.GetColorSpace();
40 EXPECT_TRUE(spin_space == spin_space); 42 EXPECT_TRUE(spin_space == spin_space);
41 EXPECT_FALSE(spin_space != spin_space); 43 EXPECT_FALSE(spin_space != spin_space);
42 EXPECT_FALSE(spin_space == adobe_space); 44 EXPECT_FALSE(spin_space == adobe_space);
43 EXPECT_TRUE(spin_space != adobe_space); 45 EXPECT_TRUE(spin_space != adobe_space);
44 46
45 EXPECT_TRUE(spin_profile == ICCProfile::FromColorSpace(spin_space)); 47 ICCProfile temp;
46 EXPECT_FALSE(spin_profile != ICCProfile::FromColorSpace(spin_space)); 48 bool get_icc_result = false;
47 EXPECT_FALSE(spin_profile == ICCProfile::FromColorSpace(adobe_space)); 49
48 EXPECT_TRUE(spin_profile != ICCProfile::FromColorSpace(adobe_space)); 50 get_icc_result = spin_space.GetICCProfile(&temp);
51 EXPECT_TRUE(get_icc_result);
52 EXPECT_TRUE(spin_profile == temp);
53 EXPECT_FALSE(spin_profile != temp);
54
55 get_icc_result = adobe_space.GetICCProfile(&temp);
56 EXPECT_TRUE(get_icc_result);
57 EXPECT_FALSE(spin_profile == temp);
58 EXPECT_TRUE(spin_profile != temp);
49 59
50 EXPECT_TRUE(!!spin_space.ToSkColorSpace()); 60 EXPECT_TRUE(!!spin_space.ToSkColorSpace());
51 EXPECT_TRUE(!!adobe_space.ToSkColorSpace()); 61 EXPECT_TRUE(!!adobe_space.ToSkColorSpace());
52 EXPECT_FALSE(SkColorSpace::Equals( 62 EXPECT_FALSE(SkColorSpace::Equals(
53 spin_space.ToSkColorSpace().get(), 63 spin_space.ToSkColorSpace().get(),
54 adobe_space.ToSkColorSpace().get())); 64 adobe_space.ToSkColorSpace().get()));
55 } 65 }
56 66
57 } // namespace gfx 67 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icc_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698