File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -595,6 +595,34 @@ var tests = [
595
595
},
596
596
impact : 'Important' ,
597
597
area : 'Core'
598
+ },
599
+ {
600
+ id : 'Canvas Blend Mode' ,
601
+ name : 'Canvas supports extended blend modes' ,
602
+ run : function () {
603
+ var fail = { output : 'Failed' , emulated : 'No' };
604
+ var ctx = document .createElement ('canvas' ).getContext ('2d' );
605
+ ctx .canvas .width = 1 ;
606
+ ctx .canvas .height = 1 ;
607
+ var mode = 'difference' ;
608
+ ctx .globalCompositeOperation = mode ;
609
+ if (ctx .globalCompositeOperation !== mode ) {
610
+ return fail ;
611
+ }
612
+ // Chrome supports setting the value, but it may not actually be
613
+ // implemented, so we have to actually test the blend mode.
614
+ ctx .fillStyle = 'red' ;
615
+ ctx .fillRect (0 , 0 , 1 , 1 );
616
+ ctx .fillStyle = 'blue' ;
617
+ ctx .fillRect (0 , 0 , 1 , 1 );
618
+ var pix = ctx .getImageData (0 , 0 , 1 , 1 ).data ;
619
+ if (pix [0 ] !== 255 || pix [1 ] !== 0 || pix [2 ] !== 255 ) {
620
+ return fail ;
621
+ }
622
+ return { output : 'Success' , emulated : '' };
623
+ },
624
+ impact : 'Important' ,
625
+ area : 'Core'
598
626
}
599
627
];
600
628
You can’t perform that action at this time.
0 commit comments