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/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.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 21 bitmap.allocN32Pixels(width, height); |
22 bitmap.allocPixels(); | |
23 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 22 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
24 } | 23 } |
25 | 24 |
26 } // namespace | 25 } // namespace |
27 | 26 |
28 namespace views { | 27 namespace views { |
29 | 28 |
30 typedef ViewsTestBase LabelButtonTest; | 29 typedef ViewsTestBase LabelButtonTest; |
31 | 30 |
32 TEST_F(LabelButtonTest, Init) { | 31 TEST_F(LabelButtonTest, Init) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 184 |
186 // The button returns to its original size when the minimal size is cleared | 185 // The button returns to its original size when the minimal size is cleared |
187 // and the original font size is restored. | 186 // and the original font size is restored. |
188 button.set_min_size(gfx::Size()); | 187 button.set_min_size(gfx::Size()); |
189 button.SetFontList(original_font_list); | 188 button.SetFontList(original_font_list); |
190 EXPECT_EQ(original_width, button.GetPreferredSize().width()); | 189 EXPECT_EQ(original_width, button.GetPreferredSize().width()); |
191 EXPECT_EQ(original_height, button.GetPreferredSize().height()); | 190 EXPECT_EQ(original_height, button.GetPreferredSize().height()); |
192 } | 191 } |
193 | 192 |
194 } // namespace views | 193 } // namespace views |
OLD | NEW |