Scripts: keep the preset-total test's titles within the title limit

The merge of main brought a 4,096-byte limit on a DocumentPreset title
(8ff8dbefc6), and document_preset_settings_are_held_to_a_total set
64,000-character titles, so the setter threw "the title is too long"
before the 16 MiB total was reached. The test now uses 4,096-byte titles
on 5,000 presets to reach the total, and reassigns a 4,000-character
title 5,000 times to show a reassigned setting counts only its new value.
This commit is contained in:
dotCooCoo committed 2026-11-28 02:21:18 -08:00
1 parent d3fc73b14c
commit 9e069427f1
1 file changed
+3 -3
+3 -3
View File
@@ -316,14 +316,14 @@ fn document_preset_settings_are_held_to_a_total() {
let (mut s, _, _) = doc();
let e = failure(
&mut s,
"var t = new Array(64001).join('x'), kept = []; for (var i = 0; i < 300; i++) { var p = new DocumentPreset(); p.title = t; kept.push(p); }",
"var t = new Array(4097).join('x'), kept = []; for (var i = 0; i < 5000; i++) { var p = new DocumentPreset(); p.title = t; kept.push(p); }",
);
assert!(e.contains("at most 16 MiB of settings"), "{e}");
let out = log(
&mut s,
"var t = new Array(64001).join('x'), p = new DocumentPreset(); for (var i = 0; i < 500; i++) p.title = t + i; vc.log(p.title.length);",
"var t = new Array(4001).join('x'), p = new DocumentPreset(); for (var i = 0; i < 5000; i++) p.title = t + i; vc.log(p.title.length);",
);
assert_eq!(out, vec![json!(64003)]);
assert_eq!(out, vec![json!(4004)]);
}
#[test]