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

Side by Side Diff: ui/gfx/mac/coordinate_conversion_unittest.mm

Issue 1280673003: [Mac] Enable MacViews site settings bubble behind --enable-mac-views-dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enabledialogs
Patch Set: Sync Created 5 years, 4 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
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 "ui/gfx/mac/coordinate_conversion.h" 5 #import "ui/gfx/mac/coordinate_conversion.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/scoped_objc_class_swizzler.h" 9 #import "base/mac/scoped_objc_class_swizzler.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Window in a screen below the primary screen. 95 // Window in a screen below the primary screen.
96 gfx_rect = Rect(10, 220, 30, 40); 96 gfx_rect = Rect(10, 220, 30, 40);
97 ns_rect = ScreenRectToNSRect(gfx_rect); 97 ns_rect = ScreenRectToNSRect(gfx_rect);
98 EXPECT_NSEQ(NSMakeRect(10, -60, 30, 40), ns_rect); 98 EXPECT_NSEQ(NSMakeRect(10, -60, 30, 40), ns_rect);
99 EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); 99 EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString());
100 100
101 // Window in a screen below and to the left primary screen. 101 // Window in a screen below and to the left primary screen.
102 gfx_rect = Rect(-40, 220, 30, 40); 102 gfx_rect = Rect(-40, 220, 30, 40);
103 ns_rect = ScreenRectToNSRect(gfx_rect); 103 ns_rect = ScreenRectToNSRect(gfx_rect);
104 EXPECT_NSEQ(NSMakeRect(-40, -60, 30, 40), ns_rect); 104 EXPECT_NSEQ(NSMakeRect(-40, -60, 30, 40), ns_rect);
105 EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString()); 105 EXPECT_EQ(gfx_rect.ToString(), ScreenRectFromNSRect(ns_rect).ToString());
tapted 2015/08/11 01:23:20 hm - these ToString() calls are probably unnecessa
jackhou1 2015/08/11 03:09:24 Done.
106 } 106 }
107 107
108 TEST_F(MacCoordinateConversionTest, ScreenPointToFromNSPoint) {
tapted 2015/08/11 01:23:19 nit: add a boring comment
jackhou1 2015/08/11 03:09:24 Done.
109 Point gfx_point = Point(10, 20);
110 NSPoint ns_point = ScreenPointToNSPoint(gfx_point);
111 EXPECT_NSEQ(NSMakePoint(10, 180), ns_point);
112 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
113
114 // Window in a screen to the left of the primary screen.
tapted 2015/08/11 01:23:19 Window -> Point (or Coordinate). More below
jackhou1 2015/08/11 03:09:24 Done.
115 gfx_point = Point(-40, 20);
116 ns_point = ScreenPointToNSPoint(gfx_point);
117 EXPECT_NSEQ(NSMakePoint(-40, 180), ns_point);
118 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
119
120 // Window in a screen below the primary screen.
121 gfx_point = Point(10, 220);
122 ns_point = ScreenPointToNSPoint(gfx_point);
123 EXPECT_NSEQ(NSMakePoint(10, -20), ns_point);
124 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
125
126 // Window in a screen below and to the left primary screen.
127 gfx_point = Point(-40, 220);
128 ns_point = ScreenPointToNSPoint(gfx_point);
129 EXPECT_NSEQ(NSMakePoint(-40, -20), ns_point);
130 EXPECT_EQ(gfx_point, ScreenPointFromNSPoint(ns_point));
131 }
132
108 } // namespace gfx 133 } // namespace gfx
OLDNEW
« ui/gfx/mac/coordinate_conversion.h ('K') | « ui/gfx/mac/coordinate_conversion.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698