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

Unified Diff: ui/views/controls/styled_label_unittest.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/styled_label.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/styled_label_unittest.cc
diff --git a/ui/views/controls/styled_label_unittest.cc b/ui/views/controls/styled_label_unittest.cc
index 408212b385cfb68513b7ef29df9c089cc21eccb6..057a3a56a1b654221aff1291db3404b308d4ee0e 100644
--- a/ui/views/controls/styled_label_unittest.cc
+++ b/ui/views/controls/styled_label_unittest.cc
@@ -229,7 +229,13 @@ TEST_F(StyledLabelTest, StyledRangeWithDisabledLineWrapping) {
EXPECT_EQ(0, styled()->child_at(1)->x());
}
-TEST_F(StyledLabelTest, StyledRangeUnderlined) {
+// TODO(mboc): Linux has never supported UNDERLINE, only virtually. Fix this.
+#if defined(OS_LINUX)
+#define MAYBE_StyledRangeUnderlined DISABLED_StyledRangeUnderlined
+#else
+#define MAYBE_StyledRangeUnderlined StyledRangeUnderlined
+#endif
+TEST_F(StyledLabelTest, MAYBE_StyledRangeUnderlined) {
const std::string text("This is a test block of text, ");
const std::string underlined_text("and this should be undelined");
InitStyledLabel(text + underlined_text);
@@ -258,7 +264,7 @@ TEST_F(StyledLabelTest, StyledRangeBold) {
InitStyledLabel(bold_text + text);
StyledLabel::RangeStyleInfo style_info;
- style_info.font_style = gfx::Font::BOLD;
+ style_info.weight = gfx::Font::Weight::BOLD;
styled()->AddStyleRange(
gfx::Range(0u, static_cast<uint32_t>(bold_text.size())), style_info);
@@ -266,7 +272,8 @@ TEST_F(StyledLabelTest, StyledRangeBold) {
// and normal style.
Label label(ASCIIToUTF16(bold_text));
const gfx::Size normal_label_size = label.GetPreferredSize();
- label.SetFontList(label.font_list().DeriveWithStyle(gfx::Font::BOLD));
+ label.SetFontList(
+ label.font_list().DeriveWithWeight(gfx::Font::Weight::BOLD));
const gfx::Size bold_label_size = label.GetPreferredSize();
ASSERT_GE(bold_label_size.width(), normal_label_size.width());
@@ -292,13 +299,13 @@ TEST_F(StyledLabelTest, StyledRangeBold) {
ASSERT_EQ(std::string(Label::kViewClassName),
styled()->child_at(0)->GetClassName());
EXPECT_EQ(
- gfx::Font::BOLD,
- static_cast<Label*>(styled()->child_at(0))->font_list().GetFontStyle());
+ gfx::Font::Weight::BOLD,
+ static_cast<Label*>(styled()->child_at(0))->font_list().GetFontWeight());
ASSERT_EQ(std::string(Label::kViewClassName),
styled()->child_at(1)->GetClassName());
EXPECT_EQ(
- gfx::Font::BOLD,
- static_cast<Label*>(styled()->child_at(1))->font_list().GetFontStyle());
+ gfx::Font::Weight::BOLD,
+ static_cast<Label*>(styled()->child_at(1))->font_list().GetFontWeight());
ASSERT_EQ(std::string(Label::kViewClassName),
styled()->child_at(2)->GetClassName());
EXPECT_EQ(
« no previous file with comments | « ui/views/controls/styled_label.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698