Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions crates/engine/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33388,10 +33388,14 @@ fn export_map_to_geotiff_draws_tile_layers_and_keeps_their_credits() {
drop(c);
s.map_mut().tiles.clear();
s.run("layer.addData", &json!({"path": broken.display().to_string()})).unwrap();
// Its file gone before the map is drawn.
let gone = s.map().tiles[0].url.clone();
std::fs::remove_file(&broken).unwrap();
s.map_mut().tiles[0].url = gone.replace("broken", "gone");
// Its file gone before the map is drawn: the layer points at an archive that isn't there.
// (Not by deleting `broken.mbtiles`: the session holds it open, and Windows refuses to
// delete an open file.)
let url = s.map().tiles[0].url.clone();
let gone = url.strip_suffix("broken.mbtiles").map(|head| format!("{head}gone.mbtiles"));
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
assert!(gone.is_some(), "{url}");
assert!(!dir.join("gone.mbtiles").exists());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (test assertion, low impact): this checks dir.join("gone.mbtiles"), which is a separately built path, not the path the layer will read (gone, derived from url). They match today because url starts with dir, but the assertion should check the layer's own target. Checking the same path the layer uses:

Suggested change
assert!(!dir.join("gone.mbtiles").exists());
assert!(!std::path::Path::new(&url).with_file_name("gone.mbtiles").exists());

Confidence: medium. Only test-assertion precision; the rest of the change looks correct. The mbtiles reader opens read-only (crates/data/src/mbtiles.rs:308), so the missing-file path is what the export exercises.

s.map_mut().tiles[0].url = gone.unwrap_or_default();
let n = s.notices.len();
s.run("share.exportMap", &json!({"path": path.display().to_string()})).unwrap();
// Said as a tile layer that couldn't be drawn, or (where the reader is slower to give up)
Expand Down
Loading