Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 652573002: RenderText: Add a test to ensure strings fit their own widths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fcc2d4309968ea017e070af88d43d241a0117f7b 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
« no previous file with comments | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698