Index: Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp b/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp |
index 0b8dbb3d1ccc8a93de5837c975b188f020b3571c..81a0b7be371f0f647230d149c150a5572f13e883 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp |
@@ -65,6 +65,99 @@ TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsLeadingCommon) |
EXPECT_EQ(HB_SCRIPT_LATIN, script); |
} |
+TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsTabOnStart) |
+{ |
+ TextRun leadingTab(reinterpret_cast<const LChar*>("\t//TEST"), 7); |
+ leadingTab.setTabSize(true, TabSize(1)); |
+ HarfBuzzShaper shaper(font, leadingTab, &fallbackFonts); |
+ RefPtr<ShapeResult> result = shaper.shapeResult(); |
+ |
+ ASSERT_EQ(2u, result->numberOfRunsForTesting()); |
+ ASSERT_TRUE(result->runInfoForTesting(0, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(0u, startIndex); |
+ EXPECT_EQ(1u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(1, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(1u, startIndex); |
+ EXPECT_EQ(6u, numGlyphs); |
+} |
+ |
+TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsTabsOnStart) |
+{ |
+ TextRun leadingTab(reinterpret_cast<const LChar*>("\t\t\tTEST"), 7); |
+ leadingTab.setTabSize(true, TabSize(1)); |
+ HarfBuzzShaper shaper(font, leadingTab, &fallbackFonts); |
+ RefPtr<ShapeResult> result = shaper.shapeResult(); |
+ |
+ ASSERT_EQ(2u, result->numberOfRunsForTesting()); |
+ ASSERT_TRUE(result->runInfoForTesting(0, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(0u, startIndex); |
+ EXPECT_EQ(3u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(1, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(3u, startIndex); |
+ EXPECT_EQ(4u, numGlyphs); |
+} |
+ |
+TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsTabsOnEnd) |
+{ |
+ TextRun trailingTab(reinterpret_cast<const LChar*>("TEST\t\t\t"), 7); |
+ trailingTab.setTabSize(true, TabSize(1)); |
+ HarfBuzzShaper shaper(font, trailingTab, &fallbackFonts); |
+ RefPtr<ShapeResult> result = shaper.shapeResult(); |
+ |
+ ASSERT_EQ(2u, result->numberOfRunsForTesting()); |
+ ASSERT_TRUE(result->runInfoForTesting(0, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(0u, startIndex); |
+ EXPECT_EQ(4u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(1, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(4u, startIndex); |
+ EXPECT_EQ(3u, numGlyphs); |
+} |
+ |
+TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsTabsAfterSpaces) |
+{ |
+ TextRun tabsAfterSpaces(reinterpret_cast<const LChar*>("TEST \t\t\tTEST"), 13); |
+ tabsAfterSpaces.setTabSize(true, TabSize(1)); |
+ HarfBuzzShaper shaper(font, tabsAfterSpaces, &fallbackFonts); |
+ RefPtr<ShapeResult> result = shaper.shapeResult(); |
+ |
+ ASSERT_EQ(3u, result->numberOfRunsForTesting()); |
+ ASSERT_TRUE(result->runInfoForTesting(0, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(0u, startIndex); |
+ EXPECT_EQ(6u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(1, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(6u, startIndex); |
+ EXPECT_EQ(3u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(2, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(9u, startIndex); |
+ EXPECT_EQ(4u, numGlyphs); |
+} |
+ |
+TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsTabsInMid) |
+{ |
+ TextRun tabsInMid(reinterpret_cast<const LChar*>("TEST\t\t\tTEST"), 11); |
+ tabsInMid.setTabSize(true, TabSize(1)); |
+ HarfBuzzShaper shaper(font, tabsInMid, &fallbackFonts); |
+ RefPtr<ShapeResult> result = shaper.shapeResult(); |
+ |
+ ASSERT_EQ(3u, result->numberOfRunsForTesting()); |
+ ASSERT_TRUE(result->runInfoForTesting(0, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(0u, startIndex); |
+ EXPECT_EQ(4u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(1, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(4u, startIndex); |
+ EXPECT_EQ(3u, numGlyphs); |
+ |
+ ASSERT_TRUE(result->runInfoForTesting(2, startIndex, numGlyphs, script)); |
+ EXPECT_EQ(7u, startIndex); |
+ EXPECT_EQ(4u, numGlyphs); |
+} |
+ |
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsUnicodeVariants) |
{ |
struct { |