add simple thumbnail resize test

This commit is contained in:
walter
2021-10-08 13:45:46 -04:00
parent 734a545847
commit f8685e8531

View File

@ -59,6 +59,29 @@ fn test_resize_image() {
assert_eq!(192, wand.get_image_height()); assert_eq!(192, wand.get_image_height());
} }
#[test]
fn test_thumbnail_image() {
START.call_once(|| {
magick_wand_genesis();
});
let wand = MagickWand::new();
assert!(wand.read_image("tests/data/IMG_5745.JPG").is_ok());
assert_eq!(512, wand.get_image_width());
assert_eq!(384, wand.get_image_height());
let halfwidth = match wand.get_image_width() {
1 => 1,
width => width / 2,
};
let halfheight = match wand.get_image_height() {
1 => 1,
height => height / 2,
};
wand.thumbnail_image(halfwidth, halfheight);
assert_eq!(256, wand.get_image_width());
assert_eq!(192, wand.get_image_height());
}
#[test] #[test]
fn test_read_from_blob() { fn test_read_from_blob() {
START.call_once(|| { START.call_once(|| {