| 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, SetInterlineSpacing) { |
| 409 const std::string text("one\ntwo\nthree"); |
| 410 InitStyledLabel(text); |
| 411 int before = styled()->GetHeightForWidth(100); |
| 412 styled()->SetInterlineSpacing(4); |
| 413 EXPECT_EQ(before + 4*3, styled()->GetHeightForWidth(100)); |
| 414 } |
| 415 |
| 408 TEST_F(StyledLabelTest, HandleEmptyLayout) { | 416 TEST_F(StyledLabelTest, HandleEmptyLayout) { |
| 409 const std::string text("This is a test block of text."); | 417 const std::string text("This is a test block of text."); |
| 410 InitStyledLabel(text); | 418 InitStyledLabel(text); |
| 411 styled()->Layout(); | 419 styled()->Layout(); |
| 412 EXPECT_EQ(0, styled()->child_count()); | 420 EXPECT_EQ(0, styled()->child_count()); |
| 413 } | 421 } |
| 414 | 422 |
| 415 } // namespace views | 423 } // namespace views |
| OLD | NEW |