Tests: a visible legacy name of the macro storage shape survives a save

The stash reads a legacy _sc_<key> name as data whether or not it is
hidden, so writing key macro_0 removed a person's visible _sc_macro_0
name with no word. The index allocator steps around that key as well;
this test fails without it.
This commit is contained in:
prxnvt
2026-10-24 23:45:04 -04:00
parent da439b71ed
commit 4c11929fe2
+13
View File
@@ -260,6 +260,19 @@ fn a_huge_visible_index_takes_no_part_in_numbering() {
assert_eq!(names_of(&back), names_of(&wb));
}
#[test]
fn a_visible_legacy_name_of_the_storage_shape_is_kept() {
// The stash reads a legacy `_sc_<key>` name as data whether or not it is hidden, so writing
// key `macro_0` would remove a person's visible `_sc_macro_0`. That key is stepped around too.
let mut wb = Workbook::new();
wb.macros.push(sample_macro("A"));
wb.names.push(visible("_sc_macro_0"));
let (raw, back) = xlsx_round_trip(&wb);
assert_eq!(raw, ["_sc_macro_0", "_gc_macro_1_0"]);
assert_eq!(back.macros, wb.macros);
assert_eq!(back.names, vec![visible("_sc_macro_0")]);
}
#[test]
fn a_name_defined_after_opening_does_not_block_the_next_save() {
// Once a file is open its macros are out of the names, so Define Name accepts a visible