Skip to content

Commit cb60c6a

Browse files
clydecbrownlostwaldclaude
committed
upstream #3782: the web wire test compares with the engine's CPU render
Adapted from upstream #3782: wire_job_renders_like_the_engine compared the worker's render with the native thumbnail job, which uses a GPU once another test in the process has set one up, so Chromaforge allowed the GPU's 3 LSB (6a97568). It now renders the job's source with the engine's CPU pipeline and asserts the pixels and histogram are identical, whatever the test order: an exact check of the serialized job again. Test only. Adapted from upstream commit c363ba3cbc. Sources: upstream #3782, commit c363ba3cbc. Co-authored-by: lostwald <lars.ostwald@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a071c6a commit cb60c6a

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎apps/web/src/wire.rs‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,15 +469,14 @@ mod tests {
469469
let mut core = WorkerCore::default();
470470
assert_eq!(core.needs_original(&wire), None, "demo scenes are generated");
471471
let a = core.render(&wire, None).unwrap();
472-
let b = job.run().rendered.unwrap();
472+
// The worker uses the CPU. A native thumbnail job may use an already initialized GPU,
473+
// so exact serialization parity must use the engine's CPU reference, regardless of test
474+
// order. The window tests separately check native CPU/GPU equivalence.
475+
let source = job.source.load_source().unwrap();
476+
let b = lcc_engine::pipeline::render(&source.image, &source.info_or(job.info), &job.settings, &job.request);
473477
assert_eq!((a.image.width, a.image.height), (b.image.width, b.image.height));
474-
// the worker renders on the CPU; the engine job uses a GPU once another test in this process
475-
// has set one up: within docs/gpu-pipeline.md's bound (≤ 3 LSB per channel), as for windows
476-
let max = a.image.data.iter().zip(&b.image.data).flat_map(|(p, q)| (0..3).map(move |c| p[c].abs_diff(q[c]))).max();
477-
assert!(max.is_some_and(|m| m <= 3), "max channel difference {max:?}");
478-
if a.image.data == b.image.data {
479-
assert_eq!(a.histogram, b.histogram);
480-
}
478+
assert_eq!(a.image.data, b.image.data);
479+
assert_eq!(a.histogram, b.histogram);
481480
}
482481

483482
#[test]

0 commit comments

Comments
 (0)