Skip to content

Commit

Permalink
Test checking comparison of images with different layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
serpent7776 committed Oct 2, 2024
1 parent ab3aa9f commit ff58a1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/Test_Core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ let test_blend_semi_transparent_color () =
test_blend 0. 128. 255. 51. 204. 229.6 255. 0.2;
test_blend 0. 128. 255. 128. 127. 191.25 255. 0.5

let test_different_layouts () =
Sys.getcwd () |> print_endline;
let img1 = Png.IO.loadImage "test-images/png/white4x4.png" in
let img2 = Png.IO.loadImage "test-images/png/purple8x8.png" in
let _, diffPixels, diffPercentage, _ =
PNG_Diff.compare img1 img2 ~outputDiffMask:false ~antialiasing:false ()
in
check int "diffPixels" 16 diffPixels;
check (float 0.001) "diffPercentage" 100.0 diffPercentage

let () =
run "CORE"
[
Expand All @@ -98,4 +108,9 @@ let () =
test_case "blend semi-transparent colors" `Quick
test_blend_semi_transparent_color;
] );
( "layoutDifference",
[
test_case "diff images with different layouts" `Quick
test_different_layouts;
] );
]
Binary file added test/test-images/png/purple8x8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/test-images/png/white4x4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff58a1e

Please sign in to comment.