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 5d377e74f89b748981f132f5c4a5c858b56a3fca..40f7c5cd3ba16ff1f8c2f56d8597c7adb98bc632 100644 |
| --- a/ui/gfx/render_text_unittest.cc |
| +++ b/ui/gfx/render_text_unittest.cc |
| @@ -2309,4 +2309,18 @@ TEST_F(RenderTextTest, HarfBuzz_EmptyRun) { |
| EXPECT_EQ(Range(0, 0), glyphs); |
| } |
| +// Ensure a string fits in a display rect with a width equal to the string's. |
| +TEST_F(RenderTextTest, StringFitsOwnWidth) { |
| + scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |
| + |
| + render_text->SetText(ASCIIToUTF16("www.example.com")); |
| + render_text->ApplyStyle(BOLD, true, Range(0, 3)); |
| + render_text->SetElideBehavior(ELIDE_TAIL); |
| + |
| + render_text->SetDisplayRect(Rect(0, 0, 500, 100)); |
| + EXPECT_EQ(base::char16('m'), *(render_text->GetLayoutText().end() - 1)); |
|
msw
2014/10/16 20:32:21
nit: Just compare the whole string (avoid accident
ckocagil
2014/10/16 20:40:20
Done.
|
| + render_text->SetDisplayRect(Rect(0, 0, render_text->GetContentWidth(), 100)); |
| + EXPECT_EQ(base::char16('m'), *(render_text->GetLayoutText().end() - 1)); |
| +} |
| + |
| } // namespace gfx |