MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

snap_drawing/test/src/TextLayout_Tests.cpp:120–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118struct 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);

Callers

nothing calls this directly

Calls 15

utf8ToUnicodeFunction · 0.85
toJSONValueFunction · 0.85
makeTextLayoutJSONFunction · 0.85
TextLayoutEntryClass · 0.85
setIncludeSegmentsMethod · 0.80
fitsInMaxSizeMethod · 0.80
toJSONValueMethod · 0.80
setLineBreakStrategyMethod · 0.80

Tested by

no test coverage detected