@@ -154,8 +154,8 @@ Future<bool> fuzzyGoldenImageCompare(
154154
155155 final Codec codec = await instantiateImageCodec (goldenData);
156156 final FrameInfo frame = await codec.getNextFrame ();
157- expect (frame.image.height, equals (image.width ));
158- expect (frame.image.width, equals (image.height ));
157+ expect (frame.image.height, equals (image.height ));
158+ expect (frame.image.width, equals (image.width ));
159159
160160 areEqual = await fuzzyCompareImages (frame.image, image);
161161 }
@@ -316,4 +316,45 @@ void main() {
316316 }
317317 expect (areEqual, true );
318318 });
319+
320+ test ('Path effects from Paragraphs do not affect further rendering' , () async {
321+ void drawText (Canvas canvas, String content, Offset offset,
322+ {TextDecorationStyle style = TextDecorationStyle .solid}) {
323+ final ParagraphBuilder builder = ParagraphBuilder (ParagraphStyle ());
324+ builder.pushStyle (TextStyle (
325+ decoration: TextDecoration .underline,
326+ decorationColor: const Color (0xFF0000FF ),
327+ fontSize: 10 ,
328+ color: const Color (0xFF000000 ),
329+ decorationStyle: style,
330+ ));
331+ builder.addText (content);
332+ final Paragraph paragraph = builder.build ();
333+ paragraph.layout (const ParagraphConstraints (width: 100 ));
334+ canvas.drawParagraph (paragraph, offset);
335+ }
336+
337+ final Image image = await toImage ((Canvas canvas) {
338+ canvas.drawColor (const Color (0xFFFFFFFF ), BlendMode .srcOver);
339+ final Paint paint = Paint ()
340+ ..style = PaintingStyle .stroke
341+ ..strokeWidth = 5 ;
342+ drawText (canvas, 'Hello World' , const Offset (20 , 10 ));
343+ canvas.drawCircle (const Offset (150 , 25 ), 15 , paint..color = const Color (0xFF00FF00 ));
344+ drawText (canvas, 'Regular text' , const Offset (20 , 60 ));
345+ canvas.drawCircle (const Offset (150 , 75 ), 15 , paint..color = const Color (0xFFFFFF00 ));
346+ drawText (canvas, 'Dotted text' , const Offset (20 , 110 ), style: TextDecorationStyle .dotted);
347+ canvas.drawCircle (const Offset (150 , 125 ), 15 , paint..color = const Color (0xFFFF0000 ));
348+ drawText (canvas, 'Dashed text' , const Offset (20 , 160 ), style: TextDecorationStyle .dashed);
349+ canvas.drawCircle (const Offset (150 , 175 ), 15 , paint..color = const Color (0xFFFF0000 ));
350+ drawText (canvas, 'Wavy text' , const Offset (20 , 210 ), style: TextDecorationStyle .wavy);
351+ canvas.drawCircle (const Offset (150 , 225 ), 15 , paint..color = const Color (0xFFFF0000 ));
352+ }, 200 , 250 );
353+ expect (image.width, equals (200 ));
354+ expect (image.height, equals (250 ));
355+
356+ final bool areEqual =
357+ await fuzzyGoldenImageCompare (image, 'dotted_path_effect_mixed_with_stroked_geometry.png' );
358+ expect (areEqual, true );
359+ }, skip: ! Platform .isLinux); // https://github.com/flutter/flutter/issues/53784
319360}
0 commit comments