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

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

Issue 2869893005: Clamp RunInfo::num_characters when shaping ranges with context (Closed)
Patch Set: Created 3 years, 7 months 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
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
index 120e2dba4437fd655ac00ed5036e19a31f7aa846..5a62bd36c54904923ccbda6c6aefa74e2e769aaf 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
@@ -30,6 +30,7 @@ class HarfBuzzShaperTest : public ::testing::Test {
FontDescription font_description;
Font font;
unsigned start_index = 0;
+ unsigned num_characters = 0;
unsigned num_glyphs = 0;
hb_script_t script = HB_SCRIPT_INVALID;
};
@@ -225,6 +226,19 @@ TEST_F(HarfBuzzShaperTest, ShapeLatinSegment) {
RefPtr<ShapeResult> second = shaper.Shape(&font, direction, 6, 11);
RefPtr<ShapeResult> third = shaper.Shape(&font, direction, 11, 12);
+ ASSERT_TRUE(TestInfo(first)->RunInfoForTesting(0, start_index, num_characters,
+ num_glyphs, script));
+ EXPECT_EQ(0u, start_index);
+ EXPECT_EQ(6u, num_characters);
+ ASSERT_TRUE(TestInfo(second)->RunInfoForTesting(
+ 0, start_index, num_characters, num_glyphs, script));
+ EXPECT_EQ(6u, start_index);
+ EXPECT_EQ(5u, num_characters);
+ ASSERT_TRUE(TestInfo(third)->RunInfoForTesting(0, start_index, num_characters,
+ num_glyphs, script));
+ EXPECT_EQ(11u, start_index);
+ EXPECT_EQ(1u, num_characters);
+
HarfBuzzShaper shaper2(string.Characters16(), 6);
RefPtr<ShapeResult> first_reference = shaper2.Shape(&font, direction);

Powered by Google App Engine
This is Rietveld 408576698