File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
tests/framework/src/runner Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ pub fn test(
152152 & difference_image,
153153 ImageFormat :: Png ,
154154 ) ?;
155+ print_outlier_table ( & difference_data) ;
155156 }
156157
157158 if is_alpha_different {
@@ -191,6 +192,36 @@ pub fn test(
191192 Ok ( ( ) )
192193}
193194
195+ fn print_outlier_table ( difference_data : & [ u8 ] ) {
196+ let mut count_per_differences = [ 0usize ; 256 ] ;
197+ let mut total_differences = 0 ;
198+
199+ for difference in difference_data {
200+ if * difference > 0 {
201+ total_differences += 1 ;
202+ count_per_differences[ * difference as usize ] += 1 ;
203+ }
204+ }
205+
206+ println ! ( "-- Color Differences --" ) ;
207+ println ! ( "Total > 0: {total_differences}" ) ;
208+ println ! ( "difference | amount | percent | withPriors | remaining" ) ;
209+ let total = total_differences as f64 ;
210+ let mut prior_count = 0 ;
211+ for ( i, count) in count_per_differences. iter ( ) . enumerate ( ) {
212+ if * count > 0 {
213+ prior_count += count;
214+ let pct = * count as f64 / total * 100.0 ;
215+ let pct_inc_below = prior_count as f64 / total * 100.0 ;
216+ let remaining = total_differences - prior_count;
217+ println ! (
218+ "{i:>10} | {count:>10} | {pct:>6.2}% | {pct_inc_below:>9.2}% | {remaining:>9}"
219+ ) ;
220+ }
221+ }
222+ println ! ( "-----" ) ;
223+ }
224+
194225fn calculate_difference_data (
195226 actual_image : & image:: RgbaImage ,
196227 expected_image : & image:: RgbaImage ,
You can’t perform that action at this time.
0 commit comments