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 1925943002: Add views_unittests to Mac10.{9,9(dbg),10,11} and asan bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yipe - cater for r401862 and r401987 Created 4 years, 5 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
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 TEST_F(StyledLabelTest, StyledRangeBold) { 260 // Fails on Mac, but only on 10.10. See http://crbug.com/622983.
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) {
261 const std::string bold_text( 267 const std::string bold_text(
262 "This is a block of text whose style will be set to BOLD in the test"); 268 "This is a block of text whose style will be set to BOLD in the test");
263 const std::string text(" normal text"); 269 const std::string text(" normal text");
264 InitStyledLabel(bold_text + text); 270 InitStyledLabel(bold_text + text);
265 271
266 StyledLabel::RangeStyleInfo style_info; 272 StyledLabel::RangeStyleInfo style_info;
267 style_info.weight = gfx::Font::Weight::BOLD; 273 style_info.weight = gfx::Font::Weight::BOLD;
268 styled()->AddStyleRange( 274 styled()->AddStyleRange(
269 gfx::Range(0u, static_cast<uint32_t>(bold_text.size())), style_info); 275 gfx::Range(0u, static_cast<uint32_t>(bold_text.size())), style_info);
270 276
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // all controls should be recreated 512 // all controls should be recreated
507 styled()->SetText(another_text); 513 styled()->SetText(another_text);
508 int updated_height = styled()->GetHeightForWidth(styled()->width()); 514 int updated_height = styled()->GetHeightForWidth(styled()->width());
509 EXPECT_NE(updated_height, real_height); 515 EXPECT_NE(updated_height, real_height);
510 View* first_child_after_text_update = styled()->has_children() ? 516 View* first_child_after_text_update = styled()->has_children() ?
511 styled()->child_at(0) : nullptr; 517 styled()->child_at(0) : nullptr;
512 EXPECT_NE(first_child_after_text_update, first_child_after_layout); 518 EXPECT_NE(first_child_after_text_update, first_child_after_layout);
513 } 519 }
514 520
515 } // namespace views 521 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_runner_unittest.cc ('k') | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698