| 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/controls/styled_label.h" | 5 #include "ui/views/controls/styled_label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 styled()->child_at(2)->GetTooltipText(gfx::Point(1, 1), &tooltip)); | 482 styled()->child_at(2)->GetTooltipText(gfx::Point(1, 1), &tooltip)); |
| 483 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); | 483 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); |
| 484 } | 484 } |
| 485 | 485 |
| 486 TEST_F(StyledLabelTest, SetBaseFontList) { | 486 TEST_F(StyledLabelTest, SetBaseFontList) { |
| 487 const std::string text("This is a test block of text."); | 487 const std::string text("This is a test block of text."); |
| 488 InitStyledLabel(text); | 488 InitStyledLabel(text); |
| 489 std::string font_name("arial"); | 489 std::string font_name("arial"); |
| 490 gfx::Font font(font_name, 30); | 490 gfx::Font font(font_name, 30); |
| 491 styled()->SetBaseFontList(gfx::FontList(font)); | 491 styled()->SetBaseFontList(gfx::FontList(font)); |
| 492 Label label(ASCIIToUTF16(text), {gfx::FontList(font)}); | 492 Label label(ASCIIToUTF16(text), Label::CustomFont{gfx::FontList(font)}); |
| 493 | 493 |
| 494 styled()->SetBounds(0, | 494 styled()->SetBounds(0, |
| 495 0, | 495 0, |
| 496 label.GetPreferredSize().width(), | 496 label.GetPreferredSize().width(), |
| 497 label.GetPreferredSize().height()); | 497 label.GetPreferredSize().height()); |
| 498 | 498 |
| 499 // Make sure we have the same sizing as a label. | 499 // Make sure we have the same sizing as a label. |
| 500 EXPECT_EQ(label.GetPreferredSize().height(), styled()->height()); | 500 EXPECT_EQ(label.GetPreferredSize().height(), styled()->height()); |
| 501 EXPECT_EQ(label.GetPreferredSize().width(), styled()->width()); | 501 EXPECT_EQ(label.GetPreferredSize().width(), styled()->width()); |
| 502 } | 502 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 styled()->Layout(); | 573 styled()->Layout(); |
| 574 EXPECT_EQ( | 574 EXPECT_EQ( |
| 575 label_preferred_size.height() + 5 /*top border*/ + 6 /*bottom border*/, | 575 label_preferred_size.height() + 5 /*top border*/ + 6 /*bottom border*/, |
| 576 styled()->GetPreferredSize().height()); | 576 styled()->GetPreferredSize().height()); |
| 577 EXPECT_EQ( | 577 EXPECT_EQ( |
| 578 label_preferred_size.width() + 10 /*left border*/ + 20 /*right border*/, | 578 label_preferred_size.width() + 10 /*left border*/ + 20 /*right border*/, |
| 579 styled()->GetPreferredSize().width()); | 579 styled()->GetPreferredSize().width()); |
| 580 } | 580 } |
| 581 | 581 |
| 582 } // namespace views | 582 } // namespace views |
| OLD | NEW |