Index: Source/core/platform/graphics/FontTest.cpp |
diff --git a/Source/core/platform/graphics/FontTest.cpp b/Source/core/platform/graphics/FontTest.cpp |
index 8b9c784db4a1b82e346b50e04b5b4da724c0d98c..a5ee4f46ab166f61e92d23293121699ec6d6bcfd 100644 |
--- a/Source/core/platform/graphics/FontTest.cpp |
+++ b/Source/core/platform/graphics/FontTest.cpp |
@@ -33,484 +33,70 @@ |
namespace WebCore { |
-TEST(FontTest, TestCharacterRangeCodePath1) |
+static void TestSpecificUCharRange(UChar rangeStart, UChar rangeEnd) |
{ |
- static UChar c1[] = { 0x0 }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x2E4 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c3[] = { 0x2E5 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x2E8 }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x2E9 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c6[] = { 0x2EA }; |
- codePath = Font::characterRangeCodePath(c6, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath2) |
-{ |
- static UChar c1[] = { 0x2FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x300 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x330 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x36F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x370 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath3) |
-{ |
- static UChar c1[] = { 0x0590 }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x0591 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x05A0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x05BD }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x05BE }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c6[] = { 0x05BF }; |
- codePath = Font::characterRangeCodePath(c6, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c7[] = { 0x05C0 }; |
- codePath = Font::characterRangeCodePath(c7, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c8[] = { 0x05CF }; |
- codePath = Font::characterRangeCodePath(c8, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c9[] = { 0x05D0 }; |
- codePath = Font::characterRangeCodePath(c9, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath4) |
-{ |
- static UChar c1[] = { 0x05FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x0600 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x0700 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x109F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x10A0 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath5) |
-{ |
- static UChar c1[] = { 0x10FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1100 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x11A0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x11FF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x1200 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
+ UChar below[1]; |
+ UChar start[1]; |
+ UChar midway[1]; |
+ UChar end[1]; |
+ UChar above[1]; |
+ |
+ below[0] = rangeStart - 1; |
+ start[0] = rangeStart; |
+ midway[0] = ((int)rangeStart + (int)rangeEnd) / 2; |
+ end[0] = rangeEnd; |
+ above[0] = rangeEnd + 1; |
+ |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(below, 1)); |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(start, 1)); |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(midway, 1)); |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(end, 1)); |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(above, 1)); |
} |
-TEST(FontTest, TestCharacterRangeCodePath6) |
+TEST(FontTest, TestCharacterRangeCodePath) |
{ |
- static UChar c1[] = { 0x135C }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x135D }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x135E }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x135F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x1360 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath7) |
-{ |
- static UChar c1[] = { 0x16FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1700 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x1800 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x18AF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x18B0 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath8) |
-{ |
- static UChar c1[] = { 0x18FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1900 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x1940 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x194F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x1950 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath9) |
-{ |
- static UChar c1[] = { 0x197F }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1980 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x19D0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x19DF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x19E0 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath10) |
-{ |
- static UChar c1[] = { 0x19FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1A00 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x1C00 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x1CFF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x1D00 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath11) |
-{ |
- static UChar c1[] = { 0x1DBF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x1DC0 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x1DD0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x1DFF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x1E00 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath); |
- |
- static UChar c6[] = { 0x2000 }; |
- codePath = Font::characterRangeCodePath(c6, 1); |
- EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath); |
- |
- static UChar c7[] = { 0x2001 }; |
- codePath = Font::characterRangeCodePath(c7, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath12) |
-{ |
- static UChar c1[] = { 0x20CF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x20D0 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x20F0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x20FF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x2100 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath13) |
-{ |
- static UChar c1[] = { 0x2CED }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x2CEF }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x2CF0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x2CF1 }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x2CF2 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath14) |
-{ |
- static UChar c1[] = { 0x3029 }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0x302A }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0x302C }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0x302F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0x3030 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath15) |
-{ |
- static UChar c1[] = { 0xA67B }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xA67C }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xA67D }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xA67E }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath16) |
-{ |
- static UChar c1[] = { 0xA6E9 }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xA6F0 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xA6F1 }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xA6F2 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath17) |
-{ |
- static UChar c1[] = { 0xA7FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xA800 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0xAA00 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xABFF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xAC00 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath18) |
-{ |
- static UChar c1[] = { 0xD7AF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xD7B0 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0xD7F0 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xD7FF }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xD800 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath19) |
-{ |
- static UChar c1[] = { 0xFDFF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xFE00 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0xFE05 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xFE0F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xFE10 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
-} |
- |
-TEST(FontTest, TestCharacterRangeCodePath20) |
-{ |
- static UChar c1[] = { 0xFD1F }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
- static UChar c2[] = { 0xFE20 }; |
- codePath = Font::characterRangeCodePath(c2, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c3[] = { 0xFE28 }; |
- codePath = Font::characterRangeCodePath(c3, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c4[] = { 0xFE2F }; |
- codePath = Font::characterRangeCodePath(c4, 1); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
- static UChar c5[] = { 0xFE30 }; |
- codePath = Font::characterRangeCodePath(c5, 1); |
- EXPECT_EQ(Font::Simple, codePath); |
+ static UChar c1[] = { 0x0 }; |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c1, 1)); |
+ |
+ TestSpecificUCharRange(0x2E5, 0x2E9); |
+ TestSpecificUCharRange(0x300, 0x36F); |
+ TestSpecificUCharRange(0x0591, 0x05BD); |
+ TestSpecificUCharRange(0x05BF, 0x05CF); |
+ TestSpecificUCharRange(0x0600, 0x109F); |
+ TestSpecificUCharRange(0x1100, 0x11FF); |
+ TestSpecificUCharRange(0x135D, 0x135F); |
+ TestSpecificUCharRange(0x1700, 0x18AF); |
+ TestSpecificUCharRange(0x1900, 0x194F); |
+ TestSpecificUCharRange(0x1980, 0x19DF); |
+ TestSpecificUCharRange(0x1A00, 0x1CFF); |
+ |
+ static UChar c2[] = { 0x1DBF }; |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c2, 1)); |
+ static UChar c3[] = { 0x1DC0 }; |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c3, 1)); |
+ static UChar c4[] = { 0x1DD0 }; |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c4, 1)); |
+ static UChar c5[] = { 0x1DFF }; |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c5, 1)); |
+ static UChar c6[] = { 0x1E00 }; |
+ EXPECT_EQ(Font::SimpleWithGlyphOverflow, Font::characterRangeCodePath(c6, 1)); |
+ static UChar c7[] = { 0x2000 }; |
+ EXPECT_EQ(Font::SimpleWithGlyphOverflow, Font::characterRangeCodePath(c7, 1)); |
+ static UChar c8[] = { 0x2001 }; |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c8, 1)); |
+ |
+ TestSpecificUCharRange(0x20D0, 0x20FF); |
+ TestSpecificUCharRange(0x2CEF, 0x2CF1); |
+ TestSpecificUCharRange(0x302A, 0x302F); |
+ |
+ TestSpecificUCharRange(0xA67C, 0xA67D); |
+ TestSpecificUCharRange(0xA6F0, 0xA6F1); |
+ TestSpecificUCharRange(0xA800, 0xABFF); |
+ |
+ TestSpecificUCharRange(0xD7B0, 0xD7FF); |
+ TestSpecificUCharRange(0xFE00, 0xFE0F); |
+ TestSpecificUCharRange(0xFE20, 0xFE2F); |
} |
TEST(FontTest, TestCharacterRangeCodePathSurrogate1) |
@@ -521,123 +107,259 @@ TEST(FontTest, TestCharacterRangeCodePathSurrogate1) |
/* The following 5 should all be Simple because they are not surrogate. */ |
static UChar c1[] = { 0xD800, 0xDBFE }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c1, 2)); |
static UChar c2[] = { 0xD800, 0xE000 }; |
- codePath = Font::characterRangeCodePath(c2, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c2, 2)); |
static UChar c3[] = { 0xDBFF, 0xDBFE }; |
- codePath = Font::characterRangeCodePath(c3, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c3, 2)); |
static UChar c4[] = { 0xDBFF, 0xE000 }; |
- codePath = Font::characterRangeCodePath(c4, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c4, 2)); |
static UChar c5[] = { 0xDC00, 0xDBFF }; |
- codePath = Font::characterRangeCodePath(c5, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c5, 2)); |
/* To be Complex, the Supplementary Character must be in either */ |
/* U+1F1E6 through U+1F1FF or U+E0100 through U+E01EF. */ |
/* That is, a lead of 0xD83C with trail 0xDDE6 .. 0xDDFF or */ |
/* a lead of 0xDB40 with trail 0xDD00 .. 0xDDEF. */ |
static UChar c6[] = { 0xD83C, 0xDDE5 }; |
- codePath = Font::characterRangeCodePath(c6, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c6, 2)); |
static UChar c7[] = { 0xD83C, 0xDDE6 }; |
- codePath = Font::characterRangeCodePath(c7, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c7, 2)); |
static UChar c8[] = { 0xD83C, 0xDDF0 }; |
- codePath = Font::characterRangeCodePath(c8, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c8, 2)); |
static UChar c9[] = { 0xD83C, 0xDDFF }; |
- codePath = Font::characterRangeCodePath(c9, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c9, 2)); |
static UChar c10[] = { 0xD83C, 0xDE00 }; |
- codePath = Font::characterRangeCodePath(c10, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c10, 2)); |
static UChar c11[] = { 0xDB40, 0xDCFF }; |
- codePath = Font::characterRangeCodePath(c11, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c11, 2)); |
static UChar c12[] = { 0xDB40, 0xDD00 }; |
- codePath = Font::characterRangeCodePath(c12, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c12, 2)); |
static UChar c13[] = { 0xDB40, 0xDDED }; |
- codePath = Font::characterRangeCodePath(c13, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c13, 2)); |
static UChar c14[] = { 0xDB40, 0xDDEF }; |
- codePath = Font::characterRangeCodePath(c14, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c14, 2)); |
static UChar c15[] = { 0xDB40, 0xDDF0 }; |
- codePath = Font::characterRangeCodePath(c15, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c15, 2)); |
} |
TEST(FontTest, TestCharacterRangeCodePathString) |
{ |
// Simple-Simple is still simple |
static UChar c1[] = { 0x2FF, 0x2FF }; |
- Font::CodePath codePath = Font::characterRangeCodePath(c1, 2); |
- EXPECT_EQ(Font::Simple, codePath); |
- |
+ EXPECT_EQ(Font::Simple, Font::characterRangeCodePath(c1, 2)); |
// Complex-Simple is Complex |
static UChar c2[] = { 0x300, 0x2FF }; |
- codePath = Font::characterRangeCodePath(c2, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c2, 2)); |
// Simple-Complex is Complex |
static UChar c3[] = { 0x2FF, 0x330 }; |
- codePath = Font::characterRangeCodePath(c3, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c3, 2)); |
// Complex-Complex is Complex |
static UChar c4[] = { 0x36F, 0x330 }; |
- codePath = Font::characterRangeCodePath(c4, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c4, 2)); |
// SimpleWithGlyphOverflow-Simple is SimpleWithGlyphOverflow |
static UChar c5[] = { 0x1E00, 0x2FF }; |
- codePath = Font::characterRangeCodePath(c5, 2); |
- EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath); |
- |
+ EXPECT_EQ(Font::SimpleWithGlyphOverflow, Font::characterRangeCodePath(c5, 2)); |
// Simple-SimpleWithGlyphOverflow is SimpleWithGlyphOverflow |
static UChar c6[] = { 0x2FF, 0x2000 }; |
- codePath = Font::characterRangeCodePath(c6, 2); |
- EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath); |
- |
+ EXPECT_EQ(Font::SimpleWithGlyphOverflow, Font::characterRangeCodePath(c6, 2)); |
// SimpleWithGlyphOverflow-Complex is Complex |
static UChar c7[] = { 0x1E00, 0x330 }; |
- codePath = Font::characterRangeCodePath(c7, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c7, 2)); |
// Complex-SimpleWithGlyphOverflow is Complex |
static UChar c8[] = { 0x330, 0x2000 }; |
- codePath = Font::characterRangeCodePath(c8, 2); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c8, 2)); |
// Surrogate-Complex is Complex |
static UChar c9[] = { 0xD83C, 0xDDE5, 0x330 }; |
- codePath = Font::characterRangeCodePath(c9, 3); |
- EXPECT_EQ(Font::Complex, codePath); |
- |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c9, 3)); |
// Complex-Surrogate is Complex |
static UChar c10[] = { 0x330, 0xD83C, 0xDDE5 }; |
- codePath = Font::characterRangeCodePath(c10, 3); |
- EXPECT_EQ(Font::Complex, codePath); |
+ EXPECT_EQ(Font::Complex, Font::characterRangeCodePath(c10, 3)); |
} |
+static void TestSpecificUChar32RangeIdeograph(UChar32 rangeStart, UChar32 rangeEnd) |
+{ |
+ EXPECT_FALSE(Font::isCJKIdeograph(rangeStart - 1)); |
+ EXPECT_TRUE(Font::isCJKIdeograph(rangeStart)); |
+ EXPECT_TRUE(Font::isCJKIdeograph((UChar32)((uint64_t)rangeStart + (uint64_t)rangeEnd) / 2)); |
+ EXPECT_TRUE(Font::isCJKIdeograph(rangeEnd)); |
+ EXPECT_FALSE(Font::isCJKIdeograph(rangeEnd + 1)); |
+} |
+ |
+TEST(FontTest, TestIsCJKIdeograph) |
+{ |
+ // The basic CJK Unified Ideographs block. |
+ TestSpecificUChar32RangeIdeograph(0x4E00, 0x9FFF); |
+ // CJK Unified Ideographs Extension A. |
+ TestSpecificUChar32RangeIdeograph(0x3400, 0x4DBF); |
+ // CJK Unified Ideographs Extension A and Kangxi Radicals. |
+ TestSpecificUChar32RangeIdeograph(0x2E80, 0x2FDF); |
+ // CJK Strokes. |
+ TestSpecificUChar32RangeIdeograph(0x31C0, 0x31EF); |
+ // CJK Compatibility Ideographs. |
+ TestSpecificUChar32RangeIdeograph(0xF900, 0xFAFF); |
+ // CJK Unified Ideographs Extension B. |
+ TestSpecificUChar32RangeIdeograph(0x20000, 0x2A6DF); |
+ // CJK Unified Ideographs Extension C. |
+ // CJK Unified Ideographs Extension D. |
+ TestSpecificUChar32RangeIdeograph(0x2A700, 0x2B81F); |
+ // CJK Compatibility Ideographs Supplement. |
+ TestSpecificUChar32RangeIdeograph(0x2F800, 0x2FA1F); |
+} |
+ |
+static void TestSpecificUChar32RangeIdeographSymbol(UChar32 rangeStart, UChar32 rangeEnd) |
+{ |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(rangeStart - 1)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(rangeStart)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol((UChar32)((uint64_t)rangeStart + (uint64_t)rangeEnd) / 2)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(rangeEnd)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(rangeEnd + 1)); |
+} |
+ |
+TEST(FontTest, TestIsCJKIdeographOrSymbol) |
+{ |
+ // CJK Compatibility Ideographs Supplement. |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2C7)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2CA)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2CB)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2D9)); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2020)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2021)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2030)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x203B)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x203C)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2042)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2047)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2048)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2049)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2051)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x20DD)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x20DE)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2100)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2103)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2105)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2109)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x210A)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2113)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2116)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2121)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x212B)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x213B)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2150)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2151)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2152)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2156, 0x215A); |
+ TestSpecificUChar32RangeIdeographSymbol(0x2160, 0x216B); |
+ TestSpecificUChar32RangeIdeographSymbol(0x2170, 0x217B); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x217F)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2189)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2307)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2312)); |
+ |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0x23BD)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x23BE)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x23C4)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x23CC)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0x23CD)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x23CE)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2423)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2460, 0x2492); |
+ TestSpecificUChar32RangeIdeographSymbol(0x249C, 0x24FF); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25A0)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25A1)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25A2)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25AA)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25AB)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25B1)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25B2)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25B3)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25B6)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25B7)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25BC)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25BD)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25C0)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25C1)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25C6)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25C7)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25C9)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25CB)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25CC)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x25CE, 0x25D3); |
+ TestSpecificUChar32RangeIdeographSymbol(0x25E2, 0x25E6); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x25EF)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2600, 0x2603); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2605)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2606)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x260E)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2616)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2617)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2640)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2642)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2660, 0x266F); |
+ TestSpecificUChar32RangeIdeographSymbol(0x2672, 0x267D); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x26A0)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x26BD)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x26BE)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2713)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x271A)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x273F)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2740)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2756)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2776, 0x277F); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x2B1A)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x2FF0, 0x302F); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x3031)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x312F)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0x3130)); |
+ |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0x318F)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x3190)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x319F)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x31BF)); |
+ |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0x31FF)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x3200)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x3300)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x33FF)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0xF860, 0xF862); |
+ TestSpecificUChar32RangeIdeographSymbol(0xFE30, 0xFE4F); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0xFE10)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0xFE11)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0xFE12)); |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0xFE19)); |
+ |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0xFF0D)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0xFF1B)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0xFF1C)); |
+ EXPECT_FALSE(Font::isCJKIdeographOrSymbol(0xFF1E)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0xFF00, 0xFFEF); |
+ |
+ EXPECT_TRUE(Font::isCJKIdeographOrSymbol(0x1F100)); |
+ |
+ TestSpecificUChar32RangeIdeographSymbol(0x1F110, 0x1F129); |
+ TestSpecificUChar32RangeIdeographSymbol(0x1F130, 0x1F149); |
+ TestSpecificUChar32RangeIdeographSymbol(0x1F150, 0x1F169); |
+ TestSpecificUChar32RangeIdeographSymbol(0x1F170, 0x1F189); |
+ TestSpecificUChar32RangeIdeographSymbol(0x1F200, 0x1F6FF); |
+} |
} // namespace WebCore |