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

Side by Side Diff: ui/views/controls/label_unittest.cc

Issue 1773063002: MacViews: Fix failing label-related views_unittests after r377477 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: I like this better Created 4 years, 9 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
« no previous file with comments | « no previous file | ui/views/controls/styled_label.cc » ('j') | ui/views/controls/styled_label.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/label.h" 5 #include "ui/views/controls/label.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 label.SetText(ASCIIToUTF16("Altered")); 315 label.SetText(ASCIIToUTF16("Altered"));
316 // The altered text should be painted even though Layout() or SetBounds() are 316 // The altered text should be painted even though Layout() or SetBounds() are
317 // not called. 317 // not called.
318 label.Paint(ui::CanvasPainter(&canvas, 1.f).context()); 318 label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
319 EXPECT_EQ(1u, label.lines_.size()); 319 EXPECT_EQ(1u, label.lines_.size());
320 EXPECT_EQ(ASCIIToUTF16("Altered"), label.lines_[0]->GetDisplayText()); 320 EXPECT_EQ(ASCIIToUTF16("Altered"), label.lines_[0]->GetDisplayText());
321 } 321 }
322 322
323 TEST_F(LabelTest, EmptyLabelSizing) { 323 TEST_F(LabelTest, EmptyLabelSizing) {
324 Label label; 324 Label label;
325 const gfx::Size expected_size(0, gfx::FontList().GetHeight()); 325 const gfx::Size expected_size(0, label.font_list().GetHeight());
326 EXPECT_EQ(expected_size, label.GetPreferredSize()); 326 EXPECT_EQ(expected_size, label.GetPreferredSize());
327 label.SetMultiLine(!label.multi_line()); 327 label.SetMultiLine(!label.multi_line());
328 EXPECT_EQ(expected_size, label.GetPreferredSize()); 328 EXPECT_EQ(expected_size, label.GetPreferredSize());
329 } 329 }
330 330
331 TEST_F(LabelTest, SingleLineSizing) { 331 TEST_F(LabelTest, SingleLineSizing) {
332 Label label; 332 Label label;
333 label.SetText(ASCIIToUTF16("A not so random string in one line.")); 333 label.SetText(ASCIIToUTF16("A not so random string in one line."));
334 const gfx::Size size = label.GetPreferredSize(); 334 const gfx::Size size = label.GetPreferredSize();
335 EXPECT_GT(size.height(), kMinTextDimension); 335 EXPECT_GT(size.height(), kMinTextDimension);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 label()->SetFocusable(true); 651 label()->SetFocusable(true);
652 label()->RequestFocus(); 652 label()->RequestFocus();
653 label()->SizeToPreferredSize(); 653 label()->SizeToPreferredSize();
654 654
655 gfx::Rect focus_bounds = label()->GetFocusBounds(); 655 gfx::Rect focus_bounds = label()->GetFocusBounds();
656 EXPECT_FALSE(focus_bounds.IsEmpty()); 656 EXPECT_FALSE(focus_bounds.IsEmpty());
657 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height()); 657 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height());
658 } 658 }
659 659
660 } // namespace views 660 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/styled_label.cc » ('j') | ui/views/controls/styled_label.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698