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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 base::string16 tooltip; | 376 base::string16 tooltip; |
377 EXPECT_TRUE( | 377 EXPECT_TRUE( |
378 styled()->child_at(1)->GetTooltipText(gfx::Point(1, 1), &tooltip)); | 378 styled()->child_at(1)->GetTooltipText(gfx::Point(1, 1), &tooltip)); |
379 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); | 379 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); |
380 EXPECT_TRUE( | 380 EXPECT_TRUE( |
381 styled()->child_at(2)->GetTooltipText(gfx::Point(1, 1), &tooltip)); | 381 styled()->child_at(2)->GetTooltipText(gfx::Point(1, 1), &tooltip)); |
382 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); | 382 EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); |
383 } | 383 } |
384 | 384 |
| 385 TEST_F(StyledLabelTest, SetFontList) { |
| 386 const std::string text("This is a test block of text."); |
| 387 InitStyledLabel(text); |
| 388 std::string font_name("arial"); |
| 389 gfx::Font font(font_name, 30); |
| 390 styled()->SetFontList(gfx::FontList(font)); |
| 391 Label label(ASCIIToUTF16(text), gfx::FontList(font)); |
| 392 |
| 393 styled()->SetBounds(0, |
| 394 0, |
| 395 label.GetPreferredSize().width(), |
| 396 label.GetPreferredSize().height()); |
| 397 |
| 398 // Make sure we have the same sizing as a label. |
| 399 EXPECT_EQ(label.GetPreferredSize().height(), styled()->height()); |
| 400 EXPECT_EQ(label.GetPreferredSize().width(), styled()->width()); |
| 401 } |
| 402 |
385 TEST_F(StyledLabelTest, HandleEmptyLayout) { | 403 TEST_F(StyledLabelTest, HandleEmptyLayout) { |
386 const std::string text("This is a test block of text."); | 404 const std::string text("This is a test block of text."); |
387 InitStyledLabel(text); | 405 InitStyledLabel(text); |
388 styled()->Layout(); | 406 styled()->Layout(); |
389 EXPECT_EQ(0, styled()->child_count()); | 407 EXPECT_EQ(0, styled()->child_count()); |
390 } | 408 } |
391 | 409 |
| 410 |
392 } // namespace | 411 } // namespace |
OLD | NEW |