Chromium Code Reviews| Index: ui/gfx/render_text_unittest.cc |
| diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc |
| index 542939ea3081369af9a50fdf080f3490eaa7d3d8..aae647f223407aa4fa56c1b3c790bfbd4d3c904d 100644 |
| --- a/ui/gfx/render_text_unittest.cc |
| +++ b/ui/gfx/render_text_unittest.cc |
| @@ -28,6 +28,12 @@ |
| #include "ui/gfx/platform_font_win.h" |
| #endif |
| +#if defined(OS_MACOSX) |
| +#include <ApplicationServices/ApplicationServices.h> |
| + |
| +#include "ui/gfx/render_text_mac.h" |
| +#endif |
| + |
| using base::ASCIIToUTF16; |
| using base::UTF8ToUTF16; |
| using base::WideToUTF16; |
| @@ -2608,4 +2614,23 @@ TEST_F(RenderTextTest, TextDoesntClip) { |
| } |
| } |
| +#if defined(OS_MACOSX) |
| +TEST_F(RenderTextTest, Mac_ElidedText) { |
| + RenderTextMac render_text; |
| + base::string16 text(ASCIIToUTF16("This is example.")); |
|
msw
2015/03/02 22:50:55
nit: "This is an example."
Jun Mukai
2015/03/02 23:10:37
Done.
|
| + render_text.SetText(text); |
| + render_text.EnsureLayout(); |
| + // Note that glyph count matches to the text length because all the characters |
|
msw
2015/03/02 22:50:55
nit: "// NOTE: Character and glyph counts are only
Jun Mukai
2015/03/02 23:10:37
Done.
|
| + // in |text| is simple. |
| + EXPECT_EQ(text.size(), CTLineGetGlyphCount(render_text.line_)); |
| + |
| + render_text.SetElideBehavior(ELIDE_TAIL); |
| + gfx::Size string_size = render_text.GetStringSize(); |
| + string_size.set_width(string_size.width() / 2); |
| + render_text.SetDisplayRect(gfx::Rect(string_size)); |
| + render_text.EnsureLayout(); |
| + EXPECT_GT(text.size(), CTLineGetGlyphCount(render_text.line_)); |
| +} |
| +#endif |
| + |
| } // namespace gfx |