16 {
17
18 struct Answer {
19 size_t glyphStartIndex, glyphEndIndex;
20 uint32_t utf8StartIndex, utf8EndIndex;
21 };
22
24 size_t utf8Len;
25 std::vector<uint32_t> clusters;
27 };
28
29 std::vector<TestCase> cases = {
30 { 1, {0}, {{0, 1, 0, 1}} },
31 { 1, {0, 0}, {{0, 2, 0, 1}} },
32 { 2, {0}, {{0, 1, 0, 2}} },
33 { 2, {0, 0, 0}, {{0, 3, 0, 2}} },
34 { 3, {0, 0}, {{0, 2, 0, 3}} },
35
36
37 { 2, {0, 1}, {{0, 1, 0, 1}, {1, 2, 1, 2}} },
38 { 2, {1, 0}, {{0, 1, 1, 2}, {1, 2, 0, 1}} },
39 { 2, {0, 0, 1}, {{0, 2, 0, 1}, {2, 3, 1, 2}} },
40 { 2, {1, 0, 0}, {{0, 1, 1, 2}, {1, 3, 0, 1}} },
41 { 2, {0, 1, 1}, {{0, 1, 0, 1}, {1, 3, 1, 2}} },
42 { 2, {1, 1, 0}, {{0, 2, 1, 2}, {2, 3, 0, 1}} },
43 { 3, {0, 0, 1}, {{0, 2, 0, 1}, {2, 3, 1, 3}} },
44 { 3, {1, 0, 0}, {{0, 1, 1, 3}, {1, 3, 0, 1}} },
45 { 3, {0, 1, 1}, {{0, 1, 0, 1}, {1, 3, 1, 3}} },
46 { 3, {1, 1, 0}, {{0, 2, 1, 3}, {2, 3, 0, 1}} },
47 { 4, {3, 2, 1, 0}, {{0, 1, 3, 4}, {1, 2, 2, 3}, {2, 3, 1, 2}, {3, 4, 0, 1}} },
48 };
49
50 for (auto& oneCase : cases) {
51 size_t answerCount = 0;
52 auto checker = [&](size_t glyphStartIndex, size_t glyphEndIndex,
53 uint32_t utf8StartIndex, uint32_t utf8EndIndex) {
54 if (answerCount < oneCase.answers.size()) {
55 Answer
a = oneCase.answers[answerCount];
60
61 } else {
63 }
64 answerCount++;
65 };
66
68 0, oneCase.utf8Len,
SkSpan(oneCase.clusters), checker);
70 }
71}
static const double answers[][2]
#define REPORTER_ASSERT(r, cond,...)
static void BreakupClusters(size_t utf8Begin, size_t utf8End, SkSpan< const uint32_t > clusters, const BreakupClustersCallback &processMToN)