From 8f6400a3998aeaa799303afb084ff20323c8e6f2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 28 Nov 2026 02:07:36 -0800 Subject: [PATCH] craft-cdr: pass the begin-page instruction's end to field_starts The header test calls field_starts, which now takes the end of the instruction it reads, so the test passes where the begin-page instruction ends. --- crates/cdr/tests/it/cmx_write.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cdr/tests/it/cmx_write.rs b/crates/cdr/tests/it/cmx_write.rs index d104bb4280..989205e635 100644 --- a/crates/cdr/tests/it/cmx_write.rs +++ b/crates/cdr/tests/it/cmx_write.rs @@ -1087,10 +1087,11 @@ fn the_header_repeats_the_first_pages_edges_and_instruction_count() { ]; let b = write_cmx(&drawing(pages)).unwrap().bytes; let cont = 12 + 8; - let page = page_index(&b)[0][0] + 8; + let chunk = page_index(&b)[0][0]; + let page = chunk + 8; // Begin page's field 1: the page number, the flags, the edges, the end offset, the layer count // and the instruction count. - let fields = field_starts(&b, page + 4); + let fields = field_starts(&b, page + 4, page + instruction_size(&b, page, page + u32_at(&b, chunk + 4))); assert_eq!(fields[0].0, 1); let f1 = fields[0].1; assert_eq!(&b[cont + 96..cont + 112], &b[f1 + 6..f1 + 22]);