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

Side by Side Diff: chrome/browser/cocoa/status_bubble_mac_unittest.mm

Issue 3041028: [Mac] Reposition the status bubble whenever adding it to a window.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/status_bubble_mac.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include <Cocoa/Cocoa.h> 5 #include <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #import "chrome/browser/cocoa/bubble_view.h" 9 #import "chrome/browser/cocoa/bubble_view.h"
10 #import "chrome/browser/cocoa/browser_test_helper.h" 10 #import "chrome/browser/cocoa/browser_test_helper.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 frame.size.width += 50.0; // (fairly arbitrary nonzero value) 451 frame.size.width += 50.0; // (fairly arbitrary nonzero value)
452 frame.size.height += 50.0; // (fairly arbitrary nonzero value) 452 frame.size.height += 50.0; // (fairly arbitrary nonzero value)
453 [window setFrame:frame display:YES]; 453 [window setFrame:frame display:YES];
454 bubble_->UpdateSizeAndPosition(); 454 bubble_->UpdateSizeAndPosition();
455 rect_after = [GetWindow() frame]; 455 rect_after = [GetWindow() frame];
456 EXPECT_EQ(rect_before.origin.x, rect_after.origin.x); 456 EXPECT_EQ(rect_before.origin.x, rect_after.origin.x);
457 EXPECT_EQ(rect_before.origin.y, rect_after.origin.y); 457 EXPECT_EQ(rect_before.origin.y, rect_after.origin.y);
458 EXPECT_NE(rect_before.size.width, rect_after.size.width); 458 EXPECT_NE(rect_before.size.width, rect_after.size.width);
459 EXPECT_EQ(rect_before.size.height, rect_after.size.height); 459 EXPECT_EQ(rect_before.size.height, rect_after.size.height);
460 } 460 }
461
462 TEST_F(StatusBubbleMacTest, MovingWindowUpdatesPosition) {
463 NSWindow* window = test_window();
464
465 // Show the bubble and make sure it has the same origin as |window|.
466 bubble_->SetStatus(L"Showing");
467 NSWindow* child = GetWindow();
468 EXPECT_TRUE(NSEqualPoints([window frame].origin, [child frame].origin));
469
470 // Hide the bubble, move the window, and show it again.
471 bubble_->Hide();
472 NSRect frame = [window frame];
473 frame.origin.x += 50;
474 [window setFrame:frame display:YES];
475 bubble_->SetStatus(L"Reshowing");
476
477 // The bubble should reattach in the correct location.
478 child = GetWindow();
479 EXPECT_TRUE(NSEqualPoints([window frame].origin, [child frame].origin));
480 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/status_bubble_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698