Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-blending-shadow.html
blob7cd457e7741e52669702e74f02e54cf0d5a5685e
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <script src="../../resources/js-test.js"></script>
5 <script type="text/javascript" src="canvas-blending-helpers.js"></script>
6 <script type="text/javascript">
8 description("Series of tests to ensure correct results on applying different blend modes when drawing a rectangle with shadow.");
10 var context;
11 function actualColor(x, y) {
12 return context.getImageData(x, y, 1, 1).data;
15 function checkBlendModeResult(i, context, sigma) {
16 var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i);
17 var ac = "actualColor(0, 0)";
18 shouldBeCloseTo(ac + "[0]", expectedColor[0], sigma);
19 shouldBeCloseTo(ac + "[1]", expectedColor[1], sigma);
20 shouldBeCloseTo(ac + "[2]", expectedColor[2], sigma);
21 shouldBeCloseTo(ac + "[3]", expectedColor[3], sigma);
23 var expectedShadowColor = blendColors([192 / 255, 192 / 255, 192 / 255, 1], [1, 129 / 255, 129 / 255, 1], i);
24 var ac = "actualColor(11, 11)";
25 shouldBeCloseTo(ac + "[0]", expectedShadowColor[0], sigma);
26 shouldBeCloseTo(ac + "[1]", expectedShadowColor[1], sigma);
27 shouldBeCloseTo(ac + "[2]", expectedShadowColor[2], sigma);
28 shouldBeCloseTo(ac + "[3]", expectedShadowColor[3], sigma);
31 function runTest() {
32 var canvas = document.createElement("canvas");
33 var sigma = 5;
34 canvas.width = 12;
35 canvas.height = 12;
36 context = canvas.getContext("2d");
38 for (var i = 0; i < blendModes.length; ++i) {
39 debug("Testing blend mode " + blendModes[i]);
41 context.clearRect(0, 0, 12, 12);
42 context.save();
43 drawBackdropColorWithShadowInContext(context);
44 context.globalCompositeOperation = blendModes[i];
45 drawSourceColorRectOverShadow(context);
46 checkBlendModeResult(i, context, sigma);
47 context.restore();
48 debug('');
52 runTest();
53 </script>
54 </body>
55 </html>