Add a test file for little-endian data.
This commit is contained in:
parent
8f7f8afc35
commit
17344addcb
|
@ -191,6 +191,7 @@ impl<'a> ProvideUnit<'a> for &'a Exif {
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
|
use crate::tag::Context;
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -240,6 +241,35 @@ mod tests {
|
||||||
"10 deg 0 min 0 sec [GPSLatitudeRef missing]");
|
"10 deg 0 min 0 sec [GPSLatitudeRef missing]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn yaminabe() {
|
||||||
|
let file = File::open("tests/yaminabe.tif").unwrap();
|
||||||
|
let be = Reader::new().read_from_container(
|
||||||
|
&mut BufReader::new(&file)).unwrap();
|
||||||
|
let file = File::open("tests/yaminale.tif").unwrap();
|
||||||
|
let le = Reader::new().read_from_container(
|
||||||
|
&mut BufReader::new(&file)).unwrap();
|
||||||
|
assert!(!be.little_endian());
|
||||||
|
assert!(le.little_endian());
|
||||||
|
for exif in &[be, le] {
|
||||||
|
assert_eq!(exif.fields().len(), 26);
|
||||||
|
let f = exif.get_field(Tag::ImageWidth, In(0)).unwrap();
|
||||||
|
assert_eq!(f.display_value().to_string(), "17");
|
||||||
|
let f = exif.get_field(Tag::Humidity, In(0)).unwrap();
|
||||||
|
assert_eq!(f.display_value().to_string(), "65");
|
||||||
|
let f = exif.get_field(Tag(Context::Tiff, 65000), In(0)).unwrap();
|
||||||
|
match f.value {
|
||||||
|
Value::Float(ref v) => assert_eq!(v[0], f32::MIN),
|
||||||
|
_ => panic!(),
|
||||||
|
}
|
||||||
|
let f = exif.get_field(Tag(Context::Tiff, 65001), In(0)).unwrap();
|
||||||
|
match f.value {
|
||||||
|
Value::Double(ref v) => assert_eq!(v[0], f64::MIN),
|
||||||
|
_ => panic!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn heif() {
|
fn heif() {
|
||||||
let file = std::fs::File::open("tests/exif.heic").unwrap();
|
let file = std::fs::File::open("tests/exif.heic").unwrap();
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue