1
0
Fork 0

Add test case for code coverage, and implement two Joost comments.

This commit is contained in:
woutervdub 2023-12-16 22:09:22 +00:00
parent e1fa8286d4
commit 3cef72975e
2 changed files with 15 additions and 2 deletions

View file

@ -600,6 +600,19 @@ describe('Path', () => {
expect(halves[1].ops[0].to.y).to.equal(30)
})
it('Should split a path on roughly a line joint', () => {
const a = new Point(45, 60)
const b = new Point(10, 30)
const c = new Point(90, 30)
const test = new Path().move(a).line(b).line(c)
let halves = test.split(new Point(10.1, 29.9))
expect(halves[0].ops[1].to.x).to.equal(10.1)
expect(halves[0].ops[1].to.y).to.equal(29.9)
expect(halves[1].ops[0].to.x).to.equal(10.1)
expect(halves[1].ops[0].to.y).to.equal(29.9)
})
it('Should split a path on a curve joint', () => {
const a = new Point(45, 60)
const b = new Point(10, 30)