Adding tests for cubicCurveTo
This commit is contained in:
parent
9716e166df
commit
354b65b623
@ -76,8 +76,10 @@ class Path {
|
||||
this.pathParts.push(`${command}${cx1},${cy1} ${cx2},${cy2} ${x},${y}`);
|
||||
}
|
||||
|
||||
this.currentPosition.x = relative ? this.currentPosition.x + x : x;
|
||||
this.currentPosition.y = relative ? this.currentPosition.y + y : y;
|
||||
this.currentPosition = {
|
||||
x: relative ? this.currentPosition.x + x : x,
|
||||
y: relative ? this.currentPosition.y + y : y
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ describe('Path', () => {
|
||||
[ 'lineTo', { x: 5, relative: true }, 'h5' ],
|
||||
[ 'lineTo', { y: 1, relative: true }, 'v1' ],
|
||||
[ 'lineTo', { relative: true }, '' ],
|
||||
// cubicCurveTo
|
||||
[ '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', { 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' ]
|
||||
].forEach(([ cmd, args, str ], i) => (
|
||||
test(`case #${ i }`, () => {
|
||||
const path = new Path();
|
||||
|
Loading…
Reference in New Issue
Block a user