OLD | NEW |
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 #include "base/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 EXPECT_EQ(button.get()->exits_, 3); | 145 EXPECT_EQ(button.get()->exits_, 3); |
146 } | 146 } |
147 | 147 |
148 // Confirms a cell created in a nib is initialized properly | 148 // Confirms a cell created in a nib is initialized properly |
149 TEST_F(BookmarkButtonCellTest, Awake) { | 149 TEST_F(BookmarkButtonCellTest, Awake) { |
150 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); | 150 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); |
151 [cell awakeFromNib]; | 151 [cell awakeFromNib]; |
152 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); | 152 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); |
153 } | 153 } |
154 | 154 |
| 155 // Subfolder arrow details. |
| 156 TEST_F(BookmarkButtonCellTest, FolderArrow) { |
| 157 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 158 const BookmarkNode* bar = model->bookmark_bar_node(); |
| 159 const BookmarkNode* node = model->AddURL(bar, bar->child_count(), |
| 160 ASCIIToUTF16("title"), |
| 161 GURL("http://www.google.com")); |
| 162 scoped_nsobject<BookmarkButtonCell> cell( |
| 163 [[BookmarkButtonCell alloc] initForNode:node |
| 164 contextMenu:nil |
| 165 cellText:@"small" |
| 166 cellImage:nil]); |
| 167 EXPECT_TRUE(cell.get()); |
| 168 |
| 169 NSSize size = [cell cellSize]; |
| 170 // sanity check |
| 171 EXPECT_GE(size.width, 2); |
| 172 EXPECT_GE(size.height, 2); |
| 173 |
| 174 // Once we turn on arrow drawing make sure there is now room for it. |
| 175 [cell setDrawFolderArrow:YES]; |
| 176 NSSize arrowSize = [cell cellSize]; |
| 177 EXPECT_GT(arrowSize.width, size.width); |
| 178 } |
| 179 |
155 } // namespace | 180 } // namespace |
OLD | NEW |