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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 435583003: RenderTextHarfBuzz: Check CreateSkiaTypeface return value against NULL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 6 years, 5 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
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_harfbuzz.cc ('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 c2b8975ec76b95237fc67c6ed201369297acd3be..665632891427afc3a9e029c7dd652478572fa3b4 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -2262,4 +2262,35 @@ TEST_F(RenderTextTest, HarfBuzz_GlyphBounds) {
}
}
+// Try shaping with fonts that don't exist on the system.
msw 2014/08/02 18:05:33 Consider: "// Ensure that shaping with a non-exist
ckocagil 2014/08/03 03:36:55 Done.
+TEST_F(RenderTextTest, HarfBuzz_NonExistentFont) {
+ RenderTextHarfBuzz render_text;
+
msw 2014/08/02 18:05:33 nit: remove blank line
ckocagil 2014/08/03 03:36:55 Done.
+ render_text.SetText(ASCIIToUTF16("test"));
+ render_text.EnsureLayout();
+ ASSERT_EQ(1U, render_text.runs_.size());
+ internal::TextRunHarfBuzz* run = render_text.runs_[0];
+ render_text.ShapeRunWithFont(run, "TheFontThatDoesntExist");
+}
+
+// Ensure an empty run returns sane values to queries.
+TEST_F(RenderTextTest, HarfBuzz_EmptyRun) {
+ internal::TextRunHarfBuzz run;
+ const base::string16 kString = ASCIIToUTF16("abcdefgh");
+ scoped_ptr<base::i18n::BreakIterator> iter(new base::i18n::BreakIterator(
+ kString, base::i18n::BreakIterator::BREAK_CHARACTER));
+ ASSERT_TRUE(iter->Init());
+
+ run.range = Range(3, 8);
+ run.glyph_count = 0;
+ EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5)));
+ EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4));
+ Range chars;
+ Range glyphs;
+ run.GetClusterAt(4, &chars, &glyphs);
+ EXPECT_EQ(Range(3, 8), chars);
+ EXPECT_EQ(Range(0, 0), glyphs);
+
msw 2014/08/02 18:05:33 nit: remove blank line
ckocagil 2014/08/03 03:36:55 Done.
+}
+
} // namespace gfx
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698