mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-27 11:17:01 -06:00
Merge pull request #4210 from KaboomFox/pdf-tests-dated-alike
PDF tests: exports compared byte for byte are dated alike
This commit is contained in:
@@ -37,13 +37,18 @@ fn close(a: Rect, b: Rect, tol: f64) -> bool {
|
||||
(a.x0 - b.x0).abs() < tol && (a.y0 - b.y0).abs() < tol && (a.x1 - b.x1).abs() < tol && (a.y1 - b.y1).abs() < tol
|
||||
}
|
||||
|
||||
/// `d` exported with the default options and imported back: the document a round trip through a PDF
|
||||
/// gives.
|
||||
fn roundtrip(d: &Document) -> Document {
|
||||
let bytes = export(d, &PdfOptions::default()).expect("export");
|
||||
import(&bytes).expect("import")
|
||||
}
|
||||
|
||||
/// `d` exported uncompressed, dated `created: Some(0)` rather than by the clock: two exports of one
|
||||
/// document are then the same bytes, where the clock's dates, in whole seconds, differ whenever a
|
||||
/// second ticks between them.
|
||||
fn uncompressed(d: &Document) -> String {
|
||||
let bytes = export(d, &PdfOptions::uncompressed()).expect("export");
|
||||
let bytes = export(d, &PdfOptions { created: Some(0), ..PdfOptions::uncompressed() }).expect("export");
|
||||
String::from_utf8_lossy(&bytes).into_owned()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user