Apply e-TeX line penalty arrays to native pagination

This commit is contained in:
gloamxun committed 2026-11-28 13:44:30 +08:00
1 parent 09cd19594c
commit c094d9a81d
12 files changed
+243 -24

No files matched your search

@@ -128,6 +128,43 @@ fn last_line_fit_reuses_the_selected_fill_only_for_the_same_parameter() {
assert_eq!((work.solved_passes, work.reused_passes), (2, 1));
}
#[test]
fn etex_penalty_arrays_index_actual_lines_across_display_and_reset_at_par() {
let execution = run(
r"\catcode36=3
\font\symbols=cmsy10 \textfont2=\symbols \scriptfont2=\symbols \scriptscriptfont2=\symbols
\font\extensions=cmex10 \textfont3=\extensions \scriptfont3=\extensions \scriptscriptfont3=\extensions
\pretolerance=10000 \tolerance=10000
\interlinepenalty=7
\clubpenalties=2 3 5
\widowpenalties=3 31 41 51
\displaywidowpenalties=3 80 90 100
\let\w=\widowpenalties
{\w=2 92 93 \message{LOCAL:\the\w0/\the\w9}}
\message{VALUES:\the\w-1/\the\w0/\the\w2/\the\numexpr\w20+1\relax}
\def\br{\hfil\penalty-10000\relax}
\setbox0=\vbox{\interlinepenalties=10 1 2 3 4 5 6 7 8 9 10
\noindent AA\br BB\br CC$$\hbox{DD}$$EE\br FF\br GG\par
\message{RESET:\the\interlinepenalties0/\the\clubpenalties0/\the\w0}
\noindent AA\br BB\par}",
);
let built = paragraphs(&execution);
assert_eq!(built.len(), 3);
assert_eq!(built[0].interline_penalties, [94, 87]);
assert_eq!(built[1].previous_lines, 6);
assert_eq!(built[1].interline_penalties, [51, 44]);
assert_eq!(built[2].interline_penalties, [41]);
let messages: Vec<_> = execution
.events
.iter()
.filter_map(|event| match event {
Event::Message { text, .. } => Some(text.as_str()),
_ => None,
})
.collect();
assert_eq!(messages, ["LOCAL:2/93", "VALUES:0/3/41/52", "RESET:0/2/3"]);
}
#[test]
fn native_parameters_have_scopes_and_par_end_timing() {
let e = run(