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 |