| 118 | struct TextShaperTestContainer { |
| 119 | Ref<TextShaper> textShaper; |
| 120 | TextSegmentProperties segment; |
| 121 | std::vector<TextSegmentProperties> segments; |
| 122 | |
| 123 | TextShaperTestContainer() : segment(false, 0, 0, TextScript::invalid()) { |
| 124 | textShaper = TextShaper::make(true); |
| 125 | } |
| 126 | |
| 127 | void resolveSingleSegmentTextProperties(std::string str, bool isRightToLeft, bool expectsResolvedAsRightToLeft) { |
| 128 | resolveMultipleSegmentsTextProperties(str, isRightToLeft, expectsResolvedAsRightToLeft); |
| 129 | ASSERT_EQ(static_cast<size_t>(1), segments.size()); |
| 130 | |
| 131 | segment = segments[0]; |
| 132 | } |
| 133 | |
| 134 | void resolveMultipleSegmentsTextProperties(std::string str, bool isRightToLeft, bool expectsResolvedAsRightToLeft) { |
| 135 | segments.clear(); |
| 136 | |
| 137 | auto unicode = utf8ToUnicode(str); |
| 138 | auto paragraphList = textShaper->resolveParagraphs(unicode.data(), unicode.size(), isRightToLeft); |
| 139 | |
| 140 | ASSERT_EQ(static_cast<size_t>(1), paragraphList.size()); |
| 141 | ASSERT_EQ(expectsResolvedAsRightToLeft, paragraphList[0].baseDirectionIsRightToLeft); |
| 142 | |
| 143 | for (const auto& segment : paragraphList[0].segments) { |
| 144 | segments.emplace_back(segment); |
nothing calls this directly
no test coverage detected