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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 | « ui/views/controls/label.cc ('k') | ui/views/controls/menu/menu_controller.h » ('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 (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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // Changing layout just resets |lines_|. It'll recover next time it's drawn. 584 // Changing layout just resets |lines_|. It'll recover next time it's drawn.
585 label.SetBounds(0, 0, 10, 10); 585 label.SetBounds(0, 0, 10, 10);
586 EXPECT_EQ(0u, label.lines_.size()); 586 EXPECT_EQ(0u, label.lines_.size());
587 587
588 label.Paint(ui::CanvasPainter(&canvas, 1.f).context()); 588 label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
589 EXPECT_EQ(1u, label.lines_.size()); 589 EXPECT_EQ(1u, label.lines_.size());
590 } 590 }
591 591
592 #if !defined(OS_MACOSX) 592 #if !defined(OS_MACOSX)
593 TEST_F(LabelTest, MultilineSupportedRenderText) { 593 TEST_F(LabelTest, MultilineSupportedRenderText) {
594 scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateInstance()); 594 std::unique_ptr<gfx::RenderText> render_text(
595 gfx::RenderText::CreateInstance());
595 ASSERT_TRUE(render_text->MultilineSupported()); 596 ASSERT_TRUE(render_text->MultilineSupported());
596 597
597 Label label; 598 Label label;
598 label.SetText(ASCIIToUTF16("Example of\nmultilined label")); 599 label.SetText(ASCIIToUTF16("Example of\nmultilined label"));
599 label.SetMultiLine(true); 600 label.SetMultiLine(true);
600 label.SizeToPreferredSize(); 601 label.SizeToPreferredSize();
601 602
602 gfx::Canvas canvas(label.GetPreferredSize(), 1.0f, true); 603 gfx::Canvas canvas(label.GetPreferredSize(), 1.0f, true);
603 label.Paint(ui::CanvasPainter(&canvas, 1.f).context()); 604 label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
604 605
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 label()->SetFocusable(true); 652 label()->SetFocusable(true);
652 label()->RequestFocus(); 653 label()->RequestFocus();
653 label()->SizeToPreferredSize(); 654 label()->SizeToPreferredSize();
654 655
655 gfx::Rect focus_bounds = label()->GetFocusBounds(); 656 gfx::Rect focus_bounds = label()->GetFocusBounds();
656 EXPECT_FALSE(focus_bounds.IsEmpty()); 657 EXPECT_FALSE(focus_bounds.IsEmpty());
657 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height()); 658 EXPECT_LT(label()->font_list().GetHeight(), focus_bounds.height());
658 } 659 }
659 660
660 } // namespace views 661 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698