diff options
author | ckocagil <ckocagil@chromium.org> | 2014-10-16 15:48:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-16 22:49:18 +0000 |
commit | 28da9ffbd9e39edb8fd707ec6129343a74e3816b (patch) | |
tree | 8cf4c75469a5a7c1dc4d1fd0421bb2b2c69d047a /ui/gfx/render_text_unittest.cc | |
parent | 535c75f4da3d754d0716305405a70418b99502de (diff) | |
download | chromium_src-28da9ffbd9e39edb8fd707ec6129343a74e3816b.zip chromium_src-28da9ffbd9e39edb8fd707ec6129343a74e3816b.tar.gz chromium_src-28da9ffbd9e39edb8fd707ec6129343a74e3816b.tar.bz2 |
RenderText: Add a test to ensure strings fit their own widths
This CL tests against regressions of http://crbug.com/402347
BUG=402347
Review URL: https://codereview.chromium.org/652573002
Cr-Commit-Position: refs/heads/master@{#299997}
Diffstat (limited to 'ui/gfx/render_text_unittest.cc')
-rw-r--r-- | ui/gfx/render_text_unittest.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index d098e93..10a0a90 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -2309,4 +2309,19 @@ 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()); + const base::string16 kString = ASCIIToUTF16("www.example.com"); + + render_text->SetText(kString); + render_text->ApplyStyle(BOLD, true, Range(0, 3)); + render_text->SetElideBehavior(ELIDE_TAIL); + + render_text->SetDisplayRect(Rect(0, 0, 500, 100)); + EXPECT_EQ(kString, render_text->GetLayoutText()); + render_text->SetDisplayRect(Rect(0, 0, render_text->GetContentWidth(), 100)); + EXPECT_EQ(kString, render_text->GetLayoutText()); +} + } // namespace gfx |