Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.path.moveTo.nonfinite.html
blob55423f01c8d002235ba30c0ea09775e1cddcaadb
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.path.moveTo.nonfinite</title>
3 <!-- Testing: moveTo() with Infinity/NaN is ignored -->
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 var _thrown_outer = false;
30 try {
32 ctx.moveTo(0, 0);
33 ctx.lineTo(100, 0);
34 ctx.moveTo(Infinity, 50);
35 ctx.moveTo(-Infinity, 50);
36 ctx.moveTo(NaN, 50);
37 ctx.moveTo(0, Infinity);
38 ctx.moveTo(0, -Infinity);
39 ctx.moveTo(0, NaN);
40 ctx.moveTo(Infinity, Infinity);
41 ctx.lineTo(100, 50);
42 ctx.lineTo(0, 50);
43 ctx.fillStyle = '#0f0';
44 ctx.fill();
45 isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
47 } catch (e) {
48 _thrown_outer = true;
50 todo(!_thrown_outer, 'should not throw exception');
52 SimpleTest.finish();
54 });
55 </script>