Skip to content

Commit

Permalink
Skew transformations added2
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Nov 21, 2013
1 parent 930b9c4 commit a24a2a5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/skew.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var assert = chai.assert;

describe("X axis skew", function() {

it("should work with relative path", function() {
assert.equal(new SVGPathData(
'm100 75l-50 -45l0 90z'
).skewX(Math.PI/2).encode(),
'm175.29136163904155 75l-95.17481698342493 -45l90.34963396684985 90z');
});

it("should work with absolute path", function() {
assert.equal(new SVGPathData(
'M 100,75 50,30 50,120 z'
).skewX(Math.PI/2).encode(),
'M175.29136163904155 75L80.11654465561662 30L170.46617862246646 120z');
});

});

describe("Y axis skew", function() {

it("should work with relative path", function() {
assert.equal(new SVGPathData(
'm100 75l-50 -45l0 90z'
).skewY(Math.PI/2).encode(),
'm100 175.3884821853887l-50 -95.19424109269436l0 90z');
});

it("should work with absolute path", function() {
assert.equal(new SVGPathData(
'M 100,75 50,30 50,120 z'
).skewY(Math.PI/2).encode(),
'M100 175.3884821853887L50 80.19424109269436L50 170.19424109269437z');
});

});

0 comments on commit a24a2a5

Please sign in to comment.