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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm

Issue 6469044: The bookmark folder menus look bad when squeezed up against the bottom of a s... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 BookmarkButton* parentButton = [[bar_ buttons] objectAtIndex:0]; 249 BookmarkButton* parentButton = [[bar_ buttons] objectAtIndex:0];
250 EXPECT_TRUE(parentButton); 250 EXPECT_TRUE(parentButton);
251 251
252 // If parent is a BookmarkBarController, grow down. 252 // If parent is a BookmarkBarController, grow down.
253 scoped_nsobject<BookmarkBarFolderController> bbfc; 253 scoped_nsobject<BookmarkBarFolderController> bbfc;
254 bbfc.reset([[BookmarkBarFolderController alloc] 254 bbfc.reset([[BookmarkBarFolderController alloc]
255 initWithParentButton:parentButton 255 initWithParentButton:parentButton
256 parentController:nil 256 parentController:nil
257 barController:bar_]); 257 barController:bar_]);
258 [bbfc window]; 258 [bbfc window];
259 NSPoint pt = [bbfc windowTopLeftForWidth:0]; // screen coords 259 NSPoint pt = [bbfc windowTopLeftForWidth:0 height:100]; // screen coords
260 NSPoint buttonOriginInScreen = 260 NSPoint buttonOriginInScreen =
261 [[parentButton window] 261 [[parentButton window]
262 convertBaseToScreen:[parentButton 262 convertBaseToScreen:[parentButton
263 convertRectToBase:[parentButton frame]].origin]; 263 convertRectToBase:[parentButton frame]].origin];
264 // Within margin 264 // Within margin
265 EXPECT_LE(abs(pt.x - buttonOriginInScreen.x), 265 EXPECT_LE(abs(pt.x - buttonOriginInScreen.x),
266 bookmarks::kBookmarkMenuOverlap+1); 266 bookmarks::kBookmarkMenuOverlap+1);
267 EXPECT_LE(abs(pt.y - buttonOriginInScreen.y), 267 EXPECT_LE(abs(pt.y - buttonOriginInScreen.y),
268 bookmarks::kBookmarkMenuOverlap+1); 268 bookmarks::kBookmarkMenuOverlap+1);
269 269
270 // Make sure we see the window shift left if it spills off the screen 270 // Make sure we see the window shift left if it spills off the screen
271 pt = [bbfc windowTopLeftForWidth:0]; 271 pt = [bbfc windowTopLeftForWidth:0 height:100];
272 NSPoint shifted = [bbfc windowTopLeftForWidth:9999999]; 272 NSPoint shifted = [bbfc windowTopLeftForWidth:9999999 height:100];
273 EXPECT_LT(shifted.x, pt.x); 273 EXPECT_LT(shifted.x, pt.x);
274 274
275 // If parent is a BookmarkBarFolderController, grow right. 275 // If parent is a BookmarkBarFolderController, grow right.
276 scoped_nsobject<BookmarkBarFolderController> bbfc2; 276 scoped_nsobject<BookmarkBarFolderController> bbfc2;
277 bbfc2.reset([[BookmarkBarFolderController alloc] 277 bbfc2.reset([[BookmarkBarFolderController alloc]
278 initWithParentButton:[[bbfc buttons] objectAtIndex:0] 278 initWithParentButton:[[bbfc buttons] objectAtIndex:0]
279 parentController:bbfc.get() 279 parentController:bbfc.get()
280 barController:bar_]); 280 barController:bar_]);
281 [bbfc2 window]; 281 [bbfc2 window];
282 pt = [bbfc2 windowTopLeftForWidth:0]; 282 pt = [bbfc2 windowTopLeftForWidth:0 height:100];
283 // We're now overlapping the window a bit. 283 // We're now overlapping the window a bit.
284 EXPECT_EQ(pt.x, NSMaxX([[bbfc.get() window] frame]) - 284 EXPECT_EQ(pt.x, NSMaxX([[bbfc.get() window] frame]) -
285 bookmarks::kBookmarkMenuOverlap); 285 bookmarks::kBookmarkMenuOverlap);
286 } 286 }
287 287
288 // Confirm we grow right until end of screen, then start growing left 288 // Confirm we grow right until end of screen, then start growing left
289 // until end of screen again, then right. 289 // until end of screen again, then right.
290 TEST_F(BookmarkBarFolderControllerTest, PositionRightLeftRight) { 290 TEST_F(BookmarkBarFolderControllerTest, PositionRightLeftRight) {
291 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); 291 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
292 const BookmarkNode* parent = model->GetBookmarkBarNode(); 292 const BookmarkNode* parent = model->GetBookmarkBarNode();
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 [folder deleteBookmark:folder]; 1550 [folder deleteBookmark:folder];
1551 EXPECT_FALSE([folder folderController]); 1551 EXPECT_FALSE([folder folderController]);
1552 } 1552 }
1553 1553
1554 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so 1554 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so
1555 // they are hard to test. Factor out "fire timers" into routines 1555 // they are hard to test. Factor out "fire timers" into routines
1556 // which can be overridden to fire immediately to make behavior 1556 // which can be overridden to fire immediately to make behavior
1557 // confirmable. 1557 // confirmable.
1558 // There is a similar problem with mouseEnteredButton: and 1558 // There is a similar problem with mouseEnteredButton: and
1559 // mouseExitedButton:. 1559 // mouseExitedButton:.
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698