@@ -15,9 +15,9 @@ describe('resize.fromJson', () => {
1515 { actionType : 'fill' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'ocr' } , x : 4 , y : 5 } ,
1616 { actionType : 'limitFill' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 4 , y : 5 } ,
1717 { actionType : 'thumbnail' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , zoom : 4 } ,
18- { actionType : 'pad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 , background : 'white' } ,
19- { actionType : 'limitPad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 , background : 'white' } ,
20- { actionType : 'minimumPad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 , background : ' white'} ,
18+ { actionType : 'pad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 } ,
19+ { actionType : 'limitPad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 } ,
20+ { actionType : 'minimumPad' , dimensions : { width : 100 } , relative : true , gravity : { gravityType : 'direction' , compass : 'south' } , x : 3 , y :4 , background : { backgroundType : 'color' , color : ' white'} } ,
2121 {
2222 actionType : 'crop' ,
2323 dimensions : { width : 200 } ,
@@ -55,8 +55,8 @@ describe('resize.fromJson', () => {
5555 'c_fill,fl_relative,g_ocr_text,w_100,x_4,y_5' ,
5656 'c_lfill,fl_relative,g_south,w_100,x_4,y_5' ,
5757 'c_thumb,fl_relative,g_south,w_100,z_4' ,
58- 'b_white, c_pad,fl_relative,g_south,w_100,x_3,y_4' ,
59- 'b_white, c_lpad,fl_relative,g_south,w_100,x_3,y_4' ,
58+ 'c_pad,fl_relative,g_south,w_100,x_3,y_4' ,
59+ 'c_lpad,fl_relative,g_south,w_100,x_3,y_4' ,
6060 'b_white,c_mpad,fl_relative,g_south,w_100,x_3,y_4' ,
6161 'c_crop,g_auto:person_100:cat_avoid,w_200' ,
6262 'c_crop,g_dog:auto:bird_30:cat_avoid,w_200' ,
@@ -72,4 +72,52 @@ describe('resize.fromJson', () => {
7272 expect ( transformation ) . toMatchObject ( fromJson ( json ) ) ;
7373 expect ( transformation . toString ( ) ) . toStrictEqual ( fromJson ( json ) . toString ( ) ) ;
7474 } ) ;
75+
76+ it ( 'Should generate AutoBackground from model' , ( ) => {
77+ const transformation = fromJson ( [
78+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'auto' } } ,
79+ ] ) ;
80+
81+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_auto,c_pad,w_100' ) ;
82+ } ) ;
83+
84+ it ( 'Should generate ColorBackground from model' , ( ) => {
85+ const transformation = fromJson ( [
86+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'color' , color : 'red' } } ,
87+ ] ) ;
88+
89+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_red,c_pad,w_100' ) ;
90+ } ) ;
91+
92+ it ( 'Should generate BorderBackground from model' , ( ) => {
93+ const transformation = fromJson ( [
94+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'border' , contrast : true , palette : [ 'red' , 'blue' ] } } ,
95+ ] ) ;
96+
97+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_auto:border_contrast:palette_red_blue,c_pad,w_100' ) ;
98+ } ) ;
99+
100+ it ( 'Should generate BorderGradientBackground from model' , ( ) => {
101+ const transformation = fromJson ( [
102+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'borderGradient' , contrast : true , palette : [ 'red' , 'blue' ] , gradientColors : 4 , gradientDirection : 'diagonal_desc' } } ,
103+ ] ) ;
104+
105+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_auto:border_gradient_contrast:4:diagonal_desc:palette_red_blue,c_pad,w_100' ) ;
106+ } ) ;
107+
108+ it ( 'Should generate PredominantBackground from model' , ( ) => {
109+ const transformation = fromJson ( [
110+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'predominant' , contrast : true , palette : [ 'red' , 'blue' ] } } ,
111+ ] ) ;
112+
113+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_auto:predominant_contrast:palette_red_blue,c_pad,w_100' ) ;
114+ } ) ;
115+
116+ it ( 'Should generate PredominantGradientBackground from model' , ( ) => {
117+ const transformation = fromJson ( [
118+ { actionType : 'pad' , dimensions : { width : 100 } , background : { backgroundType : 'predominantGradient' , contrast : true , palette : [ 'red' , 'blue' ] , gradientColors : 4 , gradientDirection : 'diagonal_desc' } } ,
119+ ] ) ;
120+
121+ expect ( transformation . toString ( ) ) . toStrictEqual ( 'b_auto:predominant_gradient_contrast:4:diagonal_desc:palette_red_blue,c_pad,w_100' ) ;
122+ } ) ;
75123} ) ;
0 commit comments