Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions crates/map/src/raster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ impl RasterLayer {
jobs.iter().map(|j| j.work.waiting.load(std::sync::atomic::Ordering::SeqCst)).sum()
}

/// How many light jobs it and its copies keep, including finished ones: for tests of whether
/// drawing started work, without starting any work through the inspection itself.
#[doc(hidden)]
pub fn cast_shadow_jobs(&self) -> usize {
self.cast.0.lock().unwrap_or_else(|e| e.into_inner()).len()
}

/// The light its cast shadows leave on each cell (see [`crate::shadow::light`]), when it is
/// drawn as Shaded Relief with shadows. Worked out once per pixels, band, sun, Z factor and
/// mask and kept: each owner's latest, and a few of suns left, for going back.
Expand Down
6 changes: 2 additions & 4 deletions crates/render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9589,6 +9589,7 @@ mod tests {
let m = export.join().unwrap();
assert!(waited, "the export waited for the far band's cast shadows");
let rl = m.layer(id).and_then(|l| l.raster.as_ref()).unwrap();
assert!(rl.cast_shadow_jobs() > 0, "completed light work remains observable");
assert!(matches!(rl.cast_shadows(false, (0, 0), || {}), rustgis_map::raster::CastShadows::Ready(_)), "and drew them");
}

Expand Down Expand Up @@ -9627,10 +9628,7 @@ mod tests {
}
render_complete(&mut m, &view).unwrap();
let rl = m.layer(id).and_then(|l| l.raster.as_ref()).unwrap();
assert!(
matches!(rl.cast_shadows(false, (0, 0), || {}), rustgis_map::raster::CastShadows::Pending),
"grouped {grouped}: nothing was worked out for it"
);
assert_eq!(rl.cast_shadow_jobs(), 0, "grouped {grouped}: no light work was started");
}
}

Expand Down
Loading