summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-05-29 15:45:57 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-31 22:33:40 +0200
commite023bf2ac9f5796355d9485afc16781196bf212b (patch)
tree26d4487de0c4e2d0f69182483301de867cb5fa34 /tests
parent9f77f09aacd1fb0fd6138a6d16ed2755f6bfae3f (diff)
Module loading system
Detects cyclic imports and loads each module only once per compilation.
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/full/coma.typ2
-rw-r--r--tests/typ/library/image.typ22
-rw-r--r--tests/typ/text/bidi.typ2
-rw-r--r--tests/typeset.rs5
4 files changed, 16 insertions, 15 deletions
diff --git a/tests/typ/full/coma.typ b/tests/typ/full/coma.typ
index 619843d7..4941fb71 100644
--- a/tests/typ/full/coma.typ
+++ b/tests/typ/full/coma.typ
@@ -46,4 +46,4 @@ von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel.
// The `image` function returns a "template" value of the same type as
// the `[...]` literals.
-#align(center, image("res/graph.png", width: 75%))
+#align(center, image("../../res/graph.png", width: 75%))
diff --git a/tests/typ/library/image.typ b/tests/typ/library/image.typ
index a5737f4f..1fa128f0 100644
--- a/tests/typ/library/image.typ
+++ b/tests/typ/library/image.typ
@@ -4,35 +4,35 @@
// Test loading different image formats.
// Load an RGBA PNG image.
-#image("res/rhino.png")
+#image("../../res/rhino.png")
#pagebreak()
// Load an RGB JPEG image.
-#image("res/tiger.jpg")
+#image("../../res/tiger.jpg")
-// Error: 8-29 failed to load image
+// Error: 8-29 file not found
#image("path/does/not/exist")
-// Error: 8-29 failed to load image
-#image("typ/image-error.typ")
+// Error: 8-20 failed to load image
+#image("./font.typ")
---
// Test configuring the size and fitting behaviour of images.
// Fit to width of page.
-#image("res/rhino.png")
+#image("../../res/rhino.png")
// Fit to height of page.
-#page(height: 40pt, image("res/rhino.png"))
+#page(height: 40pt, image("../../res/rhino.png"))
// Set width explicitly.
-#image("res/rhino.png", width: 50pt)
+#image("../../res/rhino.png", width: 50pt)
// Set height explicitly.
-#image("res/rhino.png", height: 50pt)
+#image("../../res/rhino.png", height: 50pt)
// Set width and height explicitly and force stretching.
-#image("res/rhino.png", width: 25pt, height: 50pt)
+#image("../../res/rhino.png", width: 25pt, height: 50pt)
// Make sure the bounding-box of the image is correct.
-#align(bottom, right, image("res/tiger.jpg", width: 60pt))
+#align(bottom, right, image("../../res/tiger.jpg", width: 60pt))
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ
index 44f0cc15..0d589930 100644
--- a/tests/typ/text/bidi.typ
+++ b/tests/typ/text/bidi.typ
@@ -46,4 +46,4 @@ Lריווח #h(1cm) R
// Test inline object.
#font("Noto Serif Hebrew", "EB Garamond")
#lang("he")
-קרנפיםRh#image("res/rhino.png", height: 11pt)inoחיים
+קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים
diff --git a/tests/typeset.rs b/tests/typeset.rs
index faf76f7e..3f9bbd1d 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -162,7 +162,7 @@ fn test(
}
} else {
let (part_ok, compare_here, part_frames) =
- test_part(loader, cache, part, i, compare_ref, lines);
+ test_part(loader, cache, src_path, part, i, compare_ref, lines);
ok &= part_ok;
compare_ever |= compare_here;
frames.extend(part_frames);
@@ -203,6 +203,7 @@ fn test(
fn test_part(
loader: &mut FsLoader,
cache: &mut Cache,
+ path: &Path,
src: &str,
i: usize,
compare_ref: bool,
@@ -223,7 +224,7 @@ fn test_part(
state.page.size = Size::new(Length::pt(120.0), Length::raw(f64::INFINITY));
state.page.margins = Sides::splat(Some(Length::pt(10.0).into()));
- let mut pass = typst::typeset(loader, cache, &src, &scope, state);
+ let mut pass = typst::typeset(loader, cache, path, &src, &scope, state);
if !compare_ref {
pass.output.clear();
}