Commit e1ca1f9a authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Enable more shaper tests on Mac

Now that HarfBuzz AAT landed, enable more HarfBuzzShaper tests on Mac.

Bug: 894354
Change-Id: I2d3cdf721187f4366c964bcd982f3954ccd61429
Reviewed-on: https://chromium-review.googlesource.com/c/1350810
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610867}
parent 995f8099
...@@ -245,11 +245,9 @@ TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsUnicodeVariants) { ...@@ -245,11 +245,9 @@ TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsUnicodeVariants) {
// If the specified VS is not in the font, it's mapped to .notdef. // If the specified VS is not in the font, it's mapped to .notdef.
// then hb_ot_hide_default_ignorables() swaps it to a space with zero-advance. // then hb_ot_hide_default_ignorables() swaps it to a space with zero-advance.
// http://lists.freedesktop.org/archives/harfbuzz/2015-May/004888.html // http://lists.freedesktop.org/archives/harfbuzz/2015-May/004888.html
#if !defined(OS_MACOSX)
EXPECT_EQ(TestInfo(result)->FontDataForTesting(0)->SpaceGlyph(), EXPECT_EQ(TestInfo(result)->FontDataForTesting(0)->SpaceGlyph(),
TestInfo(result)->GlyphForTesting(0, 1)) TestInfo(result)->GlyphForTesting(0, 1))
<< test.name; << test.name;
#endif
EXPECT_EQ(0.f, TestInfo(result)->AdvanceForTesting(0, 1)) << test.name; EXPECT_EQ(0.f, TestInfo(result)->AdvanceForTesting(0, 1)) << test.name;
} else { } else {
EXPECT_EQ(1u, num_glyphs) << test.name; EXPECT_EQ(1u, num_glyphs) << test.name;
...@@ -413,8 +411,9 @@ TEST_F(HarfBuzzShaperTest, ShapeLatinSegment) { ...@@ -413,8 +411,9 @@ TEST_F(HarfBuzzShaperTest, ShapeLatinSegment) {
} }
// Represents the case where a part of a cluster has a different color. // Represents the case where a part of a cluster has a different color.
// <div>0x647<span style="color: red;">0x64A</span></div> // <div>0x647<span style="color: red;">0x64A</span></
// TODO(crbug.com/689155): Still fails on Mac, AAT? // Cannot be enabled on Mac yet, compare
// https:// https://github.com/harfbuzz/harfbuzz/issues/1415
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#define MAYBE_ShapeArabicWithContext DISABLED_ShapeArabicWithContext #define MAYBE_ShapeArabicWithContext DISABLED_ShapeArabicWithContext
#else #else
...@@ -723,17 +722,14 @@ static struct GlyphDataRangeTestData { ...@@ -723,17 +722,14 @@ static struct GlyphDataRangeTestData {
// The two code points form a grapheme cluster, which produces two glyphs. // The two code points form a grapheme cluster, which produces two glyphs.
// Character index array should be [0, 0]. // Character index array should be [0, 0].
{u"\u05E9\u05B0", TextDirection::kRtl, 0, 0, 1, 0, 2}, {u"\u05E9\u05B0", TextDirection::kRtl, 0, 0, 1, 0, 2},
#if !defined(OS_MACOSX)
// ZWJ tests taken from fast/text/international/zerowidthjoiner.html // ZWJ tests taken from fast/text/international/zerowidthjoiner.html
// Character index array should be [6, 3, 3, 3, 0, 0, 0]. // Character index array should be [6, 3, 3, 3, 0, 0, 0].
// Mac shapes differently and that glyph index expectations do not match.
{u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 0, {u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 0,
1, 4, 7}, 1, 4, 7},
{u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 2, {u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 2,
5, 1, 4}, 5, 1, 4},
{u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 4, {u"\u0639\u200D\u200D\u0639\u200D\u200D\u0639", TextDirection::kRtl, 0, 4,
7, 0, 1}, 7, 0, 1},
#endif
}; };
std::ostream& operator<<(std::ostream& ostream, std::ostream& operator<<(std::ostream& ostream,
...@@ -1455,9 +1451,9 @@ TEST_F(HarfBuzzShaperTest, SafeToBreakLatinDiscretionaryLigatures) { ...@@ -1455,9 +1451,9 @@ TEST_F(HarfBuzzShaperTest, SafeToBreakLatinDiscretionaryLigatures) {
} }
} }
// TODO(crbug.com/870712): This test fails on Mac due to AAT shaping and // TODO(crbug.com/870712): This test fails due to font fallback differences on
// font fallback differences on Android. // Android.
#if defined(OS_MACOSX) || defined(OS_ANDROID) #if defined(OS_ANDROID)
#define MAYBE_SafeToBreakArabicCommonLigatures \ #define MAYBE_SafeToBreakArabicCommonLigatures \
DISABLED_SafeToBreakArabicCommonLigatures DISABLED_SafeToBreakArabicCommonLigatures
#else #else
...@@ -1474,33 +1470,27 @@ TEST_F(HarfBuzzShaperTest, MAYBE_SafeToBreakArabicCommonLigatures) { ...@@ -1474,33 +1470,27 @@ TEST_F(HarfBuzzShaperTest, MAYBE_SafeToBreakArabicCommonLigatures) {
HarfBuzzShaper shaper(string); HarfBuzzShaper shaper(string);
scoped_refptr<ShapeResult> result = shaper.Shape(&font, TextDirection::kRtl); scoped_refptr<ShapeResult> result = shaper.Shape(&font, TextDirection::kRtl);
// Safe to break at 0, 3, 4, 5, 7, and 11. std::vector<unsigned> safe_to_break_positions;
EXPECT_EQ(0u, result->NextSafeToBreakOffset(0));
EXPECT_EQ(3u, result->NextSafeToBreakOffset(1)); #if defined(OS_MACOSX)
EXPECT_EQ(3u, result->NextSafeToBreakOffset(2)); safe_to_break_positions = {0, 2, 3, 4, 11};
EXPECT_EQ(3u, result->NextSafeToBreakOffset(3)); #else
EXPECT_EQ(4u, result->NextSafeToBreakOffset(4)); safe_to_break_positions = {0, 3, 4, 5, 7, 11};
EXPECT_EQ(5u, result->NextSafeToBreakOffset(5)); #endif
EXPECT_EQ(7u, result->NextSafeToBreakOffset(6)); unsigned compare_safe_to_break_position = 0;
EXPECT_EQ(7u, result->NextSafeToBreakOffset(7)); for (unsigned i = 0; i < string.length() - 1; ++i) {
EXPECT_EQ(11u, result->NextSafeToBreakOffset(8)); EXPECT_EQ(safe_to_break_positions[compare_safe_to_break_position],
EXPECT_EQ(11u, result->NextSafeToBreakOffset(9)); result->NextSafeToBreakOffset(i));
EXPECT_EQ(11u, result->NextSafeToBreakOffset(10)); if (i == safe_to_break_positions[compare_safe_to_break_position])
EXPECT_EQ(11u, result->NextSafeToBreakOffset(11)); compare_safe_to_break_position++;
EXPECT_EQ(12u, result->NextSafeToBreakOffset(12)); }
} }
// TODO(layout-dev): Expand RTL test coverage and add tests for mixed // TODO(layout-dev): Expand RTL test coverage and add tests for mixed
// directionality strings. // directionality strings.
// Test when some characters are missing in |runs_|. // Test when some characters are missing in |runs_|.
// RTL on Mac may not have runs for all characters. crbug.com/774034 TEST_P(ShapeParameterTest, SafeToBreakMissingRun) {
#if defined(OS_MACOSX)
#define MAYBE_SafeToBreakMissingRun DISABLED_SafeToBreakMissingRun
#else
#define MAYBE_SafeToBreakMissingRun SafeToBreakMissingRun
#endif
TEST_P(ShapeParameterTest, MAYBE_SafeToBreakMissingRun) {
TextDirection direction = GetParam(); TextDirection direction = GetParam();
scoped_refptr<ShapeResult> result = ShapeResult::Create(&font, 8, direction); scoped_refptr<ShapeResult> result = ShapeResult::Create(&font, 8, direction);
result->InsertRunForTesting(2, 1, direction, {0}); result->InsertRunForTesting(2, 1, direction, {0});
......
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