OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/corewm/tooltip_aura.h" | 5 #include "ui/views/corewm/tooltip_aura.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/font_list.h" | 9 #include "ui/gfx/font_list.h" |
10 #include "ui/gfx/text_elider.h" | 10 #include "ui/gfx/text_elider.h" |
11 #include "ui/gfx/text_utils.h" | 11 #include "ui/gfx/text_utils.h" |
12 #include "ui/views/test/views_test_base.h" | 12 #include "ui/views/test/views_test_base.h" |
13 | 13 |
14 using base::ASCIIToUTF16; | 14 using base::ASCIIToUTF16; |
| 15 using base::UTF8ToUTF16; |
15 | 16 |
16 namespace views { | 17 namespace views { |
17 namespace corewm { | 18 namespace corewm { |
18 | 19 |
19 typedef ViewsTestBase TooltipAuraTest; | 20 typedef ViewsTestBase TooltipAuraTest; |
20 | 21 |
21 TEST_F(TooltipAuraTest, TrimTooltipToFitTests) { | 22 TEST_F(TooltipAuraTest, TrimTooltipToFitTests) { |
22 const gfx::FontList font_list; | 23 const gfx::FontList font_list; |
23 const int max_width = 4000; | 24 const int max_width = 4000; |
24 base::string16 tooltip; | 25 base::string16 tooltip; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width, | 123 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width, |
123 &line_count); | 124 &line_count); |
124 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tool t\tip"), font_list), | 125 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tool t\tip"), font_list), |
125 width); | 126 width); |
126 EXPECT_EQ(1, line_count); | 127 EXPECT_EQ(1, line_count); |
127 EXPECT_EQ(ASCIIToUTF16("Small Tool t\tip"), tooltip); | 128 EXPECT_EQ(ASCIIToUTF16("Small Tool t\tip"), tooltip); |
128 } | 129 } |
129 | 130 |
130 } // namespace corewm | 131 } // namespace corewm |
131 } // namespace views | 132 } // namespace views |
OLD | NEW |