Browse Source

Added color serialization getters for strokeStyle and shadowColor

v1.x
Tj Holowaychuk 14 years ago
parent
commit
c8bdcd7a6b
  1. 18
      test/canvas.test.js

18
test/canvas.test.js

@ -63,17 +63,19 @@ module.exports = {
var canvas = new Canvas(200, 200)
, ctx = canvas.getContext('2d');
ctx.fillStyle = '#FFFFFF';
assert.equal('#ffffff', ctx.fillStyle);
['fillStyle', 'strokeStyle', 'shadowColor'].forEach(function(prop){
ctx[prop] = '#FFFFFF';
assert.equal('#ffffff', ctx[prop], prop + ' #FFFFFF -> #ffffff, got ' + ctx[prop]);
ctx.fillStyle = '#FFF';
assert.equal('#ffffff', ctx.fillStyle);
ctx[prop] = '#FFF';
assert.equal('#ffffff', ctx[prop], prop + ' #FFF -> #ffffff, got ' + ctx[prop]);
ctx.fillStyle = 'rgba(128, 200, 128, 1)';
assert.equal('#80c880', ctx.fillStyle);
ctx[prop] = 'rgba(128, 200, 128, 1)';
assert.equal('#80c880', ctx[prop], prop + ' rgba(128, 200, 128, 1) -> #80c880, got ' + ctx[prop]);
ctx.fillStyle = 'rgba(128,80,0,0.5)';
assert.equal('rgba(128, 80, 0, 0.5)', ctx.fillStyle);
ctx[prop] = 'rgba(128,80,0,0.5)';
assert.equal('rgba(128, 80, 0, 0.5)', ctx[prop], prop + ' rgba(128,80,0,0.5) -> rgba(128, 80, 0, 0.5), got ' + ctx[prop]);
});
},
'test Canvas#getContext("2d")': function(assert){

Loading…
Cancel
Save