Browse Source

Added globalAlpha test to illustrate the previous fix

v1.x
Tj Holowaychuk 14 years ago
parent
commit
59c76251fe
  1. 20
      test/canvas.test.js

20
test/canvas.test.js

@ -401,19 +401,21 @@ module.exports = {
, ctx = canvas.getContext('2d') , ctx = canvas.getContext('2d')
, path = __dirname + '/images/globalAlpha.png'; , path = __dirname + '/images/globalAlpha.png';
ctx.fillRect(0,0,50,50); ctx.globalAlpha = 0.5;
ctx.translate(15,15); ctx.fillStyle = 'rgba(0,0,0,0.5)';
ctx.globalAlpha = 0.6; ctx.strokeRect(0,0,50,50);
assert.equal(0.6, ctx.globalAlpha.toFixed(1));
ctx.fillStyle = 'red'; ctx.globalAlpha = 0.8;
ctx.fillRect(0,0,20,20); ctx.fillRect(20,20,20,20);
ctx.fillStyle = 'yellow';
ctx.fillRect(0,0,10,10); ctx.fillStyle = 'black';
ctx.globalAlpha = 1;
ctx.fillRect(25,25,10,10);
assertChecksum( assertChecksum(
canvas canvas
, path , path
, 'd8365233f2beb420ba18ff78dc6d7405' , 'feb3e3c4bc6aac5c9e46f9b71b4504c6'
, 'Context2d#globalAlpha= failed'); , 'Context2d#globalAlpha= failed');
}, },

Loading…
Cancel
Save