diff --git a/test/core/Circle.js b/test/core/Circle.js index 183f98f..f621992 100644 --- a/test/core/Circle.js +++ b/test/core/Circle.js @@ -53,6 +53,10 @@ expect(circ1.contains(10, 16)).to.be.false; expect(circ1.contains(11, 15)).to.be.false; expect(circ1.contains(0, 0)).to.be.false; + + const circ2 = new PIXI.Circle(10, 10, 0); + + expect(circ2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Circle.js b/test/core/Circle.js index 183f98f..f621992 100644 --- a/test/core/Circle.js +++ b/test/core/Circle.js @@ -53,6 +53,10 @@ expect(circ1.contains(10, 16)).to.be.false; expect(circ1.contains(11, 15)).to.be.false; expect(circ1.contains(0, 0)).to.be.false; + + const circ2 = new PIXI.Circle(10, 10, 0); + + expect(circ2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Ellipse.js b/test/core/Ellipse.js index f2e8234..3f47442 100644 --- a/test/core/Ellipse.js +++ b/test/core/Ellipse.js @@ -56,6 +56,10 @@ expect(ellipse1.contains(10, 16)).to.be.false; expect(ellipse1.contains(11, 15)).to.be.false; expect(ellipse1.contains(0, 0)).to.be.false; + + const ellipse2 = new PIXI.Ellipse(10, 10, 0, 0); + + expect(ellipse2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Circle.js b/test/core/Circle.js index 183f98f..f621992 100644 --- a/test/core/Circle.js +++ b/test/core/Circle.js @@ -53,6 +53,10 @@ expect(circ1.contains(10, 16)).to.be.false; expect(circ1.contains(11, 15)).to.be.false; expect(circ1.contains(0, 0)).to.be.false; + + const circ2 = new PIXI.Circle(10, 10, 0); + + expect(circ2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Ellipse.js b/test/core/Ellipse.js index f2e8234..3f47442 100644 --- a/test/core/Ellipse.js +++ b/test/core/Ellipse.js @@ -56,6 +56,10 @@ expect(ellipse1.contains(10, 16)).to.be.false; expect(ellipse1.contains(11, 15)).to.be.false; expect(ellipse1.contains(0, 0)).to.be.false; + + const ellipse2 = new PIXI.Ellipse(10, 10, 0, 0); + + expect(ellipse2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Matrix.js b/test/core/Matrix.js index 9d2694b..76bd57c 100644 --- a/test/core/Matrix.js +++ b/test/core/Matrix.js @@ -107,10 +107,60 @@ expect(m1.ty).to.equal(m2.ty); }); + it('should prepend matrix', function () + { + const m1 = new PIXI.Matrix(); + const m2 = new PIXI.Matrix(); + + m2.set(2, 3, 4, 5, 100, 200); + m1.prepend(m2); + + expect(m1.a).to.equal(m2.a); + expect(m1.b).to.equal(m2.b); + expect(m1.c).to.equal(m2.c); + expect(m1.d).to.equal(m2.d); + expect(m1.tx).to.equal(m2.tx); + expect(m1.ty).to.equal(m2.ty); + + const m3 = new PIXI.Matrix(); + const m4 = new PIXI.Matrix(); + + m3.prepend(m4); + + expect(m3.a).to.equal(m4.a); + expect(m3.b).to.equal(m4.b); + expect(m3.c).to.equal(m4.c); + expect(m3.d).to.equal(m4.d); + expect(m3.tx).to.equal(m4.tx); + expect(m3.ty).to.equal(m4.ty); + }); + it('should get IDENTITY and TEMP_MATRIX', function () { expect(PIXI.Matrix.IDENTITY instanceof PIXI.Matrix).to.be.true; expect(PIXI.Matrix.TEMP_MATRIX instanceof PIXI.Matrix).to.be.true; }); -}); + it('should reset matrix to default when identity() is called', function () + { + const matrix = new PIXI.Matrix(); + + matrix.set(2, 3, 4, 5, 100, 200); + + expect(matrix.a).to.equal(2); + expect(matrix.b).to.equal(3); + expect(matrix.c).to.equal(4); + expect(matrix.d).to.equal(5); + expect(matrix.tx).to.equal(100); + expect(matrix.ty).to.equal(200); + + matrix.identity(); + + expect(matrix.a).to.equal(1); + expect(matrix.b).to.equal(0); + expect(matrix.c).to.equal(0); + expect(matrix.d).to.equal(1); + expect(matrix.tx).to.equal(0); + expect(matrix.ty).to.equal(0); + }); +}); diff --git a/test/core/Circle.js b/test/core/Circle.js index 183f98f..f621992 100644 --- a/test/core/Circle.js +++ b/test/core/Circle.js @@ -53,6 +53,10 @@ expect(circ1.contains(10, 16)).to.be.false; expect(circ1.contains(11, 15)).to.be.false; expect(circ1.contains(0, 0)).to.be.false; + + const circ2 = new PIXI.Circle(10, 10, 0); + + expect(circ2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Ellipse.js b/test/core/Ellipse.js index f2e8234..3f47442 100644 --- a/test/core/Ellipse.js +++ b/test/core/Ellipse.js @@ -56,6 +56,10 @@ expect(ellipse1.contains(10, 16)).to.be.false; expect(ellipse1.contains(11, 15)).to.be.false; expect(ellipse1.contains(0, 0)).to.be.false; + + const ellipse2 = new PIXI.Ellipse(10, 10, 0, 0); + + expect(ellipse2.contains(10, 10)).to.be.false; }); it('should return framing rectangle', function () diff --git a/test/core/Matrix.js b/test/core/Matrix.js index 9d2694b..76bd57c 100644 --- a/test/core/Matrix.js +++ b/test/core/Matrix.js @@ -107,10 +107,60 @@ expect(m1.ty).to.equal(m2.ty); }); + it('should prepend matrix', function () + { + const m1 = new PIXI.Matrix(); + const m2 = new PIXI.Matrix(); + + m2.set(2, 3, 4, 5, 100, 200); + m1.prepend(m2); + + expect(m1.a).to.equal(m2.a); + expect(m1.b).to.equal(m2.b); + expect(m1.c).to.equal(m2.c); + expect(m1.d).to.equal(m2.d); + expect(m1.tx).to.equal(m2.tx); + expect(m1.ty).to.equal(m2.ty); + + const m3 = new PIXI.Matrix(); + const m4 = new PIXI.Matrix(); + + m3.prepend(m4); + + expect(m3.a).to.equal(m4.a); + expect(m3.b).to.equal(m4.b); + expect(m3.c).to.equal(m4.c); + expect(m3.d).to.equal(m4.d); + expect(m3.tx).to.equal(m4.tx); + expect(m3.ty).to.equal(m4.ty); + }); + it('should get IDENTITY and TEMP_MATRIX', function () { expect(PIXI.Matrix.IDENTITY instanceof PIXI.Matrix).to.be.true; expect(PIXI.Matrix.TEMP_MATRIX instanceof PIXI.Matrix).to.be.true; }); -}); + it('should reset matrix to default when identity() is called', function () + { + const matrix = new PIXI.Matrix(); + + matrix.set(2, 3, 4, 5, 100, 200); + + expect(matrix.a).to.equal(2); + expect(matrix.b).to.equal(3); + expect(matrix.c).to.equal(4); + expect(matrix.d).to.equal(5); + expect(matrix.tx).to.equal(100); + expect(matrix.ty).to.equal(200); + + matrix.identity(); + + expect(matrix.a).to.equal(1); + expect(matrix.b).to.equal(0); + expect(matrix.c).to.equal(0); + expect(matrix.d).to.equal(1); + expect(matrix.tx).to.equal(0); + expect(matrix.ty).to.equal(0); + }); +}); diff --git a/test/core/TilingSprite.js b/test/core/TilingSprite.js index 2e449a7..7694792 100644 --- a/test/core/TilingSprite.js +++ b/test/core/TilingSprite.js @@ -24,4 +24,25 @@ expect(bounds.height).to.equal(600); }); }); + + it('checks if tilingSprite contains a point', function () + { + const texture = new PIXI.Texture(new PIXI.BaseTexture()); + const tilingSprite = new PIXI.extras.TilingSprite(texture, 200, 300); + + expect(tilingSprite.containsPoint(new PIXI.Point(1, 1))).to.equal(true); + expect(tilingSprite.containsPoint(new PIXI.Point(300, 400))).to.equal(false); + }); + + it('gets and sets height and width correctly', function () + { + const texture = new PIXI.Texture(new PIXI.BaseTexture()); + const tilingSprite = new PIXI.extras.TilingSprite(texture, 200, 300); + + tilingSprite.width = 400; + tilingSprite.height = 600; + + expect(tilingSprite.width).to.equal(400); + expect(tilingSprite.height).to.equal(600); + }); });