diff --git a/NOTICE b/NOTICE index 05dccbcd5..d1f488b83 100644 --- a/NOTICE +++ b/NOTICE @@ -65,19 +65,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ The SIL Open Font License Version 1.1 applies to: -* IBM Plex fonts in tests/fonts/IBMPlex*.ttf +* IBM Plex fonts in assets/fonts/IBMPlex*.ttf Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" (https://github.com/IBM/plex) -* Noto fonts in tests/fonts/Noto*.ttf +* Noto fonts in assets/fonts/Noto*.ttf Copyright 2018 The Noto Project Authors (https://github.com/googlei18n/noto-fonts) -* PT Sans fonts in tests/fonts/PTSans*.ttf +* PT Sans fonts in assets/fonts/PTSans*.ttf Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public), with Reserved Font Names "PT Sans" and "ParaType". -* Fira math fonts in tests/fonts/FiraMath*.otf +* Fira math fonts in assets/fonts/FiraMath*.otf Copyright (C) 2018--2021 by Xiangdong Zeng (https://github.com/firamath/firamath) @@ -172,7 +172,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE. ================================================================================ The Apache License Version 2.0 applies to: -* Roboto fonts in tests/fonts/Roboto*.ttf +* Roboto fonts in assets/fonts/Roboto*.ttf (https://github.com/googlefonts/roboto) Apache License @@ -356,7 +356,7 @@ The Apache License Version 2.0 applies to: ================================================================================ The Ubuntu Font License Version 1.0 applies to: -* Ubuntu fonts in tests/fonts/Ubuntu*.ttf +* Ubuntu fonts in assets/fonts/Ubuntu*.ttf (https://design.ubuntu.com/font/) ------------------------------- @@ -461,10 +461,10 @@ DEALINGS IN THE FONT SOFTWARE. ================================================================================ The GUST Font License Version 1.0 applies to: -* Latin Modern fonts in tests/fonts/LatinModern*.otf +* Latin Modern fonts in assets/fonts/LatinModern*.otf (http://www.gust.org.pl/projects/e-foundry/lm-math) -* NewComputerModern fonts in tests/fonts/NewCM*.otf +* NewComputerModern fonts in assets/fonts/NewCM*.otf % This is version 1.0, dated 22 June 2009, of the GUST Font License. % (GUST is the Polish TeX Users Group, http://www.gust.org.pl) @@ -499,7 +499,7 @@ The GUST Font License Version 1.0 applies to: ================================================================================ The Creative Commons Attribution 4.0 International License applies to: -* Twitter Color Emoji font in tests/fonts/TwitterColorEmoji.ttf +* Twitter Color Emoji font in assets/fonts/TwitterColorEmoji.ttf Copyright 2016 Brad Erickson Copyright 2016 Twitter, Inc. (https://github.com/eosrei/twemoji-color-font) @@ -509,7 +509,7 @@ The Creative Commons Attribution 4.0 International License applies to: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji) -* Monkey emoji in tests/res/monkey.svg +* Monkey emoji in assets/files/monkey.svg Copyright 2018 Vincent Le Moign, Streamline Emoji Project Via Wikimedia Commons (https://commons.wikimedia.org/wiki/File:440-monkey.svg) diff --git a/tests/res/bad.csv b/assets/files/bad.csv similarity index 100% rename from tests/res/bad.csv rename to assets/files/bad.csv diff --git a/tests/res/bad.json b/assets/files/bad.json similarity index 100% rename from tests/res/bad.json rename to assets/files/bad.json diff --git a/tests/res/bad.svg b/assets/files/bad.svg similarity index 100% rename from tests/res/bad.svg rename to assets/files/bad.svg diff --git a/tests/res/bad.xml b/assets/files/bad.xml similarity index 100% rename from tests/res/bad.xml rename to assets/files/bad.xml diff --git a/tests/res/data.xml b/assets/files/data.xml similarity index 100% rename from tests/res/data.xml rename to assets/files/data.xml diff --git a/tests/res/graph.png b/assets/files/graph.png similarity index 100% rename from tests/res/graph.png rename to assets/files/graph.png diff --git a/tests/res/hello.txt b/assets/files/hello.txt similarity index 100% rename from tests/res/hello.txt rename to assets/files/hello.txt diff --git a/tests/res/invalid-utf8.txt b/assets/files/invalid-utf8.txt similarity index 100% rename from tests/res/invalid-utf8.txt rename to assets/files/invalid-utf8.txt diff --git a/tests/res/monkey.svg b/assets/files/monkey.svg similarity index 100% rename from tests/res/monkey.svg rename to assets/files/monkey.svg diff --git a/tests/res/pattern.svg b/assets/files/pattern.svg similarity index 100% rename from tests/res/pattern.svg rename to assets/files/pattern.svg diff --git a/tests/res/rhino.png b/assets/files/rhino.png similarity index 100% rename from tests/res/rhino.png rename to assets/files/rhino.png diff --git a/tests/res/tiger.jpg b/assets/files/tiger.jpg similarity index 100% rename from tests/res/tiger.jpg rename to assets/files/tiger.jpg diff --git a/tests/res/zoo.csv b/assets/files/zoo.csv similarity index 100% rename from tests/res/zoo.csv rename to assets/files/zoo.csv diff --git a/tests/res/zoo.json b/assets/files/zoo.json similarity index 100% rename from tests/res/zoo.json rename to assets/files/zoo.json diff --git a/tests/fonts/FiraMath-Regular.otf b/assets/fonts/FiraMath-Regular.otf similarity index 100% rename from tests/fonts/FiraMath-Regular.otf rename to assets/fonts/FiraMath-Regular.otf diff --git a/tests/fonts/IBMPlexMono-Bold.ttf b/assets/fonts/IBMPlexMono-Bold.ttf similarity index 100% rename from tests/fonts/IBMPlexMono-Bold.ttf rename to assets/fonts/IBMPlexMono-Bold.ttf diff --git a/tests/fonts/IBMPlexMono-Regular.ttf b/assets/fonts/IBMPlexMono-Regular.ttf similarity index 100% rename from tests/fonts/IBMPlexMono-Regular.ttf rename to assets/fonts/IBMPlexMono-Regular.ttf diff --git a/tests/fonts/IBMPlexSans-Bold.ttf b/assets/fonts/IBMPlexSans-Bold.ttf similarity index 100% rename from tests/fonts/IBMPlexSans-Bold.ttf rename to assets/fonts/IBMPlexSans-Bold.ttf diff --git a/tests/fonts/IBMPlexSans-BoldItalic.ttf b/assets/fonts/IBMPlexSans-BoldItalic.ttf similarity index 100% rename from tests/fonts/IBMPlexSans-BoldItalic.ttf rename to assets/fonts/IBMPlexSans-BoldItalic.ttf diff --git a/tests/fonts/IBMPlexSans-Italic.ttf b/assets/fonts/IBMPlexSans-Italic.ttf similarity index 100% rename from tests/fonts/IBMPlexSans-Italic.ttf rename to assets/fonts/IBMPlexSans-Italic.ttf diff --git a/tests/fonts/IBMPlexSans-Medium.ttf b/assets/fonts/IBMPlexSans-Medium.ttf similarity index 100% rename from tests/fonts/IBMPlexSans-Medium.ttf rename to assets/fonts/IBMPlexSans-Medium.ttf diff --git a/tests/fonts/IBMPlexSans-Regular.ttf b/assets/fonts/IBMPlexSans-Regular.ttf similarity index 100% rename from tests/fonts/IBMPlexSans-Regular.ttf rename to assets/fonts/IBMPlexSans-Regular.ttf diff --git a/tests/fonts/IBMPlexSansDevanagari-Regular.ttf b/assets/fonts/IBMPlexSansDevanagari-Regular.ttf similarity index 100% rename from tests/fonts/IBMPlexSansDevanagari-Regular.ttf rename to assets/fonts/IBMPlexSansDevanagari-Regular.ttf diff --git a/tests/fonts/IBMPlexSerif-Regular.ttf b/assets/fonts/IBMPlexSerif-Regular.ttf similarity index 100% rename from tests/fonts/IBMPlexSerif-Regular.ttf rename to assets/fonts/IBMPlexSerif-Regular.ttf diff --git a/tests/fonts/LatinModernRoman-Bold.otf b/assets/fonts/LatinModernRoman-Bold.otf similarity index 100% rename from tests/fonts/LatinModernRoman-Bold.otf rename to assets/fonts/LatinModernRoman-Bold.otf diff --git a/tests/fonts/LatinModernRoman-Regular.otf b/assets/fonts/LatinModernRoman-Regular.otf similarity index 100% rename from tests/fonts/LatinModernRoman-Regular.otf rename to assets/fonts/LatinModernRoman-Regular.otf diff --git a/tests/fonts/NewCMMath-Regular.otf b/assets/fonts/NewCMMath-Regular.otf similarity index 100% rename from tests/fonts/NewCMMath-Regular.otf rename to assets/fonts/NewCMMath-Regular.otf diff --git a/tests/fonts/NotoColorEmoji.ttf b/assets/fonts/NotoColorEmoji.ttf similarity index 100% rename from tests/fonts/NotoColorEmoji.ttf rename to assets/fonts/NotoColorEmoji.ttf diff --git a/tests/fonts/NotoSansArabic-Regular.ttf b/assets/fonts/NotoSansArabic-Regular.ttf similarity index 100% rename from tests/fonts/NotoSansArabic-Regular.ttf rename to assets/fonts/NotoSansArabic-Regular.ttf diff --git a/tests/fonts/NotoSansSymbols2-Regular.ttf b/assets/fonts/NotoSansSymbols2-Regular.ttf similarity index 100% rename from tests/fonts/NotoSansSymbols2-Regular.ttf rename to assets/fonts/NotoSansSymbols2-Regular.ttf diff --git a/tests/fonts/NotoSerifCJKsc-Regular.otf b/assets/fonts/NotoSerifCJKsc-Regular.otf similarity index 100% rename from tests/fonts/NotoSerifCJKsc-Regular.otf rename to assets/fonts/NotoSerifCJKsc-Regular.otf diff --git a/tests/fonts/NotoSerifHebrew-Bold.ttf b/assets/fonts/NotoSerifHebrew-Bold.ttf similarity index 100% rename from tests/fonts/NotoSerifHebrew-Bold.ttf rename to assets/fonts/NotoSerifHebrew-Bold.ttf diff --git a/tests/fonts/NotoSerifHebrew-Regular.ttf b/assets/fonts/NotoSerifHebrew-Regular.ttf similarity index 100% rename from tests/fonts/NotoSerifHebrew-Regular.ttf rename to assets/fonts/NotoSerifHebrew-Regular.ttf diff --git a/tests/fonts/PTSans-Regular.ttf b/assets/fonts/PTSans-Regular.ttf similarity index 100% rename from tests/fonts/PTSans-Regular.ttf rename to assets/fonts/PTSans-Regular.ttf diff --git a/tests/fonts/Roboto-Regular.ttf b/assets/fonts/Roboto-Regular.ttf similarity index 100% rename from tests/fonts/Roboto-Regular.ttf rename to assets/fonts/Roboto-Regular.ttf diff --git a/tests/fonts/TwitterColorEmoji.ttf b/assets/fonts/TwitterColorEmoji.ttf similarity index 100% rename from tests/fonts/TwitterColorEmoji.ttf rename to assets/fonts/TwitterColorEmoji.ttf diff --git a/tests/fonts/Ubuntu-Regular.ttf b/assets/fonts/Ubuntu-Regular.ttf similarity index 100% rename from tests/fonts/Ubuntu-Regular.ttf rename to assets/fonts/Ubuntu-Regular.ttf diff --git a/src/lib.rs b/src/lib.rs index 4d4cbb8b3..0dc42152a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,7 +75,11 @@ pub fn compile(world: &(dyn World + 'static), source: &Source) -> SourceResult &Path; + /// + /// Defaults to the empty path. + fn root(&self) -> &Path { + Path::new("") + } /// The standard library. fn library(&self) -> &Prehashed; diff --git a/tests/README.md b/tests/README.md index 5356cf657..d57b770c2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -10,8 +10,6 @@ Top level directory structure: a test passed or failed. - `png`: PNG files produced by tests. - `pdf`: PDF files produced by tests. -- `res`: Resource files used by tests. -- `fonts`: Font files used for tests. ## Running the tests Running all tests (including unit tests): diff --git a/tests/src/benches.rs b/tests/src/benches.rs index 997d3b40c..50324c788 100644 --- a/tests/src/benches.rs +++ b/tests/src/benches.rs @@ -11,7 +11,7 @@ use typst::World; use unscanny::Scanner; const TEXT: &str = include_str!("../typ/compiler/bench.typ"); -const FONT: &[u8] = include_bytes!("../fonts/IBMPlexSans-Regular.ttf"); +const FONT: &[u8] = include_bytes!("../../assets/fonts/IBMPlexSans-Regular.ttf"); main!( bench_decode, @@ -124,10 +124,6 @@ impl BenchWorld { } impl World for BenchWorld { - fn root(&self) -> &Path { - Path::new("") - } - fn library(&self) -> &Prehashed { &self.library } diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 7cb1041f2..b90abceeb 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -28,7 +28,8 @@ const TYP_DIR: &str = "typ"; const REF_DIR: &str = "ref"; const PNG_DIR: &str = "png"; const PDF_DIR: &str = "pdf"; -const FONT_DIR: &str = "fonts"; +const FONT_DIR: &str = "../assets/fonts"; +const FILE_DIR: &str = "../assets/files"; fn main() { let args = Args::new(env::args().skip(1)); @@ -240,7 +241,7 @@ impl TestWorld { impl World for TestWorld { fn root(&self) -> &Path { - Path::new("") + Path::new(FILE_DIR) } fn library(&self) -> &Prehashed { @@ -306,10 +307,15 @@ impl TestWorld { } } -/// Read a file. +/// Read as file. fn read(path: &Path) -> FileResult> { - let f = |e| FileError::from_io(e, path); - let mut file = File::open(path).map_err(f)?; + let suffix = path + .strip_prefix(FILE_DIR) + .map(|suffix| Path::new("/").join(suffix)) + .unwrap_or_else(|_| path.into()); + + let f = |e| FileError::from_io(e, &suffix); + let mut file = File::open(&path).map_err(f)?; if file.metadata().map_err(f)?.is_file() { let mut data = vec![]; file.read_to_end(&mut data).map_err(f)?; diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ index 3ce869409..7ec2c4105 100644 --- a/tests/typ/coma.typ +++ b/tests/typ/coma.typ @@ -21,4 +21,4 @@ Die Tiefe eines Knotens _v_ ist die Länge des eindeutigen Weges von der Wurzel zu _v_, und die Höhe von _v_ ist die Länge eines längsten (absteigenden) Weges von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel. -#align(center, image("../res/graph.png", width: 75%)) +#align(center, image("/graph.png", width: 75%)) diff --git a/tests/typ/compiler/import.typ b/tests/typ/compiler/import.typ index f97b1ae0f..0d40e351d 100644 --- a/tests/typ/compiler/import.typ +++ b/tests/typ/compiler/import.typ @@ -69,8 +69,8 @@ --- // Some non-text stuff. -// Error: 9-30 file is not valid utf-8 -#import "../../res/rhino.png" +// Error: 9-21 file is not valid utf-8 +#import "/rhino.png" --- // Unresolved import. diff --git a/tests/typ/compiler/include.typ b/tests/typ/compiler/include.typ index a655e9f27..fa2e84c04 100644 --- a/tests/typ/compiler/include.typ +++ b/tests/typ/compiler/include.typ @@ -6,7 +6,7 @@ = Document // Include a file -#include "/typ/compiler/modules/chap1.typ" +#include "modules/chap1.typ" // Expression as a file name. #let chap2 = include "modu" + "les/chap" + "2.typ" diff --git a/tests/typ/compiler/set.typ b/tests/typ/compiler/set.typ index 39c3e613d..36a427452 100644 --- a/tests/typ/compiler/set.typ +++ b/tests/typ/compiler/set.typ @@ -40,7 +40,7 @@ Hello *#x* // Test relative path resolving in layout phase. #let choice = ("monkey.svg", "rhino.png", "tiger.jpg") #set enum(numbering: n => { - let path = "../../res/" + choice.at(n - 1) + let path = "/" + choice.at(n - 1) move(dy: -0.15em, image(path, width: 1em, height: 1em)) }) diff --git a/tests/typ/compiler/show-text.typ b/tests/typ/compiler/show-text.typ index 124d2ed2d..c867ff9f9 100644 --- a/tests/typ/compiler/show-text.typ +++ b/tests/typ/compiler/show-text.typ @@ -54,6 +54,6 @@ World --- // Test absolute path in layout phase. -#show "GRAPH": image("/res/graph.png") +#show "GRAPH": image("/graph.png") The GRAPH has nodes. diff --git a/tests/typ/compute/data.typ b/tests/typ/compute/data.typ index dc5630220..d80d4857b 100644 --- a/tests/typ/compute/data.typ +++ b/tests/typ/compute/data.typ @@ -3,22 +3,22 @@ --- // Test reading plain text files -#let data = read("../../res/hello.txt") +#let data = read("/hello.txt") #test(data, "Hello, world!") --- -// Error: 18-41 file not found (searched at res/missing.txt) -#let data = read("../../res/missing.txt") +// Error: 18-32 file not found (searched at /missing.txt) +#let data = read("/missing.txt") --- -// Error: 18-46 file is not valid utf-8 -#let data = read("../../res/invalid-utf8.txt") +// Error: 18-37 file is not valid utf-8 +#let data = read("/invalid-utf8.txt") --- // Test reading CSV data. // Ref: true #set page(width: auto) -#let data = csv("/res/zoo.csv") +#let data = csv("/zoo.csv") #let cells = data.at(0).map(strong) + data.slice(1).flatten() #table(columns: data.at(0).len(), ..cells) @@ -27,23 +27,23 @@ #csv("nope.csv") --- -// Error: 6-20 failed to parse csv file: found 3 instead of 2 fields in line 3 -#csv("/res/bad.csv") +// Error: 6-16 failed to parse csv file: found 3 instead of 2 fields in line 3 +#csv("/bad.csv") --- // Test reading JSON data. -#let data = json("/res/zoo.json") +#let data = json("/zoo.json") #test(data.len(), 3) #test(data.at(0).name, "Debby") #test(data.at(2).weight, 150) --- -// Error: 7-22 failed to parse json file: syntax error in line 3 -#json("/res/bad.json") +// Error: 7-18 failed to parse json file: syntax error in line 3 +#json("/bad.json") --- // Test reading XML data. -#let data = xml("/res/data.xml") +#let data = xml("/data.xml") #test(data, (( tag: "data", attrs: (:), @@ -67,5 +67,5 @@ ),)) --- -// Error: 6-20 failed to parse xml file: found closing tag 'data' instead of 'hello' in line 3 -#xml("/res/bad.xml") +// Error: 6-16 failed to parse xml file: found closing tag 'data' instead of 'hello' in line 3 +#xml("/bad.xml") diff --git a/tests/typ/compute/foundations.typ b/tests/typ/compute/foundations.typ index 1b2ab473f..602bc22d5 100644 --- a/tests/typ/compute/foundations.typ +++ b/tests/typ/compute/foundations.typ @@ -51,15 +51,15 @@ Blue #move(dy: -0.15em)[🌊] #eval("#include \"../coma.typ\"") --- -// Error: 7-35 cannot access file system from here -#eval("#image(\"/res/tiger.jpg\")") +// Error: 7-31 cannot access file system from here +#eval("#image(\"/tiger.jpg\")") --- // Error: 23-30 cannot access file system from here #show raw: it => eval(it.text) ``` -#image("/res/tiger.jpg") +#image("/tiger.jpg") ``` --- @@ -67,7 +67,7 @@ Blue #move(dy: -0.15em)[🌊] #show raw: it => eval(it.text) ``` -#show emph: _ => image("../../res/giraffe.jpg") +#show emph: _ => image("/giraffe.jpg") _No relative giraffe!_ ``` diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ index 8194da736..ee79f2fde 100644 --- a/tests/typ/layout/grid-3.typ +++ b/tests/typ/layout/grid-3.typ @@ -23,7 +23,7 @@ columns: 4 * (1fr,), row-gutter: 10pt, column-gutter: (0pt, 10%), - align(top, image("/res/rhino.png")), + align(top, image("/rhino.png")), align(top, rect(inset: 0pt, fill: eastern, align(right)[LoL])), [rofl], [\ A] * 3, diff --git a/tests/typ/layout/pad.typ b/tests/typ/layout/pad.typ index 4f4815027..2cc4d4ee7 100644 --- a/tests/typ/layout/pad.typ +++ b/tests/typ/layout/pad.typ @@ -22,7 +22,7 @@ Hi #box(pad(left: 10pt)[A]) there // Test that the pad node doesn't consume the whole region. #set page(height: 6cm) #align(left)[Before] -#pad(10pt, image("/res/tiger.jpg")) +#pad(10pt, image("/tiger.jpg")) #align(right)[After] --- diff --git a/tests/typ/layout/par-bidi.typ b/tests/typ/layout/par-bidi.typ index 4baefcd3a..31e3fded2 100644 --- a/tests/typ/layout/par-bidi.typ +++ b/tests/typ/layout/par-bidi.typ @@ -43,7 +43,7 @@ Lריווח #h(1cm) R --- // Test inline object. #set text(lang: "he", "IBM Plex Serif") -קרנפיםRh#image("/res/rhino.png", height: 11pt)inoחיים +קרנפיםRh#image("/rhino.png", height: 11pt)inoחיים --- // Test whether L1 whitespace resetting destroys stuff. diff --git a/tests/typ/layout/par-indent.typ b/tests/typ/layout/par-indent.typ index 8454dda5d..d328da410 100644 --- a/tests/typ/layout/par-indent.typ +++ b/tests/typ/layout/par-indent.typ @@ -9,10 +9,10 @@ The first paragraph has no indent. But the second one does. -#image("/res/tiger.jpg", height: 6pt) +#image("/tiger.jpg", height: 6pt) starts a paragraph without indent. -#align(center, image("/res/rhino.png", width: 1cm)) +#align(center, image("/rhino.png", width: 1cm)) = Headings - And lists. diff --git a/tests/typ/layout/place-background.typ b/tests/typ/layout/place-background.typ index fafedec1a..6f480b93a 100644 --- a/tests/typ/layout/place-background.typ +++ b/tests/typ/layout/place-background.typ @@ -7,7 +7,7 @@ dx: -10pt, dy: -10pt, image( - "/res/tiger.jpg", + "/tiger.jpg", fit: "cover", width: 100% + 20pt, height: 100% + 20pt, diff --git a/tests/typ/layout/place.typ b/tests/typ/layout/place.typ index 58f9d06d5..18f7642d1 100644 --- a/tests/typ/layout/place.typ +++ b/tests/typ/layout/place.typ @@ -5,7 +5,7 @@ #place(bottom + center)[© Typst] = Placement -#place(right, image("/res/tiger.jpg", width: 1.8cm)) +#place(right, image("/tiger.jpg", width: 1.8cm)) Hi there. This is \ a placed node. \ Unfortunately, \ diff --git a/tests/typ/layout/transform.typ b/tests/typ/layout/transform.typ index 58a053e99..cc7494b3a 100644 --- a/tests/typ/layout/transform.typ +++ b/tests/typ/layout/transform.typ @@ -31,13 +31,13 @@ nor #xetex! // Test combination of scaling and rotation. #set page(height: 80pt) #align(center + horizon, - rotate(20deg, scale(70%, image("/res/tiger.jpg"))) + rotate(20deg, scale(70%, image("/tiger.jpg"))) ) --- // Test setting rotation origin. #rotate(10deg, origin: top + left, - image("/res/tiger.jpg", width: 50%) + image("/tiger.jpg", width: 50%) ) --- diff --git a/tests/typ/meta/link.typ b/tests/typ/meta/link.typ index 8c3e6dddd..4ed7e58dc 100644 --- a/tests/typ/meta/link.typ +++ b/tests/typ/meta/link.typ @@ -38,7 +38,7 @@ My cool #move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink))) // Link containing a block. #link("https://example.com/", block[ My cool rhino - #move(dx: 10pt, image("/res/rhino.png", width: 1cm)) + #move(dx: 10pt, image("/rhino.png", width: 1cm)) ]) --- diff --git a/tests/typ/visualize/image.typ b/tests/typ/visualize/image.typ index 6a2c37e17..893819555 100644 --- a/tests/typ/visualize/image.typ +++ b/tests/typ/visualize/image.typ @@ -4,24 +4,24 @@ // Test loading different image formats. // Load an RGBA PNG image. -#image("/res/rhino.png") +#image("/rhino.png") // Load an RGB JPEG image. #set page(height: 60pt) -#image("../../res/tiger.jpg") +#image("/tiger.jpg") --- // Test configuring the size and fitting behaviour of images. // Set width and height explicitly. -#image("/res/rhino.png", width: 30pt) -#image("/res/rhino.png", height: 30pt) +#image("/rhino.png", width: 30pt) +#image("/rhino.png", height: 30pt) // Set width and height explicitly and force stretching. -#image("/res/monkey.svg", width: 100%, height: 20pt, fit: "stretch") +#image("/monkey.svg", width: 100%, height: 20pt, fit: "stretch") // Make sure the bounding-box of the image is correct. -#align(bottom + right, image("/res/tiger.jpg", width: 40pt)) +#align(bottom + right, image("/tiger.jpg", width: 40pt)) --- // Test all three fit modes. @@ -30,9 +30,9 @@ columns: (1fr, 1fr, 1fr), rows: 100%, gutter: 3pt, - image("/res/tiger.jpg", width: 100%, height: 100%, fit: "contain"), - image("/res/tiger.jpg", width: 100%, height: 100%, fit: "cover"), - image("/res/monkey.svg", width: 100%, height: 100%, fit: "stretch"), + image("/tiger.jpg", width: 100%, height: 100%, fit: "contain"), + image("/tiger.jpg", width: 100%, height: 100%, fit: "cover"), + image("/monkey.svg", width: 100%, height: 100%, fit: "stretch"), ) --- @@ -40,15 +40,15 @@ #set page(height: 60pt) Stuff #parbreak() Stuff -#image("/res/rhino.png") +#image("/rhino.png") --- // Test baseline. -A #image("/res/tiger.jpg", height: 1cm, width: 80%) B +A #image("/tiger.jpg", height: 1cm, width: 80%) B --- // Test advanced SVG features. -#image("/res/pattern.svg") +#image("/pattern.svg") --- // Error: 8-29 file not found (searched at typ/visualize/path/does/not/exist) @@ -59,5 +59,5 @@ A #image("/res/tiger.jpg", height: 1cm, width: 80%) B #image("./image.typ") --- -// Error: 8-22 failed to parse svg: found closing tag 'g' instead of 'style' in line 4 -#image("/res/bad.svg") +// Error: 8-18 failed to parse svg: found closing tag 'g' instead of 'style' in line 4 +#image("/bad.svg")