Test with some flexibility in image size
The size of the image can vary from version to version (of ImageMagick) and platform to platform (i.e. MacOS and FreeBSD). As such, allow for a degree of variability in the resulting image size. cargo test passes
This commit is contained in:
20
tests/lib.rs
20
tests/lib.rs
@ -91,12 +91,10 @@ fn test_write_image_to_blob() {
|
|||||||
assert_eq!(512, wand.get_image_width());
|
assert_eq!(512, wand.get_image_width());
|
||||||
assert_eq!(384, wand.get_image_height());
|
assert_eq!(384, wand.get_image_height());
|
||||||
let blob = wand.write_image_blob("jpeg").unwrap();
|
let blob = wand.write_image_blob("jpeg").unwrap();
|
||||||
if cfg!(target_os = "macos") {
|
let blob_len = blob.len();
|
||||||
// yeah, don't know why...
|
// There is a slight degree of variability from platform to platform,
|
||||||
assert_eq!(104061, blob.len());
|
// and version to version of ImageMagick.
|
||||||
} else {
|
assert!(blob_len > 103000 && blob_len < 105000);
|
||||||
assert_eq!(104060, blob.len());
|
|
||||||
}
|
|
||||||
// should be able to read it back again
|
// should be able to read it back again
|
||||||
assert!(wand.read_image_blob(&blob).is_ok());
|
assert!(wand.read_image_blob(&blob).is_ok());
|
||||||
assert_eq!(512, wand.get_image_width());
|
assert_eq!(512, wand.get_image_width());
|
||||||
@ -113,12 +111,10 @@ fn test_write_images_to_blob() {
|
|||||||
assert_eq!(512, wand.get_image_width());
|
assert_eq!(512, wand.get_image_width());
|
||||||
assert_eq!(384, wand.get_image_height());
|
assert_eq!(384, wand.get_image_height());
|
||||||
let blob = wand.write_images_blob("jpeg").unwrap();
|
let blob = wand.write_images_blob("jpeg").unwrap();
|
||||||
if cfg!(target_os = "macos") {
|
let blob_len = blob.len();
|
||||||
// yeah, don't know why...
|
// There is a slight degree of variability from platform to platform,
|
||||||
assert_eq!(104061, blob.len());
|
// and version to version of ImageMagick.
|
||||||
} else {
|
assert!(blob_len > 103000 && blob_len < 105000);
|
||||||
assert_eq!(104060, blob.len());
|
|
||||||
}
|
|
||||||
// should be able to read it back again
|
// should be able to read it back again
|
||||||
assert!(wand.read_image_blob(&blob).is_ok());
|
assert!(wand.read_image_blob(&blob).is_ok());
|
||||||
assert_eq!(512, wand.get_image_width());
|
assert_eq!(512, wand.get_image_width());
|
||||||
|
|||||||
Reference in New Issue
Block a user