@@ -635,6 +635,63 @@ Future<void> testMain() async {
635635 region: region,
636636 );
637637 }, skip: isFirefox);
638+
639+ test ('Paints two gradient with same width and different height' , () async {
640+ final RecordingCanvas canvas =
641+ RecordingCanvas (const Rect .fromLTRB (0 , 0 , 400 , 300 ));
642+ canvas.save ();
643+
644+ const List <Color > colors = < Color > [
645+ Color (0xFF000000 ),
646+ Color (0xFFFF3C38 ),
647+ Color (0xFFFF8C42 ),
648+ Color (0xFFFFF275 ),
649+ Color (0xFF6699CC ),
650+ Color (0xFF656D78 ),
651+ ];
652+
653+ const List <double > stops = < double > [0.0 , 0.05 , 0.4 , 0.6 , 0.9 , 1.0 ];
654+
655+ final Matrix4 transform = Matrix4 .identity ()
656+ ..translate (100 , 150 )
657+ ..scale (0.3 , 0.7 )
658+ ..rotateZ (0.5 );
659+
660+ final GradientSweep sweepGradient = GradientSweep (
661+ const Offset (0.5 , 0.5 ),
662+ colors,
663+ stops,
664+ TileMode .clamp,
665+ 0.0 ,
666+ 2 * math.pi,
667+ transform.storage,
668+ );
669+
670+ const double kBoxWidth = 150 ;
671+ const double kBoxHeight1 = 40 ;
672+ const double kBoxHeight2 = 80 ;
673+
674+ const Rect rectBounds1 = Rect .fromLTWH (10 , 20 , kBoxWidth, kBoxHeight1);
675+ const Rect rectBounds2 = Rect .fromLTWH (10 , 80 , kBoxWidth, kBoxHeight2);
676+ canvas.drawRect (
677+ rectBounds1,
678+ SurfacePaint ()
679+ ..shader = engineGradientToShader (sweepGradient, rectBounds1),
680+ );
681+ canvas.drawRect (
682+ rectBounds2,
683+ SurfacePaint ()
684+ ..shader = engineGradientToShader (sweepGradient, rectBounds2),
685+ );
686+
687+ canvas.restore ();
688+ await canvasScreenshot (
689+ canvas,
690+ 'radial_gradient_double_item' ,
691+ canvasRect: screenRect,
692+ region: region,
693+ );
694+ }, skip: isFirefox);
638695}
639696
640697Shader engineGradientToShader (GradientSweep gradient, Rect rect) {
0 commit comments