From 37a7afddfaffd44cb9bc013c9506599267e08983 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 3 Nov 2022 11:44:53 +0100 Subject: Split crates --- tests/typ/math/basic.typ | 6 ------ tests/typeset.rs | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/typ/math/basic.typ b/tests/typ/math/basic.typ index a1a9d32f..55a853cf 100644 --- a/tests/typ/math/basic.typ +++ b/tests/typ/math/basic.typ @@ -15,12 +15,6 @@ $ sum_(k=0)^n k = (n(n+1))/2 $ // Test that blackboard style looks nice. $ f: NN arrow RR $ ---- -#set math(family: "IBM Plex Sans") - -// Error: 1-4 font is not suitable for math -$a$ - --- // Error: 1:3 expected dollar sign $a diff --git a/tests/typeset.rs b/tests/typeset.rs index f3f5bfbe..7c0a6e69 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -14,16 +14,16 @@ use tiny_skia as sk; use unscanny::Scanner; use walkdir::WalkDir; -use typst::diag::{FileError, FileResult}; +use typst::diag::{bail, FileError, FileResult}; use typst::font::{Font, FontBook}; use typst::frame::{Element, Frame}; use typst::geom::{Abs, RgbaColor, Sides}; -use typst::library::layout::PageNode; -use typst::library::text::{TextNode, TextSize}; -use typst::model::{Smart, StyleMap, Value}; +use typst::model::{Smart, Value}; use typst::syntax::{Source, SourceId, SyntaxNode}; use typst::util::{Buffer, PathExt}; -use typst::{bail, Config, World}; +use typst::{Config, World}; +use typst_library::layout::PageNode; +use typst_library::text::{TextNode, TextSize}; const TYP_DIR: &str = "./typ"; const REF_DIR: &str = "./ref"; @@ -149,7 +149,7 @@ fn config() -> Config { // 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 styles = StyleMap::new(); + let mut styles = typst_library::styles(); styles.set(PageNode::WIDTH, Smart::Custom(Abs::pt(120.0).into())); styles.set(PageNode::HEIGHT, Smart::Auto); styles.set( @@ -159,10 +159,10 @@ fn config() -> Config { styles.set(TextNode::SIZE, TextSize(Abs::pt(10.0).into())); // Hook up helpers into the global scope. - let mut std = typst::library::scope(); - std.define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF)); - std.define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF)); - std.def_fn("test", move |_, args| { + let mut scope = typst_library::scope(); + scope.define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF)); + scope.define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF)); + scope.def_fn("test", move |_, args| { let lhs = args.expect::("left-hand side")?; let rhs = args.expect::("right-hand side")?; if lhs != rhs { @@ -170,7 +170,7 @@ fn config() -> Config { } Ok(Value::None) }); - std.def_fn("print", move |_, args| { + scope.def_fn("print", move |_, args| { print!("> "); for (i, value) in args.all::()?.into_iter().enumerate() { if i > 0 { @@ -184,9 +184,9 @@ fn config() -> Config { Config { root: PathBuf::new(), - items: typst::library::items(), - std, + scope, styles, + items: typst_library::items(), } } -- cgit v1.2.3