diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-12-02 13:37:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2024-12-04 10:12:07 +0100 |
| commit | f8f2ba6a5f8c8ca7dbb85cf17b73332a0c301c60 (patch) | |
| tree | b3bc754509fb3ab4c74493848fe96f116b7907ed /tests/src | |
| parent | 76c24ee6e35715cd14bb892d7b6b8d775c680bf7 (diff) | |
Rename `Document` to `PagedDocument`
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/custom.rs | 7 | ||||
| -rw-r--r-- | tests/src/run.rs | 9 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/src/custom.rs b/tests/src/custom.rs index 9a5fef03..965312ab 100644 --- a/tests/src/custom.rs +++ b/tests/src/custom.rs @@ -1,7 +1,8 @@ use std::fmt::Write; use typst::foundations::Smart; -use typst::model::{Document, DocumentInfo}; +use typst::layout::PagedDocument; +use typst::model::DocumentInfo; use typst::World; use crate::collect::Test; @@ -18,7 +19,7 @@ macro_rules! test_eq { /// Run special checks for specific tests for which it is not worth it to create /// custom annotations. -pub fn check(test: &Test, world: &TestWorld, doc: Option<&Document>) -> String { +pub fn check(test: &Test, world: &TestWorld, doc: Option<&PagedDocument>) -> String { let mut sink = String::new(); match test.name.as_str() { "document-set-author-date" => { @@ -41,6 +42,6 @@ pub fn check(test: &Test, world: &TestWorld, doc: Option<&Document>) -> String { } /// Extract the document information. -fn info(doc: Option<&Document>) -> DocumentInfo { +fn info(doc: Option<&PagedDocument>) -> DocumentInfo { doc.map(|doc| doc.info.clone()).unwrap_or_default() } diff --git a/tests/src/run.rs b/tests/src/run.rs index 1ea19a16..1aa70204 100644 --- a/tests/src/run.rs +++ b/tests/src/run.rs @@ -5,8 +5,7 @@ use std::path::Path; use ecow::eco_vec; use tiny_skia as sk; use typst::diag::{SourceDiagnostic, Warned}; -use typst::layout::{Abs, Frame, FrameItem, Page, Transform}; -use typst::model::Document; +use typst::layout::{Abs, Frame, FrameItem, Page, PagedDocument, Transform}; use typst::visualize::Color; use typst::WorldExt; use typst_pdf::PdfOptions; @@ -116,7 +115,7 @@ impl<'a> Runner<'a> { /// Run custom checks for which it is not worth to create special /// annotations. - fn check_custom(&mut self, doc: Option<&Document>) { + fn check_custom(&mut self, doc: Option<&PagedDocument>) { let errors = crate::custom::check(self.test, &self.world, doc); if !errors.is_empty() { log!(self, "custom check failed"); @@ -127,7 +126,7 @@ impl<'a> Runner<'a> { } /// Check that the document output is correct. - fn check_document(&mut self, document: Option<&Document>) { + fn check_document(&mut self, document: Option<&PagedDocument>) { let live_path = format!("{}/render/{}.png", crate::STORE_PATH, self.test.name); let ref_path = format!("{}/{}.png", crate::REF_PATH, self.test.name); let has_ref = Path::new(&ref_path).exists(); @@ -351,7 +350,7 @@ impl<'a> Runner<'a> { } /// Draw all frames into one image with padding in between. -fn render(document: &Document, pixel_per_pt: f32) -> sk::Pixmap { +fn render(document: &PagedDocument, pixel_per_pt: f32) -> sk::Pixmap { for page in &document.pages { let limit = Abs::cm(100.0); if page.frame.width() > limit || page.frame.height() > limit { |
