Adding tests for Path#quadraticCurveTo
This commit is contained in:
parent
354b65b623
commit
d6cdad7ec3
@ -94,8 +94,10 @@ class Path {
|
|||||||
this.pathParts.push(`${command}${cx},${cy} ${x},${y}`);
|
this.pathParts.push(`${command}${cx},${cy} ${x},${y}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentPosition.x = relative ? this.currentPosition.x + x : x;
|
this.currentPosition = {
|
||||||
this.currentPosition.y = relative ? this.currentPosition.y + y : y;
|
x: relative ? this.currentPosition.x + x : x,
|
||||||
|
y: relative ? this.currentPosition.y + y : y
|
||||||
|
};
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,12 @@ describe('Path', () => {
|
|||||||
[ 'cubicCurveTo', { cx1: 5, cy1: 6, cx2: 10, cy2: 11, x: 15, y: 16 }, 'C5,6 10,11 15,16' ],
|
[ 'cubicCurveTo', { cx1: 5, cy1: 6, cx2: 10, cy2: 11, x: 15, y: 16 }, 'C5,6 10,11 15,16' ],
|
||||||
[ 'cubicCurveTo', { cx2: 10, cy2: 11, x: 15, y: 16 }, 'S10,11 15,16' ],
|
[ 'cubicCurveTo', { cx2: 10, cy2: 11, x: 15, y: 16 }, 'S10,11 15,16' ],
|
||||||
[ 'cubicCurveTo', { cx1: 5, cy1: 6, cx2: 10, cy2: 11, x: 15, y: 16, relative: true }, 'c5,6 10,11 15,16' ],
|
[ 'cubicCurveTo', { cx1: 5, cy1: 6, cx2: 10, cy2: 11, x: 15, y: 16, relative: true }, 'c5,6 10,11 15,16' ],
|
||||||
[ 'cubicCurveTo', { cx2: 10, cy2: 11, x: 15, y: 16, relative: true }, 's10,11 15,16' ]
|
[ 'cubicCurveTo', { cx2: 10, cy2: 11, x: 15, y: 16, relative: true }, 's10,11 15,16' ],
|
||||||
|
// quadraticCurveTo
|
||||||
|
[ 'quadraticCurveTo', { cx: 5, cy: 6, x: 10, y: 11 }, 'Q5,6 10,11' ],
|
||||||
|
[ 'quadraticCurveTo', { x: 10, y: 11 }, 'T10,11' ],
|
||||||
|
[ 'quadraticCurveTo', { cx: 5, cy: 6, x: 10, y: 11, relative: true }, 'q5,6 10,11' ],
|
||||||
|
[ 'quadraticCurveTo', { x: 10, y: 11, relative: true }, 't10,11' ]
|
||||||
].forEach(([ cmd, args, str ], i) => (
|
].forEach(([ cmd, args, str ], i) => (
|
||||||
test(`case #${ i }`, () => {
|
test(`case #${ i }`, () => {
|
||||||
const path = new Path();
|
const path = new Path();
|
||||||
|
Loading…
Reference in New Issue
Block a user