Honour textheight geometry and widen the page oracle
This commit is contained in:
1 parent
c6ebbea58d
commit
97b72ac5d9
5 files changed
+167
-36
No files matched your search
@@ -657,6 +657,38 @@ fn route_d_pdf_renders_itemize_content() {
|
||||
assert!(response.body.len() > 500);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn route_d_honours_text_height() {
|
||||
let server = TestServer::start("route-d-textheight");
|
||||
let body = "word ".repeat(400);
|
||||
let default = server.request(
|
||||
"POST",
|
||||
"/api/route-d/preview",
|
||||
body.as_bytes(),
|
||||
"text/plain",
|
||||
);
|
||||
assert_eq!(default.status, 200, "{}", default.text());
|
||||
let default: Value = serde_json::from_slice(&default.body).expect("route-D JSON");
|
||||
let default_pages = default["pageCount"].as_u64().unwrap();
|
||||
|
||||
let source = format!("\\textheight=200pt\n\n{body}");
|
||||
let custom = server.request(
|
||||
"POST",
|
||||
"/api/route-d/preview",
|
||||
source.as_bytes(),
|
||||
"text/plain",
|
||||
);
|
||||
assert_eq!(custom.status, 200, "{}", custom.text());
|
||||
let custom: Value = serde_json::from_slice(&custom.body).expect("route-D JSON");
|
||||
let custom_pages = custom["pageCount"].as_u64().unwrap();
|
||||
|
||||
assert_eq!(default_pages, 1, "default page goal should fit the body");
|
||||
assert!(
|
||||
custom_pages > default_pages,
|
||||
"custom \\textheight should force more pages: {custom_pages} vs {default_pages}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn route_d_pdf_applies_page_offsets() {
|
||||
let server = TestServer::start("route-d-pdf-origin");
|
||||
|
||||
Reference in new issue
Block a user