diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-16 17:56:23 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-16 17:56:36 +0200 |
| commit | a741bd6b83d1e374c8218b5439e26522499cc4ae (patch) | |
| tree | 796ef8b8ae2186a082f37a2aa4732c9bba7d2bdf /tests | |
| parent | 6536e9e069616b862ebb774c7bef1b886c069350 (diff) | |
Absolute paths
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/style/set.png | bin | 14415 -> 20833 bytes | |||
| -rw-r--r-- | tests/ref/style/show-text.png | bin | 39399 -> 43671 bytes | |||
| -rw-r--r-- | tests/typ/code/import.typ | 4 | ||||
| -rw-r--r-- | tests/typ/code/include.typ | 4 | ||||
| -rw-r--r-- | tests/typ/coma.typ | 2 | ||||
| -rw-r--r-- | tests/typ/graphics/image.typ | 24 | ||||
| -rw-r--r-- | tests/typ/graphics/transform.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/grid-3.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/pad.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/place-background.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/place.typ | 2 | ||||
| -rw-r--r-- | tests/typ/style/set.typ | 12 | ||||
| -rw-r--r-- | tests/typ/style/show-text.typ | 7 | ||||
| -rw-r--r-- | tests/typ/text/bidi.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/indent.typ | 4 | ||||
| -rw-r--r-- | tests/typ/text/link.typ | 2 |
16 files changed, 46 insertions, 27 deletions
diff --git a/tests/ref/style/set.png b/tests/ref/style/set.png Binary files differindex c63ddb7c..52512b85 100644 --- a/tests/ref/style/set.png +++ b/tests/ref/style/set.png diff --git a/tests/ref/style/show-text.png b/tests/ref/style/show-text.png Binary files differindex 53c9d132..ae5230f1 100644 --- a/tests/ref/style/show-text.png +++ b/tests/ref/style/show-text.png diff --git a/tests/typ/code/import.typ b/tests/typ/code/import.typ index dab91dae..aef5e9c4 100644 --- a/tests/typ/code/import.typ +++ b/tests/typ/code/import.typ @@ -38,11 +38,11 @@ #import a, c, from "target.typ" --- -// Error: 19-21 file not found +// Error: 19-21 file not found (searched at typ/code) #import name from "" --- -// Error: 16-27 file not found +// Error: 16-27 file not found (searched at typ/code/lib/0.2.1) #import * from "lib/0.2.1" --- diff --git a/tests/typ/code/include.typ b/tests/typ/code/include.typ index 3510cb06..cd3328a2 100644 --- a/tests/typ/code/include.typ +++ b/tests/typ/code/include.typ @@ -6,7 +6,7 @@ = Document // Include a file -#include "importable/chap1.typ" +#include "/typ/code/importable/chap1.typ" // Expression as a file name. #let chap2 = include "import" + "able/chap" + "2.typ" @@ -16,7 +16,7 @@ --- { - // Error: 19-41 file not found + // Error: 19-41 file not found (searched at typ/code/importable/chap3.typ) let x = include "importable/chap3.typ" } diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ index 0e228d14..e312fc78 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("/res/graph.png", width: 75%)) diff --git a/tests/typ/graphics/image.typ b/tests/typ/graphics/image.typ index 8817713f..e64b6c45 100644 --- a/tests/typ/graphics/image.typ +++ b/tests/typ/graphics/image.typ @@ -4,7 +4,7 @@ // Test loading different image formats. // Load an RGBA PNG image. -#image("../../res/rhino.png") +#image("/res/rhino.png") // Load an RGB JPEG image. #set page(height: 60pt) @@ -14,14 +14,14 @@ // 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("/res/rhino.png", width: 30pt) +#image("/res/rhino.png", height: 30pt) // Set width and height explicitly and force stretching. -#image("../../res/monkey.svg", width: 100%, height: 20pt, fit: "stretch") +#image("/res/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("/res/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("/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"), ) --- @@ -40,18 +40,18 @@ #set page(height: 60pt) Stuff \ Stuff -#image("../../res/rhino.png") +#image("/res/rhino.png") --- // Test baseline. -A #image("../../res/tiger.jpg", height: 1cm, width: 80%) B +A #image("/res/tiger.jpg", height: 1cm, width: 80%) B --- // Test advanced SVG features. -#image("../../res/pattern.svg") +#image("/res/pattern.svg") --- -// Error: 8-29 file not found +// Error: 8-29 file not found (searched at typ/graphics/path/does/not/exist) #image("path/does/not/exist") --- diff --git a/tests/typ/graphics/transform.typ b/tests/typ/graphics/transform.typ index e0679306..5d2a1729 100644 --- a/tests/typ/graphics/transform.typ +++ b/tests/typ/graphics/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("/res/tiger.jpg"))) ) --- // Test setting rotation origin. #rotate(10deg, origin: top + left, - image("../../res/tiger.jpg", width: 50%) + image("/res/tiger.jpg", width: 50%) ) --- diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ index 8d04722e..6b7dc47f 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("/res/rhino.png")), align(top, rect(fill: eastern, align(right)[LoL])), [rofl], [\ A] * 3, diff --git a/tests/typ/layout/pad.typ b/tests/typ/layout/pad.typ index 502137ec..9791eae4 100644 --- a/tests/typ/layout/pad.typ +++ b/tests/typ/layout/pad.typ @@ -21,7 +21,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("/res/tiger.jpg")) #align(right)[After] --- diff --git a/tests/typ/layout/place-background.typ b/tests/typ/layout/place-background.typ index f64bf0ee..fafedec1 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", + "/res/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 95049bdc..58f9d06d 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("/res/tiger.jpg", width: 1.8cm)) Hi there. This is \ a placed node. \ Unfortunately, \ diff --git a/tests/typ/style/set.typ b/tests/typ/style/set.typ index 2c12d3e9..830c6661 100644 --- a/tests/typ/style/set.typ +++ b/tests/typ/style/set.typ @@ -37,5 +37,17 @@ Hello *{x}* } --- +// Test relative path resolving in layout phase. +#let choice = ("monkey.svg", "rhino.png", "tiger.jpg") +#set enum(label: n => { + let path = "../../res/" + choice(n - 1) + move(dy: -0.15em, image(path, width: 1em, height: 1em)) +}) + +. Monkey +. Rhino +. Tiger + +--- // Error: 11-25 set is only allowed directly in code and content blocks { let x = set text(blue) } diff --git a/tests/typ/style/show-text.typ b/tests/typ/style/show-text.typ index f4ecb7e1..283a2887 100644 --- a/tests/typ/style/show-text.typ +++ b/tests/typ/style/show-text.typ @@ -56,3 +56,10 @@ Rust is memory-safe and blazingly fast. Let's rewrite everything in rust. World - World + +--- +// Test absolute path in layout phase. + +#show "GRAPH" as image("/res/graph.png") + +The GRAPH has nodes. diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ index 7058638a..11c0cafa 100644 --- a/tests/typ/text/bidi.typ +++ b/tests/typ/text/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("/res/rhino.png", height: 11pt)inoחיים --- // Test whether L1 whitespace resetting destroys stuff. diff --git a/tests/typ/text/indent.typ b/tests/typ/text/indent.typ index 897e360c..92b12180 100644 --- a/tests/typ/text/indent.typ +++ b/tests/typ/text/indent.typ @@ -8,10 +8,10 @@ The first paragraph has no indent. But the second one does. -#image("../../res/tiger.jpg", height: 6pt) +#image("/res/tiger.jpg", height: 6pt) starts a paragraph without indent. -#align(center, image("../../res/rhino.png", width: 1cm)) +#align(center, image("/res/rhino.png", width: 1cm)) = Headings - And lists. diff --git a/tests/typ/text/link.typ b/tests/typ/text/link.typ index ad538187..64697bff 100644 --- a/tests/typ/text/link.typ +++ b/tests/typ/text/link.typ @@ -31,5 +31,5 @@ My cool #move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink))) // Link containing a block. #link("https://example.com/", underline: false, block[ My cool rhino - #move(dx: 10pt, image("../../res/rhino.png", width: 1cm)) + #move(dx: 10pt, image("/res/rhino.png", width: 1cm)) ]) |
