Skip to content

Commit

Permalink
tests: Add tests for custom marks
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Aug 17, 2024
1 parent 6b7fc25 commit 512ebcc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Binary file added tests/mark/custom/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions tests/mark/custom/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#import "/src/lib.typ": *
#import "/tests/helper.typ": *
#set page(width: auto, height: auto)

#let register-face() = {
import draw: *

register-mark("face", style => {
circle((0,0), radius: .5, fill: yellow)
arc((0,0), start: 180deg + 30deg, delta: 180deg - 60deg, anchor: "origin", radius: .3)
circle((-.15, +.15), radius: .1, fill: white)
circle((-.10, +.10), radius: .025, fill: black)
circle((+.15, +.15), radius: .1, fill: white)
circle((+.20, +.10), radius: .025, fill: black)

anchor("tip", (+.5, 0))
anchor("base", (-.5, 0))
}, mnemonic: ":)")
}

#test-case({
import draw: *

register-face()
catmull((-3, 0), (-1,1), (1,-1), (3,0), mark: (end: "face", start: (symbol: ":)", flip: true, reverse: true), ))
})

#test-case({
import draw: *

line((0,-1), (0,1), stroke: green)

register-face()
mark((0,0), (+1,0), symbol: ":)", slant: 50%, anchor: "center")
})

#test-case({
import draw: *

register-face()
line((0,0), (3,0), mark: (end: (":)", ":)", ":)"), sep: -.3))
})

0 comments on commit 512ebcc

Please sign in to comment.