diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Cargo.toml | 1 | ||||
| -rw-r--r-- | tests/src/benches.rs | 27 | ||||
| -rw-r--r-- | tests/src/tests.rs | 28 |
3 files changed, 19 insertions, 37 deletions
diff --git a/tests/Cargo.toml b/tests/Cargo.toml index ca8c1c0c..386b1073 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -8,7 +8,6 @@ publish = false [dev-dependencies] typst = { workspace = true } -typst-library = { workspace = true } typst-pdf = { workspace = true } typst-render = { workspace = true } typst-svg = { workspace = true } diff --git a/tests/src/benches.rs b/tests/src/benches.rs index 8ef17353..16122bd4 100644 --- a/tests/src/benches.rs +++ b/tests/src/benches.rs @@ -1,11 +1,12 @@ use comemo::{Prehashed, Track, Tracked}; use iai::{black_box, main, Iai}; use typst::diag::FileResult; -use typst::eval::{Bytes, Datetime, Library, Tracer}; -use typst::font::{Font, FontBook}; -use typst::geom::Color; +use typst::eval::Tracer; +use typst::foundations::{Bytes, Datetime}; use typst::syntax::{FileId, Source}; -use typst::World; +use typst::text::{Font, FontBook}; +use typst::visualize::Color; +use typst::{Library, World}; use unscanny::Scanner; const TEXT: &str = include_str!("../typ/compiler/bench.typ"); @@ -17,7 +18,6 @@ main!( bench_parse, bench_edit, bench_eval, - bench_layout, bench_compile, bench_render, ); @@ -65,21 +65,6 @@ fn bench_eval(iai: &mut Iai) { }); } -fn bench_layout(iai: &mut Iai) { - let world = BenchWorld::new(); - let route = typst::eval::Route::default(); - let mut tracer = typst::eval::Tracer::new(); - let module = typst::eval::eval( - world.track(), - route.track(), - tracer.track_mut(), - &world.source, - ) - .unwrap(); - let content = module.content(); - iai.run(|| typst::model::layout(world.track(), tracer.track_mut(), &content)); -} - fn bench_compile(iai: &mut Iai) { let world = BenchWorld::new(); let mut tracer = Tracer::new(); @@ -106,7 +91,7 @@ impl BenchWorld { let book = FontBook::from_fonts([&font]); Self { - library: Prehashed::new(typst_library::build()), + library: Prehashed::new(Library::build()), book: Prehashed::new(book), font, source: Source::detached(TEXT), diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 42663e6c..0a936a8d 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -2,13 +2,12 @@ use std::cell::{RefCell, RefMut}; use std::collections::{HashMap, HashSet}; -use std::env; use std::ffi::OsStr; use std::fmt::{self, Display, Formatter, Write as _}; -use std::fs; use std::io::{self, Write}; use std::ops::Range; use std::path::{Path, PathBuf}; +use std::{env, fs}; use clap::Parser; use comemo::{Prehashed, Track}; @@ -17,20 +16,20 @@ use oxipng::{InFile, Options, OutFile}; use rayon::iter::{ParallelBridge, ParallelIterator}; use std::cell::OnceCell; use tiny_skia as sk; -use unscanny::Scanner; -use walkdir::WalkDir; - use typst::diag::{bail, FileError, FileResult, Severity, StrResult}; -use typst::doc::{Document, Frame, FrameItem, Meta}; -use typst::eval::{ - eco_format, func, Bytes, Datetime, Library, NoneValue, Repr, Smart, Tracer, Value, +use typst::eval::Tracer; +use typst::foundations::{ + eco_format, func, Bytes, Datetime, NoneValue, Repr, Smart, Value, }; -use typst::font::{Font, FontBook}; -use typst::geom::{Abs, Color, Transform}; +use typst::introspection::Meta; +use typst::layout::{Abs, Frame, FrameItem, Margin, PageElem, Transform}; +use typst::model::Document; use typst::syntax::{FileId, PackageVersion, Source, SyntaxNode, VirtualPath}; -use typst::{World, WorldExt}; -use typst_library::layout::{Margin, PageElem}; -use typst_library::text::{TextElem, TextSize}; +use typst::text::{Font, FontBook, TextElem, TextSize}; +use typst::visualize::Color; +use typst::{Library, World, WorldExt}; +use unscanny::Scanner; +use walkdir::WalkDir; const TYP_DIR: &str = "typ"; const REF_DIR: &str = "ref"; @@ -183,11 +182,10 @@ fn library() -> Library { NoneValue } - let mut lib = typst_library::build(); - // Set page width to 120pt with 10pt margins, so that the inner page is // exactly 100pt wide. Page height is unbounded and font size is 10pt so // that it multiplies to nice round numbers. + let mut lib = Library::build(); lib.styles .set(PageElem::set_width(Smart::Custom(Abs::pt(120.0).into()))); lib.styles.set(PageElem::set_height(Smart::Auto)); |
