test(tests): R4.5 timing of the L export with real rasters (ignored by default, release only)

This commit is contained in:
bchanot committed 2026-10-18 23:28:45 +02:00
1 parent ba6ac078be
commit babe7b76d2
1 file changed
+31 -4
+31 -4
View File
@@ -781,15 +781,13 @@ fn export_side_security_cases_hold() {
);
let text = String::from_utf8_lossy(&stub_run("demo", "fr", "logos").r4).into_owned();
assert!(!text.contains("/URI ("), "URIs are written as hex strings");
assert!(
text.contains(&format!(
assert!(text.contains(&format!(
"/URI <{}>",
"https://faunosteo.com"
.bytes()
.map(|b| format!("{b:02x}"))
.collect::<String>()
))
);
)));
// A refused PNG logo: the slot fails alone, the export completes with the warning.
let mut bad_logo = envelope.clone();
bad_logo["branding"]["headerLogo"] = json!({ "kind": "png", "base64": "iVBORw0KGgo=" });
@@ -804,3 +802,32 @@ fn export_side_security_cases_hold() {
);
assert!(read_attached_document(&result.pdf, ProbeLimits::PRODUCTION).is_ok());
}
/// The writer's own cost on the L report with a real 1200 × 943 raster for every view (what
/// the browser produces), printed for RUST.md §10.7: the one-shot proofs export measured in
/// Node adds its JSON and base64 copies on top of this. 5 s in release, 40 s in debug, so
/// it runs on request: `cargo test --release … --test pdf_serialize -- --ignored`.
#[test]
#[ignore = "release-only timing (40 s in debug)"]
fn l_report_with_real_rasters_costs_what_it_costs() {
let r3 = fixture("pdf/r3/demo.fr.logos.pdf");
let mut input = input_from(&envelope_of(&r3));
let text =
std::fs::read_to_string(repo_root().join("apps/app/tests/fixtures/r4/reports/L.json"))
.unwrap();
let mut report: faunosteo_core::domain::report::Report =
serde_json::from_value(parse_json(&text).unwrap()).unwrap();
report.sheet = input.report.sheet.clone();
input.report = report;
let raster = fixture("pdf/r3/real/raster-1.png");
let rasters = stub_rasters(&input, &raster);
let started = std::time::Instant::now();
let result = export_pdf(input, &rasters).unwrap();
let ms = started.elapsed().as_millis();
println!(
"L with real rasters: {} views, pdf {} bytes, {ms} ms (export incl. self-check)",
rasters.views.len(),
result.pdf.len()
);
assert!(result.warnings.is_empty());
}