diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-09 13:07:36 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-09 13:07:36 +0100 |
| commit | 2c13ff9bfe9aea9537938fc957d90a2b798bba2f (patch) | |
| tree | 2c6a1e07f3ec3bd37432b30d035cf0ef391219fa /tests/src | |
| parent | ab841188e3d2687ee8f436336e6fde337985a83e (diff) | |
Make render background color configurable
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/benches.rs | 3 | ||||
| -rw-r--r-- | tests/src/tests.rs | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs index 1628f32d..242f6e51 100644 --- a/tests/src/benches.rs +++ b/tests/src/benches.rs @@ -4,6 +4,7 @@ use comemo::{Prehashed, Track, Tracked}; use iai::{black_box, main, Iai}; use typst::diag::{FileError, FileResult}; use typst::font::{Font, FontBook}; +use typst::geom::Color; use typst::model::Library; use typst::syntax::{Source, SourceId}; use typst::util::Buffer; @@ -95,7 +96,7 @@ fn bench_compile(iai: &mut Iai) { fn bench_render(iai: &mut Iai) { let world = BenchWorld::new(); let document = typst::compile(&world, &world.source).unwrap(); - iai.run(|| typst::export::render(&document.pages[0], 1.0)) + iai.run(|| typst::export::render(&document.pages[0], 1.0, Color::WHITE)) } struct BenchWorld { diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 62e6f3f5..c319fe2f 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -14,7 +14,7 @@ use tiny_skia as sk; use typst::diag::{bail, FileError, FileResult, SourceResult}; use typst::doc::{Document, Element, Frame, Meta}; use typst::font::{Font, FontBook}; -use typst::geom::{Abs, RgbaColor, Sides, Smart}; +use typst::geom::{Abs, Color, RgbaColor, Sides, Smart}; use typst::model::{func, Library, Value}; use typst::syntax::{Source, SourceId, Span, SyntaxNode}; use typst::util::{Buffer, PathExt}; @@ -690,7 +690,7 @@ fn render(frames: &[Frame]) -> sk::Pixmap { if frame.width() > limit || frame.height() > limit { panic!("overlarge frame: {:?}", frame.size()); } - typst::export::render(frame, pixel_per_pt) + typst::export::render(frame, pixel_per_pt, Color::WHITE) }) .collect(); |
