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

Unified 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, 11 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_profile_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_profile_mac_unittest.mm
diff --git a/ui/gfx/color_profile_mac_unittest.mm b/ui/gfx/color_profile_mac_unittest.mm
index 6ecb7fb9faf8a1392c8204597db1acad4b32d3ad..95680c35ce61258ce80c02f8baec2c2b8a8f08c2 100644
--- a/ui/gfx/color_profile_mac_unittest.mm
+++ b/ui/gfx/color_profile_mac_unittest.mm
@@ -93,4 +93,49 @@ TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenBounds) {
EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds()));
}
+bool TestColorProfileForWindow(NSWindow* window) {
+ std::vector<char> color_profile;
+ return gfx::GetDisplayColorProfile(window, &color_profile);
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForOnScreenWindow) {
+ MoveTestWindowTo(gfx::Rect(10, 10, 100, 100));
+ EXPECT_FALSE(TestWindowBounds().IsEmpty());
+ EXPECT_TRUE(TestWindowContainedOnScreen());
+ EXPECT_TRUE(TestColorProfileForWindow(test_window()));
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForPartiallyOnScreenWindow) {
+ MoveTestWindowTo(gfx::Rect(-50, -50, 80, 80));
+ EXPECT_FALSE(TestWindowBounds().IsEmpty());
+ EXPECT_TRUE(TestWindowOnScreen());
+ EXPECT_TRUE(TestColorProfileForWindow(test_window()));
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForOffScreenWindow) {
+ MoveTestWindowTo(gfx::Rect(-100, -100, 10, 10));
+ EXPECT_FALSE(TestWindowBounds().IsEmpty());
+ EXPECT_FALSE(TestWindowOnScreen());
+ EXPECT_TRUE(TestColorProfileForWindow(test_window()));
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOnScreenWindow) {
+ MoveTestWindowTo(gfx::Rect(10, 10, 0, 0));
+ EXPECT_TRUE(TestWindowBounds().IsEmpty());
+ EXPECT_FALSE(TestWindowOnScreen());
+ EXPECT_FALSE(TestColorProfileForWindow(test_window()));
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenWindow) {
+ MoveTestWindowTo(gfx::Rect(-100, -100, 0, 0));
+ EXPECT_TRUE(TestWindowBounds().IsEmpty());
+ EXPECT_FALSE(TestWindowOnScreen());
+ EXPECT_FALSE(TestColorProfileForWindow(test_window()));
+}
+
+TEST_F(ColorProfileTest, GetDisplayColorProfileForNullWindow) {
+ EXPECT_FALSE(TestColorProfileForWindow(nullptr));
+ EXPECT_FALSE(TestColorProfileForWindow(nil));
+}
+
} // namespace
« 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