From 163c2e1aa27169c1eba946204096d3e8fdfd3c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20d=27Herbais=20de=20Thun?= Date: Tue, 19 Sep 2023 15:48:33 +0200 Subject: Gradient Part 1 - Color rework (#2171) --- tests/src/tests.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tests/src') diff --git a/tests/src/tests.rs b/tests/src/tests.rs index b575b4d4..e7595cf7 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -24,7 +24,7 @@ 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, Tracer, Value}; use typst::font::{Font, FontBook}; -use typst::geom::{Abs, Color, RgbaColor, Smart}; +use typst::geom::{Abs, Color, Smart}; use typst::syntax::{FileId, PackageVersion, Source, Span, SyntaxNode, VirtualPath}; use typst::{World, WorldExt}; use typst_library::layout::{Margin, PageElem}; @@ -159,6 +159,14 @@ fn library() -> Library { Ok(NoneValue) } + #[func] + fn test_repr(lhs: Value, rhs: Value) -> StrResult { + if lhs.repr() != rhs.repr() { + bail!("Assertion failed: {lhs:?} != {rhs:?}"); + } + Ok(NoneValue) + } + #[func] fn print(#[variadic] values: Vec) -> NoneValue { let mut stdout = io::stdout().lock(); @@ -188,13 +196,14 @@ fn library() -> Library { // Hook up helpers into the global scope. lib.global.scope_mut().define_func::(); + lib.global.scope_mut().define_func::(); lib.global.scope_mut().define_func::(); lib.global .scope_mut() - .define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF)); + .define("conifer", Color::from_u8(0x9f, 0xEB, 0x52, 0xFF)); lib.global .scope_mut() - .define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF)); + .define("forest", Color::from_u8(0x43, 0xA1, 0x27, 0xFF)); lib } -- cgit v1.2.3