Skip to content

Commit 9d578fe

Browse files
committed
tests: Add tests for custom marks
1 parent 9678181 commit 9d578fe

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/mark/custom/ref/1.png

7.4 KB
Loading

tests/mark/custom/test.typ

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#import "/src/lib.typ": *
2+
#import "/tests/helper.typ": *
3+
#set page(width: auto, height: auto)
4+
5+
#let register-face() = {
6+
import draw: *
7+
8+
register-mark("face", style => {
9+
circle((0,0), radius: .5, fill: yellow)
10+
arc((0,0), start: 180deg + 30deg, delta: 180deg - 60deg, anchor: "origin", radius: .3)
11+
circle((-.15, +.15), radius: .1, fill: white)
12+
circle((-.10, +.10), radius: .025, fill: black)
13+
circle((+.15, +.15), radius: .1, fill: white)
14+
circle((+.20, +.10), radius: .025, fill: black)
15+
16+
anchor("tip", (+.5, 0))
17+
anchor("base", (-.5, 0))
18+
}, mnemonic: ":)")
19+
}
20+
21+
#test-case({
22+
import draw: *
23+
24+
register-face()
25+
catmull((-3, 0), (-1,1), (1,-1), (3,0), mark: (end: "face", start: (symbol: ":)", flip: true, reverse: true), ))
26+
})
27+
28+
#test-case({
29+
import draw: *
30+
31+
line((0,-1), (0,1), stroke: green)
32+
33+
register-face()
34+
mark((0,0), (+1,0), symbol: ":)", slant: 50%, anchor: "center")
35+
})
36+
37+
#test-case({
38+
import draw: *
39+
40+
register-face()
41+
line((0,0), (3,0), mark: (end: (":)", ":)", ":)"), sep: -.3))
42+
})

0 commit comments

Comments
 (0)