Skip to content

Commit

Permalink
Add a test for the dzi dezoomer
Browse files Browse the repository at this point in the history
See #45
  • Loading branch information
lovasoa committed May 19, 2020
1 parent a5d237f commit ef04ada
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/dzi/dzi_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,22 @@ fn test_dzi() {
<Size Height="3852" Width="5393"/>
</Image>"#,
)
.unwrap();
.unwrap();
assert_eq!(dzi.get_size().unwrap(), Vec2d { x: 5393, y: 3852 });
assert_eq!(dzi.get_tile_size(), Vec2d { x: 256, y: 256 });
assert_eq!(dzi.max_level(), 13);
}

#[test]
fn test_dzi_with_doctype() {
// See https://github.com/lovasoa/dezoomify-rs/issues/45
let dzi: DziFile = serde_xml_rs::from_str(
r#"<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="256" Overlap="0" Format="jpg" xmlns="http://schemas.microsoft.com/deepzoom/2008">
<Size Width="6261" Height="6047" />
</Image>"#,
).unwrap();
assert_eq!(dzi.get_size().unwrap(), Vec2d { x: 6261, y: 6047 });
assert_eq!(dzi.get_tile_size(), Vec2d { x: 256, y: 256 });
assert_eq!(dzi.max_level(), 13);
}

0 comments on commit ef04ada

Please sign in to comment.