mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Ensure clone.effects is defined on each instance (#225)
* Ensure clone.effects is defined on each instance * Add regression test for GH-224
This commit is contained in:
parent
2226fda19e
commit
5728d648b1
2 changed files with 27 additions and 13 deletions
|
@ -29,6 +29,20 @@ function Clone(sprite, runtime) {
|
|||
* @type {?Number}
|
||||
*/
|
||||
this.drawableID = null;
|
||||
|
||||
/**
|
||||
* Map of current graphic effect values.
|
||||
* @type {!Object.<string, number>}
|
||||
*/
|
||||
this.effects = {
|
||||
'color': 0,
|
||||
'fisheye': 0,
|
||||
'whirl': 0,
|
||||
'pixelate': 0,
|
||||
'mosaic': 0,
|
||||
'brightness': 0,
|
||||
'ghost': 0
|
||||
};
|
||||
}
|
||||
util.inherits(Clone, Target);
|
||||
|
||||
|
@ -121,19 +135,6 @@ Clone.ROTATION_STYLE_NONE = 'don\'t rotate';
|
|||
*/
|
||||
Clone.prototype.rotationStyle = Clone.ROTATION_STYLE_ALL_AROUND;
|
||||
|
||||
/**
|
||||
* Map of current graphic effect values.
|
||||
* @type {!Object.<string, number>}
|
||||
*/
|
||||
Clone.prototype.effects = {
|
||||
'color': 0,
|
||||
'fisheye': 0,
|
||||
'whirl': 0,
|
||||
'pixelate': 0,
|
||||
'mosaic': 0,
|
||||
'brightness': 0,
|
||||
'ghost': 0
|
||||
};
|
||||
// End clone-level properties.
|
||||
|
||||
/**
|
||||
|
|
13
test/unit/clone.js
Normal file
13
test/unit/clone.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var test = require('tap').test;
|
||||
var Clone = require('../../src/sprites/clone');
|
||||
var Sprite = require('../../src/sprites/sprite');
|
||||
|
||||
test('clone effects', function (t) {
|
||||
// Create two clones and ensure they have different graphic effect objects.
|
||||
// Regression test for Github issue #224
|
||||
var spr = new Sprite();
|
||||
var a = new Clone(spr, null);
|
||||
var b = new Clone(spr, null);
|
||||
t.ok(a.effects !== b.effects);
|
||||
t.end();
|
||||
});
|
Loading…
Reference in a new issue