Add support for ASCII tags
This commit is contained in:
1 parent
daf23f34a0
commit
ff1d31533b
4 files changed
+54
-12
No files matched your search
+19
-1
@@ -1,7 +1,7 @@
|
||||
extern crate tiff;
|
||||
|
||||
use tiff::ColorType;
|
||||
use tiff::decoder::{Decoder, DecodingResult};
|
||||
use tiff::decoder::{Decoder, DecodingResult, ifd::Tag, ifd::Value};
|
||||
|
||||
use std::fs::File;
|
||||
|
||||
@@ -45,6 +45,24 @@ fn test_rgb_u16()
|
||||
assert!(img_res.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_tags()
|
||||
{
|
||||
// these files have null-terminated strings for their Software tag. One has extra bytes after
|
||||
// the null byte, so we check both to ensure that we're truncating properly
|
||||
let filenames = vec!["minisblack-1c-16b.tiff", "rgb-3c-16b.tiff"];
|
||||
for filename in filenames.iter() {
|
||||
let path = format!("./tests/images/{}", filename);
|
||||
let img_file = File::open(path).expect("can't open file");
|
||||
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
|
||||
let software= decoder.get_tag(Tag::Software).unwrap();
|
||||
match software {
|
||||
Value::Ascii(s) => assert_eq!(s, String::from("GraphicsMagick 1.2 unreleased Q16 http://www.GraphicsMagick.org/")),
|
||||
_ => assert!(false)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: GrayA support
|
||||
//#[test]
|
||||
//fn test_gray_alpha_u8()
|
||||
|
||||
Reference in new issue
Block a user