Detect and correct non-optimal image orientation

cargo test passes
This commit is contained in:
Nathan Fiedler
2016-03-29 18:28:33 -07:00
parent 3732fd5747
commit faebc468ba
5 changed files with 47 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Nathan Fiedler
* Copyright 2015-2016 Nathan Fiedler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -133,3 +133,25 @@ fn test_get_image_property() {
assert!(missing_value.is_err());
assert_eq!("missing property", missing_value.unwrap_err());
}
#[test]
fn test_requires_orientation() {
START.call_once(|| {
magick_wand_genesis();
});
let wand = MagickWand::new();
assert!(wand.read_image("tests/data/IMG_5745.JPG").is_ok());
assert_eq!(false, wand.requires_orientation());
}
#[test]
fn test_auto_orient() {
START.call_once(|| {
magick_wand_genesis();
});
let wand = MagickWand::new();
assert!(wand.read_image("tests/data/IMG_5745_rotl.JPG").is_ok());
assert_eq!(true, wand.requires_orientation());
assert!(wand.auto_orient());
assert_eq!(false, wand.requires_orientation());
}