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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 | 23 |
24 class StyledLabelTest : public ViewsTestBase, public StyledLabelListener { | 24 class StyledLabelTest : public ViewsTestBase, public StyledLabelListener { |
25 public: | 25 public: |
26 StyledLabelTest() {} | 26 StyledLabelTest() {} |
27 virtual ~StyledLabelTest() {} | 27 virtual ~StyledLabelTest() {} |
28 | 28 |
29 // StyledLabelListener implementation. | 29 // StyledLabelListener implementation. |
30 virtual void StyledLabelLinkClicked(const gfx::Range& range, | 30 virtual void StyledLabelLinkClicked(const gfx::Range& range, |
31 int event_flags) OVERRIDE {} | 31 int event_flags) override {} |
32 | 32 |
33 protected: | 33 protected: |
34 StyledLabel* styled() { return styled_.get(); } | 34 StyledLabel* styled() { return styled_.get(); } |
35 | 35 |
36 void InitStyledLabel(const std::string& ascii_text) { | 36 void InitStyledLabel(const std::string& ascii_text) { |
37 styled_.reset(new StyledLabel(ASCIIToUTF16(ascii_text), this)); | 37 styled_.reset(new StyledLabel(ASCIIToUTF16(ascii_text), this)); |
38 styled_->set_owned_by_client(); | 38 styled_->set_owned_by_client(); |
39 } | 39 } |
40 | 40 |
41 int StyledLabelContentHeightForWidth(int w) { | 41 int StyledLabelContentHeightForWidth(int w) { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 416 } |
417 | 417 |
418 TEST_F(StyledLabelTest, HandleEmptyLayout) { | 418 TEST_F(StyledLabelTest, HandleEmptyLayout) { |
419 const std::string text("This is a test block of text."); | 419 const std::string text("This is a test block of text."); |
420 InitStyledLabel(text); | 420 InitStyledLabel(text); |
421 styled()->Layout(); | 421 styled()->Layout(); |
422 EXPECT_EQ(0, styled()->child_count()); | 422 EXPECT_EQ(0, styled()->child_count()); |
423 } | 423 } |
424 | 424 |
425 } // namespace views | 425 } // namespace views |
OLD | NEW |