fix(core): Tests for smurve and smurve_
This commit is contained in:
parent
d7cbd42ced
commit
269b1a36f1
1 changed files with 31 additions and 7 deletions
|
@ -9,17 +9,16 @@ describe('Path', () => {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
draft: ({ Point, points, Path, paths, part }) => {
|
draft: ({ Point, points, Path, paths, part }) => {
|
||||||
points.from = new Point(10, 20)
|
points.from = new Point(10, 20)
|
||||||
points.cp1 = new Point(40, 0)
|
points.cp1 = new Point(40, 10)
|
||||||
points.cp2 = new Point(60, 30)
|
points.cp2 = new Point(60, 30)
|
||||||
points.to = new Point(90, 20)
|
points.to = new Point(90, 20)
|
||||||
points.scp2 = new Point(30, 55)
|
points.scp2 = new Point(140, 10)
|
||||||
points.sto = new Point(10, 50)
|
points.sto = new Point(170, 20)
|
||||||
|
|
||||||
paths.test = new Path()
|
paths.test = new Path()
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.curve(points.cp1, points.cp2, points.to)
|
.curve(points.cp1, points.cp2, points.to)
|
||||||
.smurve(points.scp2, points.sto)
|
.smurve(points.scp2, points.sto)
|
||||||
console.log(paths.test, 'in draft')
|
|
||||||
|
|
||||||
return part
|
return part
|
||||||
},
|
},
|
||||||
|
@ -28,9 +27,34 @@ describe('Path', () => {
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
|
|
||||||
console.log(pattern.parts[0].test.paths)
|
expect(round(pattern.parts[0].test.paths.test.ops[2].cp1.x)).to.equal(120)
|
||||||
console.log(pattern.stores[0].logs)
|
expect(round(pattern.parts[0].test.paths.test.ops[2].cp1.y)).to.equal(10)
|
||||||
//expect(pattern.parts[0].test.paths.test.bottomRight.x).to.equal(-10)
|
})
|
||||||
|
|
||||||
|
it('Should draw a smurve_', () => {
|
||||||
|
const part = {
|
||||||
|
name: 'test',
|
||||||
|
draft: ({ Point, points, Path, paths, part }) => {
|
||||||
|
points.from = new Point(10, 20)
|
||||||
|
points.cp1 = new Point(40, 10)
|
||||||
|
points.cp2 = new Point(60, 30)
|
||||||
|
points.to = new Point(90, 20)
|
||||||
|
points.sto = new Point(170, 20)
|
||||||
|
|
||||||
|
paths.test = new Path()
|
||||||
|
.move(points.from)
|
||||||
|
.curve(points.cp1, points.cp2, points.to)
|
||||||
|
.smurve_(points.sto)
|
||||||
|
|
||||||
|
return part
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const design = new Design({ parts: [part] })
|
||||||
|
const pattern = new design()
|
||||||
|
pattern.draft().render()
|
||||||
|
|
||||||
|
expect(round(pattern.parts[0].test.paths.test.ops[2].cp1.x)).to.equal(120)
|
||||||
|
expect(round(pattern.parts[0].test.paths.test.ops[2].cp1.y)).to.equal(10)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should offset a line', () => {
|
it('Should offset a line', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue