Reuse closed events and line breaking after a checkpoint
This commit is contained in:
1 parent
fc6786d9f4
commit
393fba42d8
7 files changed
+140
-16
No files matched your search
@@ -367,6 +367,56 @@ fn atomic_definition(p: &Path, revision: u64, body: &str) -> ProjectDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resumed_suffix_reuses_search_for_unchanged_paragraphs() {
|
||||
let p = directory("resumed-paragraphs");
|
||||
let original = "The first paragraph contains a few distinct words.";
|
||||
let changed =
|
||||
"The first paragraph now occupies a different number of lines in the measured box.";
|
||||
let body = format!(
|
||||
r"
|
||||
\hsize=82pt \parindent=0pt \tolerance=10000 \pretolerance=10000
|
||||
\rightskip=0pt plus20pt \parfillskip=0pt plus1fil
|
||||
\shipout\hbox{{Stable first page}}
|
||||
\shipout\vbox{{
|
||||
\noindent {original}\par
|
||||
\noindent Second material remains in place while the first text changes its length.\par
|
||||
\noindent Each reused break still lays out the paragraph from the current measured nodes.\par
|
||||
}}
|
||||
\end
|
||||
"
|
||||
);
|
||||
let project = ProjectSnapshot::new(atomic_definition(&p, 1, &body)).unwrap();
|
||||
let first_request = request(&p)
|
||||
.with_project(project.clone())
|
||||
.observe_generated_initial();
|
||||
let compiler = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||
let first = compiler.compile(first_request.clone()).unwrap();
|
||||
assert_eq!(first.pages.len(), 2);
|
||||
|
||||
let edit = format!("{HEADER}{}", body.replace(original, changed));
|
||||
let edited = project
|
||||
.with_file_edits(
|
||||
2,
|
||||
BTreeMap::from([(p.join("main.tex"), Arc::from(edit.into_bytes()))]),
|
||||
)
|
||||
.unwrap();
|
||||
let repeat = first_request.with_project(edited);
|
||||
let resumed = compiler.compile(repeat.clone()).unwrap();
|
||||
let full = NativeCompiler::default().compile(repeat).unwrap();
|
||||
assert!(resumed.entry_checkpoint_work.reused_steps > 0);
|
||||
assert!(resumed.line_break_work.reused_passes >= 2);
|
||||
assert!(resumed.line_break_work.examined_edges < full.line_break_work.examined_edges);
|
||||
assert_eq!(resumed.pdf, full.pdf);
|
||||
assert_eq!(resumed.pages, full.pages);
|
||||
assert_eq!(resumed.source_map.pages, full.source_map.pages);
|
||||
assert_eq!(
|
||||
resumed.execution.execution_resources,
|
||||
full.execution.execution_resources
|
||||
);
|
||||
fs::remove_dir_all(p).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn library_cli_bytes_final_resource_closure_and_immutable_revision_match() {
|
||||
let p = directory("closure");
|
||||
|
||||
Reference in new issue
Block a user