Commit 002ba86a authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Add unittest for zero-width unicode characters

Adding unitests to ensures the zero width characters are processeed
correctly with render_text and font fallbacks.

R=msw@chromium.org

Bug: 972090
Change-Id: Ie68f706278669f1347475699cf0516e9ad1356ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1681451Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#673430}
parent 26fe0827
...@@ -4842,6 +4842,26 @@ TEST_F(RenderTextTest, CJKFontWithLocale) { ...@@ -4842,6 +4842,26 @@ TEST_F(RenderTextTest, CJKFontWithLocale) {
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
TEST_F(RenderTextTest, ZeroWidthCharacters) {
static const wchar_t* kEmptyText[] = {
L"\u200C", // ZERO WIDTH NON-JOINER
L"\u200D", // ZERO WIDTH JOINER
L"\u200B", // ZERO WIDTH SPACE
L"\uFEFF", // ZERO WIDTH NO-BREAK SPACE
};
for (const wchar_t* text : kEmptyText) {
RenderTextHarfBuzz* render_text = GetRenderText();
render_text->SetText(WideToUTF16(text));
test_api()->EnsureLayout();
const internal::TextRunList* run_list = GetHarfBuzzRunList();
EXPECT_EQ(0, run_list->width());
ASSERT_EQ(run_list->runs().size(), 1U);
EXPECT_EQ(run_list->runs()[0]->CountMissingGlyphs(), 0U);
}
}
// Ensure that the width reported by RenderText is sufficient for drawing. Draws // Ensure that the width reported by RenderText is sufficient for drawing. Draws
// to a canvas and checks if any pixel beyond the bounding rectangle is colored. // to a canvas and checks if any pixel beyond the bounding rectangle is colored.
TEST_F(RenderTextTest, TextDoesntClip) { TEST_F(RenderTextTest, TextDoesntClip) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment