77
88namespace SixLabors . ImageSharp . Tests . Drawing
99{
10+ using System ;
11+
1012 [ GroupOutput ( "Drawing/GradientBrushes" ) ]
1113 public class FillRadialGradientBrushTests
1214 {
@@ -16,23 +18,23 @@ public void WithEqualColorsReturnsUnicolorImage<TPixel>(
1618 TestImageProvider < TPixel > provider )
1719 where TPixel : struct , IPixel < TPixel >
1820 {
19- using ( var image = provider . GetImage ( ) )
20- {
21- TPixel red = NamedColors < TPixel > . Red ;
22-
23- RadialGradientBrush < TPixel > unicolorRadialGradientBrush =
24- new RadialGradientBrush < TPixel > (
25- new SixLabors . Primitives . Point ( 0 , 0 ) ,
26- 100 ,
27- GradientRepetitionMode . None ,
28- new ColorStop < TPixel > ( 0 , red ) ,
29- new ColorStop < TPixel > ( 1 , red ) ) ;
21+ provider . VerifyOperation (
22+ image =>
23+ {
24+ TPixel red = NamedColors < TPixel > . Red ;
3025
31- image . Mutate ( x => x . Fill ( unicolorRadialGradientBrush ) ) ;
32- image . DebugSave ( provider ) ;
26+ var unicolorRadialGradientBrush =
27+ new RadialGradientBrush < TPixel > (
28+ new SixLabors . Primitives . Point ( 0 , 0 ) ,
29+ 100 ,
30+ GradientRepetitionMode . None ,
31+ new ColorStop < TPixel > ( 0 , red ) ,
32+ new ColorStop < TPixel > ( 1 , red ) ) ;
3333
34- image . CompareToReferenceOutput ( provider ) ;
35- }
34+ image . Mutate ( x => x . Fill ( unicolorRadialGradientBrush ) ) ;
35+ } ,
36+ false ,
37+ false ) ;
3638 }
3739
3840 [ Theory ]
@@ -47,20 +49,21 @@ public void WithDifferentCentersReturnsImage<TPixel>(
4749 int centerY )
4850 where TPixel : struct , IPixel < TPixel >
4951 {
50- using ( var image = provider . GetImage ( ) )
51- {
52- RadialGradientBrush < TPixel > brush =
53- new RadialGradientBrush < TPixel > (
54- new SixLabors . Primitives . Point ( centerX , centerY ) ,
55- image . Width / 2f ,
56- GradientRepetitionMode . None ,
57- new ColorStop < TPixel > ( 0 , NamedColors < TPixel > . Red ) ,
58- new ColorStop < TPixel > ( 1 , NamedColors < TPixel > . Yellow ) ) ;
52+ provider . VerifyOperation (
53+ image =>
54+ {
55+ var brush = new RadialGradientBrush < TPixel > (
56+ new SixLabors . Primitives . Point ( centerX , centerY ) ,
57+ image . Width / 2f ,
58+ GradientRepetitionMode . None ,
59+ new ColorStop < TPixel > ( 0 , NamedColors < TPixel > . Red ) ,
60+ new ColorStop < TPixel > ( 1 , NamedColors < TPixel > . Yellow ) ) ;
5961
60- image . Mutate ( x => x . Fill ( brush ) ) ;
61- image . DebugSave ( provider , $ "center{ centerX : D3} ,{ centerY : D3} ") ;
62- image . CompareToReferenceOutput ( provider ) ;
63- }
62+ image . Mutate ( x => x . Fill ( brush ) ) ;
63+ } ,
64+ $ "center({ centerX } ,{ centerY } )",
65+ false ,
66+ false ) ;
6467 }
6568 }
6669}
0 commit comments