|
|
@ -364,7 +364,36 @@ module.exports = { |
|
|
|
canvas |
|
|
|
, path |
|
|
|
, 'fc8bbf2cf6ae2d85fcf526103200e844' |
|
|
|
, 'Context2d#save() / resetore() failed'); |
|
|
|
, 'Context2d#save() / restore() failed'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d states with stroke/fill/globalAlpha': function(assert){ |
|
|
|
var canvas = new Canvas(200, 200) |
|
|
|
, ctx = canvas.getContext('2d') |
|
|
|
, path = __dirname + '/images/states2.png'; |
|
|
|
|
|
|
|
ctx.fillRect(0,0,150,150); // Draw a rectangle with default settings
|
|
|
|
ctx.save(); // Save the default state
|
|
|
|
|
|
|
|
ctx.fillStyle = '#09F' // Make changes to the settings
|
|
|
|
ctx.fillRect(15,15,120,120); // Draw a rectangle with new settings
|
|
|
|
|
|
|
|
ctx.save(); // Save the current state
|
|
|
|
ctx.fillStyle = '#FFF' // Make changes to the settings
|
|
|
|
ctx.globalAlpha = 0.5; |
|
|
|
ctx.fillRect(30,30,90,90); // Draw a rectangle with new settings
|
|
|
|
|
|
|
|
ctx.restore(); // Restore previous state
|
|
|
|
ctx.fillRect(45,45,60,60); // Draw a rectangle with restored settings
|
|
|
|
|
|
|
|
ctx.restore(); // Restore original state
|
|
|
|
ctx.fillRect(60,60,30,30); // Draw a rectangle with restored settings
|
|
|
|
|
|
|
|
assertChecksum( |
|
|
|
canvas |
|
|
|
, path |
|
|
|
, 'c7217b183c3b47e76a0454d8f5a8b424' |
|
|
|
, 'Context#save() / restore() with stroke/fill/globalAlpha failed'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#globalAlpha=': function(assert){ |
|
|
|