| Index: third_party/WebKit/Source/platform/fonts/FontTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/fonts/FontTest.cpp b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
|
| index c38c10dba6bf2e3c0622969c92a96726d389231d..26a0ff572b1178cbc55cdc4a0c9e39d548e68d1e 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/FontTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
|
| @@ -348,5 +348,45 @@ TEST(FontTest, TestIsCJKIdeographOrSymbol)
|
| TestSpecificUChar32RangeIdeographSymbol(0x1F200, 0x1F6FF);
|
| }
|
|
|
| -} // namespace blink
|
| +void measureUScript(UChar32 min, UChar32 max, UScriptCode* scripts)
|
| +{
|
| + for (UChar32 ch = min; ch <= max; ch++) {
|
| + UErrorCode status = U_ZERO_ERROR;
|
| + UScriptCode script = uscript_getScript(ch, &status);
|
| + if (U_FAILURE(status)) {
|
| + if (scripts)
|
| + *scripts++ = USCRIPT_INVALID_CODE;
|
| + continue;
|
| + }
|
| + if (scripts)
|
| + *scripts++ = script;
|
| + }
|
| +}
|
|
|
| +void measureIsCJKIdeographOrSymbol(UChar32 min, UChar32 max, bool* results)
|
| +{
|
| + for (UChar32 ch = min; ch <= max; ch++) {
|
| + bool result = Character::isCJKIdeographOrSymbol(ch);
|
| + if (results)
|
| + *results++ = result;
|
| + }
|
| +}
|
| +
|
| +#define P(name, min, max, iteration) \
|
| +TEST(FontTest, Perf ## name ## UScript) \
|
| +{ \
|
| + for (int i = 0; i < iteration; i++) \
|
| + measureUScript(min, max, nullptr); \
|
| +} \
|
| +TEST(FontTest, Perf ## name ## IsCJKIdeographOrSymbol) \
|
| +{ \
|
| + for (int i = 0; i < iteration; i++) \
|
| + measureIsCJKIdeographOrSymbol(min, max, nullptr); \
|
| +}
|
| +P(All, 0x0000, 0x1FFFFF, 10)
|
| +P(ASCII, 0x0020, 0x007E, 100000)
|
| +P(Han, 0x4E00, 0x9FFF, 1000)
|
| +P(Hira, 0x3041, 0x3093, 10000)
|
| +P(Arabic, 0x0600, 0x06FF, 10000)
|
| +
|
| +} // namespace blink
|
|
|