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

Side by Side Diff: ui/gfx/color_profile_mac_unittest.mm

Issue 849523003: ui/gfx/color_profile: Add GetDisplayColorProfile for an NSWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/color_profile_mac.mm ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/color_profile.h" 9 #include "ui/gfx/color_profile.h"
10 #include "ui/gfx/mac/coordinate_conversion.h" 10 #include "ui/gfx/mac/coordinate_conversion.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds())); 86 EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds()));
87 } 87 }
88 88
89 TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenBounds) { 89 TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenBounds) {
90 MoveTestWindowTo(gfx::Rect(-100, -100, 0, 0)); 90 MoveTestWindowTo(gfx::Rect(-100, -100, 0, 0));
91 EXPECT_TRUE(TestWindowBounds().IsEmpty()); 91 EXPECT_TRUE(TestWindowBounds().IsEmpty());
92 EXPECT_FALSE(TestWindowOnScreen()); 92 EXPECT_FALSE(TestWindowOnScreen());
93 EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds())); 93 EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds()));
94 } 94 }
95 95
96 bool TestColorProfileForWindow(NSWindow* window) {
97 std::vector<char> color_profile;
98 return gfx::GetDisplayColorProfile(window, &color_profile);
99 }
100
101 TEST_F(ColorProfileTest, GetDisplayColorProfileForOnScreenWindow) {
102 MoveTestWindowTo(gfx::Rect(10, 10, 100, 100));
103 EXPECT_FALSE(TestWindowBounds().IsEmpty());
104 EXPECT_TRUE(TestWindowContainedOnScreen());
105 EXPECT_TRUE(TestColorProfileForWindow(test_window()));
106 }
107
108 TEST_F(ColorProfileTest, GetDisplayColorProfileForPartiallyOnScreenWindow) {
109 MoveTestWindowTo(gfx::Rect(-50, -50, 80, 80));
110 EXPECT_FALSE(TestWindowBounds().IsEmpty());
111 EXPECT_TRUE(TestWindowOnScreen());
112 EXPECT_TRUE(TestColorProfileForWindow(test_window()));
113 }
114
115 TEST_F(ColorProfileTest, GetDisplayColorProfileForOffScreenWindow) {
116 MoveTestWindowTo(gfx::Rect(-100, -100, 10, 10));
117 EXPECT_FALSE(TestWindowBounds().IsEmpty());
118 EXPECT_FALSE(TestWindowOnScreen());
119 EXPECT_TRUE(TestColorProfileForWindow(test_window()));
120 }
121
122 TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOnScreenWindow) {
123 MoveTestWindowTo(gfx::Rect(10, 10, 0, 0));
124 EXPECT_TRUE(TestWindowBounds().IsEmpty());
125 EXPECT_FALSE(TestWindowOnScreen());
126 EXPECT_FALSE(TestColorProfileForWindow(test_window()));
127 }
128
129 TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenWindow) {
130 MoveTestWindowTo(gfx::Rect(-100, -100, 0, 0));
131 EXPECT_TRUE(TestWindowBounds().IsEmpty());
132 EXPECT_FALSE(TestWindowOnScreen());
133 EXPECT_FALSE(TestColorProfileForWindow(test_window()));
134 }
135
136 TEST_F(ColorProfileTest, GetDisplayColorProfileForNullWindow) {
137 EXPECT_FALSE(TestColorProfileForWindow(nullptr));
138 EXPECT_FALSE(TestColorProfileForWindow(nil));
139 }
140
96 } // namespace 141 } // namespace
OLDNEW
« no previous file with comments | « ui/gfx/color_profile_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698