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

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

Issue 2722503005: Add bottom border to StyledLabel. (Closed)
Patch Set: Spacing fixed Created 3 years, 9 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/styled_label.cc ('k') | 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // layout should be recalculated 555 // layout should be recalculated
556 // all controls should be recreated 556 // all controls should be recreated
557 styled()->SetText(another_text); 557 styled()->SetText(another_text);
558 int updated_height = styled()->GetHeightForWidth(styled()->width()); 558 int updated_height = styled()->GetHeightForWidth(styled()->width());
559 EXPECT_NE(updated_height, real_height); 559 EXPECT_NE(updated_height, real_height);
560 View* first_child_after_text_update = styled()->has_children() ? 560 View* first_child_after_text_update = styled()->has_children() ?
561 styled()->child_at(0) : nullptr; 561 styled()->child_at(0) : nullptr;
562 EXPECT_NE(first_child_after_text_update, first_child_after_layout); 562 EXPECT_NE(first_child_after_text_update, first_child_after_layout);
563 } 563 }
564 564
565 TEST_F(StyledLabelTest, Border) {
566 const std::string text("One line");
567 InitStyledLabel(text);
568 Label label(ASCIIToUTF16(text));
569 gfx::Size label_preferred_size = label.GetPreferredSize();
570 styled()->SetBorder(
571 CreateEmptyBorder(5 /*top*/, 10 /*left*/, 6 /*bottom*/, 20 /*right*/));
572 styled()->SetBounds(0, 0, 1000, 0);
573 styled()->Layout();
574 EXPECT_EQ(
575 label_preferred_size.height() + 5 /*top border*/ + 6 /*bottom border*/,
576 styled()->GetPreferredSize().height());
577 EXPECT_EQ(
578 label_preferred_size.width() + 10 /*left border*/ + 20 /*right border*/,
579 styled()->GetPreferredSize().width());
580 }
581
565 } // namespace views 582 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/styled_label.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698