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

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

Issue 2561463003: MacViews: Re-enable StyledLabelTest.StyledRangeBold. (Closed)
Patch Set: Created 4 years 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 | no next file » | 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/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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 styled()->Layout(); 250 styled()->Layout();
251 251
252 ASSERT_EQ(2, styled()->child_count()); 252 ASSERT_EQ(2, styled()->child_count());
253 ASSERT_EQ(std::string(Label::kViewClassName), 253 ASSERT_EQ(std::string(Label::kViewClassName),
254 styled()->child_at(1)->GetClassName()); 254 styled()->child_at(1)->GetClassName());
255 EXPECT_EQ( 255 EXPECT_EQ(
256 gfx::Font::UNDERLINE, 256 gfx::Font::UNDERLINE,
257 static_cast<Label*>(styled()->child_at(1))->font_list().GetFontStyle()); 257 static_cast<Label*>(styled()->child_at(1))->font_list().GetFontStyle());
258 } 258 }
259 259
260 // Fails on Mac, but only on 10.10. See http://crbug.com/622983. 260 TEST_F(StyledLabelTest, StyledRangeBold) {
261 #if defined(OS_MACOSX)
262 #define MAYBE_StyledRangeBold DISABLED_StyledRangeBold
263 #else
264 #define MAYBE_StyledRangeBold StyledRangeBold
265 #endif
266 TEST_F(StyledLabelTest, MAYBE_StyledRangeBold) {
267 const std::string bold_text( 261 const std::string bold_text(
268 "This is a block of text whose style will be set to BOLD in the test"); 262 "This is a block of text whose style will be set to BOLD in the test");
269 const std::string text(" normal text"); 263 const std::string text(" normal text");
270 InitStyledLabel(bold_text + text); 264 InitStyledLabel(bold_text + text);
271 265
272 StyledLabel::RangeStyleInfo style_info; 266 StyledLabel::RangeStyleInfo style_info;
273 style_info.weight = gfx::Font::Weight::BOLD; 267 style_info.weight = gfx::Font::Weight::BOLD;
274 styled()->AddStyleRange( 268 styled()->AddStyleRange(
275 gfx::Range(0u, static_cast<uint32_t>(bold_text.size())), style_info); 269 gfx::Range(0u, static_cast<uint32_t>(bold_text.size())), style_info);
276 270
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // all controls should be recreated 506 // all controls should be recreated
513 styled()->SetText(another_text); 507 styled()->SetText(another_text);
514 int updated_height = styled()->GetHeightForWidth(styled()->width()); 508 int updated_height = styled()->GetHeightForWidth(styled()->width());
515 EXPECT_NE(updated_height, real_height); 509 EXPECT_NE(updated_height, real_height);
516 View* first_child_after_text_update = styled()->has_children() ? 510 View* first_child_after_text_update = styled()->has_children() ?
517 styled()->child_at(0) : nullptr; 511 styled()->child_at(0) : nullptr;
518 EXPECT_NE(first_child_after_text_update, first_child_after_layout); 512 EXPECT_NE(first_child_after_text_update, first_child_after_layout);
519 } 513 }
520 514
521 } // namespace views 515 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698