| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" | 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 8 #include "ui/base/material_design/material_design_controller.h" |
| 8 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/resources/grit/ui_resources.h" | 10 #include "ui/resources/grit/ui_resources.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 class BookmarkBarFolderButtonCellTest : public CocoaTest { | 14 class BookmarkBarFolderButtonCellTest : public CocoaTest { |
| 14 }; | 15 }; |
| 15 | 16 |
| 16 // Basic creation. | 17 // Basic creation. |
| 17 TEST_F(BookmarkBarFolderButtonCellTest, Create) { | 18 TEST_F(BookmarkBarFolderButtonCellTest, Create) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 51 |
| 51 [view setCell:cell.get()]; | 52 [view setCell:cell.get()]; |
| 52 [folder_view setCell:folder_cell.get()]; | 53 [folder_view setCell:folder_cell.get()]; |
| 53 | 54 |
| 54 [[test_window() contentView] addSubview:view]; | 55 [[test_window() contentView] addSubview:view]; |
| 55 [[test_window() contentView] addSubview:folder_view]; | 56 [[test_window() contentView] addSubview:folder_view]; |
| 56 | 57 |
| 57 NSRect rect = NSMakeRect(20, 20, 20, 20); | 58 NSRect rect = NSMakeRect(20, 20, 20, 20); |
| 58 | 59 |
| 59 [cell setBookmarkCellText:@"" image:image]; | 60 [cell setBookmarkCellText:@"" image:image]; |
| 60 float cell_x_without_title = ([cell imageRectForBounds:rect]).origin.x; | 61 float icon_x_without_title = ([cell imageRectForBounds:rect]).origin.x; |
| 61 float cell_width_without_title = ([cell cellSize]).width; | 62 float cell_width_without_title = ([cell cellSize]).width; |
| 62 | 63 |
| 63 [cell setBookmarkCellText:@"test" image:image]; | 64 [cell setBookmarkCellText:@"test" image:image]; |
| 64 float cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; | 65 float icon_x_with_title = ([cell imageRectForBounds:rect]).origin.x; |
| 65 float cell_width_with_title = ([cell cellSize]).width; | 66 float cell_width_with_title = ([cell cellSize]).width; |
| 66 | 67 |
| 67 EXPECT_LT(cell_x_without_title, cell_x_with_title); | 68 EXPECT_LT(icon_x_without_title, icon_x_with_title); |
| 68 EXPECT_LT(cell_width_without_title, cell_width_with_title); | 69 EXPECT_LT(cell_width_without_title, cell_width_with_title); |
| 69 | 70 |
| 70 [folder_cell setBookmarkCellText:@"" image:image]; | 71 [folder_cell setBookmarkCellText:@"" image:image]; |
| 71 float folder_cell_x_without_title = ([cell imageRectForBounds:rect]).origin.x; | 72 float folder_cell_x_without_title = ([cell imageRectForBounds:rect]).origin.x; |
| 72 float folder_cell_width_without_title = ([cell cellSize]).width; | 73 float folder_cell_width_without_title = ([cell cellSize]).width; |
| 73 | 74 |
| 74 [folder_cell setBookmarkCellText:@"test" image:image]; | 75 [folder_cell setBookmarkCellText:@"test" image:image]; |
| 75 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; | 76 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; |
| 76 float folder_cell_width_with_title = ([cell cellSize]).width; | 77 float folder_cell_width_with_title = ([cell cellSize]).width; |
| 77 | 78 |
| 78 EXPECT_EQ(folder_cell_x_without_title, folder_cell_x_with_title); | 79 EXPECT_EQ(folder_cell_x_without_title, folder_cell_x_with_title); |
| 79 EXPECT_EQ(folder_cell_width_without_title, folder_cell_width_with_title); | 80 EXPECT_EQ(folder_cell_width_without_title, folder_cell_width_with_title); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace | 83 } // namespace |
| OLD | NEW |