diff --git a/Cargo.toml b/Cargo.toml index d96d30f..54d7348 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,7 @@ text_image = [] [dev-dependencies] criterion = "0.8.0" +insta = "0.3" [profile.release] panic = "abort" diff --git a/tests/snapshots.rs b/tests/snapshots.rs new file mode 100644 index 0000000..75eecb8 --- /dev/null +++ b/tests/snapshots.rs @@ -0,0 +1,34 @@ +use aarty::{Config, TextImage, COLORS, REVERSE}; + +#[test] +fn test_snapshot_basic() { + let config = Config::new(vec![' ', '.', ',', '-', '~', '!', '*', '%', '$', '@', '#'].into()); + let ti = TextImage::new( + vec![ + vec![0, 128, 255], + vec![128, 255, 0], + ], + 2, + 3, + ); + let result = ti.to_text(&config); + insta::assert_snapshot!(result); +} + +#[test] +fn test_snapshot_colors() { + let config = Config::new(vec![' ', '.', ',', '-', '~', '!', '*', '%', '$', '@', '#'].into()) + .with_flags(COLORS); + let ti = TextImage::new(vec![vec![255, 0, 0]], 1, 1); + let result = ti.to_text(&config); + insta::assert_snapshot!(result); +} + +#[test] +fn test_snapshot_reverse_colors() { + let config = Config::new(vec![' ', '.', ',', '-', '~', '!', '*', '%', '$', '@', '#'].into()) + .with_flags(COLORS | REVERSE); + let ti = TextImage::new(vec![vec![255, 0, 0]], 1, 1); + let result = ti.to_text(&config); + insta::assert_snapshot!(result); +}