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 "ui/views/controls/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/font_list.h" | 10 #include "ui/gfx/font_list.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 #include "ui/gfx/text_utils.h" | 12 #include "ui/gfx/text_utils.h" |
13 #include "ui/views/test/views_test_base.h" | 13 #include "ui/views/test/views_test_base.h" |
14 | 14 |
15 using base::ASCIIToUTF16; | 15 using base::ASCIIToUTF16; |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 gfx::ImageSkia CreateTestImage(int width, int height) { | 19 gfx::ImageSkia CreateTestImage(int width, int height) { |
20 SkBitmap bitmap; | 20 SkBitmap bitmap; |
21 bitmap.allocN32Pixels(width, height); | 21 bitmap.allocN32Pixels(width, height); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 button.SetImageLabelSpacing(2 * kOriginalSpacing); | 219 button.SetImageLabelSpacing(2 * kOriginalSpacing); |
220 EXPECT_GT(button.GetPreferredSize().width(), original_width); | 220 EXPECT_GT(button.GetPreferredSize().width(), original_width); |
221 | 221 |
222 // The button shrinks if the original spacing is restored. | 222 // The button shrinks if the original spacing is restored. |
223 button.SetMinSize(gfx::Size()); | 223 button.SetMinSize(gfx::Size()); |
224 button.SetImageLabelSpacing(kOriginalSpacing); | 224 button.SetImageLabelSpacing(kOriginalSpacing); |
225 EXPECT_EQ(original_width, button.GetPreferredSize().width()); | 225 EXPECT_EQ(original_width, button.GetPreferredSize().width()); |
226 } | 226 } |
227 | 227 |
228 } // namespace views | 228 } // namespace views |
OLD | NEW |