Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <title>Canvas Tests</title> |
michael@0 | 3 | <script src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 4 | <link rel="stylesheet" href="/tests/SimpleTest/test.css"> |
michael@0 | 5 | <body> |
michael@0 | 6 | <script> |
michael@0 | 7 | |
michael@0 | 8 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 9 | const Cc = SpecialPowers.Cc; |
michael@0 | 10 | const Cr = SpecialPowers.Cr; |
michael@0 | 11 | SpecialPowers.setBoolPref("canvas.path.enabled", true); |
michael@0 | 12 | |
michael@0 | 13 | function isPixel(ctx, x,y, c, d) { |
michael@0 | 14 | var pos = x + "," + y; |
michael@0 | 15 | var color = c[0] + "," + c[1] + "," + c[2] + "," + c[3]; |
michael@0 | 16 | var pixel = ctx.getImageData(x, y, 1, 1); |
michael@0 | 17 | var pr = pixel.data[0], |
michael@0 | 18 | pg = pixel.data[1], |
michael@0 | 19 | pb = pixel.data[2], |
michael@0 | 20 | pa = pixel.data[3]; |
michael@0 | 21 | ok(c[0]-d <= pr && pr <= c[0]+d && |
michael@0 | 22 | c[1]-d <= pg && pg <= c[1]+d && |
michael@0 | 23 | c[2]-d <= pb && pb <= c[2]+d && |
michael@0 | 24 | c[3]-d <= pa && pa <= c[3]+d, |
michael@0 | 25 | "pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+"; expected "+color+" +/- "+d); |
michael@0 | 26 | } |
michael@0 | 27 | </script> |
michael@0 | 28 | |
michael@0 | 29 | <p>Canvas test: test_drawClipPath_canvas</p> |
michael@0 | 30 | <canvas id="c1" class="output" width="100" height="100">+ |
michael@0 | 31 | </canvas> |
michael@0 | 32 | <script type="text/javascript"> |
michael@0 | 33 | function test_drawClipPath_canvas() { |
michael@0 | 34 | var c = document.getElementById("c1"); |
michael@0 | 35 | var ctx = c.getContext("2d"); |
michael@0 | 36 | |
michael@0 | 37 | var path = new Path2D(); |
michael@0 | 38 | path.rect(0, 0, 100, 100); |
michael@0 | 39 | path.rect(25, 25, 50, 50); |
michael@0 | 40 | |
michael@0 | 41 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 42 | ctx.beginPath(); |
michael@0 | 43 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 44 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 45 | ctx.save(); |
michael@0 | 46 | ctx.clip(path); |
michael@0 | 47 | |
michael@0 | 48 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 49 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 50 | ctx.restore(); |
michael@0 | 51 | |
michael@0 | 52 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 53 | ctx.beginPath(); |
michael@0 | 54 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 55 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 56 | ctx.save(); |
michael@0 | 57 | ctx.clip(path, 'nonzero'); |
michael@0 | 58 | |
michael@0 | 59 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 60 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 61 | ctx.restore(); |
michael@0 | 62 | |
michael@0 | 63 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 64 | ctx.beginPath(); |
michael@0 | 65 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 66 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 67 | ctx.save(); |
michael@0 | 68 | ctx.clip(path, 'evenodd'); |
michael@0 | 69 | |
michael@0 | 70 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 71 | isPixel(ctx, 50, 50, [255, 0, 0, 255], 5); |
michael@0 | 72 | ctx.restore(); |
michael@0 | 73 | } |
michael@0 | 74 | </script> |
michael@0 | 75 | |
michael@0 | 76 | <p>Canvas test: test_drawFillPath_canvas</p> |
michael@0 | 77 | <canvas id="c2" class="output" width="100" height="100">+ |
michael@0 | 78 | </canvas> |
michael@0 | 79 | <script type="text/javascript"> |
michael@0 | 80 | function test_drawFillPath_canvas() { |
michael@0 | 81 | var c = document.getElementById("c2"); |
michael@0 | 82 | var ctx = c.getContext("2d"); |
michael@0 | 83 | |
michael@0 | 84 | var path = new Path2D(); |
michael@0 | 85 | path.rect(0, 0, 100, 100); |
michael@0 | 86 | path.rect(25, 25, 50, 50); |
michael@0 | 87 | |
michael@0 | 88 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 89 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 90 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 91 | ctx.fill(path); |
michael@0 | 92 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 93 | |
michael@0 | 94 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 95 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 96 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 97 | ctx.fill(path, 'nonzero'); |
michael@0 | 98 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 99 | |
michael@0 | 100 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 101 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 102 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 103 | ctx.fill(path, 'evenodd'); |
michael@0 | 104 | isPixel(ctx, 50, 50, [255, 0, 0, 255], 5); |
michael@0 | 105 | } |
michael@0 | 106 | </script> |
michael@0 | 107 | |
michael@0 | 108 | <p>Canvas test: test_drawStrokePath_canvas</p> |
michael@0 | 109 | <canvas id="c3" class="output" width="100" height="100">+ |
michael@0 | 110 | </canvas> |
michael@0 | 111 | <script type="text/javascript"> |
michael@0 | 112 | function test_drawStrokePath_canvas() { |
michael@0 | 113 | var c = document.getElementById("c3"); |
michael@0 | 114 | var ctx = c.getContext("2d"); |
michael@0 | 115 | |
michael@0 | 116 | var path = new Path2D(); |
michael@0 | 117 | path.rect(0, 0, 100, 100); |
michael@0 | 118 | path.rect(25, 25, 50, 50); |
michael@0 | 119 | |
michael@0 | 120 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 121 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 122 | ctx.strokeStyle = 'rgb(0,255,0)'; |
michael@0 | 123 | ctx.lineWidth = 5; |
michael@0 | 124 | ctx.stroke(path); |
michael@0 | 125 | isPixel(ctx, 0, 0, [0, 255, 0, 255], 5); |
michael@0 | 126 | isPixel(ctx, 25, 25, [0, 255, 0, 255], 5); |
michael@0 | 127 | isPixel(ctx, 10, 10, [255, 0, 0, 255], 5); |
michael@0 | 128 | } |
michael@0 | 129 | </script> |
michael@0 | 130 | |
michael@0 | 131 | <p>Canvas test: test_large_canvas</p> |
michael@0 | 132 | <canvas id="c4" class="output" width="10000" height="100">+ |
michael@0 | 133 | </canvas> |
michael@0 | 134 | <script type="text/javascript"> |
michael@0 | 135 | function test_large_canvas() { |
michael@0 | 136 | // test paths on large canvases. On certain platforms this will |
michael@0 | 137 | // trigger retargeting of the backend |
michael@0 | 138 | var c = document.getElementById("c4"); |
michael@0 | 139 | var ctx = c.getContext("2d"); |
michael@0 | 140 | |
michael@0 | 141 | var path = new Path2D(); |
michael@0 | 142 | path.rect(0, 0, 100, 100); |
michael@0 | 143 | path.rect(25, 25, 50, 50); |
michael@0 | 144 | |
michael@0 | 145 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 146 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 147 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 148 | ctx.fill(path); |
michael@0 | 149 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 150 | |
michael@0 | 151 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 152 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 153 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 154 | ctx.fill(path, 'nonzero'); |
michael@0 | 155 | isPixel(ctx, 50, 50, [0, 255, 0, 255], 5); |
michael@0 | 156 | |
michael@0 | 157 | ctx.fillStyle = 'rgb(255,0,0)'; |
michael@0 | 158 | ctx.fillRect(0, 0, 100, 100); |
michael@0 | 159 | ctx.fillStyle = 'rgb(0,255,0)'; |
michael@0 | 160 | ctx.fill(path, 'evenodd'); |
michael@0 | 161 | isPixel(ctx, 50, 50, [255, 0, 0, 255], 5); |
michael@0 | 162 | } |
michael@0 | 163 | </script> |
michael@0 | 164 | |
michael@0 | 165 | <p>Canvas test: test_isPointInPath_canvas</p> |
michael@0 | 166 | <canvas id="c5" class="output" width="100" height="100">+ |
michael@0 | 167 | </canvas> |
michael@0 | 168 | <script type="text/javascript"> |
michael@0 | 169 | |
michael@0 | 170 | function shouldThrow(ctx, s) { |
michael@0 | 171 | var _ok = false; |
michael@0 | 172 | try { |
michael@0 | 173 | eval(s); |
michael@0 | 174 | } catch(e) { |
michael@0 | 175 | _ok = true; |
michael@0 | 176 | } |
michael@0 | 177 | ok(_ok, s); |
michael@0 | 178 | } |
michael@0 | 179 | |
michael@0 | 180 | function shouldBeTrue(ctx, path, s) { |
michael@0 | 181 | var _ok = eval(s); |
michael@0 | 182 | ok(_ok, s); |
michael@0 | 183 | } |
michael@0 | 184 | function shouldBeFalse(ctx, path, s) { |
michael@0 | 185 | var _ok = !eval(s); |
michael@0 | 186 | ok(_ok, s); |
michael@0 | 187 | } |
michael@0 | 188 | |
michael@0 | 189 | function test_isPointInPath_canvas() { |
michael@0 | 190 | var c = document.getElementById("c5"); |
michael@0 | 191 | var ctx = c.getContext("2d"); |
michael@0 | 192 | |
michael@0 | 193 | var path = new Path2D(); |
michael@0 | 194 | path.rect(0, 0, 100, 100); |
michael@0 | 195 | path.rect(25, 25, 50, 50); |
michael@0 | 196 | shouldBeTrue(ctx, path, "ctx.isPointInPath(path, 50, 50)"); |
michael@0 | 197 | shouldBeFalse(ctx, path, "ctx.isPointInPath(path, NaN, 50)"); |
michael@0 | 198 | shouldBeFalse(ctx, path, "ctx.isPointInPath(path, 50, NaN)"); |
michael@0 | 199 | |
michael@0 | 200 | path = new Path2D(); |
michael@0 | 201 | path.rect(0, 0, 100, 100); |
michael@0 | 202 | path.rect(25, 25, 50, 50); |
michael@0 | 203 | shouldBeTrue(ctx, path, "ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
michael@0 | 204 | |
michael@0 | 205 | path = new Path2D(); |
michael@0 | 206 | path.rect(0, 0, 100, 100); |
michael@0 | 207 | path.rect(25, 25, 50, 50); |
michael@0 | 208 | shouldBeFalse(ctx, path, "ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
michael@0 | 209 | |
michael@0 | 210 | shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50)"); |
michael@0 | 211 | shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50, 'nonzero')"); |
michael@0 | 212 | shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50, 'evenodd')"); |
michael@0 | 213 | shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50)"); |
michael@0 | 214 | shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50, 'nonzero')"); |
michael@0 | 215 | shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50, 'evenodd')"); |
michael@0 | 216 | |
michael@0 | 217 | shouldThrow(ctx, "ctx.isPointInPath([], 50, 50)"); |
michael@0 | 218 | shouldThrow(ctx, "ctx.isPointInPath([], 50, 50, 'nonzero')"); |
michael@0 | 219 | shouldThrow(ctx, "ctx.isPointInPath([], 50, 50, 'evenodd')"); |
michael@0 | 220 | shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50)"); |
michael@0 | 221 | shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50, 'nonzero')"); |
michael@0 | 222 | shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50, 'evenodd')"); |
michael@0 | 223 | } |
michael@0 | 224 | </script> |
michael@0 | 225 | |
michael@0 | 226 | <p>Canvas test: test_isPointInStroke_canvas</p> |
michael@0 | 227 | <canvas id="c6" class="output" width="100" height="100">+ |
michael@0 | 228 | </canvas> |
michael@0 | 229 | <script type="text/javascript"> |
michael@0 | 230 | |
michael@0 | 231 | function test_isPointInStroke_canvas() { |
michael@0 | 232 | var c = document.getElementById("c6"); |
michael@0 | 233 | var ctx = c.getContext("2d"); |
michael@0 | 234 | |
michael@0 | 235 | ctx.strokeStyle = '#0ff'; |
michael@0 | 236 | |
michael@0 | 237 | var path = new Path2D(); |
michael@0 | 238 | path.rect(20,20,100,100); |
michael@0 | 239 | |
michael@0 | 240 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,20)"); |
michael@0 | 241 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,20)"); |
michael@0 | 242 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,120)"); |
michael@0 | 243 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,120)"); |
michael@0 | 244 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,20)"); |
michael@0 | 245 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,70)"); |
michael@0 | 246 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,70)"); |
michael@0 | 247 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,120)"); |
michael@0 | 248 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,22,22)"); |
michael@0 | 249 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,118,22)"); |
michael@0 | 250 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,22,118)"); |
michael@0 | 251 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,118,118)"); |
michael@0 | 252 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,18)"); |
michael@0 | 253 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,122,70)"); |
michael@0 | 254 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,122)"); |
michael@0 | 255 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,18,70)"); |
michael@0 | 256 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,NaN,122)"); |
michael@0 | 257 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,18,NaN)"); |
michael@0 | 258 | |
michael@0 | 259 | shouldThrow(ctx, "ctx.isPointInStroke(null,70,20)"); |
michael@0 | 260 | shouldThrow(ctx, "ctx.isPointInStroke([],20,70)"); |
michael@0 | 261 | shouldThrow(ctx, "ctx.isPointInStroke({},120,70)"); |
michael@0 | 262 | |
michael@0 | 263 | ctx.lineWidth = 10; |
michael@0 | 264 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,22,22)"); |
michael@0 | 265 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,118,22)"); |
michael@0 | 266 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,22,118)"); |
michael@0 | 267 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,118,118)"); |
michael@0 | 268 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,18)"); |
michael@0 | 269 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,122,70)"); |
michael@0 | 270 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,122)"); |
michael@0 | 271 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,18,70)"); |
michael@0 | 272 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,26,70)"); |
michael@0 | 273 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,26)"); |
michael@0 | 274 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,114)"); |
michael@0 | 275 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,114,70)"); |
michael@0 | 276 | |
michael@0 | 277 | path = new Path2D(); |
michael@0 | 278 | path.moveTo(10,10); |
michael@0 | 279 | path.lineTo(110,20); |
michael@0 | 280 | path.lineTo(10,30); |
michael@0 | 281 | ctx.lineJoin = "bevel"; |
michael@0 | 282 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,113,20)"); |
michael@0 | 283 | |
michael@0 | 284 | ctx.miterLimit = 40.0; |
michael@0 | 285 | ctx.lineJoin = "miter"; |
michael@0 | 286 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,113,20)"); |
michael@0 | 287 | |
michael@0 | 288 | ctx.miterLimit = 2.0; |
michael@0 | 289 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,113,20)"); |
michael@0 | 290 | |
michael@0 | 291 | path = new Path2D(); |
michael@0 | 292 | path.moveTo(10,10); |
michael@0 | 293 | path.lineTo(110,10); |
michael@0 | 294 | ctx.lineCap = "butt"; |
michael@0 | 295 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,112,10)"); |
michael@0 | 296 | |
michael@0 | 297 | ctx.lineCap = "round"; |
michael@0 | 298 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,112,10)"); |
michael@0 | 299 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,117,10)"); |
michael@0 | 300 | |
michael@0 | 301 | ctx.lineCap = "square"; |
michael@0 | 302 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,112,10)"); |
michael@0 | 303 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,117,10)"); |
michael@0 | 304 | |
michael@0 | 305 | ctx.lineCap = "butt"; |
michael@0 | 306 | ctx.setLineDash([10,10]); |
michael@0 | 307 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,15,10)"); |
michael@0 | 308 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,25,10)"); |
michael@0 | 309 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,35,10)"); |
michael@0 | 310 | |
michael@0 | 311 | ctx.lineDashOffset = 10; |
michael@0 | 312 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,15,10)"); |
michael@0 | 313 | shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,25,10)"); |
michael@0 | 314 | shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,35,10)"); |
michael@0 | 315 | } |
michael@0 | 316 | </script> |
michael@0 | 317 | |
michael@0 | 318 | <p>Canvas test: test_pathconstructor_canvas</p> |
michael@0 | 319 | <canvas id="c7" class="output" width="200" height="100">+ |
michael@0 | 320 | </canvas> |
michael@0 | 321 | <script type="text/javascript"> |
michael@0 | 322 | |
michael@0 | 323 | function test_pathconstructor_canvas() { |
michael@0 | 324 | var c = document.getElementById("c7"); |
michael@0 | 325 | var ctx = c.getContext("2d"); |
michael@0 | 326 | |
michael@0 | 327 | var p = new Path2D("M100,0L200,0L200,100L100,100z"); |
michael@0 | 328 | ctx.fillStyle = 'blue'; |
michael@0 | 329 | ctx.fill(p); |
michael@0 | 330 | isPixel(ctx, 105, 5, [0, 0, 255, 255], 0); |
michael@0 | 331 | isPixel(ctx, 5, 5, [0, 0, 0, 0], 0); |
michael@0 | 332 | } |
michael@0 | 333 | </script> |
michael@0 | 334 | |
michael@0 | 335 | <script> |
michael@0 | 336 | |
michael@0 | 337 | function runTests() { |
michael@0 | 338 | try { |
michael@0 | 339 | test_drawClipPath_canvas(); |
michael@0 | 340 | } catch(e) { |
michael@0 | 341 | throw e; |
michael@0 | 342 | ok(false, "unexpected exception thrown in: test_drawClipPath_canvas"); |
michael@0 | 343 | } |
michael@0 | 344 | try { |
michael@0 | 345 | test_drawFillPath_canvas(); |
michael@0 | 346 | } catch(e) { |
michael@0 | 347 | throw e; |
michael@0 | 348 | ok(false, "unexpected exception thrown in: test_drawFillPath_canvas"); |
michael@0 | 349 | } |
michael@0 | 350 | try { |
michael@0 | 351 | test_drawStrokePath_canvas(); |
michael@0 | 352 | } catch(e) { |
michael@0 | 353 | throw e; |
michael@0 | 354 | ok(false, "unexpected exception thrown in: test_drawStrokePath_canvas"); |
michael@0 | 355 | } |
michael@0 | 356 | try { |
michael@0 | 357 | test_large_canvas(); |
michael@0 | 358 | } catch(e) { |
michael@0 | 359 | throw e; |
michael@0 | 360 | ok(false, "unexpected exception thrown in: test_large_canvas"); |
michael@0 | 361 | } |
michael@0 | 362 | try { |
michael@0 | 363 | test_isPointInPath_canvas(); |
michael@0 | 364 | } catch(e) { |
michael@0 | 365 | throw e; |
michael@0 | 366 | ok(false, "unexpected exception thrown in: test_isPointInPath_canvas"); |
michael@0 | 367 | } |
michael@0 | 368 | try { |
michael@0 | 369 | test_isPointInStroke_canvas(); |
michael@0 | 370 | } catch(e) { |
michael@0 | 371 | throw e; |
michael@0 | 372 | ok(false, "unexpected exception thrown in: test_isPointInStroke_canvas"); |
michael@0 | 373 | } |
michael@0 | 374 | try { |
michael@0 | 375 | test_pathconstructor_canvas(); |
michael@0 | 376 | } catch(e) { |
michael@0 | 377 | throw e; |
michael@0 | 378 | ok(false, "unexpected exception thrown in: test_pathconstructor_canvas"); |
michael@0 | 379 | } |
michael@0 | 380 | SpecialPowers.setBoolPref("canvas.path.enabled", false); |
michael@0 | 381 | SimpleTest.finish(); |
michael@0 | 382 | } |
michael@0 | 383 | |
michael@0 | 384 | addLoadEvent(runTests); |
michael@0 | 385 | |
michael@0 | 386 | // Don't leak the world via the Path2D reference to its window. |
michael@0 | 387 | document.all; |
michael@0 | 388 | window.p = new Path2D(); |
michael@0 | 389 | |
michael@0 | 390 | </script> |