summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/tests.rs24
-rw-r--r--tests/typ/bugs/cite-locate.typ2
-rw-r--r--tests/typ/bugs/hide-meta.typ2
-rw-r--r--tests/typ/coma.typ2
-rw-r--r--tests/typ/compiler/import.typ4
-rw-r--r--tests/typ/compiler/set.typ2
-rw-r--r--tests/typ/compiler/show-text.typ2
-rw-r--r--tests/typ/compute/data.typ40
-rw-r--r--tests/typ/layout/grid-3.typ2
-rw-r--r--tests/typ/layout/pad.typ2
-rw-r--r--tests/typ/layout/par-bidi.typ2
-rw-r--r--tests/typ/layout/par-indent.typ4
-rw-r--r--tests/typ/layout/place-background.typ2
-rw-r--r--tests/typ/layout/place.typ2
-rw-r--r--tests/typ/layout/transform.typ4
-rw-r--r--tests/typ/math/content.typ2
-rw-r--r--tests/typ/meta/bibliography-ordering.typ2
-rw-r--r--tests/typ/meta/bibliography.typ17
-rw-r--r--tests/typ/meta/cite-footnote.typ2
-rw-r--r--tests/typ/meta/figure.typ4
-rw-r--r--tests/typ/meta/footnote-container.typ2
-rw-r--r--tests/typ/meta/footnote-table.typ2
-rw-r--r--tests/typ/meta/link.typ2
-rw-r--r--tests/typ/meta/outline-entry.typ2
-rw-r--r--tests/typ/meta/query-figure.typ4
-rw-r--r--tests/typ/meta/ref.typ4
-rw-r--r--tests/typ/text/baseline.typ24
-rw-r--r--tests/typ/text/linebreak-obj.typ2
-rw-r--r--tests/typ/visualize/image.typ28
-rw-r--r--tests/typ/visualize/svg-text.typ2
30 files changed, 100 insertions, 95 deletions
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index a2b6e985..b2a87a5c 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -37,7 +37,7 @@ const REF_DIR: &str = "ref";
const PNG_DIR: &str = "png";
const PDF_DIR: &str = "pdf";
const FONT_DIR: &str = "../assets/fonts";
-const FILE_DIR: &str = "../assets/files";
+const ASSET_DIR: &str = "../assets";
#[derive(Debug, Clone, Parser)]
#[clap(name = "typst-test", author)]
@@ -281,7 +281,7 @@ impl World for TestWorld {
impl TestWorld {
fn set(&mut self, path: &Path, text: String) -> Source {
- self.main = FileId::new(None, path);
+ self.main = FileId::new(None, &Path::new("/").join(path));
let mut slot = self.slot(self.main).unwrap();
let source = Source::new(self.main, text);
slot.source = OnceCell::from(Ok(source.clone()));
@@ -289,11 +289,9 @@ impl TestWorld {
}
fn slot(&self, id: FileId) -> FileResult<RefMut<PathSlot>> {
- let path = id.path();
let root: PathBuf = match id.package() {
Some(spec) => format!("packages/{}-{}", spec.name, spec.version).into(),
- None if path.is_relative() => PathBuf::new(),
- None => FILE_DIR.into(),
+ None => PathBuf::new(),
};
let system_path = root.join_rooted(id.path()).ok_or(FileError::AccessDenied)?;
@@ -310,16 +308,18 @@ impl TestWorld {
/// Read as file.
fn read(path: &Path) -> FileResult<Vec<u8>> {
- let suffix = path
- .strip_prefix(FILE_DIR)
- .map(|suffix| Path::new("/").join(suffix))
- .unwrap_or_else(|_| path.into());
+ // Basically symlinks `assets/files` to `tests/files` so that the assets
+ // are within the test project root.
+ let mut resolved = path.to_path_buf();
+ if path.starts_with("files/") {
+ resolved = Path::new(ASSET_DIR).join(path);
+ }
- let f = |e| FileError::from_io(e, &suffix);
- if fs::metadata(path).map_err(f)?.is_dir() {
+ let f = |e| FileError::from_io(e, path);
+ if fs::metadata(&resolved).map_err(f)?.is_dir() {
Err(FileError::IsDirectory)
} else {
- fs::read(path).map_err(f)
+ fs::read(&resolved).map_err(f)
}
}
diff --git a/tests/typ/bugs/cite-locate.typ b/tests/typ/bugs/cite-locate.typ
index c3786c5f..4eb95b54 100644
--- a/tests/typ/bugs/cite-locate.typ
+++ b/tests/typ/bugs/cite-locate.typ
@@ -20,4 +20,4 @@
#locate(loc => [Citation @distress on page #loc.page()])
#pagebreak()
-#bibliography("/works.bib", style: "chicago-notes")
+#bibliography("/files/works.bib", style: "chicago-notes")
diff --git a/tests/typ/bugs/hide-meta.typ b/tests/typ/bugs/hide-meta.typ
index 6dce81ad..10c95e59 100644
--- a/tests/typ/bugs/hide-meta.typ
+++ b/tests/typ/bugs/hide-meta.typ
@@ -7,7 +7,7 @@ A pirate. @arrgh \
#set text(2pt)
#hide[
A @arrgh pirate.
- #bibliography("/works.bib")
+ #bibliography("/files/works.bib")
]
---
diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ
index 7ec2c410..32a68308 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("/graph.png", width: 75%))
+#align(center, image("/files/graph.png", width: 75%))
diff --git a/tests/typ/compiler/import.typ b/tests/typ/compiler/import.typ
index 0f161766..7f6baee0 100644
--- a/tests/typ/compiler/import.typ
+++ b/tests/typ/compiler/import.typ
@@ -112,8 +112,8 @@
---
// Some non-text stuff.
-// Error: 9-21 file is not valid utf-8
-#import "/rhino.png"
+// Error: 9-27 file is not valid utf-8
+#import "/files/rhino.png"
---
// Unresolved import.
diff --git a/tests/typ/compiler/set.typ b/tests/typ/compiler/set.typ
index 99bb90d0..b317e60c 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 = "/" + choice.at(n - 1)
+ let path = "/files/" + 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 0f978563..e635574c 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("/graph.png")
+#show "GRAPH": image("/files/graph.png")
The GRAPH has nodes.
diff --git a/tests/typ/compute/data.typ b/tests/typ/compute/data.typ
index d67b7aef..f13f7da8 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("/hello.txt")
+#let data = read("/files/hello.txt")
#test(data, "Hello, world!")
---
-// Error: 18-32 file not found (searched at /missing.txt)
-#let data = read("/missing.txt")
+// Error: 18-38 file not found (searched at files/missing.txt)
+#let data = read("/files/missing.txt")
---
-// Error: 18-28 file is not valid utf-8
-#let data = read("/bad.txt")
+// Error: 18-34 file is not valid utf-8
+#let data = read("/files/bad.txt")
---
// Test reading CSV data.
// Ref: true
#set page(width: auto)
-#let data = csv("/zoo.csv")
+#let data = csv("/files/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-16 failed to parse csv file: found 3 instead of 2 fields in line 3
-#csv("/bad.csv")
+// Error: 6-22 failed to parse csv file: found 3 instead of 2 fields in line 3
+#csv("/files/bad.csv")
---
// Test reading JSON data.
-#let data = json("/zoo.json")
+#let data = json("/files/zoo.json")
#test(data.len(), 3)
#test(data.at(0).name, "Debby")
#test(data.at(2).weight, 150)
---
-// Error: 7-18 failed to parse json file: syntax error in line 3
-#json("/bad.json")
+// Error: 7-24 failed to parse json file: syntax error in line 3
+#json("/files/bad.json")
---
// Test reading TOML data.
-#let data = toml("/toml-types.toml")
+#let data = toml("/files/toml-types.toml")
#test(data.string, "wonderful")
#test(data.integer, 42)
#test(data.float, 3.14)
@@ -62,12 +62,12 @@
))
---
-// Error: 7-18 failed to parse toml file: expected `.`, `=`, index 15-15
-#toml("/bad.toml")
+// Error: 7-24 failed to parse toml file: expected `.`, `=`, index 15-15
+#toml("/files/bad.toml")
---
// Test reading YAML data
-#let data = yaml("/yaml-types.yaml")
+#let data = yaml("/files/yaml-types.yaml")
#test(data.len(), 7)
#test(data.null_key, (none, none))
#test(data.string, "text")
@@ -80,12 +80,12 @@
---
---
-// Error: 7-18 failed to parse yaml file: while parsing a flow sequence, expected ',' or ']' at line 2 column 1
-#yaml("/bad.yaml")
+// Error: 7-24 failed to parse yaml file: while parsing a flow sequence, expected ',' or ']' at line 2 column 1
+#yaml("/files/bad.yaml")
---
// Test reading XML data.
-#let data = xml("/data.xml")
+#let data = xml("/files/data.xml")
#test(data, ((
tag: "data",
attrs: (:),
@@ -109,5 +109,5 @@
),))
---
-// Error: 6-16 failed to parse xml file: found closing tag 'data' instead of 'hello' in line 3
-#xml("/bad.xml")
+// Error: 6-22 failed to parse xml file: found closing tag 'data' instead of 'hello' in line 3
+#xml("/files/bad.xml")
diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ
index ee79f2fd..89bcb90f 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("/rhino.png")),
+ align(top, image("/files/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 88e8510f..f7b47142 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 element doesn't consume the whole region.
#set page(height: 6cm)
#align(left)[Before]
-#pad(10pt, image("/tiger.jpg"))
+#pad(10pt, image("/files/tiger.jpg"))
#align(right)[After]
---
diff --git a/tests/typ/layout/par-bidi.typ b/tests/typ/layout/par-bidi.typ
index 90c6a55e..ea3711ab 100644
--- a/tests/typ/layout/par-bidi.typ
+++ b/tests/typ/layout/par-bidi.typ
@@ -41,7 +41,7 @@ Lריווח #h(1cm) R
---
// Test inline object.
#set text(lang: "he")
-קרנפיםRh#box(image("/rhino.png", height: 11pt))inoחיים
+קרנפיםRh#box(image("/files/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 78789181..324ff44a 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.
-#box(image("/tiger.jpg", height: 6pt))
+#box(image("/files/tiger.jpg", height: 6pt))
starts a paragraph, also with indent.
-#align(center, image("/rhino.png", width: 1cm))
+#align(center, image("/files/rhino.png", width: 1cm))
= Headings
- And lists.
diff --git a/tests/typ/layout/place-background.typ b/tests/typ/layout/place-background.typ
index 6f480b93..3a7a06b9 100644
--- a/tests/typ/layout/place-background.typ
+++ b/tests/typ/layout/place-background.typ
@@ -7,7 +7,7 @@
dx: -10pt,
dy: -10pt,
image(
- "/tiger.jpg",
+ "/files/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 f0ffaf57..6f79e3e1 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("/tiger.jpg", width: 1.8cm))
+#place(right, image("/files/tiger.jpg", width: 1.8cm))
Hi there. This is \
a placed element. \
Unfortunately, \
diff --git a/tests/typ/layout/transform.typ b/tests/typ/layout/transform.typ
index 22a94532..3a674282 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("/tiger.jpg")))
+ rotate(20deg, scale(70%, image("/files/tiger.jpg")))
)
---
// Test setting rotation origin.
#rotate(10deg, origin: top + left,
- image("/tiger.jpg", width: 50%)
+ image("/files/tiger.jpg", width: 50%)
)
---
diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ
index 765e0ec3..5a51901a 100644
--- a/tests/typ/math/content.typ
+++ b/tests/typ/math/content.typ
@@ -2,7 +2,7 @@
---
// Test images and font fallback.
-#let monkey = move(dy: 0.2em, image("/monkey.svg", height: 1em))
+#let monkey = move(dy: 0.2em, image("/files/monkey.svg", height: 1em))
$ sum_(i=#emoji.apple)^#emoji.apple.red i + monkey/2 $
---
diff --git a/tests/typ/meta/bibliography-ordering.typ b/tests/typ/meta/bibliography-ordering.typ
index c1c9880b..5a00c51e 100644
--- a/tests/typ/meta/bibliography-ordering.typ
+++ b/tests/typ/meta/bibliography-ordering.typ
@@ -4,4 +4,4 @@
@netwok, @issue201, @arrgh, @quark, @distress,
@glacier-melt, @issue201, @tolkien54, @sharing, @restful
-#bibliography("/works.bib")
+#bibliography("/files/works.bib")
diff --git a/tests/typ/meta/bibliography.typ b/tests/typ/meta/bibliography.typ
index 94b44346..40d281fa 100644
--- a/tests/typ/meta/bibliography.typ
+++ b/tests/typ/meta/bibliography.typ
@@ -5,19 +5,24 @@
= Introduction <arrgh>
// Error: 1-7 label occurs in the document and its bibliography
@arrgh
-#bibliography("/works.bib")
+#bibliography("/files/works.bib")
---
#set page(width: 200pt)
= Details
See also #cite("arrgh", "distress", [p. 22]), @arrgh[p. 4], and @distress[p. 5].
-#bibliography("/works.bib")
+#bibliography("/files/works.bib")
---
// Test unconventional order.
#set page(width: 200pt)
-#bibliography("/works.bib", title: [Works to be cited], style: "chicago-author-date")
+#bibliography(
+ "/files/works.bib",
+ title: [Works to be cited],
+ style: "chicago-author-date",
+)
#line(length: 100%)
+
#[#set cite(brackets: false)
As described by @netwok],
the net-work is a creature of its own.
@@ -25,8 +30,8 @@ This is close to piratery! @arrgh
And quark! @quark
---
-// Error: 15-43 duplicate bibliography keys: arrgh, distress, glacier-melt, issue201, mcintosh_anxiety, netwok, psychology25, quark, restful, sharing, tolkien54
-#bibliography(("/works.bib", "/works.bib"))
+// Error: 15-55 duplicate bibliography keys: arrgh, distress, glacier-melt, issue201, mcintosh_anxiety, netwok, psychology25, quark, restful, sharing, tolkien54
+#bibliography(("/files/works.bib", "/files/works.bib"))
---
#set page(width: 200pt)
@@ -35,4 +40,4 @@ And quark! @quark
= Multiple Bibs
Now we have multiple bibliographies containing #cite("glacier-melt", "keshav2007read")
-#bibliography(("/works.bib", "/works_too.bib"))
+#bibliography(("/files/works.bib", "/files/works_too.bib"))
diff --git a/tests/typ/meta/cite-footnote.typ b/tests/typ/meta/cite-footnote.typ
index 03984752..071a68d7 100644
--- a/tests/typ/meta/cite-footnote.typ
+++ b/tests/typ/meta/cite-footnote.typ
@@ -2,4 +2,4 @@ Hello @netwok
And again: @netwok
#pagebreak()
-#bibliography("/works.bib", style: "chicago-notes")
+#bibliography("/files/works.bib", style: "chicago-notes")
diff --git a/tests/typ/meta/figure.typ b/tests/typ/meta/figure.typ
index fcf92740..48dea0e8 100644
--- a/tests/typ/meta/figure.typ
+++ b/tests/typ/meta/figure.typ
@@ -13,7 +13,7 @@ We can clearly see that @fig-cylinder and
) <tab-basic>
#figure(
- pad(y: -6pt, image("/cylinder.svg", height: 2cm)),
+ pad(y: -6pt, image("/files/cylinder.svg", height: 2cm)),
caption: [The basic shapes.],
numbering: "I",
) <fig-cylinder>
@@ -30,7 +30,7 @@ We can clearly see that @fig-cylinder and
table(
columns: 2,
[Second cylinder],
- image("/cylinder.svg"),
+ image("/files/cylinder.svg"),
),
caption: "A table containing images."
) <fig-image-in-table>
diff --git a/tests/typ/meta/footnote-container.typ b/tests/typ/meta/footnote-container.typ
index fa246162..562831a9 100644
--- a/tests/typ/meta/footnote-container.typ
+++ b/tests/typ/meta/footnote-container.typ
@@ -4,7 +4,7 @@
// Test footnote in caption.
Read the docs #footnote[https://typst.app/docs]!
#figure(
- image("/graph.png", width: 70%),
+ image("/files/graph.png", width: 70%),
caption: [
A graph #footnote[A _graph_ is a structure with nodes and edges.]
]
diff --git a/tests/typ/meta/footnote-table.typ b/tests/typ/meta/footnote-table.typ
index bfbc3779..8256dc58 100644
--- a/tests/typ/meta/footnote-table.typ
+++ b/tests/typ/meta/footnote-table.typ
@@ -12,7 +12,7 @@
[This cell
#footnote[This footnote is not on the same page]
breaks over multiple pages.],
- image("/tiger.jpg"),
+ image("/files/tiger.jpg"),
)
#table(
diff --git a/tests/typ/meta/link.typ b/tests/typ/meta/link.typ
index 37eba6b7..5dfe37e7 100644
--- a/tests/typ/meta/link.typ
+++ b/tests/typ/meta/link.typ
@@ -54,7 +54,7 @@ My cool #box(move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink))))
// Link containing a block.
#link("https://example.com/", block[
My cool rhino
- #box(move(dx: 10pt, image("/rhino.png", width: 1cm)))
+ #box(move(dx: 10pt, image("/files/rhino.png", width: 1cm)))
])
---
diff --git a/tests/typ/meta/outline-entry.typ b/tests/typ/meta/outline-entry.typ
index ac78ec2a..50147442 100644
--- a/tests/typ/meta/outline-entry.typ
+++ b/tests/typ/meta/outline-entry.typ
@@ -57,4 +57,4 @@
// Error: 2-23 cannot outline cite
#outline(target: cite)
#cite("arrgh", "distress", [p. 22])
-#bibliography("/works.bib")
+#bibliography("/files/works.bib")
diff --git a/tests/typ/meta/query-figure.typ b/tests/typ/meta/query-figure.typ
index 4b730770..b1e59abe 100644
--- a/tests/typ/meta/query-figure.typ
+++ b/tests/typ/meta/query-figure.typ
@@ -24,7 +24,7 @@
})
#figure(
- image("/glacier.jpg"),
+ image("/files/glacier.jpg"),
caption: [Glacier melting],
)
@@ -36,6 +36,6 @@
)
#figure(
- image("/tiger.jpg"),
+ image("/files/tiger.jpg"),
caption: [Tiger world],
)
diff --git a/tests/typ/meta/ref.typ b/tests/typ/meta/ref.typ
index a62e6cce..630bad61 100644
--- a/tests/typ/meta/ref.typ
+++ b/tests/typ/meta/ref.typ
@@ -26,13 +26,13 @@ As seen in @intro, we proceed.
= Intro
#figure(
- image("/cylinder.svg", height: 1cm),
+ image("/files/cylinder.svg", height: 1cm),
caption: [A cylinder.],
supplement: "Fig",
) <fig1>
#figure(
- image("/tiger.jpg", height: 1cm),
+ image("/files/tiger.jpg", height: 1cm),
caption: [A tiger.],
supplement: "Tig",
) <fig2>
diff --git a/tests/typ/text/baseline.typ b/tests/typ/text/baseline.typ
index c19e3c63..e00e9230 100644
--- a/tests/typ/text/baseline.typ
+++ b/tests/typ/text/baseline.typ
@@ -1,12 +1,12 @@
-// Test baseline handling.
-
----
-Hi #text(1.5em)[You], #text(0.75em)[how are you?]
-
-Our cockatoo was one of the
-#text(baseline: -0.2em)[#box(circle(radius: 2pt)) first]
-#text(baseline: 0.2em)[birds #box(circle(radius: 2pt))]
-that ever learned to mimic a human voice.
-
----
-Hey #box(baseline: 40%, image("/tiger.jpg", width: 1.5cm)) there!
+// Test baseline handling.
+
+---
+Hi #text(1.5em)[You], #text(0.75em)[how are you?]
+
+Our cockatoo was one of the
+#text(baseline: -0.2em)[#box(circle(radius: 2pt)) first]
+#text(baseline: 0.2em)[birds #box(circle(radius: 2pt))]
+that ever learned to mimic a human voice.
+
+---
+Hey #box(baseline: 40%, image("/files/tiger.jpg", width: 1.5cm)) there!
diff --git a/tests/typ/text/linebreak-obj.typ b/tests/typ/text/linebreak-obj.typ
index c0a74a1e..50254df1 100644
--- a/tests/typ/text/linebreak-obj.typ
+++ b/tests/typ/text/linebreak-obj.typ
@@ -7,7 +7,7 @@
They can look for the details in @netwok,
which is the authoritative source.
-#bibliography("/works.bib")
+#bibliography("/files/works.bib")
---
// Test punctuation after math equations.
diff --git a/tests/typ/visualize/image.typ b/tests/typ/visualize/image.typ
index 7891e7e2..e3bcc64f 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("/rhino.png")
+#image("/files/rhino.png")
// Load an RGB JPEG image.
#set page(height: 60pt)
-#image("/tiger.jpg")
+#image("../../files/tiger.jpg")
---
// Test configuring the size and fitting behaviour of images.
// Set width and height explicitly.
-#box(image("/rhino.png", width: 30pt))
-#box(image("/rhino.png", height: 30pt))
+#box(image("/files/rhino.png", width: 30pt))
+#box(image("/files/rhino.png", height: 30pt))
// Set width and height explicitly and force stretching.
-#image("/monkey.svg", width: 100%, height: 20pt, fit: "stretch")
+#image("/files/monkey.svg", width: 100%, height: 20pt, fit: "stretch")
// Make sure the bounding-box of the image is correct.
-#align(bottom + right, image("/tiger.jpg", width: 40pt, alt: "A tiger"))
+#align(bottom + right, image("/files/tiger.jpg", width: 40pt, alt: "A tiger"))
---
// Test all three fit modes.
@@ -30,24 +30,24 @@
columns: (1fr, 1fr, 1fr),
rows: 100%,
gutter: 3pt,
- 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"),
+ image("/files/tiger.jpg", width: 100%, height: 100%, fit: "contain"),
+ image("/files/tiger.jpg", width: 100%, height: 100%, fit: "cover"),
+ image("/files/monkey.svg", width: 100%, height: 100%, fit: "stretch"),
)
---
// Does not fit to remaining height of page.
#set page(height: 60pt)
Stuff
-#image("/rhino.png")
+#image("/files/rhino.png")
---
// Test baseline.
-A #box(image("/tiger.jpg", height: 1cm, width: 80%)) B
+A #box(image("/files/tiger.jpg", height: 1cm, width: 80%)) B
---
// Test advanced SVG features.
-#image("/pattern.svg")
+#image("/files/pattern.svg")
---
// Error: 8-29 file not found (searched at typ/visualize/path/does/not/exist)
@@ -58,5 +58,5 @@ A #box(image("/tiger.jpg", height: 1cm, width: 80%)) B
#image("./image.typ")
---
-// Error: 2-19 failed to parse svg: found closing tag 'g' instead of 'style' in line 4
-#image("/bad.svg")
+// Error: 2-25 failed to parse svg: found closing tag 'g' instead of 'style' in line 4
+#image("/files/bad.svg")
diff --git a/tests/typ/visualize/svg-text.typ b/tests/typ/visualize/svg-text.typ
index 132905a8..838f7360 100644
--- a/tests/typ/visualize/svg-text.typ
+++ b/tests/typ/visualize/svg-text.typ
@@ -4,6 +4,6 @@
#set page(width: 250pt)
#figure(
- image("/diagram.svg"),
+ image("/files/diagram.svg"),
caption: [A textful diagram],
)