diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-31 15:05:42 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-31 15:05:42 +0100 |
| commit | ec05ed7e0646d1e8ff76677d0332ddf93ed57b69 (patch) | |
| tree | 75f57cbc2380591ef6c4f30d71e018e3cd001e19 /tests | |
| parent | 9a99beec94a5b02aa91a363b299d4795ef52c0fa (diff) | |
Move assets
Diffstat (limited to 'tests')
56 files changed, 60 insertions, 187 deletions
diff --git a/tests/README.md b/tests/README.md index 5356cf65..d57b770c 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/fonts/FiraMath-Regular.otf b/tests/fonts/FiraMath-Regular.otf Binary files differdeleted file mode 100644 index f1f9d40c..00000000 --- a/tests/fonts/FiraMath-Regular.otf +++ /dev/null diff --git a/tests/fonts/IBMPlexMono-Bold.ttf b/tests/fonts/IBMPlexMono-Bold.ttf Binary files differdeleted file mode 100644 index 2ad2fa1d..00000000 --- a/tests/fonts/IBMPlexMono-Bold.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexMono-Regular.ttf b/tests/fonts/IBMPlexMono-Regular.ttf Binary files differdeleted file mode 100644 index ef3bc4b3..00000000 --- a/tests/fonts/IBMPlexMono-Regular.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSans-Bold.ttf b/tests/fonts/IBMPlexSans-Bold.ttf Binary files differdeleted file mode 100644 index 0e9eb07b..00000000 --- a/tests/fonts/IBMPlexSans-Bold.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSans-BoldItalic.ttf b/tests/fonts/IBMPlexSans-BoldItalic.ttf Binary files differdeleted file mode 100644 index 07f8bc87..00000000 --- a/tests/fonts/IBMPlexSans-BoldItalic.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSans-Italic.ttf b/tests/fonts/IBMPlexSans-Italic.ttf Binary files differdeleted file mode 100644 index 9ef096fe..00000000 --- a/tests/fonts/IBMPlexSans-Italic.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSans-Medium.ttf b/tests/fonts/IBMPlexSans-Medium.ttf Binary files differdeleted file mode 100644 index 9395402b..00000000 --- a/tests/fonts/IBMPlexSans-Medium.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSans-Regular.ttf b/tests/fonts/IBMPlexSans-Regular.ttf Binary files differdeleted file mode 100644 index f1c3da2f..00000000 --- a/tests/fonts/IBMPlexSans-Regular.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSansDevanagari-Regular.ttf b/tests/fonts/IBMPlexSansDevanagari-Regular.ttf Binary files differdeleted file mode 100644 index 5d7c8f0f..00000000 --- a/tests/fonts/IBMPlexSansDevanagari-Regular.ttf +++ /dev/null diff --git a/tests/fonts/IBMPlexSerif-Regular.ttf b/tests/fonts/IBMPlexSerif-Regular.ttf Binary files differdeleted file mode 100644 index 7d6dc5c1..00000000 --- a/tests/fonts/IBMPlexSerif-Regular.ttf +++ /dev/null diff --git a/tests/fonts/LatinModernRoman-Bold.otf b/tests/fonts/LatinModernRoman-Bold.otf Binary files differdeleted file mode 100644 index 7d6afa73..00000000 --- a/tests/fonts/LatinModernRoman-Bold.otf +++ /dev/null diff --git a/tests/fonts/LatinModernRoman-Regular.otf b/tests/fonts/LatinModernRoman-Regular.otf Binary files differdeleted file mode 100644 index 6a96b468..00000000 --- a/tests/fonts/LatinModernRoman-Regular.otf +++ /dev/null diff --git a/tests/fonts/NewCMMath-Regular.otf b/tests/fonts/NewCMMath-Regular.otf Binary files differdeleted file mode 100644 index 82221fb8..00000000 --- a/tests/fonts/NewCMMath-Regular.otf +++ /dev/null diff --git a/tests/fonts/NotoColorEmoji.ttf b/tests/fonts/NotoColorEmoji.ttf Binary files differdeleted file mode 100644 index 2c1f1043..00000000 --- a/tests/fonts/NotoColorEmoji.ttf +++ /dev/null diff --git a/tests/fonts/NotoSansArabic-Regular.ttf b/tests/fonts/NotoSansArabic-Regular.ttf Binary files differdeleted file mode 100644 index 94eead4c..00000000 --- a/tests/fonts/NotoSansArabic-Regular.ttf +++ /dev/null diff --git a/tests/fonts/NotoSansSymbols2-Regular.ttf b/tests/fonts/NotoSansSymbols2-Regular.ttf Binary files differdeleted file mode 100644 index 429a51d5..00000000 --- a/tests/fonts/NotoSansSymbols2-Regular.ttf +++ /dev/null diff --git a/tests/fonts/NotoSerifCJKsc-Regular.otf b/tests/fonts/NotoSerifCJKsc-Regular.otf Binary files differdeleted file mode 100644 index 4c5f715b..00000000 --- a/tests/fonts/NotoSerifCJKsc-Regular.otf +++ /dev/null diff --git a/tests/fonts/NotoSerifHebrew-Bold.ttf b/tests/fonts/NotoSerifHebrew-Bold.ttf Binary files differdeleted file mode 100644 index e7cbd93a..00000000 --- a/tests/fonts/NotoSerifHebrew-Bold.ttf +++ /dev/null diff --git a/tests/fonts/NotoSerifHebrew-Regular.ttf b/tests/fonts/NotoSerifHebrew-Regular.ttf Binary files differdeleted file mode 100644 index 27893f10..00000000 --- a/tests/fonts/NotoSerifHebrew-Regular.ttf +++ /dev/null diff --git a/tests/fonts/PTSans-Regular.ttf b/tests/fonts/PTSans-Regular.ttf Binary files differdeleted file mode 100644 index 5222968f..00000000 --- a/tests/fonts/PTSans-Regular.ttf +++ /dev/null diff --git a/tests/fonts/Roboto-Regular.ttf b/tests/fonts/Roboto-Regular.ttf Binary files differdeleted file mode 100644 index 500b1045..00000000 --- a/tests/fonts/Roboto-Regular.ttf +++ /dev/null diff --git a/tests/fonts/TwitterColorEmoji.ttf b/tests/fonts/TwitterColorEmoji.ttf Binary files differdeleted file mode 100644 index a8f829ac..00000000 --- a/tests/fonts/TwitterColorEmoji.ttf +++ /dev/null diff --git a/tests/fonts/Ubuntu-Regular.ttf b/tests/fonts/Ubuntu-Regular.ttf Binary files differdeleted file mode 100644 index f98a2dab..00000000 --- a/tests/fonts/Ubuntu-Regular.ttf +++ /dev/null diff --git a/tests/res/bad.csv b/tests/res/bad.csv deleted file mode 100644 index 2c2696e9..00000000 --- a/tests/res/bad.csv +++ /dev/null @@ -1,4 +0,0 @@ -A,B -1,2 -3,4,5 -6,7 diff --git a/tests/res/bad.json b/tests/res/bad.json deleted file mode 100644 index cd5d0366..00000000 --- a/tests/res/bad.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "valid": true, - "invalid": True -} diff --git a/tests/res/bad.svg b/tests/res/bad.svg deleted file mode 100644 index b7828a61..00000000 --- a/tests/res/bad.svg +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> - <style> - </g> -</svg> diff --git a/tests/res/bad.xml b/tests/res/bad.xml deleted file mode 100644 index 7fa6a6ed..00000000 --- a/tests/res/bad.xml +++ /dev/null @@ -1,3 +0,0 @@ -<data> - <hello name="hi">1 -</data> diff --git a/tests/res/data.xml b/tests/res/data.xml deleted file mode 100644 index 9ae409ee..00000000 --- a/tests/res/data.xml +++ /dev/null @@ -1,7 +0,0 @@ -<data> - <hello name="hi">1</hello> - <data> - <hello>World</hello> - <hello>World</hello> - </data> -</data> diff --git a/tests/res/graph.png b/tests/res/graph.png Binary files differdeleted file mode 100644 index 069b0cbc..00000000 --- a/tests/res/graph.png +++ /dev/null diff --git a/tests/res/hello.txt b/tests/res/hello.txt deleted file mode 100644 index 5dd01c17..00000000 --- a/tests/res/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, world!
\ No newline at end of file diff --git a/tests/res/invalid-utf8.txt b/tests/res/invalid-utf8.txt Binary files differdeleted file mode 100644 index 71308112..00000000 --- a/tests/res/invalid-utf8.txt +++ /dev/null diff --git a/tests/res/monkey.svg b/tests/res/monkey.svg deleted file mode 100644 index 0e8c1124..00000000 --- a/tests/res/monkey.svg +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Monkey emoji by Vincent Le Moign of the Streamline Emoji Project. Sourced - from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:440-monkey.svg) - on 2021-06-12 and partially minified using SVGO. Used under the Creative - Commons Attribution 4.0 International license --> -<!--Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)--> -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" viewBox="0 0 48 48" style="enable-background:new 0 0 48 48" xml:space="preserve"> - <style> - .st3 { - fill: none; - stroke: #45413c; - stroke-linecap: round; - stroke-linejoin: round; - stroke-miterlimit: 10 - } - .st8 { - fill: #fff48c - } - .st34 { - fill: #bf8256 - } - .st35 { - fill: #dea47a - } - .st84 { - fill: #45413c - } - </style> - <g> - <ellipse cx="20.5" cy="44.5" rx="18" ry="1.5" style="opacity:.15;fill:#45413c"/> - <path d="M8.7 28.8 8 27.1c-.3-.7-.9-1.1-1.6-1-.9.1-1.6.9-1.5 1.9.7 5-.6 6.6-3 9.4-.5.5-.5 1.3-.1 1.9.4.6 1 .8 1.9.6 4.5-1.6 6.9-6.6 5-11.1z" style="fill:#ffe500"/> - <g> - <path class="st8" d="M5 29.6c.2-.6.8-1 1.4-1 .7-.1 1.4.4 1.6 1l.7 1.8c.3.6.5 1.1.6 1.7.2-1.4 0-2.9-.6-4.3L8 27.1c-.3-.7-.9-1.1-1.6-1-.9.1-1.6.9-1.5 1.9 0 .5.1 1.1.1 1.6zM2.1 39.6c2.1-2.5 3.2-4.1 2.8-8.3-.2 2.6-1.3 4-3.1 6-.5.5-.5 1.3-.1 1.9l.4.4z"/> - </g> - <path class="st3" d="M8.7 28.8 8 27.1c-.3-.7-.9-1.1-1.6-1-.9.1-1.6.9-1.5 1.9.7 5-.6 6.6-3 9.4-.5.5-.5 1.3-.1 1.9.4.6 1 .8 1.9.6 4.5-1.6 6.9-6.6 5-11.1z"/> - <path class="st3" d="m6.1 26.1-.7-1.8"/> - <path class="st3" d="m7.1 23.6-3.5 1.5"/> - <path class="st34" d="M30.7 19.4c-.5.9-.2 2.1.7 2.6.9.5 2.1.2 2.6-.7.9-1.7 3-2.3 4.7-1.6 3.5 1.5 5.4 5.4 4.4 9.1-1.7 6.7-7.7 11.3-14.6 11.3h-8l-.6 3.9h8.8c8.7 0 16.4-5.9 18.5-14.4 1.3-5.4-1.3-10.9-6.3-13.3-3.7-1.8-8.1-.5-10.2 3.1z"/> - <g> - <path class="st35" d="M43.4 27.9c0 .3-.1.6-.2.8C41.5 35.4 35.5 40 28.6 40h-8l-.4 2.2h8.4c6.9 0 12.9-4.6 14.6-11.3.3-1 .3-2 .2-3zM30.7 19.4c-.4.7-.3 1.5.1 2.1 2.1-3.4 6.5-4.7 10.1-3 3.8 1.8 6.2 5.4 6.6 9.4.4-4.8-2.1-9.4-6.6-11.6-3.7-1.8-8.1-.5-10.2 3.1z"/> - </g> - <path class="st3" d="M30.7 19.4c-.5.9-.2 2.1.7 2.6.9.5 2.1.2 2.6-.7.9-1.7 3-2.3 4.7-1.6 3.5 1.5 5.4 5.4 4.4 9.1-1.7 6.7-7.7 11.3-14.6 11.3h-8l-.6 3.9h8.8c8.7 0 16.4-5.9 18.5-14.4 1.3-5.4-1.3-10.9-6.3-13.3-3.7-1.8-8.1-.5-10.2 3.1z"/> - <path class="st34" d="M31.2 30.6c-1.6-8.2-8.8-14.2-17.2-14.2v12l-4.3-.8c-1.6-.3-2.9 1.2-2.4 2.7.2.8.9 1.4 1.7 1.5l5 .8V35c-1 1-1.6 2.5-1.5 4.1l.1 1h-.8c-1.7 0-3 1.6-2.7 3.2.1.5.5.8 1 .8h14.1c4.2 0 7.6-3.4 7.6-7.6-.1-2-.3-4-.6-5.9z"/> - <path d="M14 26.3c4.5 0 8.4-2.7 10.2-6.5-2.9-2.1-6.4-3.3-10.2-3.3v9.8z" style="fill:#915e3a"/> - <path class="st3" d="M31.2 30.6c-1.6-8.2-8.8-14.2-17.2-14.2v12l-4.3-.8c-1.6-.3-2.9 1.2-2.4 2.7.2.8.9 1.4 1.7 1.5l5 .8V35c-1 1-1.6 2.5-1.5 4.1l.1 1h-.8c-1.7 0-3 1.6-2.7 3.2.1.5.5.8 1 .8h14.1c4.2 0 7.6-3.4 7.6-7.6-.1-2-.3-4-.6-5.9z"/> - <path class="st34" d="M22.5 9.2h-.2C21.4 5.4 18 2.6 14 2.6S6.5 5.4 5.7 9.2h-.2c-1.8 0-3.3 1.5-3.3 3.3v.7c0 1.8 1.5 3.3 3.3 3.3h.2C6.5 20.2 9.9 23 14 23s7.4-2.8 8.3-6.6h.2c1.8 0 3.3-1.5 3.3-3.3v-.7c0-1.8-1.5-3.2-3.3-3.2z"/> - <path class="st35" d="M22.5 9.2h-.2C21.4 5.4 18 2.6 14 2.6c-4 0-7.4 2.8-8.3 6.6h-.2c-1.8 0-3.3 1.5-3.3 3.3v.7c0 .4.1.7.2 1 .4-1.3 1.7-2.3 3.1-2.3h.2c.8-3.8 4.2-6.6 8.3-6.6 4 0 7.4 2.8 8.3 6.6h.2c1.5 0 2.7 1 3.1 2.3.1-.3.2-.7.2-1v-.7c0-1.9-1.5-3.3-3.3-3.3z"/> - <path class="st3" d="M22.5 9.2h-.2C21.4 5.4 18 2.6 14 2.6S6.5 5.4 5.7 9.2h-.2c-1.8 0-3.3 1.5-3.3 3.3v.7c0 1.8 1.5 3.3 3.3 3.3h.2C6.5 20.2 9.9 23 14 23s7.4-2.8 8.3-6.6h.2c1.8 0 3.3-1.5 3.3-3.3v-.7c0-1.8-1.5-3.2-3.3-3.2z"/> - <path d="M18.6 15.1c1.1 1 1.7 2.4 1.7 4 0 .5-.1.9-.2 1.3C18.5 22 16.4 23 14 23c-2.8 0-5.2-1.3-6.8-3.3 0 0 0 0 0 0 0-.2-.1-.4-.1-.6 0-1.5.7-2.9 1.7-4-1-.7-1.7-1.9-1.7-3.3 0-2.2 1.8-3.9 3.9-3.9 1 0 1.9.4 2.6 1 .7-.6 1.6-1 2.6-1 2.2 0 3.9 1.8 3.9 3.9.2 1.4-.5 2.6-1.5 3.3z" style="fill:#ffdcd1;stroke:#45413c;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"/> - <circle transform="matrix(.05447 -.9985 .9985 .05447 4.528 28.393)" class="st84" cx="17.3" cy="11.8" r="1.3"/> - <circle transform="matrix(.05447 -.9985 .9985 .05447 -1.682 21.835)" class="st84" cx="10.7" cy="11.8" r="1.3"/> - <path class="st3" d="M11.3 18.4s1.1 1.3 2.6 1.3c1.6 0 2.6-1.3 2.6-1.3"/> - <path class="st3" d="m14 28.4 3.5.6"/> - <path class="st3" d="m21.4 25 1.6 4.4c.8 2.2-1.1 4.4-3.3 4l-5.7-.8"/> - <path class="st3" d="M22.9 39.3c.2-3.2-2.4-5.9-5.7-5.8-1.3.1-2.4.6-3.2 1.5"/> - </g> -</svg> diff --git a/tests/res/pattern.svg b/tests/res/pattern.svg deleted file mode 100644 index 0a46c0b6..00000000 --- a/tests/res/pattern.svg +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Adapted from - https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Patterns under - CC0 / Public Domain Licensing --> -<svg width="200" height="150" xmlns="http://www.w3.org/2000/svg"> - <defs> - <linearGradient id="Gradient1"> - <stop offset="5%" stop-color="white"/> - <stop offset="95%" stop-color="blue"/> - </linearGradient> - <linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1"> - <stop offset="5%" stop-color="red"/> - <stop offset="95%" stop-color="orange"/> - </linearGradient> - <pattern id="Pattern" x="40" y="10" width="50" height="50" patternUnits="userSpaceOnUse"> - <rect x="0" y="0" width="50" height="50" fill="skyblue"/> - <rect x="0" y="0" width="25" height="25" fill="url(#Gradient2)"/> - <circle cx="25" cy="25" r="20" fill="url(#Gradient1)" fill-opacity="0.5"/> - </pattern> - </defs> - <rect fill="url(#Pattern)" stroke="black" width="200" height="150"/> -</svg> diff --git a/tests/res/rhino.png b/tests/res/rhino.png Binary files differdeleted file mode 100644 index f9d47dd3..00000000 --- a/tests/res/rhino.png +++ /dev/null diff --git a/tests/res/tiger.jpg b/tests/res/tiger.jpg Binary files differdeleted file mode 100644 index 74dc5e0b..00000000 --- a/tests/res/tiger.jpg +++ /dev/null diff --git a/tests/res/zoo.csv b/tests/res/zoo.csv deleted file mode 100644 index 42ff06c7..00000000 --- a/tests/res/zoo.csv +++ /dev/null @@ -1,4 +0,0 @@ -Name,Species,Weight,Length -Debby,Rhinoceros,1900kg,390cm -Fluffy,Tiger,115kg,310cm -Sleepy,Dolphin,150kg,180cm diff --git a/tests/res/zoo.json b/tests/res/zoo.json deleted file mode 100644 index 3b5a7ffc..00000000 --- a/tests/res/zoo.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "name": "Debby", - "species": "Rhinoceros", - "weight": 1900, - "length": 390 - }, - { - "name": "Fluffy", - "species": "Tiger", - "weight": 115, - "length": 310 - }, - { - "name": "Sleepy", - "species": "Dolphin", - "weight": 150, - "length": 180 - } -] diff --git a/tests/src/benches.rs b/tests/src/benches.rs index 997d3b40..50324c78 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<Library> { &self.library } diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 7cb1041f..b90abcee 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<Library> { @@ -306,10 +307,15 @@ impl TestWorld { } } -/// Read a file. +/// Read as file. fn read(path: &Path) -> FileResult<Vec<u8>> { - 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 3ce86940..7ec2c410 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 f97b1ae0..0d40e351 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 a655e9f2..fa2e84c0 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 39c3e613..36a42745 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 124d2ed2..c867ff9f 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 dc563022..d80d4857 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 1b2ab473..602bc22d 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 8194da73..ee79f2fd 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 4f481502..2cc4d4ee 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 4baefcd3..31e3fded 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 8454dda5..d328da41 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 fafedec1..6f480b93 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 58f9d06d..18f7642d 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 58a053e9..cc7494b3 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 8c3e6ddd..4ed7e58d 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 6a2c37e1..89381955 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") |
