| 98 | }; |
| 99 | |
| 100 | TEST_F(WordCachingTextShaperTest, canShapeByWord) { |
| 101 | WordCachingTextShaper textShaper(testTextShaper, WordCachingTextShaperStrategy::PrioritizeCorrectness); |
| 102 | |
| 103 | auto unicode = utf8ToUnicode("This is a sentence"); |
| 104 | |
| 105 | std::vector<ShapedGlyph> glyphs; |
| 106 | |
| 107 | textShaper.shape(unicode.data(), unicode.size(), *avenirNext, false, 1.0f, TextScript::invalid(), glyphs); |
| 108 | |
| 109 | ASSERT_EQ(static_cast<size_t>(4), testTextShaper->shapeRequests.size()); |
| 110 | |
| 111 | ASSERT_EQ("This", testTextShaper->shapeRequests[0].characters); |
| 112 | ASSERT_EQ("is", testTextShaper->shapeRequests[1].characters); |
| 113 | ASSERT_EQ("a", testTextShaper->shapeRequests[2].characters); |
| 114 | ASSERT_EQ("sentence", testTextShaper->shapeRequests[3].characters); |
| 115 | |
| 116 | for (const auto& shapeRequest : testTextShaper->shapeRequests) { |
| 117 | ASSERT_EQ(avenirNext, shapeRequest.font); |
| 118 | ASSERT_FALSE(shapeRequest.isRightToLeft); |
| 119 | ASSERT_EQ(1.0f, shapeRequest.letterSpacing); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | TEST_F(WordCachingTextShaperTest, avoidShapingWhenHittingKnownWords) { |
| 124 | WordCachingTextShaper textShaper(testTextShaper, WordCachingTextShaperStrategy::PrioritizeCorrectness); |