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