diff --git a/test/features/tests.js b/test/features/tests.js index 528a0378c..f0eab3ef7 100644 --- a/test/features/tests.js +++ b/test/features/tests.js @@ -595,6 +595,34 @@ var tests = [ }, impact: 'Important', area: 'Core' + }, + { + id: 'Canvas Blend Mode', + name: 'Canvas supports extended blend modes', + run: function () { + var fail = { output: 'Failed', emulated: 'No' }; + var ctx = document.createElement('canvas').getContext('2d'); + ctx.canvas.width = 1; + ctx.canvas.height = 1; + var mode = 'difference'; + ctx.globalCompositeOperation = mode; + if (ctx.globalCompositeOperation !== mode) { + return fail; + } + // Chrome supports setting the value, but it may not actually be + // implemented, so we have to actually test the blend mode. + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 1, 1); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 1, 1); + var pix = ctx.getImageData(0, 0, 1, 1).data; + if (pix[0] !== 255 || pix[1] !== 0 || pix[2] !== 255) { + return fail; + } + return { output: 'Success', emulated: '' }; + }, + impact: 'Important', + area: 'Core' } ];