Chromium Code Reviews| 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 ae4931763c8a212db0fe07e6d1a9c2ca97e7eb58..ecb1011bde62c42842c298253d5ef0eb8ffd90d4 100644 |
| --- a/ui/gfx/mac/coordinate_conversion_unittest.mm |
| +++ b/ui/gfx/mac/coordinate_conversion_unittest.mm |
| @@ -81,28 +81,55 @@ void MacCoordinateConversionTest::TearDown() { |
| // .. .. |
| // 0 199 |
| TEST_F(MacCoordinateConversionTest, ScreenRectToFromNSRect) { |
| + // Window on the primary screen. |
| Rect gfx_rect = Rect(10, 20, 30, 40); |
| NSRect ns_rect = ScreenRectToNSRect(gfx_rect); |
| EXPECT_NSEQ(NSMakeRect(10, 140, 30, 40), ns_rect); |
| - EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); |
| + EXPECT_EQ(gfx_rect, ScreenRectFromNSRect(ns_rect)); |
| // Window in a screen to the left of the primary screen. |
| gfx_rect = Rect(-40, 20, 30, 40); |
| ns_rect = ScreenRectToNSRect(gfx_rect); |
| EXPECT_NSEQ(NSMakeRect(-40, 140, 30, 40), ns_rect); |
| - EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); |
| + EXPECT_EQ(gfx_rect, ScreenRectFromNSRect(ns_rect)); |
| // Window in a screen below the primary screen. |
| gfx_rect = Rect(10, 220, 30, 40); |
| ns_rect = ScreenRectToNSRect(gfx_rect); |
| EXPECT_NSEQ(NSMakeRect(10, -60, 30, 40), ns_rect); |
| - EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); |
| + EXPECT_EQ(gfx_rect, ScreenRectFromNSRect(ns_rect)); |
| // Window in a screen below and to the left primary screen. |
| gfx_rect = Rect(-40, 220, 30, 40); |
| ns_rect = ScreenRectToNSRect(gfx_rect); |
| EXPECT_NSEQ(NSMakeRect(-40, -60, 30, 40), ns_rect); |
| - EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); |
| + EXPECT_EQ(gfx_rect, ScreenRectFromNSRect(ns_rect)); |
| +} |
| + |
| +TEST_F(MacCoordinateConversionTest, ScreenPointToFromNSPoint) { |
|
tapted
2015/08/11 04:01:01
nit: boring comment. I guess something like
// Te
jackhou1
2015/08/11 06:40:56
Done.
|
| + // Point on the primary screen. |
| + Point gfx_point = Point(10, 20); |
| + NSPoint ns_point = ScreenPointToNSPoint(gfx_point); |
| + EXPECT_NSEQ(NSMakePoint(10, 180), ns_point); |
| + EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); |
| + |
| + // Point in a screen to the left of the primary screen. |
| + gfx_point = Point(-40, 20); |
| + ns_point = ScreenPointToNSPoint(gfx_point); |
| + EXPECT_NSEQ(NSMakePoint(-40, 180), ns_point); |
| + EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); |
| + |
| + // Point in a screen below the primary screen. |
| + gfx_point = Point(10, 220); |
| + ns_point = ScreenPointToNSPoint(gfx_point); |
| + EXPECT_NSEQ(NSMakePoint(10, -20), ns_point); |
| + EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); |
| + |
| + // Point in a screen below and to the left primary screen. |
| + gfx_point = Point(-40, 220); |
| + ns_point = ScreenPointToNSPoint(gfx_point); |
| + EXPECT_NSEQ(NSMakePoint(-40, -20), ns_point); |
| + EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point)); |
| } |
| } // namespace gfx |