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 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 |