Skip to content

Commit fa21a4a

Browse files
committed
Added another test with more varied values
1 parent 3c89002 commit fa21a4a

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

examples/read_tags.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ fn main() -> Result<(), Box<dyn Error>> {
1010

1111
println!("IPTC: {:?}", iptc.get_all());
1212

13-
let city = iptc.get(IPTCTag::City);
1413
let keywords = iptc.get(IPTCTag::Keywords);
1514

16-
println!("city: {}", city);
1715
println!("keywords: {}", keywords);
1816
Ok(())
1917
}

tests/DSC00512.jpg

778 KB
Loading

tests/jpeg-read.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,29 @@ fn exiv2_iptc_example() -> Result<(), Box<dyn Error>> {
3232

3333
Ok(())
3434
}
35+
36+
#[test]
37+
fn street_photo_example() -> Result<(), Box<dyn Error>> {
38+
let image_path = Path::new("tests/DSC00512.jpg");
39+
let iptc = IPTC::read_from_path(&image_path)?;
40+
41+
let tags = iptc.get_all();
42+
println!("IPTC: {:?}", tags);
43+
44+
let date_created = iptc.get(IPTCTag::DateCreated);
45+
assert_eq!(date_created, "20190519");
46+
47+
let time_created = iptc.get(IPTCTag::TimeCreated);
48+
assert_eq!(time_created, "162932+0000");
49+
50+
let keywords = iptc.get(IPTCTag::Keywords);
51+
assert_eq!(keywords, "London, England, Street, Night");
52+
53+
let city = iptc.get(IPTCTag::City);
54+
assert_eq!(city, "London");
55+
56+
let country = iptc.get(IPTCTag::CountryOrPrimaryLocationName);
57+
assert_eq!(country, "UK");
58+
59+
Ok(())
60+
}

0 commit comments

Comments
 (0)