diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 20:12:50 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 20:12:50 +0000 |
commit | c4f0ed1562c5f4f021b17f1d371f77f955968561 (patch) | |
tree | 3a9724883d519a2b2be43e795cababb1fdfe8758 /chrome/browser/cocoa/tab_controller_unittest.mm | |
parent | dabc3e84a78f0438785e892cf56b4c94cc8d22c3 (diff) | |
download | chromium_src-c4f0ed1562c5f4f021b17f1d371f77f955968561.zip chromium_src-c4f0ed1562c5f4f021b17f1d371f77f955968561.tar.gz chromium_src-c4f0ed1562c5f4f021b17f1d371f77f955968561.tar.bz2 |
Make tabs go all the way to the right edge and stop using less of the strip as more tabs are added. Don't resize on selection when tabs are very small, except just enough to show a close box. Clip closebox and favicon as tab gets very small. Fix z-order to be consistent among all unselected tabs. Fix incognito man disappearing when dragging window via the tab. Tabs can now get about as small as they do on windows allowing many more to fit.
BUG=14911, 14913, 17372
TEST=adding and removing lots of tabs and making sure nothing goes wrong.
Review URL: http://codereview.chromium.org/159206
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_controller_unittest.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_controller_unittest.mm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_controller_unittest.mm b/chrome/browser/cocoa/tab_controller_unittest.mm index b489235..b38ae91 100644 --- a/chrome/browser/cocoa/tab_controller_unittest.mm +++ b/chrome/browser/cocoa/tab_controller_unittest.mm @@ -200,4 +200,55 @@ TEST_F(TabControllerTest, UserSelection) { [[controller view] removeFromSuperview]; } +TEST_F(TabControllerTest, IconCapacity) { + NSWindow* window = cocoa_helper_.window(); + scoped_nsobject<TabController> controller([[TabController alloc] init]); + [[window contentView] addSubview:[controller view]]; + int cap = [controller iconCapacity]; + EXPECT_GE(cap, 1); + + NSRect frame = [[controller view] frame]; + frame.size.width += 500; + [[controller view] setFrame:frame]; + int newcap = [controller iconCapacity]; + EXPECT_GT(newcap, cap); +} + +TEST_F(TabControllerTest, ShouldShowIcon) { + NSWindow* window = cocoa_helper_.window(); + scoped_nsobject<TabController> controller([[TabController alloc] init]); + [[window contentView] addSubview:[controller view]]; + int cap = [controller iconCapacity]; + EXPECT_GT(cap, 0); + + // Tab is minimum width, both icon and close box should be hidden. + NSRect frame = [[controller view] frame]; + frame.size.width = [TabController minTabWidth]; + [[controller view] setFrame:frame]; + EXPECT_FALSE([controller shouldShowIcon]); + EXPECT_FALSE([controller shouldShowCloseBox]); + + // Tab is at selected minimum width. Since it's selected, the close box + // should be visible. + [controller setSelected:YES]; + frame = [[controller view] frame]; + frame.size.width = [TabController minSelectedTabWidth]; + [[controller view] setFrame:frame]; + EXPECT_FALSE([controller shouldShowIcon]); + EXPECT_TRUE([controller shouldShowCloseBox]); + + // Test expanding the tab to max width and ensure the icon and close box + // get put back, even when de-selected. + frame.size.width = [TabController maxTabWidth]; + [[controller view] setFrame:frame]; + EXPECT_TRUE([controller shouldShowIcon]); + EXPECT_TRUE([controller shouldShowCloseBox]); + [controller setSelected:NO]; + EXPECT_TRUE([controller shouldShowIcon]); + EXPECT_TRUE([controller shouldShowCloseBox]); + + cap = [controller iconCapacity]; + EXPECT_GT(cap, 0); +} + } // namespace |