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.
This commit is contained in:
dotCooCoo committed 2026-11-28 02:07:36 -08:00
1 parent ad39ddbb65
commit 8f6400a399
1 file changed
+3 -2
+3 -2
View File
@@ -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]);