diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-14 17:32:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-14 18:07:18 +0200 |
| commit | 5e41672a91536c1f740bbc1630a6908adff57329 (patch) | |
| tree | 2f481ab7a205154b11deaf4925aa5a0f693d7f23 /tests | |
| parent | 7c0899b5373cdc4f1083a0a8515856207c431423 (diff) | |
Refactor and refine PDF exporter ♻
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/layouting.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/layouting.rs b/tests/layouting.rs index cb7b75ef..75aaa66b 100644 --- a/tests/layouting.rs +++ b/tests/layouting.rs @@ -1,6 +1,7 @@ use std::fs::{self, File}; use std::io::{BufWriter, Read, Write}; use std::process::Command; +use std::time::Instant; use typst::export::pdf::PdfExporter; use typst::layout::LayoutAction; @@ -50,16 +51,22 @@ fn main() { /// Create a _PDF_ with a name from the source code. fn test(name: &str, src: &str) { - println!("Testing: {}", name); + print!("Testing: {}", name); let mut typesetter = Typesetter::new(); let provider = FileSystemFontProvider::from_listing("fonts/fonts.toml").unwrap(); typesetter.add_font_provider(provider.clone()); + let start = Instant::now(); + // Layout into box layout. let tree = typesetter.parse(src).unwrap(); let layout = typesetter.layout(&tree).unwrap(); + let end = Instant::now(); + let duration = end - start; + println!(" [{:?}]", duration); + // Write the serialed layout file. let path = format!("{}/serialized/{}.box", CACHE_DIR, name); let mut file = File::create(path).unwrap(); |
