diff --git a/src/shapes/Sprite.js b/src/shapes/Sprite.js index abb7b5bb..1dda2ecd 100644 --- a/src/shapes/Sprite.js +++ b/src/shapes/Sprite.js @@ -101,7 +101,7 @@ context.beginPath(); context.rect(0, 0, f.width, f.height); context.closePath(); - context.fill(this); + context.fillShape(this); }, /** * start sprite animation diff --git a/test/unit/shapes/Sprite-test.js b/test/unit/shapes/Sprite-test.js index 2a245e72..b839a555 100644 --- a/test/unit/shapes/Sprite-test.js +++ b/test/unit/shapes/Sprite-test.js @@ -91,11 +91,20 @@ suite('Sprite', function() { }); layer.add(sprite); + stage.add(layer); + + assert.equal(sprite.getClassName(), 'Sprite'); + assert.equal(sprite.getIndex(), 0); + + showHit(layer); + + var trace = layer.hitCanvas.getContext().getTrace(); + + assert.equal(trace.indexOf(sprite.colorKey) >= 0, true); + sprite.start(); - stage.add(layer); - // kick once setTimeout(function() { sprite.setAnimation('kicking'); @@ -108,8 +117,7 @@ suite('Sprite', function() { sprite.stop(); }, 3000); - assert.equal(sprite.getClassName(), 'Sprite'); - assert.equal(sprite.getIndex(), 0); + done(); };