test(tests): R4.4 layout timing on L and CAP; ledger rows of the text and layout cases point at cargo
This commit is contained in:
1 parent
70007e0c93
commit
1550d2160a
3 files changed
+67
-17
No files matched your search
@@ -243,12 +243,12 @@ packages/pdf/tests/security.test.ts import: the report survives a rejected snaps
|
||||
packages/pdf/tests/security.test.ts import: the report survives a rejected snapshot > a view chain cycle → integrity ported cargo pdf_import::o7_locate_and_read_match_the_typescript O7 -
|
||||
packages/pdf/tests/security.test.ts import: the report survives a rejected snapshot > a dangling svg_asset_id → integrity ported cargo pdf_import::o7_locate_and_read_match_the_typescript O7 -
|
||||
packages/pdf/tests/security.test.ts import: the report survives a rejected snapshot > another sheet (sheet_mismatch) → sheet_mismatch ported cargo pdf_import::o7_locate_and_read_match_the_typescript O7 -
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > 1,025 annotations → snapshot_too_large ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > a 3 MiB asset → snapshot_too_large ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > 5 assets → snapshot_invalid ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > a dangling svg_asset_id → snapshot_invalid ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > another sheet → sheet_mismatch ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > too many observations or views per observation → too_many_pages ported R4.4/R4.5 cargo (pending) - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > 1,025 annotations → snapshot_too_large ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > a 3 MiB asset → snapshot_too_large ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > 5 assets → snapshot_invalid ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > a dangling svg_asset_id → snapshot_invalid ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > another sheet → sheet_mismatch ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts export: a snapshot over the caps fails with a typed error and no file > too many observations or views per observation → too_many_pages ported cargo pdf_layout::the_checks_refuse_what_export_ts_refused - typed export errors, no oracle file
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > <script>, on*, javascript: href, external <image>, <style> are gone from what is rasterised ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > the sanitiser names what it removed and clamps stdDeviation ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > CSS escapes, image-set and function calls in style or presentation attributes are removed ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
@@ -256,7 +256,7 @@ packages/pdf/tests/security.test.ts hostile SVG assets > a non-finite or empty v
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > <!ENTITY> and 257 <use> are refused: the export fails as snapshot_invalid ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > a huge root viewBox is clamped to a 1200×2400 raster ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
packages/pdf/tests/security.test.ts hostile SVG assets > horse.svg and paws-in-harmony.svg pass with nothing removed and an identical serialisation ported R4.4/R4.5 cargo (pending) - export SVG path; R4 refuses where the TS sanitised (A.3, RUST.md §9.4)
|
||||
packages/pdf/tests/security.test.ts __proto__ ids and the inflate bomb > report ids named __proto__ print raw and pollute nothing ported R4.4/R4.5 cargo (pending) O1 -
|
||||
packages/pdf/tests/security.test.ts __proto__ ids and the inflate bomb > report ids named __proto__ print raw and pollute nothing ported cargo pdf_layout::o1_draw_logs_match_the_typescript_at_full_precision O1 -
|
||||
packages/pdf/tests/security.test.ts __proto__ ids and the inflate bomb > inflates a normal payload and returns null for a 24 MB bomb ported cargo pdf_inflate::every_o9_row_matches_node, pdf_inflate::every_o7_flate_input_matches_node O7 -
|
||||
packages/pdf/tests/security.test.ts branding URL injection (HIGH) > writes /URI as the hex of the ASCII bytes, no UTF-16 BOM, and reloads to the URL ported R4.4/R4.5 cargo (pending) O2 link sink
|
||||
packages/pdf/tests/security.test.ts branding URL injection (HIGH) > a URL with a code point above 0x7e or below 0x21 throws branding_invalid at the sink ported R4.4/R4.5 cargo (pending) O2 link sink
|
||||
@@ -293,8 +293,8 @@ packages/pdf/tests/security.test.ts PNG budget (MEDIUM) > a 1 × 0 header logo f
|
||||
packages/pdf/tests/security.test.ts PNG budget (MEDIUM) > the real logos reach embedPng when the gate passes them ported R4.4/R4.5 cargo (pending) O6 -
|
||||
packages/pdf/tests/size.test.ts demo envelope size > nologos: stored attachment under 250,000 bytes ported R4.4/R4.5 cargo (pending) O2 E2 budget
|
||||
packages/pdf/tests/size.test.ts demo envelope size > logos: stored attachment under 250,000 bytes ported R4.4/R4.5 cargo (pending) O2 E2 budget
|
||||
packages/pdf/tests/text.test.ts safeText > keeps the WinAnsi glyphs the pages use ported R4.4/R4.5 cargo (pending) O4 -
|
||||
packages/pdf/tests/text.test.ts safeText > replaces unencodable glyphs by ? and strips control characters ported R4.4/R4.5 cargo (pending) O4 -
|
||||
packages/pdf/tests/text.test.ts safeText > wrapLines splits on any whitespace first, then makes each word safe ported R4.4/R4.5 cargo (pending) O4 -
|
||||
packages/pdf/tests/text.test.ts export with hostile text > a report with ⚠ in a comment exports; the glyph prints as ? ported R4.4/R4.5 cargo (pending) O4 -
|
||||
packages/pdf/tests/text.test.ts formatDate > formats an ISO date per locale and returns anything else unchanged ported R4.4/R4.5 cargo (pending) O5 -
|
||||
packages/pdf/tests/text.test.ts safeText > keeps the WinAnsi glyphs the pages use ported cargo pdf_text::safe_text_reproduces_every_oracle_range, pdf_text::safe_text_works_on_whole_strings O4 -
|
||||
packages/pdf/tests/text.test.ts safeText > replaces unencodable glyphs by ? and strips control characters ported cargo pdf_text::safe_text_reproduces_every_oracle_range, pdf_text::safe_text_works_on_whole_strings O4 -
|
||||
packages/pdf/tests/text.test.ts safeText > wrapLines splits on any whitespace first, then makes each word safe ported cargo pdf_text::wrap_lines_reproduces_every_case O4 -
|
||||
packages/pdf/tests/text.test.ts export with hostile text > a report with ⚠ in a comment exports; the glyph prints as ? ported cargo pdf_layout::o1_draw_logs_match_the_typescript_at_full_precision O4 the layout draws the safe text
|
||||
packages/pdf/tests/text.test.ts formatDate > formats an ISO date per locale and returns anything else unchanged ported cargo pdf_text::format_date_reproduces_the_intl_grid_and_the_others O6 -
|
||||
|
Can't render this file because it contains an unexpected character in line 44 and column 158.
|
@@ -343,3 +343,34 @@ fn page_caps_and_missing_rasters_behave_as_export_ts() {
|
||||
);
|
||||
assert_eq!(drawn.log.pages.len(), checked.report.observations.len() + 1);
|
||||
}
|
||||
|
||||
/// Layout cost on the synthetic L (60 observations) and CAP (500) reports, printed for
|
||||
/// RUST.md §10.6; a loose bound catches an order-of-magnitude regression only.
|
||||
#[test]
|
||||
fn layout_of_the_large_reports_stays_fast() {
|
||||
for (name, cap_ms) in [("L", 500), ("CAP", 4000)] {
|
||||
let mut input = export_input("demo", "fr", "logos");
|
||||
let text = std::fs::read_to_string(
|
||||
repo_root().join(format!("apps/app/tests/fixtures/r4/reports/{name}.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 rasters = stub_rasters(&input, "logos");
|
||||
let started = std::time::Instant::now();
|
||||
let checked = check_input(input).unwrap();
|
||||
let checks_ms = started.elapsed().as_millis();
|
||||
let started = std::time::Instant::now();
|
||||
let drawn = layout(&checked, &rasters).unwrap();
|
||||
let layout_ms = started.elapsed().as_millis();
|
||||
let ops: usize = drawn.log.pages.iter().map(|p| p.ops.len()).sum();
|
||||
println!(
|
||||
"{name}: {} pages, {ops} ops, {} embeds; checks {checks_ms} ms, layout {layout_ms} ms",
|
||||
drawn.log.pages.len(),
|
||||
drawn.log.embeds.len()
|
||||
);
|
||||
assert!(layout_ms < cap_ms, "{name}: layout {layout_ms} ms");
|
||||
}
|
||||
}
|
||||
+24
-5
@@ -70,6 +70,15 @@ const LOCATE = 'cargo pdf_import::o7_locate_and_read_match_the_typescript'
|
||||
const INFLATE =
|
||||
'cargo pdf_inflate::every_o9_row_matches_node, pdf_inflate::every_o7_flate_input_matches_node'
|
||||
const WRITER = 'R4.4/R4.5 cargo (pending)'
|
||||
// R4.4 targets: the layout and text suites (one cargo test checks every frozen row).
|
||||
const LAYOUT =
|
||||
'cargo pdf_layout::o1_draw_logs_match_the_typescript_at_full_precision'
|
||||
const CHECKS = 'cargo pdf_layout::the_checks_refuse_what_export_ts_refused'
|
||||
const SAFE_TEXT =
|
||||
'cargo pdf_text::safe_text_reproduces_every_oracle_range, pdf_text::safe_text_works_on_whole_strings'
|
||||
const WRAP = 'cargo pdf_text::wrap_lines_reproduces_every_case'
|
||||
const DATES =
|
||||
'cargo pdf_text::format_date_reproduces_the_intl_grid_and_the_others'
|
||||
const CARGO_GOLDENS = 'R4.4/R4.5 cargo goldens (pending)'
|
||||
const SAME = 'vitest (same case)'
|
||||
const NONE = '-'
|
||||
@@ -137,12 +146,12 @@ const RULES = [
|
||||
{
|
||||
file: SECURITY,
|
||||
title: '__proto__ ids and the inflate bomb > report ids named __proto__',
|
||||
...ported(WRITER, 'O1'),
|
||||
...ported(LAYOUT, 'O1'),
|
||||
},
|
||||
{
|
||||
file: SECURITY,
|
||||
title: 'export: a snapshot over the caps fails',
|
||||
...ported(WRITER, NONE, 'typed export errors, no oracle file'),
|
||||
...ported(CHECKS, NONE, 'typed export errors, no oracle file'),
|
||||
},
|
||||
{
|
||||
file: SECURITY,
|
||||
@@ -163,9 +172,19 @@ const RULES = [
|
||||
{
|
||||
file: `${PDF}text.test.ts`,
|
||||
title: 'formatDate > ',
|
||||
...ported(WRITER, 'O5'),
|
||||
...ported(DATES, 'O6'),
|
||||
},
|
||||
{ file: `${PDF}text.test.ts`, ...ported(WRITER, 'O4') },
|
||||
{
|
||||
file: `${PDF}text.test.ts`,
|
||||
title: 'safeText > wrapLines',
|
||||
...ported(WRAP, 'O4'),
|
||||
},
|
||||
{
|
||||
file: `${PDF}text.test.ts`,
|
||||
title: 'export with hostile text > ',
|
||||
...ported(LAYOUT, 'O4', 'the layout draws the safe text'),
|
||||
},
|
||||
{ file: `${PDF}text.test.ts`, ...ported(SAFE_TEXT, 'O4') },
|
||||
{ file: `${PDF}size.test.ts`, ...ported(WRITER, 'O2', 'E2 budget') },
|
||||
{ file: `${PDF}raster.test.ts`, ...ported(WRITER, 'O2/O4') },
|
||||
{ file: `${PDF}reexport.test.ts`, ...ported(WRITER, 'O2') },
|
||||
@@ -428,7 +447,7 @@ function cargoTests(file) {
|
||||
'-p',
|
||||
'faunosteo-core',
|
||||
'--features',
|
||||
'pdf-read',
|
||||
'pdf-read,pdf-write',
|
||||
'--locked',
|
||||
'--test',
|
||||
file,
|
||||
|
||||
Reference in new issue
Block a user