Test that a stub decoder reaches the scan, the ladder and export
FR-RAW-2's "without changing callers" needs a test that would fail if a caller named the concrete decoder; passing a real RAW through rawler cannot tell the two apart, because both routes give the same answer. The decoder_seam tests hand a stub decoder, for a container no real decoder reads, to the catalog scan (read_metadata_only over a folder backend), the preview ladder (the remote two-stage fetch, an import's thumbnail and the viewer's no-GPU fallback) and export (open_for_export, skipped without an adapter). Each assertion is on something only the stub produces: its camera and date, a header fetched at its 64-byte budget rather than HEADER_BYTES, preview and sensor sizes turned by its orientation. Switching collect_metadata or make_thumbnail back to the free functions fails two of the three tests. The develop test_support module is widened to the crate so the export test shares the one headless GPU context the other tests use. The requirements note for FR-RAW-2 now records the trait as built and the second decoder as not.
This commit is contained in:
@@ -48,7 +48,7 @@ pub(super) const SEGMENT_PROXY_EDGE: u32 = 1600;
|
||||
/// the code they exercise left these three needed in most of the resulting
|
||||
/// files, so they live here once instead of being copied.
|
||||
#[cfg(test)]
|
||||
pub(super) mod test_support {
|
||||
pub(crate) mod test_support {
|
||||
use super::*;
|
||||
use dr_gpu::GpuContext;
|
||||
|
||||
@@ -142,7 +142,7 @@ pub(super) mod test_support {
|
||||
/// `OnceLock` rather than `lazy_static`: the initialiser runs once however
|
||||
/// many threads arrive together, and the losers block until it is done —
|
||||
/// which is precisely the property that was missing.
|
||||
pub(super) fn headless() -> Option<GpuContext> {
|
||||
pub(crate) fn headless() -> Option<GpuContext> {
|
||||
static SHARED: std::sync::OnceLock<Option<GpuContext>> = std::sync::OnceLock::new();
|
||||
SHARED
|
||||
.get_or_init(|| pollster::block_on(dr_gpu::GpuContext::new_headless()).ok())
|
||||
|
||||
Reference in New Issue
Block a user