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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp

Issue 1524913003: Account for total glyph overflow in CachingWordShaper::width (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ace of rebase Created 5 years 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 | « third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
index 60bae9d5be0f553bf2159b4642a8c54ec6454f36..198e599fed66a07c6ca0545d453b9f34baea21db 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -203,4 +203,23 @@ TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList)
EXPECT_EQ(0u, fallbackFonts.size());
}
+TEST_F(CachingWordShaperTest, GlyphBoundsWithSpaces)
+{
+ CachingWordShaper shaper(cache.get());
+
+ TextRun periods(reinterpret_cast<const LChar*>(".........."), 10);
+ FloatRect periodsGlyphBounds;
+ float periodsWidth = shaper.width(&font, periods, nullptr, &periodsGlyphBounds);
+
+ TextRun periodsAndSpaces(reinterpret_cast<const LChar*>(". . . . . . . . . ."), 19);
+ FloatRect periodsAndSpacesGlyphBounds;
+ float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr, &periodsAndSpacesGlyphBounds);
+
+ // The total width of periods and spaces should be longer than the width of periods alone.
+ ASSERT_GT(periodsAndSpacesWidth, periodsWidth);
+
+ // The glyph bounds of periods and spaces should be longer than the glyph bounds of periods alone.
+ ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698