chromium/third_party/blink/web_tests/fast/canvas/canvas-blending-transforms.html

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script type="text/javascript" src="canvas-blending-helpers.js"></script>
<script>
test(function(t) {
    function checkNonBlendPixel(context, sigma) {
        ac = context.getImageData(9, 9, 1, 1).data;;
        assert_approx_equals(ac[0], 0, sigma);
        assert_approx_equals(ac[1], 0, sigma);
        assert_approx_equals(ac[2], 0, sigma);
        assert_approx_equals(ac[3], 0, sigma);
    }

    var canvas = document.createElement('canvas');
    var sigma = 5;
    canvas.width = 10;
    canvas.height = 10;
    context = canvas.getContext('2d');

    for (var i = 0; i < blendModes.length; ++i) {
        context.clearRect(0, 0, 10, 10);
        context.save();
        applyTransformsToContext(context);
        drawBackdropColorInContext(context);
        context.globalCompositeOperation = blendModes[i];
        drawSourceColorInContext(context);
        checkBlendModeResult(i, context, sigma, 0, 1);
        checkNonBlendPixel(context, sigma);
        context.restore();
    }
}, 'Series of tests to ensure correct results on applying different blend modes when drawing in a transformed context.');
</script>