@@ -901,13 +901,21 @@ std::vector<DisplayListInvocationGroup> CreateAllRenderingOps() {
901901 {" DrawTextBlob" ,
902902 {
903903 {1 , 24 , 1 , 24 ,
904- [](DlOpReceiver& r) { r.drawTextBlob (TestBlob1, 10 , 10 ); }},
904+ [](DlOpReceiver& r) {
905+ r.drawTextBlob (GetTestTextBlob (1 ), 10 , 10 );
906+ }},
905907 {1 , 24 , 1 , 24 ,
906- [](DlOpReceiver& r) { r.drawTextBlob (TestBlob1, 20 , 10 ); }},
908+ [](DlOpReceiver& r) {
909+ r.drawTextBlob (GetTestTextBlob (1 ), 20 , 10 );
910+ }},
907911 {1 , 24 , 1 , 24 ,
908- [](DlOpReceiver& r) { r.drawTextBlob (TestBlob1, 10 , 20 ); }},
912+ [](DlOpReceiver& r) {
913+ r.drawTextBlob (GetTestTextBlob (1 ), 10 , 20 );
914+ }},
909915 {1 , 24 , 1 , 24 ,
910- [](DlOpReceiver& r) { r.drawTextBlob (TestBlob2, 10 , 10 ); }},
916+ [](DlOpReceiver& r) {
917+ r.drawTextBlob (GetTestTextBlob (2 ), 10 , 10 );
918+ }},
911919 }},
912920 // The -1 op counts below are to indicate to the framework not to test
913921 // SkCanvas conversion of these ops as it converts the operation into a
@@ -966,5 +974,26 @@ std::vector<DisplayListInvocationGroup> CreateAllGroups() {
966974 return result;
967975}
968976
977+ SkFont CreateTestFontOfSize (SkScalar scalar) {
978+ static constexpr const char * kTestFontFixture = " Roboto-Regular.ttf" ;
979+ auto mapping = flutter::testing::OpenFixtureAsSkData (kTestFontFixture );
980+ FML_CHECK (mapping);
981+ return SkFont{SkTypeface::MakeFromData (mapping), scalar};
982+ }
983+
984+ sk_sp<SkTextBlob> GetTestTextBlob (int index) {
985+ static std::map<int , sk_sp<SkTextBlob>> text_blobs;
986+ auto it = text_blobs.find (index);
987+ if (it != text_blobs.end ()) {
988+ return it->second ;
989+ }
990+ std::string text = " TestBlob" + std::to_string (index);
991+ sk_sp<SkTextBlob> blob =
992+ SkTextBlob::MakeFromText (text.c_str (), text.size (),
993+ CreateTestFontOfSize (20 ), SkTextEncoding::kUTF8 );
994+ text_blobs.insert (std::make_pair (index, blob));
995+ return blob;
996+ }
997+
969998} // namespace testing
970999} // namespace flutter
0 commit comments