Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.line.join.miter.html
blob1a32b15d320ac429a1afc5e12d925c6e214de991
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.line.join.miter</title>
3 <!-- Testing: lineJoin 'miter' is rendered correctly -->
4 <script src="/MochiKit/MochiKit.js"></script>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
7 <body>
8 <canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
9 <script>
10 function isPixel(ctx, x,y, r,g,b,a, pos, colour, d) {
11 var pixel = ctx.getImageData(x, y, 1, 1);
12 var pr = pixel.data[0],
13 pg = pixel.data[1],
14 pb = pixel.data[2],
15 pa = pixel.data[3];
16 ok(r-d <= pr && pr <= r+d &&
17 g-d <= pg && pg <= g+d &&
18 b-d <= pb && pb <= b+d &&
19 a-d <= pa && pa <= a+d,
20 "pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d);
23 SimpleTest.waitForExplicitFinish();
24 MochiKit.DOM.addLoadEvent(function () {
26 var canvas = document.getElementById('c');
27 var ctx = canvas.getContext('2d');
29 ctx.fillStyle = '#0f0';
30 ctx.fillRect(0, 0, 100, 50);
32 ctx.lineJoin = 'miter';
33 ctx.lineWidth = 20;
35 ctx.fillStyle = '#f00';
36 ctx.strokeStyle = '#0f0';
38 ctx.fillStyle = '#f00';
39 ctx.strokeStyle = '#0f0';
41 ctx.fillRect(10, 10, 30, 20);
42 ctx.fillRect(20, 10, 20, 30);
44 ctx.beginPath();
45 ctx.moveTo(10, 20);
46 ctx.lineTo(30, 20);
47 ctx.lineTo(30, 40);
48 ctx.stroke();
51 ctx.fillStyle = '#0f0';
52 ctx.strokeStyle = '#f00';
54 ctx.beginPath();
55 ctx.moveTo(60, 20);
56 ctx.lineTo(80, 20);
57 ctx.lineTo(80, 40);
58 ctx.stroke();
60 ctx.fillRect(60, 10, 30, 20);
61 ctx.fillRect(70, 10, 20, 30);
63 isPixel(ctx, 38,12, 0,255,0,255, "38,12", "0,255,0,255", 0);
64 isPixel(ctx, 39,11, 0,255,0,255, "39,11", "0,255,0,255", 0);
65 isPixel(ctx, 40,10, 0,255,0,255, "40,10", "0,255,0,255", 0);
66 isPixel(ctx, 41,9, 0,255,0,255, "41,9", "0,255,0,255", 0);
67 isPixel(ctx, 42,8, 0,255,0,255, "42,8", "0,255,0,255", 0);
69 isPixel(ctx, 88,12, 0,255,0,255, "88,12", "0,255,0,255", 0);
70 isPixel(ctx, 89,11, 0,255,0,255, "89,11", "0,255,0,255", 0);
71 isPixel(ctx, 90,10, 0,255,0,255, "90,10", "0,255,0,255", 0);
72 isPixel(ctx, 91,9, 0,255,0,255, "91,9", "0,255,0,255", 0);
73 isPixel(ctx, 92,8, 0,255,0,255, "92,8", "0,255,0,255", 0);
75 SimpleTest.finish();
77 });
78 </script>