Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: ui/views/corewm/tooltip_aura_unittest.cc

Issue 312233003: Add fade eliding for Views Labels; related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refine alignment check; minor additional cleanup. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/corewm/tooltip_aura.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/aura/test/aura_test_base.h" 8 #include "ui/aura/test/aura_test_base.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #if !defined(OS_WIN) 79 #if !defined(OS_WIN)
80 // Tooltip with really long word gets elided. 80 // Tooltip with really long word gets elided.
81 tooltip.clear(); 81 tooltip.clear();
82 width = line_count = -1; 82 width = line_count = -1;
83 tooltip = UTF8ToUTF16(std::string('a', max_pixel_width)); 83 tooltip = UTF8ToUTF16(std::string('a', max_pixel_width));
84 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width, 84 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width,
85 &line_count); 85 &line_count);
86 EXPECT_NEAR(max_pixel_width, width, 5); 86 EXPECT_NEAR(max_pixel_width, width, 5);
87 EXPECT_EQ(1, line_count); 87 EXPECT_EQ(1, line_count);
88 EXPECT_EQ(gfx::ElideText(UTF8ToUTF16(std::string('a', max_pixel_width)), 88 EXPECT_EQ(gfx::ElideText(UTF8ToUTF16(std::string('a', max_pixel_width)),
89 font_list, 89 font_list, max_pixel_width, gfx::ELIDE_TAIL),
90 max_pixel_width, gfx::ELIDE_AT_END), tooltip); 90 tooltip);
91 #endif 91 #endif
92 92
93 // Normal small tooltip should stay as is. 93 // Normal small tooltip should stay as is.
94 tooltip.clear(); 94 tooltip.clear();
95 width = line_count = -1; 95 width = line_count = -1;
96 tooltip = ASCIIToUTF16("Small Tooltip"); 96 tooltip = ASCIIToUTF16("Small Tooltip");
97 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width, 97 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width,
98 &line_count); 98 &line_count);
99 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tooltip"), font_list), 99 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tooltip"), font_list),
100 width); 100 width);
(...skipping 22 matching lines...) Expand all
123 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width, 123 TooltipAura::TrimTooltipToFit(font_list, max_width, &tooltip, &width,
124 &line_count); 124 &line_count);
125 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tool t\tip"), font_list), 125 EXPECT_EQ(gfx::GetStringWidth(ASCIIToUTF16("Small Tool t\tip"), font_list),
126 width); 126 width);
127 EXPECT_EQ(1, line_count); 127 EXPECT_EQ(1, line_count);
128 EXPECT_EQ(ASCIIToUTF16("Small Tool t\tip"), tooltip); 128 EXPECT_EQ(ASCIIToUTF16("Small Tool t\tip"), tooltip);
129 } 129 }
130 130
131 } // namespace corewm 131 } // namespace corewm
132 } // namespace views 132 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_aura.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698