Reuse route-D page checkpoints in project previews

This commit is contained in:
gloamxun committed 2026-10-20 23:13:49 +08:00
1 parent fe7fd68321
commit ea69301804
5 files changed
+139 -12

No files matched your search

+44
View File
@@ -280,6 +280,50 @@ fn project_preview_can_switch_to_route_d() {
.is_some_and(|pages| !pages.is_empty())
);
assert_eq!(value["pageHeightPt"], 792);
let page_count = value["pageCount"].as_u64().unwrap();
let again = server.request(
"POST",
"/api/projects/hello/preview?engine=route-d",
&[],
"application/json",
);
assert_eq!(again.status, 200, "{}", again.text());
let again: Value = serde_json::from_slice(&again.body).expect("repeat preview JSON");
assert_eq!(again["changedPages"], serde_json::json!([]));
assert_eq!(again["recomputedPages"], 0);
assert_eq!(again["pageCount"].as_u64().unwrap(), page_count);
let raw = server.get("/api/projects/hello/raw?path=hello.tex");
assert_eq!(raw.status, 200);
let edited = raw
.text()
.replacen("Compatibility examples", "Compatibility examples edited", 1);
let put = server.request(
"PUT",
"/api/projects/hello/file?path=hello.tex",
edited.as_bytes(),
"text/plain; charset=utf-8",
);
assert_eq!(put.status, 200, "{}", put.text());
let incremental = server.request(
"POST",
"/api/projects/hello/preview?engine=route-d",
&[],
"application/json",
);
assert_eq!(incremental.status, 200, "{}", incremental.text());
let incremental: Value =
serde_json::from_slice(&incremental.body).expect("incremental preview JSON");
assert!(
incremental["changedPages"]
.as_array()
.is_some_and(|pages| !pages.is_empty())
);
assert!(
incremental["recomputedPages"].as_u64().unwrap()
<= incremental["pageCount"].as_u64().unwrap()
);
let v1 = server.request(
"POST",