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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 styled()->SetBounds(0, | 398 styled()->SetBounds(0, |
399 0, | 399 0, |
400 label.GetPreferredSize().width(), | 400 label.GetPreferredSize().width(), |
401 label.GetPreferredSize().height()); | 401 label.GetPreferredSize().height()); |
402 | 402 |
403 // Make sure we have the same sizing as a label. | 403 // Make sure we have the same sizing as a label. |
404 EXPECT_EQ(label.GetPreferredSize().height(), styled()->height()); | 404 EXPECT_EQ(label.GetPreferredSize().height(), styled()->height()); |
405 EXPECT_EQ(label.GetPreferredSize().width(), styled()->width()); | 405 EXPECT_EQ(label.GetPreferredSize().width(), styled()->width()); |
406 } | 406 } |
407 | 407 |
| 408 TEST_F(StyledLabelTest, LineHeight) { |
| 409 const std::string text("one"); |
| 410 InitStyledLabel(text); |
| 411 int default_height = styled()->GetHeightForWidth(100); |
| 412 const std::string newline_text("one\ntwo\nthree"); |
| 413 InitStyledLabel(newline_text); |
| 414 styled()->SetLineHeight(18); |
| 415 EXPECT_EQ(18 * 2 + default_height, styled()->GetHeightForWidth(100)); |
| 416 } |
| 417 |
408 TEST_F(StyledLabelTest, HandleEmptyLayout) { | 418 TEST_F(StyledLabelTest, HandleEmptyLayout) { |
409 const std::string text("This is a test block of text."); | 419 const std::string text("This is a test block of text."); |
410 InitStyledLabel(text); | 420 InitStyledLabel(text); |
411 styled()->Layout(); | 421 styled()->Layout(); |
412 EXPECT_EQ(0, styled()->child_count()); | 422 EXPECT_EQ(0, styled()->child_count()); |
413 } | 423 } |
414 | 424 |
415 } // namespace views | 425 } // namespace views |
OLD | NEW |