@@ -67,6 +67,100 @@ fn test_trim_whitespace() {
6767}
6868
6969
70+ #[ test]
71+ fn test_trim_whitespace_with_padding ( ) {
72+
73+ compare_encoded (
74+ Some ( IoTestEnum :: Url ( "https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/whitespace-issue.png" . to_owned ( ) ) ) ,
75+ "trim_whitespace_with_padding" ,
76+ POPULATE_CHECKSUMS ,
77+ DEBUG_GRAPH ,
78+ Constraints {
79+ similarity : Similarity :: AllowDssimMatch ( 0.0 , 0.002 ) ,
80+ max_file_size : None
81+ } ,
82+ vec ! [
83+ Node :: CommandString {
84+ kind: CommandStringKind :: ImageResizer4 ,
85+ value: "trim.threshold=20&trim.percentpadding=0.5&bgcolor=gray" . to_owned( ) ,
86+ decode: Some ( 0 ) ,
87+ encode: Some ( 1 ) ,
88+ watermarks: None
89+ }
90+ ]
91+ ) ;
92+ }
93+ #[ test]
94+ fn test_trim_resize_whitespace_with_padding ( ) {
95+
96+ compare_encoded (
97+ Some ( IoTestEnum :: Url ( "https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/whitespace-issue.png" . to_owned ( ) ) ) ,
98+ "trim_resize_whitespace_with_padding" ,
99+ POPULATE_CHECKSUMS ,
100+ DEBUG_GRAPH ,
101+ Constraints {
102+ similarity : Similarity :: AllowDssimMatch ( 0.0 , 0.002 ) ,
103+ max_file_size : None
104+ } ,
105+ vec ! [
106+ Node :: CommandString {
107+ kind: CommandStringKind :: ImageResizer4 ,
108+ value: "w=450&h=450&scale=both&trim.threshold=20&trim.percentpadding=10&bgcolor=gray" . to_owned( ) ,
109+ decode: Some ( 0 ) ,
110+ encode: Some ( 1 ) ,
111+ watermarks: None
112+ }
113+ ]
114+ ) ;
115+ }
116+ #[ test]
117+ fn test_trim_resize_whitespace_without_padding ( ) {
118+
119+ compare_encoded (
120+ Some ( IoTestEnum :: Url ( "https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/whitespace-issue.png" . to_owned ( ) ) ) ,
121+ "trim_resize_whitespace_without_padding" ,
122+ POPULATE_CHECKSUMS ,
123+ DEBUG_GRAPH ,
124+ Constraints {
125+ similarity : Similarity :: AllowDssimMatch ( 0.0 , 0.002 ) ,
126+ max_file_size : None
127+ } ,
128+ vec ! [
129+ Node :: CommandString {
130+ kind: CommandStringKind :: ImageResizer4 ,
131+ value: "w=450&h=450&scale=both&trim.threshold=20&bgcolor=gray" . to_owned( ) ,
132+ decode: Some ( 0 ) ,
133+ encode: Some ( 1 ) ,
134+ watermarks: None
135+ }
136+ ]
137+ ) ;
138+ }
139+ #[ test]
140+ fn test_trim_whitespace_with_padding_no_resize ( ) {
141+
142+ compare_encoded (
143+ Some ( IoTestEnum :: Url ( "https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/whitespace-issue.png" . to_owned ( ) ) ) ,
144+ "trim_whitespace_with_padding_no_resize" ,
145+ POPULATE_CHECKSUMS ,
146+ DEBUG_GRAPH ,
147+ Constraints {
148+ similarity : Similarity :: AllowDssimMatch ( 0.0 , 0.002 ) ,
149+ max_file_size : None
150+ } ,
151+ vec ! [
152+ Node :: CommandString {
153+ kind: CommandStringKind :: ImageResizer4 ,
154+ value: "trim.threshold=20&trim.percentpadding=0.5&bgcolor=gray" . to_owned( ) ,
155+ decode: Some ( 0 ) ,
156+ encode: Some ( 1 ) ,
157+ watermarks: None
158+ }
159+ ]
160+ ) ;
161+ }
162+
163+
70164#[ test]
71165fn test_transparent_png_to_png ( ) {
72166 compare_encoded (
0 commit comments