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

Unified Diff: ui/gfx/mac/coordinate_conversion_unittest.mm

Issue 789763002: MacViews: Implement capture using NSEvent local+global monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140812-MacViews-LAYERS2-PRESQUASH
Patch Set: NULL -> nullptr Created 6 years 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/mac/coordinate_conversion.mm ('k') | ui/views/cocoa/bridged_content_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/mac/coordinate_conversion_unittest.mm
diff --git a/ui/gfx/mac/coordinate_conversion_unittest.mm b/ui/gfx/mac/coordinate_conversion_unittest.mm
index ea0898d2da0b05d516fda5080992e3af8bc059b8..7348e492e1eb20407fe552f580c266fe620e9412 100644
--- a/ui/gfx/mac/coordinate_conversion_unittest.mm
+++ b/ui/gfx/mac/coordinate_conversion_unittest.mm
@@ -104,4 +104,30 @@ TEST_F(MacCoordinateConversionTest, ScreenRectToFromNSRect) {
EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString());
}
+// Test point conversion, using the same setup as above.
+TEST_F(MacCoordinateConversionTest, ScreenPointFromNSPoint) {
+ Point gfx_point = Point(10, 20);
+ NSPoint ns_point = ScreenPointToNSPoint(gfx_point);
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(10, 180), ns_point));
+ EXPECT_EQ(gfx_point.ToString(), ScreenPointFromNSPoint(ns_point).ToString());
+
+ // Point in a screen to the left of the primary screen.
+ gfx_point = Point(-40, 20);
+ ns_point = ScreenPointToNSPoint(gfx_point);
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(-40, 180), ns_point));
+ EXPECT_EQ(gfx_point.ToString(), ScreenPointFromNSPoint(ns_point).ToString());
+
+ // Point in a screen below the primary screen.
+ gfx_point = Point(10, 220);
+ ns_point = ScreenPointToNSPoint(gfx_point);
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(10, -20), ns_point));
+ EXPECT_EQ(gfx_point.ToString(), ScreenPointFromNSPoint(ns_point).ToString());
+
+ // Point in a screen below and to the left primary screen.
+ gfx_point = Point(-40, 220);
+ ns_point = ScreenPointToNSPoint(gfx_point);
+ EXPECT_TRUE(NSEqualPoints(NSMakePoint(-40, -20), ns_point));
+ EXPECT_EQ(gfx_point.ToString(), ScreenPointFromNSPoint(ns_point).ToString());
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/mac/coordinate_conversion.mm ('k') | ui/views/cocoa/bridged_content_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698