Chromium Code Reviews| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, BottomBorder) { | |
| 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(CreateEmptyBorder(0, 0, 5 /* bottom */, 0)); | |
| 571 EXPECT_EQ(label_preferred_size.height() + 5 /* bottom border */, | |
|
Evan Stade
2017/03/06 22:01:29
nit: can you also set other sides of the border an
dvadym
2017/03/07 13:22:53
Done.
| |
| 572 styled()->GetHeightForWidth(1000)); | |
| 573 } | |
| 574 | |
| 565 } // namespace views | 575 } // namespace views |
| OLD | NEW |