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/material_design/material_design_controller.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/resources/grit/ui_resources.h" | 10 #include "ui/resources/grit/ui_resources.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 NSRect rect = NSMakeRect(20, 20, 20, 20); | 58 NSRect rect = NSMakeRect(20, 20, 20, 20); |
59 | 59 |
60 [cell setBookmarkCellText:@"" image:image]; | 60 [cell setBookmarkCellText:@"" image:image]; |
61 float icon_x_without_title = ([cell imageRectForBounds:rect]).origin.x; | 61 float icon_x_without_title = ([cell imageRectForBounds:rect]).origin.x; |
62 float cell_width_without_title = ([cell cellSize]).width; | 62 float cell_width_without_title = ([cell cellSize]).width; |
63 | 63 |
64 [cell setBookmarkCellText:@"test" image:image]; | 64 [cell setBookmarkCellText:@"test" image:image]; |
65 float icon_x_with_title = ([cell imageRectForBounds:rect]).origin.x; | 65 float icon_x_with_title = ([cell imageRectForBounds:rect]).origin.x; |
66 float cell_width_with_title = ([cell cellSize]).width; | 66 float cell_width_with_title = ([cell cellSize]).width; |
67 | 67 |
68 if (ui::MaterialDesignController::IsModeMaterial()) { | 68 EXPECT_EQ(icon_x_without_title, icon_x_with_title); |
69 EXPECT_EQ(icon_x_without_title, icon_x_with_title); | |
70 } else { | |
71 EXPECT_LT(icon_x_without_title, icon_x_with_title); | |
72 } | |
73 EXPECT_LT(cell_width_without_title, cell_width_with_title); | 69 EXPECT_LT(cell_width_without_title, cell_width_with_title); |
74 | 70 |
75 [folder_cell setBookmarkCellText:@"" image:image]; | 71 [folder_cell setBookmarkCellText:@"" image:image]; |
76 float folder_cell_x_without_title = ([cell imageRectForBounds:rect]).origin.x; | 72 float folder_cell_x_without_title = ([cell imageRectForBounds:rect]).origin.x; |
77 float folder_cell_width_without_title = ([cell cellSize]).width; | 73 float folder_cell_width_without_title = ([cell cellSize]).width; |
78 | 74 |
79 [folder_cell setBookmarkCellText:@"test" image:image]; | 75 [folder_cell setBookmarkCellText:@"test" image:image]; |
80 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; | 76 float folder_cell_x_with_title = ([cell imageRectForBounds:rect]).origin.x; |
81 float folder_cell_width_with_title = ([cell cellSize]).width; | 77 float folder_cell_width_with_title = ([cell cellSize]).width; |
82 | 78 |
83 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); |
84 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); |
85 } | 81 } |
86 | 82 |
87 } // namespace | 83 } // namespace |
OLD | NEW |