Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.path.rect.nonfinite.html
blob52cd17f3f413ee1e267fdaf968c2c3a7b96c3a97
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.path.rect.nonfinite</title>
3 <!-- Testing: rect() 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.rect(Infinity, 50, 1, 1);
35 ctx.rect(-Infinity, 50, 1, 1);
36 ctx.rect(NaN, 50, 1, 1);
37 ctx.rect(0, Infinity, 1, 1);
38 ctx.rect(0, -Infinity, 1, 1);
39 ctx.rect(0, NaN, 1, 1);
40 ctx.rect(0, 50, Infinity, 1);
41 ctx.rect(0, 50, -Infinity, 1);
42 ctx.rect(0, 50, NaN, 1);
43 ctx.rect(0, 50, 1, Infinity);
44 ctx.rect(0, 50, 1, -Infinity);
45 ctx.rect(0, 50, 1, NaN);
46 ctx.rect(Infinity, Infinity, 1, 1);
47 ctx.rect(Infinity, Infinity, Infinity, 1);
48 ctx.rect(Infinity, Infinity, Infinity, Infinity);
49 ctx.rect(Infinity, Infinity, 1, Infinity);
50 ctx.rect(Infinity, 50, Infinity, 1);
51 ctx.rect(Infinity, 50, Infinity, Infinity);
52 ctx.rect(Infinity, 50, 1, Infinity);
53 ctx.rect(0, Infinity, Infinity, 1);
54 ctx.rect(0, Infinity, Infinity, Infinity);
55 ctx.rect(0, Infinity, 1, Infinity);
56 ctx.rect(0, 50, Infinity, Infinity);
57 ctx.lineTo(100, 50);
58 ctx.lineTo(0, 50);
59 ctx.fillStyle = '#0f0';
60 ctx.fill();
61 isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
62 isPixel(ctx, 90,45, 0,255,0,255, "90,45", "0,255,0,255", 0);
64 } catch (e) {
65 _thrown_outer = true;
67 todo(!_thrown_outer, 'should not throw exception');
69 SimpleTest.finish();
71 });
72 </script>