1
0
Fork 0

Test with SA

This commit is contained in:
Wouter van Wageningen 2023-03-10 03:23:01 +00:00
parent 6b6bca0fbb
commit 607bc010da

View file

@ -62,10 +62,6 @@ describe('Sewtogether Plugin Tests', () => {
const pattern = new Test()
pattern.draft()
var c = pattern.parts[0].test.paths.sewtogetherSewTogetherHinge
console.log({ c: c })
console.log({ p: pattern.parts[0].test.paths })
console.log({ t: pattern.parts[0].test })
console.log({ ps0: pattern.parts[0] })
expect(c.attributes.get('class')).to.equal('dotted note stroke-sm')
expect(c.attributes.get('marker-start')).to.equal('url(#sewTogetherCross)')
expect(c.ops[0].type).to.equal('move')
@ -76,16 +72,17 @@ describe('Sewtogether Plugin Tests', () => {
expect(round(c.ops[1].to.y)).to.equal(120)
})
it('Should run the pleat/reverse macro', () => {
it('Should run the sewtogether/hinge (with sa) macro', () => {
const part = {
name: 'test',
draft: ({ Point, points, macro, part }) => {
points.from = new Point(10, 20)
points.hinge = new Point(40, 110)
points.to = new Point(10, 220)
macro('pleat', {
macro('sewtogether', {
from: points.from,
hinge: points.hinge,
to: points.to,
reverse: true,
})
return part
@ -93,16 +90,9 @@ describe('Sewtogether Plugin Tests', () => {
plugins: [annotationPlugin],
}
const Test = new Design({ plugins: [annotationPlugin], parts: [part] })
const pattern = new Test()
const pattern = new Test({ sa: 10 })
pattern.draft()
var c = pattern.parts[0].test.paths.pleatPleatFrom
expect(c.attributes.get('class')).to.equal('note dashed')
c = pattern.parts[0].test.paths.pleatPleatTo
expect(c.attributes.get('class')).to.equal('note')
c = pattern.parts[0].test.paths.pleatPleatArrow
expect(round(c.ops[0].to.x)).to.equal(18.75)
expect(round(c.ops[0].to.y)).to.equal(220)
expect(round(c.ops[1].to.x)).to.equal(18.75)
expect(round(c.ops[1].to.y)).to.equal(20)
var c = pattern.parts[0].test.paths.sewtogetherSewTogetherHinge
expect(round(c.ops[1].to.x)).to.equal(0)
})
})