Skip to content

Commit 78a9a05

Browse files
committed
update test
1 parent 6f16f0a commit 78a9a05

File tree

1 file changed

+55
-7
lines changed

1 file changed

+55
-7
lines changed

martin/src/cog/source.rs

+55-7
Original file line numberDiff line numberDiff line change
@@ -325,20 +325,14 @@ fn get_meta(path: &PathBuf) -> Result<Meta, FileError> {
325325
),
326326
&path,
327327
)?;
328-
let mut zoom_and_ifd: HashMap<u8, usize> = HashMap::new();
329-
let mut zoom_and_tile_across_down: HashMap<u8, (u32, u32)> = HashMap::new();
330-
331328
let nodata: Option<f64> = if let Ok(no_data) = decoder.get_tag_ascii_string(GdalNodata) {
332329
no_data.parse().ok()
333330
} else {
334331
None
335332
};
336333

337-
let images_ifd = get_images_ifd(&mut decoder, path);
338-
339334
let origin = get_origin(tie_points.as_deref(), transformations.as_deref(), path)?;
340335

341-
let mut resolutions = HashMap::new();
342336
let full_resolution =
343337
get_full_resolution(pixel_scale.as_deref(), transformations.as_deref(), path)?;
344338
let (full_width_pixel, full_length_pixel) = decoder.dimensions().map_err(|e| {
@@ -359,6 +353,12 @@ fn get_meta(path: &PathBuf) -> Result<Meta, FileError> {
359353
(full_width_pixel, full_length_pixel),
360354
(full_width, full_length),
361355
);
356+
let mut zoom_and_ifd: HashMap<u8, usize> = HashMap::new();
357+
let mut zoom_and_tile_across_down: HashMap<u8, (u32, u32)> = HashMap::new();
358+
359+
let mut resolutions = HashMap::new();
360+
361+
let images_ifd = get_images_ifd(&mut decoder, path);
362362

363363
for (idx, image_ifd) in images_ifd.iter().enumerate() {
364364
decoder
@@ -736,6 +736,54 @@ mod tests {
736736

737737
let meta = super::get_meta(&path).unwrap();
738738

739-
assert_yaml_snapshot!(meta, @r###""###)
739+
assert_yaml_snapshot!(meta, @r###"
740+
min_zoom: 0
741+
max_zoom: 3
742+
resolutions:
743+
2:
744+
- 20
745+
- 20
746+
- 0
747+
1:
748+
- 40
749+
- 40
750+
- 0
751+
0:
752+
- 10
753+
- 10
754+
- 0
755+
3:
756+
- 10
757+
- 10
758+
- 0
759+
zoom_and_ifd:
760+
3: 0
761+
1: 2
762+
0: 3
763+
2: 1
764+
zoom_and_tile_across_down:
765+
0:
766+
- 1
767+
- 1
768+
2:
769+
- 1
770+
- 1
771+
1:
772+
- 1
773+
- 1
774+
3:
775+
- 2
776+
- 2
777+
nodata: ~
778+
origin:
779+
- 1620750.2508
780+
- 4277012.7153
781+
- 0
782+
extent:
783+
- 1620750.2508
784+
- 4277012.7153
785+
- 1625870.2508
786+
- 4282132.7153
787+
"###)
740788
}
741789
}

0 commit comments

Comments
 (0)