Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-blending-text.html
blob70a0aaa9a671be8a50743c39f1997e77d25039f7
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 text.");
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(4, 4)";
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);
24 function runTest() {
25 var canvas = document.createElement("canvas");
26 var sigma = 5;
27 canvas.width = 10;
28 canvas.height = 10;
29 context = canvas.getContext("2d");
31 for (var i = 0; i < blendModes.length; ++i) {
32 debug("Testing blend mode " + blendModes[i]);
34 context.clearRect(0, 0, 10, 10);
35 context.save();
36 drawBackdropColorInContext(context);
37 context.globalCompositeOperation = blendModes[i];
38 context.fillStyle = "rgba(255, 129, 129, 1)";
39 context.font="6px ahem";
40 context.fillText("a", 2, 7);
41 checkBlendModeResult(i, context, sigma);
42 context.restore();
43 debug('');
47 runTest();
48 </script>
49 </body>
50 </html>