content/canvas/test/test_canvas.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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
michael@0 12 function IsD2DEnabled() {
michael@0 13 var enabled = false;
michael@0 14
michael@0 15 try {
michael@0 16 enabled = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).D2DEnabled;
michael@0 17 } catch(e) {}
michael@0 18
michael@0 19 return enabled;
michael@0 20 }
michael@0 21
michael@0 22 function IsLinux() {
michael@0 23 var os = "";
michael@0 24
michael@0 25 try {
michael@0 26 os = Cc["@mozilla.org/xre/app-info;1"]
michael@0 27 .getService(SpecialPowers.Ci.nsIXULRuntime).OS;
michael@0 28 } catch (e) {}
michael@0 29
michael@0 30 return os.indexOf("Linux") == 0 &&
michael@0 31 navigator.appVersion.indexOf("Android") == -1;
michael@0 32 }
michael@0 33
michael@0 34 function IsMacOSX10_5orOlder() {
michael@0 35 var is105orOlder = false;
michael@0 36
michael@0 37 if (navigator.platform.indexOf("Mac") == 0) {
michael@0 38 var version = Cc["@mozilla.org/system-info;1"]
michael@0 39 .getService(SpecialPowers.Ci.nsIPropertyBag2)
michael@0 40 .getProperty("version");
michael@0 41 // the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
michael@0 42 // Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
michael@0 43 // is the Darwin version.
michael@0 44 is105orOlder = (parseFloat(version) < 10.0);
michael@0 45 }
michael@0 46 return is105orOlder;
michael@0 47 }
michael@0 48
michael@0 49
michael@0 50 function IsAzureSkia() {
michael@0 51 var enabled = false;
michael@0 52
michael@0 53 try {
michael@0 54 var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
michael@0 55 enabled = (backend == "skia");
michael@0 56 } catch (e) { }
michael@0 57
michael@0 58 return enabled;
michael@0 59 }
michael@0 60
michael@0 61 function IsAcceleratedSkia() {
michael@0 62 var enabled = false;
michael@0 63
michael@0 64 try {
michael@0 65 var props = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo();
michael@0 66 enabled = props.AzureCanvasBackend == "skia" && props.AzureSkiaAccelerated;
michael@0 67 } catch(e) { }
michael@0 68
michael@0 69 return enabled;
michael@0 70 }
michael@0 71
michael@0 72 function IsAzureCairo() {
michael@0 73 var enabled = false;
michael@0 74
michael@0 75 try {
michael@0 76 var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
michael@0 77 enabled = (backend == "cairo");
michael@0 78 } catch (e) { }
michael@0 79
michael@0 80 return enabled;
michael@0 81 }
michael@0 82
michael@0 83 </script>
michael@0 84 <!-- Includes all the tests in the content/canvas/tests except for test_bug397524.html -->
michael@0 85
michael@0 86 <!-- [[[ test_2d.canvas.readonly.html ]]] -->
michael@0 87
michael@0 88 <p>Canvas test: 2d.canvas.readonly</p>
michael@0 89 <!-- Testing: CanvasRenderingContext2D.canvas is readonly -->
michael@0 90 <canvas id="c1" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 91 <script>
michael@0 92
michael@0 93 function test_2d_canvas_readonly() {
michael@0 94
michael@0 95 var canvas = document.getElementById('c1');
michael@0 96 var ctx = canvas.getContext('2d');
michael@0 97
michael@0 98 var c = document.createElement('canvas');
michael@0 99 var d = ctx.canvas;
michael@0 100 ok(c !== d, "c !== d");
michael@0 101 try { ctx.canvas = c; } catch (e) {} // not sure whether this should throw or not...
michael@0 102 ok(ctx.canvas === d, "ctx.canvas === d");
michael@0 103
michael@0 104
michael@0 105 }
michael@0 106 </script>
michael@0 107
michael@0 108 <!-- [[[ test_2d.canvas.reference.html ]]] -->
michael@0 109
michael@0 110 <p>Canvas test: 2d.canvas.reference</p>
michael@0 111 <!-- Testing: CanvasRenderingContext2D.canvas refers back to its canvas -->
michael@0 112 <canvas id="c2" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 113 <script>
michael@0 114
michael@0 115 function test_2d_canvas_reference() {
michael@0 116
michael@0 117 var canvas = document.getElementById('c2');
michael@0 118 var ctx = canvas.getContext('2d');
michael@0 119
michael@0 120 ok(ctx.canvas === canvas, "ctx.canvas === canvas");
michael@0 121
michael@0 122
michael@0 123 }
michael@0 124 </script>
michael@0 125
michael@0 126 <!-- [[[ test_2d.clearRect.basic.html ]]] -->
michael@0 127
michael@0 128 <p>Canvas test: 2d.clearRect.basic</p>
michael@0 129 <canvas id="c3" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 130 <script>
michael@0 131 function isPixel(ctx, x,y, r,g,b,a, d) {
michael@0 132 var pos = x + "," + y;
michael@0 133 var colour = r + "," + g + "," + b + "," + a;
michael@0 134 var pixel = ctx.getImageData(x, y, 1, 1);
michael@0 135 var pr = pixel.data[0],
michael@0 136 pg = pixel.data[1],
michael@0 137 pb = pixel.data[2],
michael@0 138 pa = pixel.data[3];
michael@0 139 ok(r-d <= pr && pr <= r+d &&
michael@0 140 g-d <= pg && pg <= g+d &&
michael@0 141 b-d <= pb && pb <= b+d &&
michael@0 142 a-d <= pa && pa <= a+d,
michael@0 143 "pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d);
michael@0 144 }
michael@0 145
michael@0 146 function test_2d_clearRect_basic() {
michael@0 147
michael@0 148 var canvas = document.getElementById('c3');
michael@0 149 var ctx = canvas.getContext('2d');
michael@0 150
michael@0 151 ctx.fillStyle = '#f00';
michael@0 152 ctx.fillRect(0, 0, 100, 50);
michael@0 153 ctx.clearRect(0, 0, 100, 50);
michael@0 154 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 155
michael@0 156
michael@0 157 }
michael@0 158 </script>
michael@0 159
michael@0 160 <!-- [[[ test_2d.clearRect.clip.html ]]] -->
michael@0 161
michael@0 162 <p>Canvas test: 2d.clearRect.clip</p>
michael@0 163 <canvas id="c4" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 164 <script>
michael@0 165
michael@0 166
michael@0 167 function test_2d_clearRect_clip() {
michael@0 168
michael@0 169 var canvas = document.getElementById('c4');
michael@0 170 var ctx = canvas.getContext('2d');
michael@0 171
michael@0 172 ctx.fillStyle = '#0f0';
michael@0 173 ctx.fillRect(0, 0, 100, 50);
michael@0 174
michael@0 175 ctx.beginPath();
michael@0 176 ctx.rect(0, 0, 16, 16);
michael@0 177 ctx.clip();
michael@0 178
michael@0 179 ctx.clearRect(0, 0, 100, 50);
michael@0 180
michael@0 181 ctx.fillStyle = '#0f0';
michael@0 182 ctx.fillRect(0, 0, 16, 16);
michael@0 183
michael@0 184 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 185
michael@0 186
michael@0 187 }
michael@0 188 </script>
michael@0 189
michael@0 190 <!-- [[[ test_2d.clearRect.globalalpha.html ]]] -->
michael@0 191
michael@0 192 <p>Canvas test: 2d.clearRect.globalalpha</p>
michael@0 193 <canvas id="c5" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 194 <script>
michael@0 195
michael@0 196
michael@0 197 function test_2d_clearRect_globalalpha() {
michael@0 198
michael@0 199 var canvas = document.getElementById('c5');
michael@0 200 var ctx = canvas.getContext('2d');
michael@0 201
michael@0 202 ctx.fillStyle = '#f00';
michael@0 203 ctx.fillRect(0, 0, 100, 50);
michael@0 204 ctx.globalAlpha = 0.1;
michael@0 205 ctx.clearRect(0, 0, 100, 50);
michael@0 206 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 207
michael@0 208
michael@0 209 }
michael@0 210 </script>
michael@0 211
michael@0 212 <!-- [[[ test_2d.clearRect.globalcomposite.html ]]] -->
michael@0 213
michael@0 214 <p>Canvas test: 2d.clearRect.globalcomposite</p>
michael@0 215 <canvas id="c6" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 216 <script>
michael@0 217
michael@0 218
michael@0 219 function test_2d_clearRect_globalcomposite() {
michael@0 220
michael@0 221 var canvas = document.getElementById('c6');
michael@0 222 var ctx = canvas.getContext('2d');
michael@0 223
michael@0 224 ctx.fillStyle = '#f00';
michael@0 225 ctx.fillRect(0, 0, 100, 50);
michael@0 226 ctx.globalCompositeOperation = 'destination-atop';
michael@0 227 ctx.clearRect(0, 0, 100, 50);
michael@0 228 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 229
michael@0 230
michael@0 231 }
michael@0 232 </script>
michael@0 233
michael@0 234 <!-- [[[ test_2d.clearRect.negative.html ]]] -->
michael@0 235
michael@0 236 <p>Canvas test: 2d.clearRect.negative</p>
michael@0 237 <canvas id="c7" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 238 <script>
michael@0 239
michael@0 240
michael@0 241 function test_2d_clearRect_negative() {
michael@0 242
michael@0 243 var canvas = document.getElementById('c7');
michael@0 244 var ctx = canvas.getContext('2d');
michael@0 245
michael@0 246 ctx.fillStyle = '#f00';
michael@0 247 ctx.fillRect(0, 0, 100, 50);
michael@0 248 ctx.clearRect(0, 0, 50, 25);
michael@0 249 ctx.clearRect(100, 0, -50, 25);
michael@0 250 ctx.clearRect(0, 50, 50, -25);
michael@0 251 ctx.clearRect(100, 50, -50, -25);
michael@0 252 isPixel(ctx, 25,12, 0,0,0,0, 0);
michael@0 253 isPixel(ctx, 75,12, 0,0,0,0, 0);
michael@0 254 isPixel(ctx, 25,37, 0,0,0,0, 0);
michael@0 255 isPixel(ctx, 75,37, 0,0,0,0, 0);
michael@0 256
michael@0 257
michael@0 258 }
michael@0 259 </script>
michael@0 260
michael@0 261 <!-- [[[ test_2d.clearRect.nonfinite.html ]]] -->
michael@0 262
michael@0 263 <p>Canvas test: 2d.clearRect.nonfinite</p>
michael@0 264 <!-- Testing: clearRect() with Infinity/NaN is ignored -->
michael@0 265 <canvas id="c8" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 266 <script>
michael@0 267
michael@0 268
michael@0 269 function test_2d_clearRect_nonfinite() {
michael@0 270
michael@0 271 var canvas = document.getElementById('c8');
michael@0 272 var ctx = canvas.getContext('2d');
michael@0 273
michael@0 274 var _thrown_outer = false;
michael@0 275 try {
michael@0 276
michael@0 277 ctx.fillStyle = '#0f0';
michael@0 278 ctx.fillRect(0, 0, 100, 50);
michael@0 279
michael@0 280 ctx.clearRect(Infinity, 0, 100, 50);
michael@0 281 ctx.clearRect(-Infinity, 0, 100, 50);
michael@0 282 ctx.clearRect(NaN, 0, 100, 50);
michael@0 283 ctx.clearRect(0, Infinity, 100, 50);
michael@0 284 ctx.clearRect(0, -Infinity, 100, 50);
michael@0 285 ctx.clearRect(0, NaN, 100, 50);
michael@0 286 ctx.clearRect(0, 0, Infinity, 50);
michael@0 287 ctx.clearRect(0, 0, -Infinity, 50);
michael@0 288 ctx.clearRect(0, 0, NaN, 50);
michael@0 289 ctx.clearRect(0, 0, 100, Infinity);
michael@0 290 ctx.clearRect(0, 0, 100, -Infinity);
michael@0 291 ctx.clearRect(0, 0, 100, NaN);
michael@0 292 ctx.clearRect(Infinity, Infinity, 100, 50);
michael@0 293 ctx.clearRect(Infinity, Infinity, Infinity, 50);
michael@0 294 ctx.clearRect(Infinity, Infinity, Infinity, Infinity);
michael@0 295 ctx.clearRect(Infinity, Infinity, 100, Infinity);
michael@0 296 ctx.clearRect(Infinity, 0, Infinity, 50);
michael@0 297 ctx.clearRect(Infinity, 0, Infinity, Infinity);
michael@0 298 ctx.clearRect(Infinity, 0, 100, Infinity);
michael@0 299 ctx.clearRect(0, Infinity, Infinity, 50);
michael@0 300 ctx.clearRect(0, Infinity, Infinity, Infinity);
michael@0 301 ctx.clearRect(0, Infinity, 100, Infinity);
michael@0 302 ctx.clearRect(0, 0, Infinity, Infinity);
michael@0 303
michael@0 304 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 305
michael@0 306 } catch (e) {
michael@0 307 _thrown_outer = true;
michael@0 308 }
michael@0 309 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 310
michael@0 311
michael@0 312 }
michael@0 313 </script>
michael@0 314
michael@0 315 <!-- [[[ test_2d.clearRect.path.html ]]] -->
michael@0 316
michael@0 317 <p>Canvas test: 2d.clearRect.path</p>
michael@0 318 <canvas id="c9" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 319 <script>
michael@0 320
michael@0 321
michael@0 322 function test_2d_clearRect_path() {
michael@0 323
michael@0 324 var canvas = document.getElementById('c9');
michael@0 325 var ctx = canvas.getContext('2d');
michael@0 326
michael@0 327 ctx.fillStyle = '#0f0';
michael@0 328 ctx.beginPath();
michael@0 329 ctx.rect(0, 0, 100, 50);
michael@0 330 ctx.clearRect(0, 0, 16, 16);
michael@0 331 ctx.fill();
michael@0 332 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 333
michael@0 334
michael@0 335 }
michael@0 336 </script>
michael@0 337
michael@0 338 <!-- [[[ test_2d.clearRect.shadow.html ]]] -->
michael@0 339
michael@0 340 <p>Canvas test: 2d.clearRect.shadow</p>
michael@0 341 <canvas id="c10" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 342 <script>
michael@0 343
michael@0 344
michael@0 345 function test_2d_clearRect_shadow() {
michael@0 346
michael@0 347 var canvas = document.getElementById('c10');
michael@0 348 var ctx = canvas.getContext('2d');
michael@0 349
michael@0 350 ctx.fillStyle = '#0f0';
michael@0 351 ctx.fillRect(0, 0, 100, 50);
michael@0 352 ctx.shadowColor = '#f00';
michael@0 353 ctx.shadowBlur = 0;
michael@0 354 ctx.shadowOffsetX = 0;
michael@0 355 ctx.shadowOffsetY = 50;
michael@0 356 ctx.clearRect(0, -50, 100, 50);
michael@0 357 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 358
michael@0 359
michael@0 360 }
michael@0 361 </script>
michael@0 362
michael@0 363 <!-- [[[ test_2d.clearRect.transform.html ]]] -->
michael@0 364
michael@0 365 <p>Canvas test: 2d.clearRect.transform</p>
michael@0 366 <canvas id="c11" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 367 <script>
michael@0 368
michael@0 369
michael@0 370 function test_2d_clearRect_transform() {
michael@0 371
michael@0 372 var canvas = document.getElementById('c11');
michael@0 373 var ctx = canvas.getContext('2d');
michael@0 374
michael@0 375 ctx.fillStyle = '#f00';
michael@0 376 ctx.fillRect(0, 0, 100, 50);
michael@0 377 ctx.scale(10, 10);
michael@0 378 ctx.translate(0, 5);
michael@0 379 ctx.clearRect(0, -5, 10, 5);
michael@0 380 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 381
michael@0 382
michael@0 383 }
michael@0 384 </script>
michael@0 385
michael@0 386 <!-- [[[ test_2d.clearRect.zero.html ]]] -->
michael@0 387
michael@0 388 <p>Canvas test: 2d.clearRect.zero</p>
michael@0 389 <canvas id="c12" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 390 <script>
michael@0 391
michael@0 392
michael@0 393 function test_2d_clearRect_zero() {
michael@0 394
michael@0 395 var canvas = document.getElementById('c12');
michael@0 396 var ctx = canvas.getContext('2d');
michael@0 397
michael@0 398 ctx.fillStyle = '#0f0';
michael@0 399 ctx.fillRect(0, 0, 100, 50);
michael@0 400 ctx.clearRect(0, 0, 100, 0);
michael@0 401 ctx.clearRect(0, 0, 0, 50);
michael@0 402 ctx.clearRect(0, 0, 0, 0);
michael@0 403 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 404
michael@0 405
michael@0 406 }
michael@0 407 </script>
michael@0 408
michael@0 409 <!-- [[[ test_2d.composite.canvas.copy.html ]]] -->
michael@0 410
michael@0 411 <p>Canvas test: 2d.composite.canvas.copy</p>
michael@0 412 <canvas id="c13" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 413 <script>
michael@0 414
michael@0 415
michael@0 416 function test_2d_composite_canvas_copy() {
michael@0 417
michael@0 418 var canvas = document.getElementById('c13');
michael@0 419 var ctx = canvas.getContext('2d');
michael@0 420
michael@0 421
michael@0 422 var canvas2 = document.createElement('canvas');
michael@0 423 canvas2.width = canvas.width;
michael@0 424 canvas2.height = canvas.height;
michael@0 425 var ctx2 = canvas2.getContext('2d');
michael@0 426 ctx2.drawImage(document.getElementById('yellow75_1.png'), 0, 0);
michael@0 427 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 428 ctx.fillRect(0, 0, 100, 50);
michael@0 429 ctx.globalCompositeOperation = 'copy';
michael@0 430 ctx.drawImage(canvas2, 0, 0);
michael@0 431 isPixel(ctx, 50,25, 255,255,0,191, 5);
michael@0 432
michael@0 433
michael@0 434 }
michael@0 435 </script>
michael@0 436 <img src="image_yellow75.png" id="yellow75_1.png" class="resource">
michael@0 437
michael@0 438 <!-- [[[ test_2d.composite.canvas.destination-atop.html ]]] -->
michael@0 439
michael@0 440 <p>Canvas test: 2d.composite.canvas.destination-atop</p>
michael@0 441 <canvas id="c14" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 442 <script>
michael@0 443
michael@0 444
michael@0 445 function test_2d_composite_canvas_destination_atop() {
michael@0 446
michael@0 447 var canvas = document.getElementById('c14');
michael@0 448 var ctx = canvas.getContext('2d');
michael@0 449
michael@0 450
michael@0 451 var canvas2 = document.createElement('canvas');
michael@0 452 canvas2.width = canvas.width;
michael@0 453 canvas2.height = canvas.height;
michael@0 454 var ctx2 = canvas2.getContext('2d');
michael@0 455 ctx2.drawImage(document.getElementById('yellow75_2.png'), 0, 0);
michael@0 456 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 457 ctx.fillRect(0, 0, 100, 50);
michael@0 458 ctx.globalCompositeOperation = 'destination-atop';
michael@0 459 ctx.drawImage(canvas2, 0, 0);
michael@0 460 isPixel(ctx, 50,25, 127,255,127,191, 5);
michael@0 461
michael@0 462
michael@0 463 }
michael@0 464 </script>
michael@0 465 <img src="image_yellow75.png" id="yellow75_2.png" class="resource">
michael@0 466
michael@0 467 <!-- [[[ test_2d.composite.canvas.destination-in.html ]]] -->
michael@0 468
michael@0 469 <p>Canvas test: 2d.composite.canvas.destination-in</p>
michael@0 470 <canvas id="c15" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 471 <script>
michael@0 472
michael@0 473
michael@0 474 function test_2d_composite_canvas_destination_in() {
michael@0 475
michael@0 476 var canvas = document.getElementById('c15');
michael@0 477 var ctx = canvas.getContext('2d');
michael@0 478
michael@0 479
michael@0 480 var canvas2 = document.createElement('canvas');
michael@0 481 canvas2.width = canvas.width;
michael@0 482 canvas2.height = canvas.height;
michael@0 483 var ctx2 = canvas2.getContext('2d');
michael@0 484 ctx2.drawImage(document.getElementById('yellow75_3.png'), 0, 0);
michael@0 485 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 486 ctx.fillRect(0, 0, 100, 50);
michael@0 487 ctx.globalCompositeOperation = 'destination-in';
michael@0 488 ctx.drawImage(canvas2, 0, 0);
michael@0 489 isPixel(ctx, 50,25, 0,255,255,95, 5);
michael@0 490
michael@0 491
michael@0 492 }
michael@0 493 </script>
michael@0 494 <img src="image_yellow75.png" id="yellow75_3.png" class="resource">
michael@0 495
michael@0 496 <!-- [[[ test_2d.composite.canvas.destination-out.html ]]] -->
michael@0 497
michael@0 498 <p>Canvas test: 2d.composite.canvas.destination-out</p>
michael@0 499 <canvas id="c16" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 500 <script>
michael@0 501
michael@0 502
michael@0 503 function test_2d_composite_canvas_destination_out() {
michael@0 504
michael@0 505 var canvas = document.getElementById('c16');
michael@0 506 var ctx = canvas.getContext('2d');
michael@0 507
michael@0 508
michael@0 509 var canvas2 = document.createElement('canvas');
michael@0 510 canvas2.width = canvas.width;
michael@0 511 canvas2.height = canvas.height;
michael@0 512 var ctx2 = canvas2.getContext('2d');
michael@0 513 ctx2.drawImage(document.getElementById('yellow75_4.png'), 0, 0);
michael@0 514 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 515 ctx.fillRect(0, 0, 100, 50);
michael@0 516 ctx.globalCompositeOperation = 'destination-out';
michael@0 517 ctx.drawImage(canvas2, 0, 0);
michael@0 518 isPixel(ctx, 50,25, 0,255,255,31, 5);
michael@0 519
michael@0 520
michael@0 521 }
michael@0 522 </script>
michael@0 523 <img src="image_yellow75.png" id="yellow75_4.png" class="resource">
michael@0 524
michael@0 525 <!-- [[[ test_2d.composite.canvas.destination-over.html ]]] -->
michael@0 526
michael@0 527 <p>Canvas test: 2d.composite.canvas.destination-over</p>
michael@0 528 <canvas id="c17" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 529 <script>
michael@0 530
michael@0 531
michael@0 532 function test_2d_composite_canvas_destination_over() {
michael@0 533
michael@0 534 var canvas = document.getElementById('c17');
michael@0 535 var ctx = canvas.getContext('2d');
michael@0 536
michael@0 537
michael@0 538 var canvas2 = document.createElement('canvas');
michael@0 539 canvas2.width = canvas.width;
michael@0 540 canvas2.height = canvas.height;
michael@0 541 var ctx2 = canvas2.getContext('2d');
michael@0 542 ctx2.drawImage(document.getElementById('yellow75_5.png'), 0, 0);
michael@0 543 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 544 ctx.fillRect(0, 0, 100, 50);
michael@0 545 ctx.globalCompositeOperation = 'destination-over';
michael@0 546 ctx.drawImage(canvas2, 0, 0);
michael@0 547 isPixel(ctx, 50,25, 109,255,145,223, 5);
michael@0 548
michael@0 549
michael@0 550 }
michael@0 551 </script>
michael@0 552 <img src="image_yellow75.png" id="yellow75_5.png" class="resource">
michael@0 553
michael@0 554 <!-- [[[ test_2d.composite.canvas.lighter.html ]]] -->
michael@0 555
michael@0 556 <p>Canvas test: 2d.composite.canvas.lighter</p>
michael@0 557 <canvas id="c18" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 558 <script>
michael@0 559
michael@0 560
michael@0 561 function test_2d_composite_canvas_lighter() {
michael@0 562
michael@0 563 var canvas = document.getElementById('c18');
michael@0 564 var ctx = canvas.getContext('2d');
michael@0 565
michael@0 566
michael@0 567 var canvas2 = document.createElement('canvas');
michael@0 568 canvas2.width = canvas.width;
michael@0 569 canvas2.height = canvas.height;
michael@0 570 var ctx2 = canvas2.getContext('2d');
michael@0 571 ctx2.drawImage(document.getElementById('yellow75_6.png'), 0, 0);
michael@0 572 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 573 ctx.fillRect(0, 0, 100, 50);
michael@0 574 ctx.globalCompositeOperation = 'lighter';
michael@0 575 ctx.drawImage(canvas2, 0, 0);
michael@0 576 isPixel(ctx, 50,25, 191,255,127,255, 5);
michael@0 577
michael@0 578
michael@0 579 }
michael@0 580 </script>
michael@0 581 <img src="image_yellow75.png" id="yellow75_6.png" class="resource">
michael@0 582
michael@0 583 <!-- [[[ test_2d.composite.canvas.source-atop.html ]]] -->
michael@0 584
michael@0 585 <p>Canvas test: 2d.composite.canvas.source-atop</p>
michael@0 586 <canvas id="c19" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 587 <script>
michael@0 588
michael@0 589
michael@0 590 function test_2d_composite_canvas_source_atop() {
michael@0 591
michael@0 592 var canvas = document.getElementById('c19');
michael@0 593 var ctx = canvas.getContext('2d');
michael@0 594
michael@0 595
michael@0 596 var canvas2 = document.createElement('canvas');
michael@0 597 canvas2.width = canvas.width;
michael@0 598 canvas2.height = canvas.height;
michael@0 599 var ctx2 = canvas2.getContext('2d');
michael@0 600 ctx2.drawImage(document.getElementById('yellow75_7.png'), 0, 0);
michael@0 601 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 602 ctx.fillRect(0, 0, 100, 50);
michael@0 603 ctx.globalCompositeOperation = 'source-atop';
michael@0 604 ctx.drawImage(canvas2, 0, 0);
michael@0 605 isPixel(ctx, 50,25, 191,255,63,127, 5);
michael@0 606
michael@0 607
michael@0 608 }
michael@0 609 </script>
michael@0 610 <img src="image_yellow75.png" id="yellow75_7.png" class="resource">
michael@0 611
michael@0 612 <!-- [[[ test_2d.composite.canvas.source-in.html ]]] -->
michael@0 613
michael@0 614 <p>Canvas test: 2d.composite.canvas.source-in</p>
michael@0 615 <canvas id="c20" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 616 <script>
michael@0 617
michael@0 618
michael@0 619 function test_2d_composite_canvas_source_in() {
michael@0 620
michael@0 621 var canvas = document.getElementById('c20');
michael@0 622 var ctx = canvas.getContext('2d');
michael@0 623
michael@0 624
michael@0 625 var canvas2 = document.createElement('canvas');
michael@0 626 canvas2.width = canvas.width;
michael@0 627 canvas2.height = canvas.height;
michael@0 628 var ctx2 = canvas2.getContext('2d');
michael@0 629 ctx2.drawImage(document.getElementById('yellow75_8.png'), 0, 0);
michael@0 630 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 631 ctx.fillRect(0, 0, 100, 50);
michael@0 632 ctx.globalCompositeOperation = 'source-in';
michael@0 633 ctx.drawImage(canvas2, 0, 0);
michael@0 634 isPixel(ctx, 50,25, 255,255,0,95, 5);
michael@0 635
michael@0 636
michael@0 637 }
michael@0 638 </script>
michael@0 639 <img src="image_yellow75.png" id="yellow75_8.png" class="resource">
michael@0 640
michael@0 641 <!-- [[[ test_2d.composite.canvas.source-out.html ]]] -->
michael@0 642
michael@0 643 <p>Canvas test: 2d.composite.canvas.source-out</p>
michael@0 644 <canvas id="c21" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 645 <script>
michael@0 646
michael@0 647
michael@0 648 function test_2d_composite_canvas_source_out() {
michael@0 649
michael@0 650 var canvas = document.getElementById('c21');
michael@0 651 var ctx = canvas.getContext('2d');
michael@0 652
michael@0 653
michael@0 654 var canvas2 = document.createElement('canvas');
michael@0 655 canvas2.width = canvas.width;
michael@0 656 canvas2.height = canvas.height;
michael@0 657 var ctx2 = canvas2.getContext('2d');
michael@0 658 ctx2.drawImage(document.getElementById('yellow75_9.png'), 0, 0);
michael@0 659 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 660 ctx.fillRect(0, 0, 100, 50);
michael@0 661 ctx.globalCompositeOperation = 'source-out';
michael@0 662 ctx.drawImage(canvas2, 0, 0);
michael@0 663 isPixel(ctx, 50,25, 255,255,0,95, 5);
michael@0 664
michael@0 665
michael@0 666 }
michael@0 667 </script>
michael@0 668 <img src="image_yellow75.png" id="yellow75_9.png" class="resource">
michael@0 669
michael@0 670 <!-- [[[ test_2d.composite.canvas.source-over.html ]]] -->
michael@0 671
michael@0 672 <p>Canvas test: 2d.composite.canvas.source-over</p>
michael@0 673 <canvas id="c22" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 674 <script>
michael@0 675
michael@0 676
michael@0 677 function test_2d_composite_canvas_source_over() {
michael@0 678
michael@0 679 var canvas = document.getElementById('c22');
michael@0 680 var ctx = canvas.getContext('2d');
michael@0 681
michael@0 682
michael@0 683 var canvas2 = document.createElement('canvas');
michael@0 684 canvas2.width = canvas.width;
michael@0 685 canvas2.height = canvas.height;
michael@0 686 var ctx2 = canvas2.getContext('2d');
michael@0 687 ctx2.drawImage(document.getElementById('yellow75_10.png'), 0, 0);
michael@0 688 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 689 ctx.fillRect(0, 0, 100, 50);
michael@0 690 ctx.globalCompositeOperation = 'source-over';
michael@0 691 ctx.drawImage(canvas2, 0, 0);
michael@0 692 isPixel(ctx, 50,25, 218,255,36,223, 5);
michael@0 693
michael@0 694
michael@0 695 }
michael@0 696 </script>
michael@0 697 <img src="image_yellow75.png" id="yellow75_10.png" class="resource">
michael@0 698
michael@0 699 <!-- [[[ test_2d.composite.canvas.xor.html ]]] -->
michael@0 700
michael@0 701 <p>Canvas test: 2d.composite.canvas.xor</p>
michael@0 702 <canvas id="c23" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 703 <script>
michael@0 704
michael@0 705
michael@0 706 function test_2d_composite_canvas_xor() {
michael@0 707
michael@0 708 var canvas = document.getElementById('c23');
michael@0 709 var ctx = canvas.getContext('2d');
michael@0 710
michael@0 711
michael@0 712 var canvas2 = document.createElement('canvas');
michael@0 713 canvas2.width = canvas.width;
michael@0 714 canvas2.height = canvas.height;
michael@0 715 var ctx2 = canvas2.getContext('2d');
michael@0 716 ctx2.drawImage(document.getElementById('yellow75_11.png'), 0, 0);
michael@0 717 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 718 ctx.fillRect(0, 0, 100, 50);
michael@0 719 ctx.globalCompositeOperation = 'xor';
michael@0 720 ctx.drawImage(canvas2, 0, 0);
michael@0 721 isPixel(ctx, 50,25, 191,255,63,127, 5);
michael@0 722
michael@0 723
michael@0 724 }
michael@0 725 </script>
michael@0 726 <img src="image_yellow75.png" id="yellow75_11.png" class="resource">
michael@0 727
michael@0 728 <!-- [[[ test_2d.composite.clip.copy.html ]]] -->
michael@0 729
michael@0 730 <p>Canvas test: 2d.composite.clip.copy</p>
michael@0 731 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 732 <canvas id="c24" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 733 <script>
michael@0 734
michael@0 735
michael@0 736 function test_2d_composite_clip_copy() {
michael@0 737
michael@0 738 var canvas = document.getElementById('c24');
michael@0 739 var ctx = canvas.getContext('2d');
michael@0 740
michael@0 741
michael@0 742 ctx.fillStyle = '#0f0';
michael@0 743 ctx.fillRect(0, 0, 100, 50);
michael@0 744 ctx.globalCompositeOperation = 'copy';
michael@0 745 ctx.rect(-20, -20, 10, 10);
michael@0 746 ctx.clip();
michael@0 747 ctx.fillStyle = '#f00';
michael@0 748 ctx.fillRect(0, 0, 50, 50);
michael@0 749 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 750 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 751
michael@0 752
michael@0 753 }
michael@0 754 </script>
michael@0 755
michael@0 756 <!-- [[[ test_2d.composite.clip.destination-atop.html ]]] -->
michael@0 757
michael@0 758 <p>Canvas test: 2d.composite.clip.destination-atop</p>
michael@0 759 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 760 <canvas id="c25" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 761 <script>
michael@0 762
michael@0 763
michael@0 764 function test_2d_composite_clip_destination_atop() {
michael@0 765
michael@0 766 var canvas = document.getElementById('c25');
michael@0 767 var ctx = canvas.getContext('2d');
michael@0 768
michael@0 769
michael@0 770 ctx.fillStyle = '#0f0';
michael@0 771 ctx.fillRect(0, 0, 100, 50);
michael@0 772 ctx.globalCompositeOperation = 'destination-atop';
michael@0 773 ctx.rect(-20, -20, 10, 10);
michael@0 774 ctx.clip();
michael@0 775 ctx.fillStyle = '#f00';
michael@0 776 ctx.fillRect(0, 0, 50, 50);
michael@0 777 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 778 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 779
michael@0 780
michael@0 781 }
michael@0 782 </script>
michael@0 783
michael@0 784 <!-- [[[ test_2d.composite.clip.destination-in.html ]]] -->
michael@0 785
michael@0 786 <p>Canvas test: 2d.composite.clip.destination-in</p>
michael@0 787 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 788 <canvas id="c26" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 789 <script>
michael@0 790
michael@0 791
michael@0 792 function test_2d_composite_clip_destination_in() {
michael@0 793
michael@0 794 var canvas = document.getElementById('c26');
michael@0 795 var ctx = canvas.getContext('2d');
michael@0 796
michael@0 797
michael@0 798 ctx.fillStyle = '#0f0';
michael@0 799 ctx.fillRect(0, 0, 100, 50);
michael@0 800 ctx.globalCompositeOperation = 'destination-in';
michael@0 801 ctx.rect(-20, -20, 10, 10);
michael@0 802 ctx.clip();
michael@0 803 ctx.fillStyle = '#f00';
michael@0 804 ctx.fillRect(0, 0, 50, 50);
michael@0 805 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 806 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 807
michael@0 808
michael@0 809 }
michael@0 810 </script>
michael@0 811
michael@0 812 <!-- [[[ test_2d.composite.clip.destination-out.html ]]] -->
michael@0 813
michael@0 814 <p>Canvas test: 2d.composite.clip.destination-out</p>
michael@0 815 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 816 <canvas id="c27" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 817 <script>
michael@0 818
michael@0 819
michael@0 820 function test_2d_composite_clip_destination_out() {
michael@0 821
michael@0 822 var canvas = document.getElementById('c27');
michael@0 823 var ctx = canvas.getContext('2d');
michael@0 824
michael@0 825
michael@0 826 ctx.fillStyle = '#0f0';
michael@0 827 ctx.fillRect(0, 0, 100, 50);
michael@0 828 ctx.globalCompositeOperation = 'destination-out';
michael@0 829 ctx.rect(-20, -20, 10, 10);
michael@0 830 ctx.clip();
michael@0 831 ctx.fillStyle = '#f00';
michael@0 832 ctx.fillRect(0, 0, 50, 50);
michael@0 833 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 834 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 835
michael@0 836
michael@0 837 }
michael@0 838 </script>
michael@0 839
michael@0 840 <!-- [[[ test_2d.composite.clip.destination-over.html ]]] -->
michael@0 841
michael@0 842 <p>Canvas test: 2d.composite.clip.destination-over</p>
michael@0 843 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 844 <canvas id="c28" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 845 <script>
michael@0 846
michael@0 847
michael@0 848 function test_2d_composite_clip_destination_over() {
michael@0 849
michael@0 850 var canvas = document.getElementById('c28');
michael@0 851 var ctx = canvas.getContext('2d');
michael@0 852
michael@0 853
michael@0 854 ctx.fillStyle = '#0f0';
michael@0 855 ctx.fillRect(0, 0, 100, 50);
michael@0 856 ctx.globalCompositeOperation = 'destination-over';
michael@0 857 ctx.rect(-20, -20, 10, 10);
michael@0 858 ctx.clip();
michael@0 859 ctx.fillStyle = '#f00';
michael@0 860 ctx.fillRect(0, 0, 50, 50);
michael@0 861 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 862 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 863
michael@0 864
michael@0 865 }
michael@0 866 </script>
michael@0 867
michael@0 868 <!-- [[[ test_2d.composite.clip.lighter.html ]]] -->
michael@0 869
michael@0 870 <p>Canvas test: 2d.composite.clip.lighter</p>
michael@0 871 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 872 <canvas id="c29" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 873 <script>
michael@0 874
michael@0 875
michael@0 876 function test_2d_composite_clip_lighter() {
michael@0 877
michael@0 878 var canvas = document.getElementById('c29');
michael@0 879 var ctx = canvas.getContext('2d');
michael@0 880
michael@0 881
michael@0 882 ctx.fillStyle = '#0f0';
michael@0 883 ctx.fillRect(0, 0, 100, 50);
michael@0 884 ctx.globalCompositeOperation = 'lighter';
michael@0 885 ctx.rect(-20, -20, 10, 10);
michael@0 886 ctx.clip();
michael@0 887 ctx.fillStyle = '#f00';
michael@0 888 ctx.fillRect(0, 0, 50, 50);
michael@0 889 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 890 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 891
michael@0 892
michael@0 893 }
michael@0 894 </script>
michael@0 895
michael@0 896 <!-- [[[ test_2d.composite.clip.source-atop.html ]]] -->
michael@0 897
michael@0 898 <p>Canvas test: 2d.composite.clip.source-atop</p>
michael@0 899 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 900 <canvas id="c30" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 901 <script>
michael@0 902
michael@0 903
michael@0 904 function test_2d_composite_clip_source_atop() {
michael@0 905
michael@0 906 var canvas = document.getElementById('c30');
michael@0 907 var ctx = canvas.getContext('2d');
michael@0 908
michael@0 909
michael@0 910 ctx.fillStyle = '#0f0';
michael@0 911 ctx.fillRect(0, 0, 100, 50);
michael@0 912 ctx.globalCompositeOperation = 'source-atop';
michael@0 913 ctx.rect(-20, -20, 10, 10);
michael@0 914 ctx.clip();
michael@0 915 ctx.fillStyle = '#f00';
michael@0 916 ctx.fillRect(0, 0, 50, 50);
michael@0 917 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 918 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 919
michael@0 920
michael@0 921 }
michael@0 922 </script>
michael@0 923
michael@0 924 <!-- [[[ test_2d.composite.clip.source-in.html ]]] -->
michael@0 925
michael@0 926 <p>Canvas test: 2d.composite.clip.source-in</p>
michael@0 927 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 928 <canvas id="c31" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 929 <script>
michael@0 930
michael@0 931
michael@0 932 function test_2d_composite_clip_source_in() {
michael@0 933
michael@0 934 var canvas = document.getElementById('c31');
michael@0 935 var ctx = canvas.getContext('2d');
michael@0 936
michael@0 937
michael@0 938 ctx.fillStyle = '#0f0';
michael@0 939 ctx.fillRect(0, 0, 100, 50);
michael@0 940 ctx.globalCompositeOperation = 'source-in';
michael@0 941 ctx.rect(-20, -20, 10, 10);
michael@0 942 ctx.clip();
michael@0 943 ctx.fillStyle = '#f00';
michael@0 944 ctx.fillRect(0, 0, 50, 50);
michael@0 945 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 946 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 947
michael@0 948
michael@0 949 }
michael@0 950 </script>
michael@0 951
michael@0 952 <!-- [[[ test_2d.composite.clip.source-out.html ]]] -->
michael@0 953
michael@0 954 <p>Canvas test: 2d.composite.clip.source-out</p>
michael@0 955 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 956 <canvas id="c32" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 957 <script>
michael@0 958
michael@0 959
michael@0 960 function test_2d_composite_clip_source_out() {
michael@0 961
michael@0 962 var canvas = document.getElementById('c32');
michael@0 963 var ctx = canvas.getContext('2d');
michael@0 964
michael@0 965
michael@0 966 ctx.fillStyle = '#0f0';
michael@0 967 ctx.fillRect(0, 0, 100, 50);
michael@0 968 ctx.globalCompositeOperation = 'source-out';
michael@0 969 ctx.rect(-20, -20, 10, 10);
michael@0 970 ctx.clip();
michael@0 971 ctx.fillStyle = '#f00';
michael@0 972 ctx.fillRect(0, 0, 50, 50);
michael@0 973 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 974 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 975
michael@0 976
michael@0 977 }
michael@0 978 </script>
michael@0 979
michael@0 980 <!-- [[[ test_2d.composite.clip.source-over.html ]]] -->
michael@0 981
michael@0 982 <p>Canvas test: 2d.composite.clip.source-over</p>
michael@0 983 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 984 <canvas id="c33" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 985 <script>
michael@0 986
michael@0 987
michael@0 988 function test_2d_composite_clip_source_over() {
michael@0 989
michael@0 990 var canvas = document.getElementById('c33');
michael@0 991 var ctx = canvas.getContext('2d');
michael@0 992
michael@0 993
michael@0 994 ctx.fillStyle = '#0f0';
michael@0 995 ctx.fillRect(0, 0, 100, 50);
michael@0 996 ctx.globalCompositeOperation = 'source-over';
michael@0 997 ctx.rect(-20, -20, 10, 10);
michael@0 998 ctx.clip();
michael@0 999 ctx.fillStyle = '#f00';
michael@0 1000 ctx.fillRect(0, 0, 50, 50);
michael@0 1001 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 1002 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 1003
michael@0 1004
michael@0 1005 }
michael@0 1006 </script>
michael@0 1007
michael@0 1008 <!-- [[[ test_2d.composite.clip.xor.html ]]] -->
michael@0 1009
michael@0 1010 <p>Canvas test: 2d.composite.clip.xor</p>
michael@0 1011 <!-- Testing: fill() does not affect pixels outside the clip region. -->
michael@0 1012 <canvas id="c34" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1013 <script>
michael@0 1014
michael@0 1015
michael@0 1016 function test_2d_composite_clip_xor() {
michael@0 1017
michael@0 1018 var canvas = document.getElementById('c34');
michael@0 1019 var ctx = canvas.getContext('2d');
michael@0 1020
michael@0 1021
michael@0 1022 ctx.fillStyle = '#0f0';
michael@0 1023 ctx.fillRect(0, 0, 100, 50);
michael@0 1024 ctx.globalCompositeOperation = 'xor';
michael@0 1025 ctx.rect(-20, -20, 10, 10);
michael@0 1026 ctx.clip();
michael@0 1027 ctx.fillStyle = '#f00';
michael@0 1028 ctx.fillRect(0, 0, 50, 50);
michael@0 1029 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 1030 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 1031
michael@0 1032
michael@0 1033 }
michael@0 1034 </script>
michael@0 1035
michael@0 1036 <!-- [[[ test_2d.composite.globalAlpha.canvas.html ]]] -->
michael@0 1037
michael@0 1038 <p>Canvas test: 2d.composite.globalAlpha.canvas</p>
michael@0 1039 <canvas id="c35" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1040 <script>
michael@0 1041
michael@0 1042
michael@0 1043 function test_2d_composite_globalAlpha_canvas() {
michael@0 1044
michael@0 1045 var canvas = document.getElementById('c35');
michael@0 1046 var ctx = canvas.getContext('2d');
michael@0 1047
michael@0 1048 var canvas2 = document.createElement('canvas');
michael@0 1049 canvas2.width = 100;
michael@0 1050 canvas2.height = 50;
michael@0 1051 var ctx2 = canvas2.getContext('2d');
michael@0 1052 ctx2.fillStyle = '#f00';
michael@0 1053 ctx2.fillRect(0, 0, 100, 50);
michael@0 1054
michael@0 1055 ctx.fillStyle = '#0f0';
michael@0 1056 ctx.fillRect(0, 0, 100, 50);
michael@0 1057 ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
michael@0 1058 ctx.drawImage(canvas2, 0, 0);
michael@0 1059 isPixel(ctx, 50,25, 2,253,0,255, 2);
michael@0 1060
michael@0 1061
michael@0 1062 }
michael@0 1063 </script>
michael@0 1064
michael@0 1065 <!-- [[[ test_2d.composite.globalAlpha.canvaspattern.html ]]] -->
michael@0 1066
michael@0 1067 <p>Canvas test: 2d.composite.globalAlpha.canvaspattern - bug 401790</p>
michael@0 1068 <canvas id="c36" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1069 <script>
michael@0 1070
michael@0 1071 function todo_isPixel(ctx, x,y, r,g,b,a, d) {
michael@0 1072 var pos = x + "," + y;
michael@0 1073 var colour = r + "," + g + "," + b + "," + a;
michael@0 1074 var pixel = ctx.getImageData(x, y, 1, 1);
michael@0 1075 var pr = pixel.data[0],
michael@0 1076 pg = pixel.data[1],
michael@0 1077 pb = pixel.data[2],
michael@0 1078 pa = pixel.data[3];
michael@0 1079 todo(r-d <= pr && pr <= r+d &&
michael@0 1080 g-d <= pg && pg <= g+d &&
michael@0 1081 b-d <= pb && pb <= b+d &&
michael@0 1082 a-d <= pa && pa <= a+d,
michael@0 1083 "pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+" (marked todo); expected "+colour+" +/- " + d);
michael@0 1084 }
michael@0 1085
michael@0 1086 function test_2d_composite_globalAlpha_canvaspattern() {
michael@0 1087
michael@0 1088 var canvas = document.getElementById('c36');
michael@0 1089 var ctx = canvas.getContext('2d');
michael@0 1090
michael@0 1091 var canvas2 = document.createElement('canvas');
michael@0 1092 canvas2.width = 100;
michael@0 1093 canvas2.height = 50;
michael@0 1094 var ctx2 = canvas2.getContext('2d');
michael@0 1095 ctx2.fillStyle = '#f00';
michael@0 1096 ctx2.fillRect(0, 0, 100, 50);
michael@0 1097
michael@0 1098 ctx.fillStyle = '#0f0';
michael@0 1099 ctx.fillRect(0, 0, 100, 50);
michael@0 1100 ctx.fillStyle = ctx.createPattern(canvas2, 'no-repeat');
michael@0 1101 ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
michael@0 1102 ctx.fillRect(0, 0, 100, 50);
michael@0 1103 isPixel(ctx, 50,25, 2,253,0,255, 2);
michael@0 1104
michael@0 1105
michael@0 1106 }
michael@0 1107 </script>
michael@0 1108
michael@0 1109 <!-- [[[ test_2d.composite.globalAlpha.default.html ]]] -->
michael@0 1110
michael@0 1111 <p>Canvas test: 2d.composite.globalAlpha.default</p>
michael@0 1112 <canvas id="c37" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1113 <script>
michael@0 1114
michael@0 1115 function test_2d_composite_globalAlpha_default() {
michael@0 1116
michael@0 1117 var canvas = document.getElementById('c37');
michael@0 1118 var ctx = canvas.getContext('2d');
michael@0 1119
michael@0 1120 ok(ctx.globalAlpha === 1.0, "ctx.globalAlpha === 1.0");
michael@0 1121
michael@0 1122
michael@0 1123 }
michael@0 1124 </script>
michael@0 1125
michael@0 1126 <!-- [[[ test_2d.composite.globalAlpha.fill.html ]]] -->
michael@0 1127
michael@0 1128 <p>Canvas test: 2d.composite.globalAlpha.fill</p>
michael@0 1129 <canvas id="c38" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1130 <script>
michael@0 1131
michael@0 1132
michael@0 1133 function test_2d_composite_globalAlpha_fill() {
michael@0 1134
michael@0 1135 var canvas = document.getElementById('c38');
michael@0 1136 var ctx = canvas.getContext('2d');
michael@0 1137
michael@0 1138 ctx.fillStyle = '#0f0';
michael@0 1139 ctx.fillRect(0, 0, 100, 50);
michael@0 1140 ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
michael@0 1141 ctx.fillStyle = '#f00';
michael@0 1142 ctx.fillRect(0, 0, 100, 50);
michael@0 1143 isPixel(ctx, 50,25, 2,253,0,255, 2);
michael@0 1144
michael@0 1145
michael@0 1146 }
michael@0 1147 </script>
michael@0 1148
michael@0 1149 <!-- [[[ test_2d.composite.globalAlpha.image.html ]]] -->
michael@0 1150
michael@0 1151 <p>Canvas test: 2d.composite.globalAlpha.image</p>
michael@0 1152 <canvas id="c39" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1153 <script>
michael@0 1154
michael@0 1155
michael@0 1156 function test_2d_composite_globalAlpha_image() {
michael@0 1157
michael@0 1158 var canvas = document.getElementById('c39');
michael@0 1159 var ctx = canvas.getContext('2d');
michael@0 1160
michael@0 1161 ctx.fillStyle = '#0f0';
michael@0 1162 ctx.fillRect(0, 0, 100, 50);
michael@0 1163 ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
michael@0 1164 ctx.drawImage(document.getElementById('red_1.png'), 0, 0);
michael@0 1165 isPixel(ctx, 50,25, 2,253,0,255, 2);
michael@0 1166
michael@0 1167
michael@0 1168 }
michael@0 1169 </script>
michael@0 1170 <img src="image_red.png" id="red_1.png" class="resource">
michael@0 1171
michael@0 1172 <!-- [[[ test_2d.composite.globalAlpha.imagepattern.html ]]] -->
michael@0 1173
michael@0 1174 <p>Canvas test: 2d.composite.globalAlpha.imagepattern - bug 401790</p>
michael@0 1175 <canvas id="c40" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1176 <script>
michael@0 1177
michael@0 1178
michael@0 1179
michael@0 1180 function test_2d_composite_globalAlpha_imagepattern() {
michael@0 1181
michael@0 1182 var canvas = document.getElementById('c40');
michael@0 1183 var ctx = canvas.getContext('2d');
michael@0 1184
michael@0 1185 ctx.fillStyle = '#0f0';
michael@0 1186 ctx.fillRect(0, 0, 100, 50);
michael@0 1187 ctx.fillStyle = ctx.createPattern(document.getElementById('red_2.png'), 'no-repeat');
michael@0 1188 ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
michael@0 1189 ctx.fillRect(0, 0, 100, 50);
michael@0 1190 isPixel(ctx, 50,25, 2,253,0,255, 2);
michael@0 1191
michael@0 1192
michael@0 1193 }
michael@0 1194 </script>
michael@0 1195 <img src="image_red.png" id="red_2.png" class="resource">
michael@0 1196
michael@0 1197 <!-- [[[ test_2d.composite.globalAlpha.invalid.html ]]] -->
michael@0 1198
michael@0 1199 <p>Canvas test: 2d.composite.globalAlpha.invalid</p>
michael@0 1200 <canvas id="c41" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1201 <script>
michael@0 1202
michael@0 1203 function test_2d_composite_globalAlpha_invalid() {
michael@0 1204
michael@0 1205 var canvas = document.getElementById('c41');
michael@0 1206 var ctx = canvas.getContext('2d');
michael@0 1207
michael@0 1208 ctx.globalAlpha = 0.5;
michael@0 1209 var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
michael@0 1210 ctx.globalAlpha = Infinity;
michael@0 1211 ok(ctx.globalAlpha === a, "ctx.globalAlpha === a");
michael@0 1212 ctx.globalAlpha = -Infinity;
michael@0 1213 ok(ctx.globalAlpha === a, "ctx.globalAlpha === a");
michael@0 1214 ctx.globalAlpha = NaN;
michael@0 1215 ok(ctx.globalAlpha === a, "ctx.globalAlpha === a");
michael@0 1216
michael@0 1217 }
michael@0 1218 </script>
michael@0 1219
michael@0 1220 <!-- [[[ test_2d.composite.globalAlpha.range.html ]]] -->
michael@0 1221
michael@0 1222 <p>Canvas test: 2d.composite.globalAlpha.range</p>
michael@0 1223 <canvas id="c42" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1224 <script>
michael@0 1225
michael@0 1226 function test_2d_composite_globalAlpha_range() {
michael@0 1227
michael@0 1228 var canvas = document.getElementById('c42');
michael@0 1229 var ctx = canvas.getContext('2d');
michael@0 1230
michael@0 1231 ctx.globalAlpha = 0.5;
michael@0 1232 var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
michael@0 1233 ctx.globalAlpha = 1.1;
michael@0 1234 ok(ctx.globalAlpha == a, "ctx.globalAlpha == a");
michael@0 1235 ctx.globalAlpha = -0.1;
michael@0 1236 ok(ctx.globalAlpha == a, "ctx.globalAlpha == a");
michael@0 1237 ctx.globalAlpha = 0;
michael@0 1238 ok(ctx.globalAlpha == 0, "ctx.globalAlpha == 0");
michael@0 1239 ctx.globalAlpha = 1;
michael@0 1240 ok(ctx.globalAlpha == 1, "ctx.globalAlpha == 1");
michael@0 1241
michael@0 1242
michael@0 1243 }
michael@0 1244 </script>
michael@0 1245
michael@0 1246 <!-- [[[ test_2d.composite.image.copy.html ]]] -->
michael@0 1247
michael@0 1248 <p>Canvas test: 2d.composite.image.copy</p>
michael@0 1249 <canvas id="c43" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1250 <script>
michael@0 1251
michael@0 1252
michael@0 1253 function test_2d_composite_image_copy() {
michael@0 1254
michael@0 1255 var canvas = document.getElementById('c43');
michael@0 1256 var ctx = canvas.getContext('2d');
michael@0 1257
michael@0 1258
michael@0 1259 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1260 ctx.fillRect(0, 0, 100, 50);
michael@0 1261 ctx.globalCompositeOperation = 'copy';
michael@0 1262 ctx.drawImage(document.getElementById('yellow75_12.png'), 0, 0);
michael@0 1263 isPixel(ctx, 50,25, 255,255,0,191, 5);
michael@0 1264
michael@0 1265
michael@0 1266 }
michael@0 1267 </script>
michael@0 1268 <img src="image_yellow75.png" id="yellow75_12.png" class="resource">
michael@0 1269
michael@0 1270 <!-- [[[ test_2d.composite.image.destination-atop.html ]]] -->
michael@0 1271
michael@0 1272 <p>Canvas test: 2d.composite.image.destination-atop</p>
michael@0 1273 <canvas id="c44" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1274 <script>
michael@0 1275
michael@0 1276
michael@0 1277 function test_2d_composite_image_destination_atop() {
michael@0 1278
michael@0 1279 var canvas = document.getElementById('c44');
michael@0 1280 var ctx = canvas.getContext('2d');
michael@0 1281
michael@0 1282
michael@0 1283 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1284 ctx.fillRect(0, 0, 100, 50);
michael@0 1285 ctx.globalCompositeOperation = 'destination-atop';
michael@0 1286 ctx.drawImage(document.getElementById('yellow75_13.png'), 0, 0);
michael@0 1287 isPixel(ctx, 50,25, 127,255,127,191, 5);
michael@0 1288
michael@0 1289
michael@0 1290 }
michael@0 1291 </script>
michael@0 1292 <img src="image_yellow75.png" id="yellow75_13.png" class="resource">
michael@0 1293
michael@0 1294 <!-- [[[ test_2d.composite.image.destination-in.html ]]] -->
michael@0 1295
michael@0 1296 <p>Canvas test: 2d.composite.image.destination-in</p>
michael@0 1297 <canvas id="c45" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1298 <script>
michael@0 1299
michael@0 1300
michael@0 1301 function test_2d_composite_image_destination_in() {
michael@0 1302
michael@0 1303 var canvas = document.getElementById('c45');
michael@0 1304 var ctx = canvas.getContext('2d');
michael@0 1305
michael@0 1306
michael@0 1307 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1308 ctx.fillRect(0, 0, 100, 50);
michael@0 1309 ctx.globalCompositeOperation = 'destination-in';
michael@0 1310 ctx.drawImage(document.getElementById('yellow75_14.png'), 0, 0);
michael@0 1311 isPixel(ctx, 50,25, 0,255,255,95, 5);
michael@0 1312
michael@0 1313
michael@0 1314 }
michael@0 1315 </script>
michael@0 1316 <img src="image_yellow75.png" id="yellow75_14.png" class="resource">
michael@0 1317
michael@0 1318 <!-- [[[ test_2d.composite.image.destination-out.html ]]] -->
michael@0 1319
michael@0 1320 <p>Canvas test: 2d.composite.image.destination-out</p>
michael@0 1321 <canvas id="c46" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1322 <script>
michael@0 1323
michael@0 1324
michael@0 1325 function test_2d_composite_image_destination_out() {
michael@0 1326
michael@0 1327 var canvas = document.getElementById('c46');
michael@0 1328 var ctx = canvas.getContext('2d');
michael@0 1329
michael@0 1330
michael@0 1331 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1332 ctx.fillRect(0, 0, 100, 50);
michael@0 1333 ctx.globalCompositeOperation = 'destination-out';
michael@0 1334 ctx.drawImage(document.getElementById('yellow75_15.png'), 0, 0);
michael@0 1335 isPixel(ctx, 50,25, 0,255,255,31, 5);
michael@0 1336
michael@0 1337
michael@0 1338 }
michael@0 1339 </script>
michael@0 1340 <img src="image_yellow75.png" id="yellow75_15.png" class="resource">
michael@0 1341
michael@0 1342 <!-- [[[ test_2d.composite.image.destination-over.html ]]] -->
michael@0 1343
michael@0 1344 <p>Canvas test: 2d.composite.image.destination-over</p>
michael@0 1345 <canvas id="c47" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1346 <script>
michael@0 1347
michael@0 1348
michael@0 1349 function test_2d_composite_image_destination_over() {
michael@0 1350
michael@0 1351 var canvas = document.getElementById('c47');
michael@0 1352 var ctx = canvas.getContext('2d');
michael@0 1353
michael@0 1354
michael@0 1355 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1356 ctx.fillRect(0, 0, 100, 50);
michael@0 1357 ctx.globalCompositeOperation = 'destination-over';
michael@0 1358 ctx.drawImage(document.getElementById('yellow75_16.png'), 0, 0);
michael@0 1359 isPixel(ctx, 50,25, 109,255,145,223, 5);
michael@0 1360
michael@0 1361
michael@0 1362 }
michael@0 1363 </script>
michael@0 1364 <img src="image_yellow75.png" id="yellow75_16.png" class="resource">
michael@0 1365
michael@0 1366 <!-- [[[ test_2d.composite.image.lighter.html ]]] -->
michael@0 1367
michael@0 1368 <p>Canvas test: 2d.composite.image.lighter</p>
michael@0 1369 <canvas id="c48" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1370 <script>
michael@0 1371
michael@0 1372
michael@0 1373 function test_2d_composite_image_lighter() {
michael@0 1374
michael@0 1375 var canvas = document.getElementById('c48');
michael@0 1376 var ctx = canvas.getContext('2d');
michael@0 1377
michael@0 1378
michael@0 1379 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1380 ctx.fillRect(0, 0, 100, 50);
michael@0 1381 ctx.globalCompositeOperation = 'lighter';
michael@0 1382 ctx.drawImage(document.getElementById('yellow75_17.png'), 0, 0);
michael@0 1383 isPixel(ctx, 50,25, 191,255,127,255, 5);
michael@0 1384
michael@0 1385
michael@0 1386 }
michael@0 1387 </script>
michael@0 1388 <img src="image_yellow75.png" id="yellow75_17.png" class="resource">
michael@0 1389
michael@0 1390 <!-- [[[ test_2d.composite.image.source-atop.html ]]] -->
michael@0 1391
michael@0 1392 <p>Canvas test: 2d.composite.image.source-atop</p>
michael@0 1393 <canvas id="c49" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1394 <script>
michael@0 1395
michael@0 1396
michael@0 1397 function test_2d_composite_image_source_atop() {
michael@0 1398
michael@0 1399 var canvas = document.getElementById('c49');
michael@0 1400 var ctx = canvas.getContext('2d');
michael@0 1401
michael@0 1402
michael@0 1403 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1404 ctx.fillRect(0, 0, 100, 50);
michael@0 1405 ctx.globalCompositeOperation = 'source-atop';
michael@0 1406 ctx.drawImage(document.getElementById('yellow75_18.png'), 0, 0);
michael@0 1407 isPixel(ctx, 50,25, 191,255,63,127, 5);
michael@0 1408
michael@0 1409
michael@0 1410 }
michael@0 1411 </script>
michael@0 1412 <img src="image_yellow75.png" id="yellow75_18.png" class="resource">
michael@0 1413
michael@0 1414 <!-- [[[ test_2d.composite.image.source-in.html ]]] -->
michael@0 1415
michael@0 1416 <p>Canvas test: 2d.composite.image.source-in</p>
michael@0 1417 <canvas id="c50" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1418 <script>
michael@0 1419
michael@0 1420
michael@0 1421 function test_2d_composite_image_source_in() {
michael@0 1422
michael@0 1423 var canvas = document.getElementById('c50');
michael@0 1424 var ctx = canvas.getContext('2d');
michael@0 1425
michael@0 1426
michael@0 1427 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1428 ctx.fillRect(0, 0, 100, 50);
michael@0 1429 ctx.globalCompositeOperation = 'source-in';
michael@0 1430 ctx.drawImage(document.getElementById('yellow75_19.png'), 0, 0);
michael@0 1431 isPixel(ctx, 50,25, 255,255,0,95, 5);
michael@0 1432
michael@0 1433
michael@0 1434 }
michael@0 1435 </script>
michael@0 1436 <img src="image_yellow75.png" id="yellow75_19.png" class="resource">
michael@0 1437
michael@0 1438 <!-- [[[ test_2d.composite.image.source-out.html ]]] -->
michael@0 1439
michael@0 1440 <p>Canvas test: 2d.composite.image.source-out</p>
michael@0 1441 <canvas id="c51" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1442 <script>
michael@0 1443
michael@0 1444
michael@0 1445 function test_2d_composite_image_source_out() {
michael@0 1446
michael@0 1447 var canvas = document.getElementById('c51');
michael@0 1448 var ctx = canvas.getContext('2d');
michael@0 1449
michael@0 1450
michael@0 1451 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1452 ctx.fillRect(0, 0, 100, 50);
michael@0 1453 ctx.globalCompositeOperation = 'source-out';
michael@0 1454 ctx.drawImage(document.getElementById('yellow75_20.png'), 0, 0);
michael@0 1455 isPixel(ctx, 50,25, 255,255,0,95, 5);
michael@0 1456
michael@0 1457
michael@0 1458 }
michael@0 1459 </script>
michael@0 1460 <img src="image_yellow75.png" id="yellow75_20.png" class="resource">
michael@0 1461
michael@0 1462 <!-- [[[ test_2d.composite.image.source-over.html ]]] -->
michael@0 1463
michael@0 1464 <p>Canvas test: 2d.composite.image.source-over</p>
michael@0 1465 <canvas id="c52" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1466 <script>
michael@0 1467
michael@0 1468
michael@0 1469 function test_2d_composite_image_source_over() {
michael@0 1470
michael@0 1471 var canvas = document.getElementById('c52');
michael@0 1472 var ctx = canvas.getContext('2d');
michael@0 1473
michael@0 1474
michael@0 1475 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1476 ctx.fillRect(0, 0, 100, 50);
michael@0 1477 ctx.globalCompositeOperation = 'source-over';
michael@0 1478 ctx.drawImage(document.getElementById('yellow75_21.png'), 0, 0);
michael@0 1479 isPixel(ctx, 50,25, 218,255,36,223, 5);
michael@0 1480
michael@0 1481
michael@0 1482 }
michael@0 1483 </script>
michael@0 1484 <img src="image_yellow75.png" id="yellow75_21.png" class="resource">
michael@0 1485
michael@0 1486 <!-- [[[ test_2d.composite.image.xor.html ]]] -->
michael@0 1487
michael@0 1488 <p>Canvas test: 2d.composite.image.xor</p>
michael@0 1489 <canvas id="c53" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1490 <script>
michael@0 1491
michael@0 1492
michael@0 1493 function test_2d_composite_image_xor() {
michael@0 1494
michael@0 1495 var canvas = document.getElementById('c53');
michael@0 1496 var ctx = canvas.getContext('2d');
michael@0 1497
michael@0 1498
michael@0 1499 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 1500 ctx.fillRect(0, 0, 100, 50);
michael@0 1501 ctx.globalCompositeOperation = 'xor';
michael@0 1502 ctx.drawImage(document.getElementById('yellow75_22.png'), 0, 0);
michael@0 1503 isPixel(ctx, 50,25, 191,255,63,127, 5);
michael@0 1504
michael@0 1505
michael@0 1506 }
michael@0 1507 </script>
michael@0 1508 <img src="image_yellow75.png" id="yellow75_22.png" class="resource">
michael@0 1509
michael@0 1510 <!-- [[[ test_2d.composite.operation.casesensitive.html ]]] -->
michael@0 1511
michael@0 1512 <p>Canvas test: 2d.composite.operation.casesensitive - bug 401788</p>
michael@0 1513 <canvas id="c54" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1514 <script>
michael@0 1515
michael@0 1516 function test_2d_composite_operation_casesensitive() {
michael@0 1517
michael@0 1518 var canvas = document.getElementById('c54');
michael@0 1519 var ctx = canvas.getContext('2d');
michael@0 1520
michael@0 1521 var _thrown_outer = false;
michael@0 1522 try {
michael@0 1523
michael@0 1524 ctx.globalCompositeOperation = 'xor';
michael@0 1525 ctx.globalCompositeOperation = 'Source-over';
michael@0 1526 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1527
michael@0 1528 } catch (e) {
michael@0 1529 _thrown_outer = true;
michael@0 1530 }
michael@0 1531 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 1532
michael@0 1533
michael@0 1534 }
michael@0 1535 </script>
michael@0 1536
michael@0 1537 <!-- [[[ test_2d.composite.operation.clear.html ]]] -->
michael@0 1538
michael@0 1539 <p>Canvas test: 2d.composite.operation.clear</p>
michael@0 1540 <canvas id="c55" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1541 <script>
michael@0 1542
michael@0 1543 function test_2d_composite_operation_clear() {
michael@0 1544
michael@0 1545 var canvas = document.getElementById('c55');
michael@0 1546 var ctx = canvas.getContext('2d');
michael@0 1547
michael@0 1548 ctx.globalCompositeOperation = 'xor';
michael@0 1549 ctx.globalCompositeOperation = 'clear';
michael@0 1550 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1551
michael@0 1552
michael@0 1553 }
michael@0 1554 </script>
michael@0 1555
michael@0 1556 <!-- [[[ test_2d.composite.operation.darker.html ]]] -->
michael@0 1557
michael@0 1558 <p>Canvas test: 2d.composite.operation.darker</p>
michael@0 1559 <canvas id="c56" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1560 <script>
michael@0 1561
michael@0 1562 function test_2d_composite_operation_darker() {
michael@0 1563
michael@0 1564 var canvas = document.getElementById('c56');
michael@0 1565 var ctx = canvas.getContext('2d');
michael@0 1566
michael@0 1567 ctx.globalCompositeOperation = 'xor';
michael@0 1568 ctx.globalCompositeOperation = 'darker';
michael@0 1569 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1570
michael@0 1571
michael@0 1572 }
michael@0 1573 </script>
michael@0 1574
michael@0 1575 <!-- [[[ test_2d.composite.operation.default.html ]]] -->
michael@0 1576
michael@0 1577 <p>Canvas test: 2d.composite.operation.default</p>
michael@0 1578 <canvas id="c57" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1579 <script>
michael@0 1580
michael@0 1581 function test_2d_composite_operation_default() {
michael@0 1582
michael@0 1583 var canvas = document.getElementById('c57');
michael@0 1584 var ctx = canvas.getContext('2d');
michael@0 1585
michael@0 1586 ok(ctx.globalCompositeOperation == 'source-over', "ctx.globalCompositeOperation == 'source-over'");
michael@0 1587
michael@0 1588
michael@0 1589 }
michael@0 1590 </script>
michael@0 1591
michael@0 1592 <!-- [[[ test_2d.composite.operation.get.html ]]] -->
michael@0 1593
michael@0 1594 <p>Canvas test: 2d.composite.operation.get</p>
michael@0 1595 <canvas id="c58" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1596 <script>
michael@0 1597
michael@0 1598 function test_2d_composite_operation_get() {
michael@0 1599
michael@0 1600 var canvas = document.getElementById('c58');
michael@0 1601 var ctx = canvas.getContext('2d');
michael@0 1602
michael@0 1603 var modes = ['source-atop', 'source-in', 'source-out', 'source-over',
michael@0 1604 'destination-atop', 'destination-in', 'destination-out', 'destination-over',
michael@0 1605 'lighter', 'copy', 'xor'];
michael@0 1606 for (var i = 0; i < modes.length; ++i)
michael@0 1607 {
michael@0 1608 ctx.globalCompositeOperation = modes[i];
michael@0 1609 ok(ctx.globalCompositeOperation == modes[i], "ctx.globalCompositeOperation == modes[\""+(i)+"\"]");
michael@0 1610 }
michael@0 1611
michael@0 1612
michael@0 1613 }
michael@0 1614 </script>
michael@0 1615
michael@0 1616 <!-- [[[ test_2d.composite.operation.highlight.html ]]] -->
michael@0 1617
michael@0 1618 <p>Canvas test: 2d.composite.operation.highlight - bug 401788</p>
michael@0 1619 <canvas id="c59" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1620 <script>
michael@0 1621
michael@0 1622 function test_2d_composite_operation_highlight() {
michael@0 1623
michael@0 1624 var canvas = document.getElementById('c59');
michael@0 1625 var ctx = canvas.getContext('2d');
michael@0 1626
michael@0 1627 var _thrown_outer = false;
michael@0 1628 try {
michael@0 1629
michael@0 1630 ctx.globalCompositeOperation = 'xor';
michael@0 1631 ctx.globalCompositeOperation = 'highlight';
michael@0 1632 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1633
michael@0 1634 } catch (e) {
michael@0 1635 _thrown_outer = true;
michael@0 1636 }
michael@0 1637 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 1638
michael@0 1639
michael@0 1640 }
michael@0 1641 </script>
michael@0 1642
michael@0 1643 <!-- [[[ test_2d.composite.operation.nullsuffix.html ]]] -->
michael@0 1644
michael@0 1645 <p>Canvas test: 2d.composite.operation.nullsuffix - bug 401788</p>
michael@0 1646 <canvas id="c60" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1647 <script>
michael@0 1648
michael@0 1649 function test_2d_composite_operation_nullsuffix() {
michael@0 1650
michael@0 1651 var canvas = document.getElementById('c60');
michael@0 1652 var ctx = canvas.getContext('2d');
michael@0 1653
michael@0 1654 var _thrown_outer = false;
michael@0 1655 try {
michael@0 1656
michael@0 1657 ctx.globalCompositeOperation = 'xor';
michael@0 1658 ctx.globalCompositeOperation = 'source-over\0';
michael@0 1659 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1660
michael@0 1661 } catch (e) {
michael@0 1662 _thrown_outer = true;
michael@0 1663 }
michael@0 1664 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 1665
michael@0 1666
michael@0 1667 }
michael@0 1668 </script>
michael@0 1669
michael@0 1670 <!-- [[[ test_2d.composite.operation.over.html ]]] -->
michael@0 1671
michael@0 1672 <p>Canvas test: 2d.composite.operation.over</p>
michael@0 1673 <canvas id="c61" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1674 <script>
michael@0 1675
michael@0 1676 function test_2d_composite_operation_over() {
michael@0 1677
michael@0 1678 var canvas = document.getElementById('c61');
michael@0 1679 var ctx = canvas.getContext('2d');
michael@0 1680
michael@0 1681 ctx.globalCompositeOperation = 'xor';
michael@0 1682 ctx.globalCompositeOperation = 'over';
michael@0 1683 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1684
michael@0 1685
michael@0 1686 }
michael@0 1687 </script>
michael@0 1688
michael@0 1689 <!-- [[[ test_2d.composite.operation.unrecognised.html ]]] -->
michael@0 1690
michael@0 1691 <p>Canvas test: 2d.composite.operation.unrecognised - bug 401788</p>
michael@0 1692 <canvas id="c62" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1693 <script>
michael@0 1694
michael@0 1695 function test_2d_composite_operation_unrecognised() {
michael@0 1696
michael@0 1697 var canvas = document.getElementById('c62');
michael@0 1698 var ctx = canvas.getContext('2d');
michael@0 1699
michael@0 1700 var _thrown_outer = false;
michael@0 1701 try {
michael@0 1702
michael@0 1703 ctx.globalCompositeOperation = 'xor';
michael@0 1704 ctx.globalCompositeOperation = 'nonexistent';
michael@0 1705 ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
michael@0 1706
michael@0 1707 } catch (e) {
michael@0 1708 _thrown_outer = true;
michael@0 1709 }
michael@0 1710 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 1711
michael@0 1712
michael@0 1713 }
michael@0 1714 </script>
michael@0 1715
michael@0 1716 <!-- [[[ test_2d.composite.solid.copy.html ]]] -->
michael@0 1717
michael@0 1718 <p>Canvas test: 2d.composite.solid.copy</p>
michael@0 1719 <canvas id="c63" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1720 <script>
michael@0 1721
michael@0 1722
michael@0 1723 function test_2d_composite_solid_copy() {
michael@0 1724
michael@0 1725 var canvas = document.getElementById('c63');
michael@0 1726 var ctx = canvas.getContext('2d');
michael@0 1727
michael@0 1728
michael@0 1729 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1730 ctx.fillRect(0, 0, 100, 50);
michael@0 1731 ctx.globalCompositeOperation = 'copy';
michael@0 1732 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1733 ctx.fillRect(0, 0, 100, 50);
michael@0 1734 isPixel(ctx, 50,25, 255,255,0,255, 5);
michael@0 1735
michael@0 1736
michael@0 1737 }
michael@0 1738 </script>
michael@0 1739
michael@0 1740 <!-- [[[ test_2d.composite.solid.destination-atop.html ]]] -->
michael@0 1741
michael@0 1742 <p>Canvas test: 2d.composite.solid.destination-atop</p>
michael@0 1743 <canvas id="c64" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1744 <script>
michael@0 1745
michael@0 1746
michael@0 1747 function test_2d_composite_solid_destination_atop() {
michael@0 1748
michael@0 1749 var canvas = document.getElementById('c64');
michael@0 1750 var ctx = canvas.getContext('2d');
michael@0 1751
michael@0 1752
michael@0 1753 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1754 ctx.fillRect(0, 0, 100, 50);
michael@0 1755 ctx.globalCompositeOperation = 'destination-atop';
michael@0 1756 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1757 ctx.fillRect(0, 0, 100, 50);
michael@0 1758 isPixel(ctx, 50,25, 0,255,255,255, 5);
michael@0 1759
michael@0 1760
michael@0 1761 }
michael@0 1762 </script>
michael@0 1763
michael@0 1764 <!-- [[[ test_2d.composite.solid.destination-in.html ]]] -->
michael@0 1765
michael@0 1766 <p>Canvas test: 2d.composite.solid.destination-in</p>
michael@0 1767 <canvas id="c65" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1768 <script>
michael@0 1769
michael@0 1770
michael@0 1771 function test_2d_composite_solid_destination_in() {
michael@0 1772
michael@0 1773 var canvas = document.getElementById('c65');
michael@0 1774 var ctx = canvas.getContext('2d');
michael@0 1775
michael@0 1776
michael@0 1777 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1778 ctx.fillRect(0, 0, 100, 50);
michael@0 1779 ctx.globalCompositeOperation = 'destination-in';
michael@0 1780 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1781 ctx.fillRect(0, 0, 100, 50);
michael@0 1782 isPixel(ctx, 50,25, 0,255,255,255, 5);
michael@0 1783
michael@0 1784
michael@0 1785 }
michael@0 1786 </script>
michael@0 1787
michael@0 1788 <!-- [[[ test_2d.composite.solid.destination-out.html ]]] -->
michael@0 1789
michael@0 1790 <p>Canvas test: 2d.composite.solid.destination-out</p>
michael@0 1791 <canvas id="c66" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1792 <script>
michael@0 1793
michael@0 1794
michael@0 1795 function test_2d_composite_solid_destination_out() {
michael@0 1796
michael@0 1797 var canvas = document.getElementById('c66');
michael@0 1798 var ctx = canvas.getContext('2d');
michael@0 1799
michael@0 1800
michael@0 1801 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1802 ctx.fillRect(0, 0, 100, 50);
michael@0 1803 ctx.globalCompositeOperation = 'destination-out';
michael@0 1804 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1805 ctx.fillRect(0, 0, 100, 50);
michael@0 1806 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 1807
michael@0 1808
michael@0 1809 }
michael@0 1810 </script>
michael@0 1811
michael@0 1812 <!-- [[[ test_2d.composite.solid.destination-over.html ]]] -->
michael@0 1813
michael@0 1814 <p>Canvas test: 2d.composite.solid.destination-over</p>
michael@0 1815 <canvas id="c67" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1816 <script>
michael@0 1817
michael@0 1818
michael@0 1819 function test_2d_composite_solid_destination_over() {
michael@0 1820
michael@0 1821 var canvas = document.getElementById('c67');
michael@0 1822 var ctx = canvas.getContext('2d');
michael@0 1823
michael@0 1824
michael@0 1825 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1826 ctx.fillRect(0, 0, 100, 50);
michael@0 1827 ctx.globalCompositeOperation = 'destination-over';
michael@0 1828 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1829 ctx.fillRect(0, 0, 100, 50);
michael@0 1830 isPixel(ctx, 50,25, 0,255,255,255, 5);
michael@0 1831
michael@0 1832
michael@0 1833 }
michael@0 1834 </script>
michael@0 1835
michael@0 1836 <!-- [[[ test_2d.composite.solid.lighter.html ]]] -->
michael@0 1837
michael@0 1838 <p>Canvas test: 2d.composite.solid.lighter</p>
michael@0 1839 <canvas id="c68" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1840 <script>
michael@0 1841
michael@0 1842
michael@0 1843 function test_2d_composite_solid_lighter() {
michael@0 1844
michael@0 1845 var canvas = document.getElementById('c68');
michael@0 1846 var ctx = canvas.getContext('2d');
michael@0 1847
michael@0 1848
michael@0 1849 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1850 ctx.fillRect(0, 0, 100, 50);
michael@0 1851 ctx.globalCompositeOperation = 'lighter';
michael@0 1852 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1853 ctx.fillRect(0, 0, 100, 50);
michael@0 1854 isPixel(ctx, 50,25, 255,255,255,255, 5);
michael@0 1855
michael@0 1856
michael@0 1857 }
michael@0 1858 </script>
michael@0 1859
michael@0 1860 <!-- [[[ test_2d.composite.solid.source-atop.html ]]] -->
michael@0 1861
michael@0 1862 <p>Canvas test: 2d.composite.solid.source-atop</p>
michael@0 1863 <canvas id="c69" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1864 <script>
michael@0 1865
michael@0 1866
michael@0 1867 function test_2d_composite_solid_source_atop() {
michael@0 1868
michael@0 1869 var canvas = document.getElementById('c69');
michael@0 1870 var ctx = canvas.getContext('2d');
michael@0 1871
michael@0 1872
michael@0 1873 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1874 ctx.fillRect(0, 0, 100, 50);
michael@0 1875 ctx.globalCompositeOperation = 'source-atop';
michael@0 1876 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1877 ctx.fillRect(0, 0, 100, 50);
michael@0 1878 isPixel(ctx, 50,25, 255,255,0,255, 5);
michael@0 1879
michael@0 1880
michael@0 1881 }
michael@0 1882 </script>
michael@0 1883
michael@0 1884 <!-- [[[ test_2d.composite.solid.source-in.html ]]] -->
michael@0 1885
michael@0 1886 <p>Canvas test: 2d.composite.solid.source-in</p>
michael@0 1887 <canvas id="c70" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1888 <script>
michael@0 1889
michael@0 1890
michael@0 1891 function test_2d_composite_solid_source_in() {
michael@0 1892
michael@0 1893 var canvas = document.getElementById('c70');
michael@0 1894 var ctx = canvas.getContext('2d');
michael@0 1895
michael@0 1896
michael@0 1897 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1898 ctx.fillRect(0, 0, 100, 50);
michael@0 1899 ctx.globalCompositeOperation = 'source-in';
michael@0 1900 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1901 ctx.fillRect(0, 0, 100, 50);
michael@0 1902 isPixel(ctx, 50,25, 255,255,0,255, 5);
michael@0 1903
michael@0 1904
michael@0 1905 }
michael@0 1906 </script>
michael@0 1907
michael@0 1908 <!-- [[[ test_2d.composite.solid.source-out.html ]]] -->
michael@0 1909
michael@0 1910 <p>Canvas test: 2d.composite.solid.source-out</p>
michael@0 1911 <canvas id="c71" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1912 <script>
michael@0 1913
michael@0 1914
michael@0 1915 function test_2d_composite_solid_source_out() {
michael@0 1916
michael@0 1917 var canvas = document.getElementById('c71');
michael@0 1918 var ctx = canvas.getContext('2d');
michael@0 1919
michael@0 1920
michael@0 1921 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1922 ctx.fillRect(0, 0, 100, 50);
michael@0 1923 ctx.globalCompositeOperation = 'source-out';
michael@0 1924 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1925 ctx.fillRect(0, 0, 100, 50);
michael@0 1926 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 1927
michael@0 1928
michael@0 1929 }
michael@0 1930 </script>
michael@0 1931
michael@0 1932 <!-- [[[ test_2d.composite.solid.source-over.html ]]] -->
michael@0 1933
michael@0 1934 <p>Canvas test: 2d.composite.solid.source-over</p>
michael@0 1935 <canvas id="c72" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1936 <script>
michael@0 1937
michael@0 1938
michael@0 1939 function test_2d_composite_solid_source_over() {
michael@0 1940
michael@0 1941 var canvas = document.getElementById('c72');
michael@0 1942 var ctx = canvas.getContext('2d');
michael@0 1943
michael@0 1944
michael@0 1945 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1946 ctx.fillRect(0, 0, 100, 50);
michael@0 1947 ctx.globalCompositeOperation = 'source-over';
michael@0 1948 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1949 ctx.fillRect(0, 0, 100, 50);
michael@0 1950 isPixel(ctx, 50,25, 255,255,0,255, 5);
michael@0 1951
michael@0 1952
michael@0 1953 }
michael@0 1954 </script>
michael@0 1955
michael@0 1956 <!-- [[[ test_2d.composite.solid.xor.html ]]] -->
michael@0 1957
michael@0 1958 <p>Canvas test: 2d.composite.solid.xor</p>
michael@0 1959 <canvas id="c73" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1960 <script>
michael@0 1961
michael@0 1962
michael@0 1963 function test_2d_composite_solid_xor() {
michael@0 1964
michael@0 1965 var canvas = document.getElementById('c73');
michael@0 1966 var ctx = canvas.getContext('2d');
michael@0 1967
michael@0 1968
michael@0 1969 ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
michael@0 1970 ctx.fillRect(0, 0, 100, 50);
michael@0 1971 ctx.globalCompositeOperation = 'xor';
michael@0 1972 ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
michael@0 1973 ctx.fillRect(0, 0, 100, 50);
michael@0 1974 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 1975
michael@0 1976
michael@0 1977 }
michael@0 1978 </script>
michael@0 1979
michael@0 1980 <!-- [[[ test_2d.composite.transparent.copy.html ]]] -->
michael@0 1981
michael@0 1982 <p>Canvas test: 2d.composite.transparent.copy</p>
michael@0 1983 <canvas id="c74" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 1984 <script>
michael@0 1985
michael@0 1986
michael@0 1987 function test_2d_composite_transparent_copy() {
michael@0 1988
michael@0 1989 var canvas = document.getElementById('c74');
michael@0 1990 var ctx = canvas.getContext('2d');
michael@0 1991
michael@0 1992
michael@0 1993 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 1994 ctx.fillRect(0, 0, 100, 50);
michael@0 1995 ctx.globalCompositeOperation = 'copy';
michael@0 1996 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 1997 ctx.fillRect(0, 0, 100, 50);
michael@0 1998 isPixel(ctx, 50,25, 0,0,255,191, 5);
michael@0 1999
michael@0 2000
michael@0 2001 }
michael@0 2002 </script>
michael@0 2003
michael@0 2004 <!-- [[[ test_2d.composite.transparent.destination-atop.html ]]] -->
michael@0 2005
michael@0 2006 <p>Canvas test: 2d.composite.transparent.destination-atop</p>
michael@0 2007 <canvas id="c75" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2008 <script>
michael@0 2009
michael@0 2010
michael@0 2011 function test_2d_composite_transparent_destination_atop() {
michael@0 2012
michael@0 2013 var canvas = document.getElementById('c75');
michael@0 2014 var ctx = canvas.getContext('2d');
michael@0 2015
michael@0 2016
michael@0 2017 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2018 ctx.fillRect(0, 0, 100, 50);
michael@0 2019 ctx.globalCompositeOperation = 'destination-atop';
michael@0 2020 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2021 ctx.fillRect(0, 0, 100, 50);
michael@0 2022 isPixel(ctx, 50,25, 0,127,127,191, 5);
michael@0 2023
michael@0 2024
michael@0 2025 }
michael@0 2026 </script>
michael@0 2027
michael@0 2028 <!-- [[[ test_2d.composite.transparent.destination-in.html ]]] -->
michael@0 2029
michael@0 2030 <p>Canvas test: 2d.composite.transparent.destination-in</p>
michael@0 2031 <canvas id="c76" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2032 <script>
michael@0 2033
michael@0 2034
michael@0 2035 function test_2d_composite_transparent_destination_in() {
michael@0 2036
michael@0 2037 var canvas = document.getElementById('c76');
michael@0 2038 var ctx = canvas.getContext('2d');
michael@0 2039
michael@0 2040
michael@0 2041 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2042 ctx.fillRect(0, 0, 100, 50);
michael@0 2043 ctx.globalCompositeOperation = 'destination-in';
michael@0 2044 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2045 ctx.fillRect(0, 0, 100, 50);
michael@0 2046 isPixel(ctx, 50,25, 0,255,0,95, 5);
michael@0 2047
michael@0 2048
michael@0 2049 }
michael@0 2050 </script>
michael@0 2051
michael@0 2052 <!-- [[[ test_2d.composite.transparent.destination-out.html ]]] -->
michael@0 2053
michael@0 2054 <p>Canvas test: 2d.composite.transparent.destination-out</p>
michael@0 2055 <canvas id="c77" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2056 <script>
michael@0 2057
michael@0 2058
michael@0 2059 function test_2d_composite_transparent_destination_out() {
michael@0 2060
michael@0 2061 var canvas = document.getElementById('c77');
michael@0 2062 var ctx = canvas.getContext('2d');
michael@0 2063
michael@0 2064
michael@0 2065 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2066 ctx.fillRect(0, 0, 100, 50);
michael@0 2067 ctx.globalCompositeOperation = 'destination-out';
michael@0 2068 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2069 ctx.fillRect(0, 0, 100, 50);
michael@0 2070 isPixel(ctx, 50,25, 0,255,0,31, 5);
michael@0 2071
michael@0 2072
michael@0 2073 }
michael@0 2074 </script>
michael@0 2075
michael@0 2076 <!-- [[[ test_2d.composite.transparent.destination-over.html ]]] -->
michael@0 2077
michael@0 2078 <p>Canvas test: 2d.composite.transparent.destination-over</p>
michael@0 2079 <canvas id="c78" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2080 <script>
michael@0 2081
michael@0 2082
michael@0 2083 function test_2d_composite_transparent_destination_over() {
michael@0 2084
michael@0 2085 var canvas = document.getElementById('c78');
michael@0 2086 var ctx = canvas.getContext('2d');
michael@0 2087
michael@0 2088
michael@0 2089 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2090 ctx.fillRect(0, 0, 100, 50);
michael@0 2091 ctx.globalCompositeOperation = 'destination-over';
michael@0 2092 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2093 ctx.fillRect(0, 0, 100, 50);
michael@0 2094 isPixel(ctx, 50,25, 0,145,109,223, 5);
michael@0 2095
michael@0 2096
michael@0 2097 }
michael@0 2098 </script>
michael@0 2099
michael@0 2100 <!-- [[[ test_2d.composite.transparent.lighter.html ]]] -->
michael@0 2101
michael@0 2102 <p>Canvas test: 2d.composite.transparent.lighter</p>
michael@0 2103 <canvas id="c79" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2104 <script>
michael@0 2105
michael@0 2106
michael@0 2107 function test_2d_composite_transparent_lighter() {
michael@0 2108
michael@0 2109 var canvas = document.getElementById('c79');
michael@0 2110 var ctx = canvas.getContext('2d');
michael@0 2111
michael@0 2112
michael@0 2113 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2114 ctx.fillRect(0, 0, 100, 50);
michael@0 2115 ctx.globalCompositeOperation = 'lighter';
michael@0 2116 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2117 ctx.fillRect(0, 0, 100, 50);
michael@0 2118 isPixel(ctx, 50,25, 0,127,191,255, 5);
michael@0 2119
michael@0 2120
michael@0 2121 }
michael@0 2122 </script>
michael@0 2123
michael@0 2124 <!-- [[[ test_2d.composite.transparent.source-atop.html ]]] -->
michael@0 2125
michael@0 2126 <p>Canvas test: 2d.composite.transparent.source-atop</p>
michael@0 2127 <canvas id="c80" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2128 <script>
michael@0 2129
michael@0 2130
michael@0 2131 function test_2d_composite_transparent_source_atop() {
michael@0 2132
michael@0 2133 var canvas = document.getElementById('c80');
michael@0 2134 var ctx = canvas.getContext('2d');
michael@0 2135
michael@0 2136
michael@0 2137 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2138 ctx.fillRect(0, 0, 100, 50);
michael@0 2139 ctx.globalCompositeOperation = 'source-atop';
michael@0 2140 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2141 ctx.fillRect(0, 0, 100, 50);
michael@0 2142 isPixel(ctx, 50,25, 0,63,191,127, 5);
michael@0 2143
michael@0 2144
michael@0 2145 }
michael@0 2146 </script>
michael@0 2147
michael@0 2148 <!-- [[[ test_2d.composite.transparent.source-in.html ]]] -->
michael@0 2149
michael@0 2150 <p>Canvas test: 2d.composite.transparent.source-in</p>
michael@0 2151 <canvas id="c81" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2152 <script>
michael@0 2153
michael@0 2154
michael@0 2155 function test_2d_composite_transparent_source_in() {
michael@0 2156
michael@0 2157 var canvas = document.getElementById('c81');
michael@0 2158 var ctx = canvas.getContext('2d');
michael@0 2159
michael@0 2160
michael@0 2161 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2162 ctx.fillRect(0, 0, 100, 50);
michael@0 2163 ctx.globalCompositeOperation = 'source-in';
michael@0 2164 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2165 ctx.fillRect(0, 0, 100, 50);
michael@0 2166 isPixel(ctx, 50,25, 0,0,255,95, 5);
michael@0 2167
michael@0 2168
michael@0 2169 }
michael@0 2170 </script>
michael@0 2171
michael@0 2172 <!-- [[[ test_2d.composite.transparent.source-out.html ]]] -->
michael@0 2173
michael@0 2174 <p>Canvas test: 2d.composite.transparent.source-out</p>
michael@0 2175 <canvas id="c82" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2176 <script>
michael@0 2177
michael@0 2178
michael@0 2179 function test_2d_composite_transparent_source_out() {
michael@0 2180
michael@0 2181 var canvas = document.getElementById('c82');
michael@0 2182 var ctx = canvas.getContext('2d');
michael@0 2183
michael@0 2184
michael@0 2185 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2186 ctx.fillRect(0, 0, 100, 50);
michael@0 2187 ctx.globalCompositeOperation = 'source-out';
michael@0 2188 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2189 ctx.fillRect(0, 0, 100, 50);
michael@0 2190 isPixel(ctx, 50,25, 0,0,255,95, 5);
michael@0 2191
michael@0 2192
michael@0 2193 }
michael@0 2194 </script>
michael@0 2195
michael@0 2196 <!-- [[[ test_2d.composite.transparent.source-over.html ]]] -->
michael@0 2197
michael@0 2198 <p>Canvas test: 2d.composite.transparent.source-over</p>
michael@0 2199 <canvas id="c83" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2200 <script>
michael@0 2201
michael@0 2202
michael@0 2203 function test_2d_composite_transparent_source_over() {
michael@0 2204
michael@0 2205 var canvas = document.getElementById('c83');
michael@0 2206 var ctx = canvas.getContext('2d');
michael@0 2207
michael@0 2208
michael@0 2209 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2210 ctx.fillRect(0, 0, 100, 50);
michael@0 2211 ctx.globalCompositeOperation = 'source-over';
michael@0 2212 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2213 ctx.fillRect(0, 0, 100, 50);
michael@0 2214 isPixel(ctx, 50,25, 0,36,218,223, 5);
michael@0 2215
michael@0 2216
michael@0 2217 }
michael@0 2218 </script>
michael@0 2219
michael@0 2220 <!-- [[[ test_2d.composite.transparent.xor.html ]]] -->
michael@0 2221
michael@0 2222 <p>Canvas test: 2d.composite.transparent.xor</p>
michael@0 2223 <canvas id="c84" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2224 <script>
michael@0 2225
michael@0 2226
michael@0 2227 function test_2d_composite_transparent_xor() {
michael@0 2228
michael@0 2229 var canvas = document.getElementById('c84');
michael@0 2230 var ctx = canvas.getContext('2d');
michael@0 2231
michael@0 2232
michael@0 2233 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2234 ctx.fillRect(0, 0, 100, 50);
michael@0 2235 ctx.globalCompositeOperation = 'xor';
michael@0 2236 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2237 ctx.fillRect(0, 0, 100, 50);
michael@0 2238 isPixel(ctx, 50,25, 0,63,191,127, 5);
michael@0 2239
michael@0 2240
michael@0 2241 }
michael@0 2242 </script>
michael@0 2243
michael@0 2244 <!-- [[[ test_2d.composite.uncovered.fill.copy.html ]]] -->
michael@0 2245
michael@0 2246 <p>Canvas test: 2d.composite.uncovered.fill.copy</p>
michael@0 2247 <!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2248 <canvas id="c85" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2249 <script>
michael@0 2250
michael@0 2251
michael@0 2252
michael@0 2253 function test_2d_composite_uncovered_fill_copy() {
michael@0 2254
michael@0 2255 var canvas = document.getElementById('c85');
michael@0 2256 var ctx = canvas.getContext('2d');
michael@0 2257
michael@0 2258
michael@0 2259 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2260 ctx.fillRect(0, 0, 100, 50);
michael@0 2261 ctx.globalCompositeOperation = 'copy';
michael@0 2262 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2263 ctx.translate(0, 25);
michael@0 2264 ctx.fillRect(0, 50, 100, 50);
michael@0 2265 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2266
michael@0 2267
michael@0 2268 }
michael@0 2269 </script>
michael@0 2270
michael@0 2271 <!-- [[[ test_2d.composite.uncovered.fill.destination-atop.html ]]] -->
michael@0 2272
michael@0 2273 <p>Canvas test: 2d.composite.uncovered.fill.destination-atop</p>
michael@0 2274 <!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2275 <canvas id="c86" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2276 <script>
michael@0 2277
michael@0 2278
michael@0 2279
michael@0 2280 function test_2d_composite_uncovered_fill_destination_atop() {
michael@0 2281
michael@0 2282 var canvas = document.getElementById('c86');
michael@0 2283 var ctx = canvas.getContext('2d');
michael@0 2284
michael@0 2285
michael@0 2286 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2287 ctx.fillRect(0, 0, 100, 50);
michael@0 2288 ctx.globalCompositeOperation = 'destination-atop';
michael@0 2289 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2290 ctx.translate(0, 25);
michael@0 2291 ctx.fillRect(0, 50, 100, 50);
michael@0 2292 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2293
michael@0 2294
michael@0 2295 }
michael@0 2296 </script>
michael@0 2297
michael@0 2298 <!-- [[[ test_2d.composite.uncovered.fill.destination-in.html ]]] -->
michael@0 2299
michael@0 2300 <p>Canvas test: 2d.composite.uncovered.fill.destination-in</p>
michael@0 2301 <!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2302 <canvas id="c87" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2303 <script>
michael@0 2304
michael@0 2305
michael@0 2306
michael@0 2307 function test_2d_composite_uncovered_fill_destination_in() {
michael@0 2308
michael@0 2309 var canvas = document.getElementById('c87');
michael@0 2310 var ctx = canvas.getContext('2d');
michael@0 2311
michael@0 2312
michael@0 2313 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2314 ctx.fillRect(0, 0, 100, 50);
michael@0 2315 ctx.globalCompositeOperation = 'destination-in';
michael@0 2316 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2317 ctx.translate(0, 25);
michael@0 2318 ctx.fillRect(0, 50, 100, 50);
michael@0 2319 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2320
michael@0 2321
michael@0 2322 }
michael@0 2323 </script>
michael@0 2324
michael@0 2325 <!-- [[[ test_2d.composite.uncovered.fill.source-in.html ]]] -->
michael@0 2326
michael@0 2327 <p>Canvas test: 2d.composite.uncovered.fill.source-in</p>
michael@0 2328 <!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2329 <canvas id="c88" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2330 <script>
michael@0 2331
michael@0 2332
michael@0 2333
michael@0 2334 function test_2d_composite_uncovered_fill_source_in() {
michael@0 2335
michael@0 2336 var canvas = document.getElementById('c88');
michael@0 2337 var ctx = canvas.getContext('2d');
michael@0 2338
michael@0 2339
michael@0 2340 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2341 ctx.fillRect(0, 0, 100, 50);
michael@0 2342 ctx.globalCompositeOperation = 'source-in';
michael@0 2343 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2344 ctx.translate(0, 25);
michael@0 2345 ctx.fillRect(0, 50, 100, 50);
michael@0 2346 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2347
michael@0 2348
michael@0 2349 }
michael@0 2350 </script>
michael@0 2351
michael@0 2352 <!-- [[[ test_2d.composite.uncovered.fill.source-out.html ]]] -->
michael@0 2353
michael@0 2354 <p>Canvas test: 2d.composite.uncovered.fill.source-out</p>
michael@0 2355 <!-- Testing: fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2356 <canvas id="c89" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2357 <script>
michael@0 2358
michael@0 2359
michael@0 2360
michael@0 2361 function test_2d_composite_uncovered_fill_source_out() {
michael@0 2362
michael@0 2363 var canvas = document.getElementById('c89');
michael@0 2364 var ctx = canvas.getContext('2d');
michael@0 2365
michael@0 2366
michael@0 2367 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 2368 ctx.fillRect(0, 0, 100, 50);
michael@0 2369 ctx.globalCompositeOperation = 'source-out';
michael@0 2370 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
michael@0 2371 ctx.translate(0, 25);
michael@0 2372 ctx.fillRect(0, 50, 100, 50);
michael@0 2373 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2374
michael@0 2375
michael@0 2376 }
michael@0 2377 </script>
michael@0 2378
michael@0 2379 <!-- [[[ test_2d.composite.uncovered.image.copy.html ]]] -->
michael@0 2380
michael@0 2381 <p>Canvas test: 2d.composite.uncovered.image.copy</p>
michael@0 2382 <!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2383 <canvas id="c90" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2384 <script>
michael@0 2385
michael@0 2386
michael@0 2387
michael@0 2388 function test_2d_composite_uncovered_image_copy() {
michael@0 2389
michael@0 2390 var canvas = document.getElementById('c90');
michael@0 2391 var ctx = canvas.getContext('2d');
michael@0 2392
michael@0 2393
michael@0 2394 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2395 ctx.fillRect(0, 0, 100, 50);
michael@0 2396 ctx.globalCompositeOperation = 'copy';
michael@0 2397 ctx.drawImage(document.getElementById('yellow_1.png'), 40, 40, 10, 10, 40, 50, 10, 10);
michael@0 2398 isPixel(ctx, 15,15, 0,0,0,0, 5);
michael@0 2399 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2400
michael@0 2401
michael@0 2402 }
michael@0 2403 </script>
michael@0 2404 <img src="image_yellow.png" id="yellow_1.png" class="resource">
michael@0 2405
michael@0 2406 <!-- [[[ test_2d.composite.uncovered.image.destination-atop.html ]]] -->
michael@0 2407
michael@0 2408 <p>Canvas test: 2d.composite.uncovered.image.destination-atop</p>
michael@0 2409 <!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2410 <canvas id="c91" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2411 <script>
michael@0 2412
michael@0 2413
michael@0 2414
michael@0 2415 function test_2d_composite_uncovered_image_destination_atop() {
michael@0 2416
michael@0 2417 var canvas = document.getElementById('c91');
michael@0 2418 var ctx = canvas.getContext('2d');
michael@0 2419
michael@0 2420
michael@0 2421 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2422 ctx.fillRect(0, 0, 100, 50);
michael@0 2423 ctx.globalCompositeOperation = 'destination-atop';
michael@0 2424 ctx.drawImage(document.getElementById('yellow_2.png'), 40, 40, 10, 10, 40, 50, 10, 10);
michael@0 2425 isPixel(ctx, 15,15, 0,0,0,0, 5);
michael@0 2426 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2427
michael@0 2428
michael@0 2429 }
michael@0 2430 </script>
michael@0 2431 <img src="image_yellow.png" id="yellow_2.png" class="resource">
michael@0 2432
michael@0 2433 <!-- [[[ test_2d.composite.uncovered.image.destination-in.html ]]] -->
michael@0 2434
michael@0 2435 <p>Canvas test: 2d.composite.uncovered.image.destination-in</p>
michael@0 2436 <!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2437 <canvas id="c92" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2438 <script>
michael@0 2439
michael@0 2440
michael@0 2441
michael@0 2442 function test_2d_composite_uncovered_image_destination_in() {
michael@0 2443
michael@0 2444 var canvas = document.getElementById('c92');
michael@0 2445 var ctx = canvas.getContext('2d');
michael@0 2446
michael@0 2447
michael@0 2448 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2449 ctx.fillRect(0, 0, 100, 50);
michael@0 2450 ctx.globalCompositeOperation = 'destination-in';
michael@0 2451 ctx.drawImage(document.getElementById('yellow_3.png'), 40, 40, 10, 10, 40, 50, 10, 10);
michael@0 2452 isPixel(ctx, 15,15, 0,0,0,0, 5);
michael@0 2453 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2454
michael@0 2455
michael@0 2456 }
michael@0 2457 </script>
michael@0 2458 <img src="image_yellow.png" id="yellow_3.png" class="resource">
michael@0 2459
michael@0 2460 <!-- [[[ test_2d.composite.uncovered.image.source-in.html ]]] -->
michael@0 2461
michael@0 2462 <p>Canvas test: 2d.composite.uncovered.image.source-in</p>
michael@0 2463 <!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2464 <canvas id="c93" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2465 <script>
michael@0 2466
michael@0 2467
michael@0 2468
michael@0 2469 function test_2d_composite_uncovered_image_source_in() {
michael@0 2470
michael@0 2471 var canvas = document.getElementById('c93');
michael@0 2472 var ctx = canvas.getContext('2d');
michael@0 2473
michael@0 2474
michael@0 2475 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2476 ctx.fillRect(0, 0, 100, 50);
michael@0 2477 ctx.globalCompositeOperation = 'source-in';
michael@0 2478 ctx.drawImage(document.getElementById('yellow_4.png'), 40, 40, 10, 10, 40, 50, 10, 10);
michael@0 2479 isPixel(ctx, 15,15, 0,0,0,0, 5);
michael@0 2480 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2481
michael@0 2482
michael@0 2483 }
michael@0 2484 </script>
michael@0 2485 <img src="image_yellow.png" id="yellow_4.png" class="resource">
michael@0 2486
michael@0 2487 <!-- [[[ test_2d.composite.uncovered.image.source-out.html ]]] -->
michael@0 2488
michael@0 2489 <p>Canvas test: 2d.composite.uncovered.image.source-out</p>
michael@0 2490 <!-- Testing: drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2491 <canvas id="c94" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2492 <script>
michael@0 2493
michael@0 2494
michael@0 2495
michael@0 2496 function test_2d_composite_uncovered_image_source_out() {
michael@0 2497
michael@0 2498 var canvas = document.getElementById('c94');
michael@0 2499 var ctx = canvas.getContext('2d');
michael@0 2500
michael@0 2501
michael@0 2502 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2503 ctx.fillRect(0, 0, 100, 50);
michael@0 2504 ctx.globalCompositeOperation = 'source-out';
michael@0 2505 ctx.drawImage(document.getElementById('yellow_5.png'), 40, 40, 10, 10, 40, 50, 10, 10);
michael@0 2506 isPixel(ctx, 15,15, 0,0,0,0, 5);
michael@0 2507 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2508
michael@0 2509
michael@0 2510 }
michael@0 2511 </script>
michael@0 2512 <img src="image_yellow.png" id="yellow_5.png" class="resource">
michael@0 2513
michael@0 2514 <!-- [[[ test_2d.composite.uncovered.pattern.copy.html ]]] -->
michael@0 2515
michael@0 2516 <p>Canvas test: 2d.composite.uncovered.pattern.copy</p>
michael@0 2517 <!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2518 <canvas id="c95" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2519 <script>
michael@0 2520
michael@0 2521
michael@0 2522
michael@0 2523 function test_2d_composite_uncovered_pattern_copy() {
michael@0 2524
michael@0 2525 var canvas = document.getElementById('c95');
michael@0 2526 var ctx = canvas.getContext('2d');
michael@0 2527
michael@0 2528
michael@0 2529 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2530 ctx.fillRect(0, 0, 100, 50);
michael@0 2531 ctx.globalCompositeOperation = 'copy';
michael@0 2532 ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_6.png'), 'no-repeat');
michael@0 2533 ctx.fillRect(0, 50, 100, 50);
michael@0 2534 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2535
michael@0 2536
michael@0 2537 }
michael@0 2538 </script>
michael@0 2539 <img src="image_yellow.png" id="yellow_6.png" class="resource">
michael@0 2540
michael@0 2541 <!-- [[[ test_2d.composite.uncovered.pattern.destination-atop.html ]]] -->
michael@0 2542
michael@0 2543 <p>Canvas test: 2d.composite.uncovered.pattern.destination-atop</p>
michael@0 2544 <!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2545 <canvas id="c96" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2546 <script>
michael@0 2547
michael@0 2548
michael@0 2549
michael@0 2550 function test_2d_composite_uncovered_pattern_destination_atop() {
michael@0 2551
michael@0 2552 var canvas = document.getElementById('c96');
michael@0 2553 var ctx = canvas.getContext('2d');
michael@0 2554
michael@0 2555
michael@0 2556 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2557 ctx.fillRect(0, 0, 100, 50);
michael@0 2558 ctx.globalCompositeOperation = 'destination-atop';
michael@0 2559 ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_7.png'), 'no-repeat');
michael@0 2560 ctx.fillRect(0, 50, 100, 50);
michael@0 2561 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2562
michael@0 2563
michael@0 2564 }
michael@0 2565 </script>
michael@0 2566 <img src="image_yellow.png" id="yellow_7.png" class="resource">
michael@0 2567
michael@0 2568 <!-- [[[ test_2d.composite.uncovered.pattern.destination-in.html ]]] -->
michael@0 2569
michael@0 2570 <p>Canvas test: 2d.composite.uncovered.pattern.destination-in</p>
michael@0 2571 <!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2572 <canvas id="c97" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2573 <script>
michael@0 2574
michael@0 2575
michael@0 2576
michael@0 2577 function test_2d_composite_uncovered_pattern_destination_in() {
michael@0 2578
michael@0 2579 var canvas = document.getElementById('c97');
michael@0 2580 var ctx = canvas.getContext('2d');
michael@0 2581
michael@0 2582
michael@0 2583 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2584 ctx.fillRect(0, 0, 100, 50);
michael@0 2585 ctx.globalCompositeOperation = 'destination-in';
michael@0 2586 ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_8.png'), 'no-repeat');
michael@0 2587 ctx.fillRect(0, 50, 100, 50);
michael@0 2588 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2589
michael@0 2590
michael@0 2591 }
michael@0 2592 </script>
michael@0 2593 <img src="image_yellow.png" id="yellow_8.png" class="resource">
michael@0 2594
michael@0 2595 <!-- [[[ test_2d.composite.uncovered.pattern.source-in.html ]]] -->
michael@0 2596
michael@0 2597 <p>Canvas test: 2d.composite.uncovered.pattern.source-in</p>
michael@0 2598 <!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2599 <canvas id="c98" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2600 <script>
michael@0 2601
michael@0 2602
michael@0 2603
michael@0 2604 function test_2d_composite_uncovered_pattern_source_in() {
michael@0 2605
michael@0 2606 var canvas = document.getElementById('c98');
michael@0 2607 var ctx = canvas.getContext('2d');
michael@0 2608
michael@0 2609
michael@0 2610 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2611 ctx.fillRect(0, 0, 100, 50);
michael@0 2612 ctx.globalCompositeOperation = 'source-in';
michael@0 2613 ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_9.png'), 'no-repeat');
michael@0 2614 ctx.fillRect(0, 50, 100, 50);
michael@0 2615 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2616
michael@0 2617
michael@0 2618 }
michael@0 2619 </script>
michael@0 2620 <img src="image_yellow.png" id="yellow_9.png" class="resource">
michael@0 2621
michael@0 2622 <!-- [[[ test_2d.composite.uncovered.pattern.source-out.html ]]] -->
michael@0 2623
michael@0 2624 <p>Canvas test: 2d.composite.uncovered.pattern.source-out</p>
michael@0 2625 <!-- Testing: Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. -->
michael@0 2626 <canvas id="c99" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2627 <script>
michael@0 2628
michael@0 2629
michael@0 2630
michael@0 2631 function test_2d_composite_uncovered_pattern_source_out() {
michael@0 2632
michael@0 2633 var canvas = document.getElementById('c99');
michael@0 2634 var ctx = canvas.getContext('2d');
michael@0 2635
michael@0 2636
michael@0 2637 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
michael@0 2638 ctx.fillRect(0, 0, 100, 50);
michael@0 2639 ctx.globalCompositeOperation = 'source-out';
michael@0 2640 ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_10.png'), 'no-repeat');
michael@0 2641 ctx.fillRect(0, 50, 100, 50);
michael@0 2642 isPixel(ctx, 50,25, 0,0,0,0, 5);
michael@0 2643
michael@0 2644
michael@0 2645 }
michael@0 2646 </script>
michael@0 2647 <img src="image_yellow.png" id="yellow_10.png" class="resource">
michael@0 2648
michael@0 2649 <!-- [[[ test_2d.drawImage.3arg.html ]]] -->
michael@0 2650
michael@0 2651 <p>Canvas test: 2d.drawImage.3arg</p>
michael@0 2652 <canvas id="c100" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2653 <script>
michael@0 2654
michael@0 2655
michael@0 2656 function test_2d_drawImage_3arg() {
michael@0 2657
michael@0 2658 var canvas = document.getElementById('c100');
michael@0 2659 var ctx = canvas.getContext('2d');
michael@0 2660
michael@0 2661 ctx.drawImage(document.getElementById('green_1.png'), 0, 0);
michael@0 2662 ctx.drawImage(document.getElementById('red_3.png'), -100, 0);
michael@0 2663 ctx.drawImage(document.getElementById('red_3.png'), 100, 0);
michael@0 2664 ctx.drawImage(document.getElementById('red_3.png'), 0, -50);
michael@0 2665 ctx.drawImage(document.getElementById('red_3.png'), 0, 50);
michael@0 2666
michael@0 2667 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2668 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2669 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2670 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2671
michael@0 2672
michael@0 2673 }
michael@0 2674 </script>
michael@0 2675 <img src="image_red.png" id="red_3.png" class="resource">
michael@0 2676 <img src="image_green.png" id="green_1.png" class="resource">
michael@0 2677
michael@0 2678 <!-- [[[ test_2d.drawImage.5arg.html ]]] -->
michael@0 2679
michael@0 2680 <p>Canvas test: 2d.drawImage.5arg</p>
michael@0 2681 <canvas id="c101" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2682 <script>
michael@0 2683
michael@0 2684
michael@0 2685 function test_2d_drawImage_5arg() {
michael@0 2686
michael@0 2687 var canvas = document.getElementById('c101');
michael@0 2688 var ctx = canvas.getContext('2d');
michael@0 2689
michael@0 2690 ctx.fillStyle = '#f00';
michael@0 2691 ctx.fillRect(0, 0, 100, 50);
michael@0 2692 ctx.drawImage(document.getElementById('green_2.png'), 50, 0, 50, 50);
michael@0 2693 ctx.drawImage(document.getElementById('red_4.png'), 0, 0, 50, 50);
michael@0 2694 ctx.fillStyle = '#0f0';
michael@0 2695 ctx.fillRect(0, 0, 50, 50);
michael@0 2696
michael@0 2697 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2698 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2699 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2700 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2701
michael@0 2702
michael@0 2703 }
michael@0 2704 </script>
michael@0 2705 <img src="image_red.png" id="red_4.png" class="resource">
michael@0 2706 <img src="image_green.png" id="green_2.png" class="resource">
michael@0 2707
michael@0 2708 <!-- [[[ test_2d.drawImage.9arg.basic.html ]]] -->
michael@0 2709
michael@0 2710 <p>Canvas test: 2d.drawImage.9arg.basic</p>
michael@0 2711 <canvas id="c102" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2712 <script>
michael@0 2713
michael@0 2714
michael@0 2715 function test_2d_drawImage_9arg_basic() {
michael@0 2716
michael@0 2717 var canvas = document.getElementById('c102');
michael@0 2718 var ctx = canvas.getContext('2d');
michael@0 2719
michael@0 2720 ctx.fillStyle = '#f00';
michael@0 2721 ctx.fillRect(0, 0, 100, 50);
michael@0 2722 ctx.drawImage(document.getElementById('green_3.png'), 0, 0, 100, 50, 0, 0, 100, 50);
michael@0 2723 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2724 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2725 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2726 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2727
michael@0 2728
michael@0 2729 }
michael@0 2730 </script>
michael@0 2731 <img src="image_green.png" id="green_3.png" class="resource">
michael@0 2732
michael@0 2733 <!-- [[[ test_2d.drawImage.9arg.destpos.html ]]] -->
michael@0 2734
michael@0 2735 <p>Canvas test: 2d.drawImage.9arg.destpos</p>
michael@0 2736 <canvas id="c103" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2737 <script>
michael@0 2738
michael@0 2739
michael@0 2740 function test_2d_drawImage_9arg_destpos() {
michael@0 2741
michael@0 2742 var canvas = document.getElementById('c103');
michael@0 2743 var ctx = canvas.getContext('2d');
michael@0 2744
michael@0 2745 ctx.fillStyle = '#f00';
michael@0 2746 ctx.fillRect(0, 0, 100, 50);
michael@0 2747 ctx.drawImage(document.getElementById('green_4.png'), 0, 0, 100, 50, 0, 0, 100, 50);
michael@0 2748 ctx.drawImage(document.getElementById('red_5.png'), 0, 0, 100, 50, -100, 0, 100, 50);
michael@0 2749 ctx.drawImage(document.getElementById('red_5.png'), 0, 0, 100, 50, 100, 0, 100, 50);
michael@0 2750 ctx.drawImage(document.getElementById('red_5.png'), 0, 0, 100, 50, 0, -50, 100, 50);
michael@0 2751 ctx.drawImage(document.getElementById('red_5.png'), 0, 0, 100, 50, 0, 50, 100, 50);
michael@0 2752 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2753 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2754 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2755 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2756
michael@0 2757
michael@0 2758 }
michael@0 2759 </script>
michael@0 2760 <img src="image_red.png" id="red_5.png" class="resource">
michael@0 2761 <img src="image_green.png" id="green_4.png" class="resource">
michael@0 2762
michael@0 2763 <!-- [[[ test_2d.drawImage.9arg.destsize.html ]]] -->
michael@0 2764
michael@0 2765 <p>Canvas test: 2d.drawImage.9arg.destsize</p>
michael@0 2766 <canvas id="c104" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2767 <script>
michael@0 2768
michael@0 2769
michael@0 2770 function test_2d_drawImage_9arg_destsize() {
michael@0 2771
michael@0 2772 var canvas = document.getElementById('c104');
michael@0 2773 var ctx = canvas.getContext('2d');
michael@0 2774
michael@0 2775 ctx.fillStyle = '#f00';
michael@0 2776 ctx.fillRect(0, 0, 100, 50);
michael@0 2777 ctx.drawImage(document.getElementById('green_5.png'), 1, 1, 1, 1, 0, 0, 100, 50);
michael@0 2778 ctx.drawImage(document.getElementById('red_6.png'), 0, 0, 100, 50, -50, 0, 50, 50);
michael@0 2779 ctx.drawImage(document.getElementById('red_6.png'), 0, 0, 100, 50, 100, 0, 50, 50);
michael@0 2780 ctx.drawImage(document.getElementById('red_6.png'), 0, 0, 100, 50, 0, -25, 100, 25);
michael@0 2781 ctx.drawImage(document.getElementById('red_6.png'), 0, 0, 100, 50, 0, 50, 100, 25);
michael@0 2782 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2783 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2784 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2785 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2786
michael@0 2787
michael@0 2788 }
michael@0 2789 </script>
michael@0 2790 <img src="image_red.png" id="red_6.png" class="resource">
michael@0 2791 <img src="image_green.png" id="green_5.png" class="resource">
michael@0 2792
michael@0 2793 <!-- [[[ test_2d.drawImage.9arg.sourcepos.html ]]] -->
michael@0 2794
michael@0 2795 <p>Canvas test: 2d.drawImage.9arg.sourcepos</p>
michael@0 2796 <canvas id="c105" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2797 <script>
michael@0 2798
michael@0 2799
michael@0 2800 function test_2d_drawImage_9arg_sourcepos() {
michael@0 2801
michael@0 2802 var canvas = document.getElementById('c105');
michael@0 2803 var ctx = canvas.getContext('2d');
michael@0 2804
michael@0 2805 ctx.fillStyle = '#f00';
michael@0 2806 ctx.fillRect(0, 0, 100, 50);
michael@0 2807 ctx.drawImage(document.getElementById('rgrg-256x256_1.png'), 140, 20, 100, 50, 0, 0, 100, 50);
michael@0 2808 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2809 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 2810 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 2811 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 2812
michael@0 2813
michael@0 2814 }
michael@0 2815 </script>
michael@0 2816 <img src="image_rgrg-256x256.png" id="rgrg-256x256_1.png" class="resource">
michael@0 2817
michael@0 2818 <!-- [[[ test_2d.drawImage.9arg.sourcesize.html ]]] -->
michael@0 2819
michael@0 2820 <p>Canvas test: 2d.drawImage.9arg.sourcesize</p>
michael@0 2821 <canvas id="c106" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2822 <script>
michael@0 2823
michael@0 2824
michael@0 2825 function test_2d_drawImage_9arg_sourcesize() {
michael@0 2826
michael@0 2827 var canvas = document.getElementById('c106');
michael@0 2828 var ctx = canvas.getContext('2d');
michael@0 2829
michael@0 2830 ctx.fillStyle = '#f00';
michael@0 2831 ctx.fillRect(0, 0, 100, 50);
michael@0 2832 ctx.drawImage(document.getElementById('rgrg-256x256_2.png'), 0, 0, 256, 256, 0, 0, 100, 50);
michael@0 2833 ctx.fillStyle = '#0f0';
michael@0 2834 ctx.fillRect(0, 0, 51, 26);
michael@0 2835 ctx.fillRect(49, 24, 51, 26);
michael@0 2836 isPixel(ctx, 0,0, 0,255,0,255, 3);
michael@0 2837 isPixel(ctx, 99,0, 0,255,0,255, 3);
michael@0 2838 isPixel(ctx, 0,49, 0,255,0,255, 3);
michael@0 2839 isPixel(ctx, 99,49, 0,255,0,255, 3);
michael@0 2840 isPixel(ctx, 20,20, 0,255,0,255, 3);
michael@0 2841 isPixel(ctx, 80,20, 0,255,0,255, 3);
michael@0 2842 isPixel(ctx, 20,30, 0,255,0,255, 3);
michael@0 2843 isPixel(ctx, 80,30, 0,255,0,255, 3);
michael@0 2844
michael@0 2845
michael@0 2846 }
michael@0 2847 </script>
michael@0 2848 <img src="image_rgrg-256x256.png" id="rgrg-256x256_2.png" class="resource">
michael@0 2849
michael@0 2850 <!-- [[[ test_2d.drawImage.alpha.html ]]] -->
michael@0 2851
michael@0 2852 <p>Canvas test: 2d.drawImage.alpha</p>
michael@0 2853 <canvas id="c107" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2854 <script>
michael@0 2855
michael@0 2856
michael@0 2857 function test_2d_drawImage_alpha() {
michael@0 2858
michael@0 2859 var canvas = document.getElementById('c107');
michael@0 2860 var ctx = canvas.getContext('2d');
michael@0 2861
michael@0 2862 ctx.fillStyle = '#0f0';
michael@0 2863 ctx.fillRect(0, 0, 100, 50);
michael@0 2864 ctx.globalAlpha = 0;
michael@0 2865 ctx.drawImage(document.getElementById('red_7.png'), 0, 0);
michael@0 2866 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 2867
michael@0 2868
michael@0 2869 }
michael@0 2870 </script>
michael@0 2871 <img src="image_red.png" id="red_7.png" class="resource">
michael@0 2872
michael@0 2873 <!-- [[[ test_2d.drawImage.animated.apng.html ]]] -->
michael@0 2874
michael@0 2875 <p>Canvas test: 2d.drawImage.animated.apng</p>
michael@0 2876 <!-- Testing: drawImage() of an APNG with no poster frame draws the first frame -->
michael@0 2877 <canvas id="c108" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2878 <script>
michael@0 2879
michael@0 2880
michael@0 2881 function deferTest() {
michael@0 2882 _deferred = true;
michael@0 2883 }
michael@0 2884 function wrapFunction(f) {
michael@0 2885 return function () {
michael@0 2886 f.apply(null, arguments);
michael@0 2887 };
michael@0 2888 }
michael@0 2889
michael@0 2890 var canvas108 = document.getElementById('c108');
michael@0 2891 var ctx108 = canvas108.getContext('2d');
michael@0 2892 var isDone_test_2d_drawImage_animated_apng = false;
michael@0 2893
michael@0 2894 function test_2d_drawImage_animated_apng() {
michael@0 2895
michael@0 2896 deferTest();
michael@0 2897 setTimeout(wrapFunction(function () {
michael@0 2898 ctx108.drawImage(document.getElementById('anim-gr_1.png'), 0, 0);
michael@0 2899 isPixel(ctx108, 50,25, 0,255,0,255, 2);
michael@0 2900 isDone_test_2d_drawImage_animated_apng = true;
michael@0 2901 }), 5000);
michael@0 2902
michael@0 2903
michael@0 2904 }
michael@0 2905 </script>
michael@0 2906 <img src="image_anim-gr.png" id="anim-gr_1.png" class="resource">
michael@0 2907
michael@0 2908 <!-- [[[ test_2d.drawImage.animated.gif.html ]]] -->
michael@0 2909
michael@0 2910 <p>Canvas test: 2d.drawImage.animated.gif</p>
michael@0 2911 <!-- Testing: drawImage() of an animated GIF draws the first frame -->
michael@0 2912 <canvas id="c109" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2913 <script>
michael@0 2914
michael@0 2915 var canvas109 = document.getElementById('c109');
michael@0 2916 var ctx109 = canvas109.getContext('2d');
michael@0 2917 var isDone_test_2d_drawImage_animated_gif = false;
michael@0 2918
michael@0 2919 function test_2d_drawImage_animated_gif() {
michael@0 2920
michael@0 2921 deferTest();
michael@0 2922 setTimeout(wrapFunction(function () {
michael@0 2923 ctx109.drawImage(document.getElementById('anim-gr_1.gif'), 0, 0);
michael@0 2924 isPixel(ctx109, 50,25, 0,255,0,255, 2);
michael@0 2925 isDone_test_2d_drawImage_animated_gif = true;
michael@0 2926 }), 5000);
michael@0 2927
michael@0 2928
michael@0 2929 }
michael@0 2930 </script>
michael@0 2931 <img src="image_anim-gr.gif" id="anim-gr_1.gif" class="resource">
michael@0 2932
michael@0 2933 <!-- [[[ test_2d.drawImage.animated.poster.html ]]] -->
michael@0 2934
michael@0 2935 <p>Canvas test: 2d.drawImage.animated.poster</p>
michael@0 2936 <!-- Testing: drawImage() of an APNG draws the poster frame -->
michael@0 2937 <canvas id="c110" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2938 <script>
michael@0 2939
michael@0 2940 var canvas110 = document.getElementById('c110');
michael@0 2941 var ctx110 = canvas110.getContext('2d');
michael@0 2942
michael@0 2943
michael@0 2944 function test_2d_drawImage_animated_poster() {
michael@0 2945
michael@0 2946 ctx110.drawImage(document.getElementById('anim-poster-gr_1.png'), 0, 0);
michael@0 2947 todo_isPixel(ctx110, 50,25, 0,255,0,255, 2);
michael@0 2948
michael@0 2949
michael@0 2950 }
michael@0 2951 </script>
michael@0 2952 <img src="image_anim-poster-gr.png" id="anim-poster-gr_1.png" class="resource">
michael@0 2953
michael@0 2954 <!-- [[[ test_2d.drawImage.broken.html ]]] -->
michael@0 2955
michael@0 2956 <p>Canvas test: 2d.drawImage.broken</p>
michael@0 2957 <canvas id="c111" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2958 <script>
michael@0 2959
michael@0 2960 function test_2d_drawImage_broken() {
michael@0 2961
michael@0 2962 var canvas = document.getElementById('c111');
michael@0 2963 var ctx = canvas.getContext('2d');
michael@0 2964
michael@0 2965 var img = document.getElementById('broken_1.png');
michael@0 2966 todo(img.complete === false, "img.complete === false");
michael@0 2967 var _thrown = undefined; try {
michael@0 2968 ctx.drawImage(img, 0, 0);
michael@0 2969 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 2970
michael@0 2971
michael@0 2972 }
michael@0 2973 </script>
michael@0 2974 <img src="image_broken.png" id="broken_1.png" class="resource">
michael@0 2975
michael@0 2976 <!-- [[[ test_2d.drawImage.canvas.html ]]] -->
michael@0 2977
michael@0 2978 <p>Canvas test: 2d.drawImage.canvas</p>
michael@0 2979 <canvas id="c112" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 2980 <script>
michael@0 2981
michael@0 2982
michael@0 2983 function test_2d_drawImage_canvas() {
michael@0 2984
michael@0 2985 var canvas = document.getElementById('c112');
michael@0 2986 var ctx = canvas.getContext('2d');
michael@0 2987
michael@0 2988 var canvas2 = document.createElement('canvas');
michael@0 2989 canvas2.width = 100;
michael@0 2990 canvas2.height = 50;
michael@0 2991 var ctx2 = canvas2.getContext('2d');
michael@0 2992 ctx2.fillStyle = '#0f0';
michael@0 2993 ctx2.fillRect(0, 0, 100, 50);
michael@0 2994
michael@0 2995 ctx.fillStyle = '#f00';
michael@0 2996 ctx.drawImage(canvas2, 0, 0);
michael@0 2997
michael@0 2998 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 2999 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 3000 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 3001 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 3002
michael@0 3003
michael@0 3004 }
michael@0 3005 </script>
michael@0 3006
michael@0 3007 <!-- [[[ test_2d.drawImage.clip.html ]]] -->
michael@0 3008
michael@0 3009 <p>Canvas test: 2d.drawImage.clip</p>
michael@0 3010 <canvas id="c113" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3011 <script>
michael@0 3012
michael@0 3013
michael@0 3014 function test_2d_drawImage_clip() {
michael@0 3015
michael@0 3016 var canvas = document.getElementById('c113');
michael@0 3017 var ctx = canvas.getContext('2d');
michael@0 3018
michael@0 3019 ctx.fillStyle = '#0f0';
michael@0 3020 ctx.fillRect(0, 0, 100, 50);
michael@0 3021 ctx.rect(-10, -10, 1, 1);
michael@0 3022 ctx.clip();
michael@0 3023 ctx.drawImage(document.getElementById('red_8.png'), 0, 0);
michael@0 3024 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3025
michael@0 3026
michael@0 3027 }
michael@0 3028 </script>
michael@0 3029 <img src="image_red.png" id="red_8.png" class="resource">
michael@0 3030
michael@0 3031 <!-- [[[ test_2d.drawImage.composite.html ]]] -->
michael@0 3032
michael@0 3033 <p>Canvas test: 2d.drawImage.composite</p>
michael@0 3034 <canvas id="c114" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3035 <script>
michael@0 3036
michael@0 3037
michael@0 3038 function test_2d_drawImage_composite() {
michael@0 3039
michael@0 3040 var canvas = document.getElementById('c114');
michael@0 3041 var ctx = canvas.getContext('2d');
michael@0 3042
michael@0 3043 ctx.fillStyle = '#0f0';
michael@0 3044 ctx.fillRect(0, 0, 100, 50);
michael@0 3045 ctx.globalCompositeOperation = 'destination-over';
michael@0 3046 ctx.drawImage(document.getElementById('red_9.png'), 0, 0);
michael@0 3047 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3048
michael@0 3049
michael@0 3050 }
michael@0 3051 </script>
michael@0 3052 <img src="image_red.png" id="red_9.png" class="resource">
michael@0 3053
michael@0 3054 <!-- [[[ test_2d.drawImage.floatsource.html ]]] -->
michael@0 3055
michael@0 3056 <p>Canvas test: 2d.drawImage.floatsource</p>
michael@0 3057 <canvas id="c115" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3058 <script>
michael@0 3059
michael@0 3060
michael@0 3061 function test_2d_drawImage_floatsource() {
michael@0 3062
michael@0 3063 var canvas = document.getElementById('c115');
michael@0 3064 var ctx = canvas.getContext('2d');
michael@0 3065
michael@0 3066 ctx.drawImage(document.getElementById('green_6.png'), 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50);
michael@0 3067 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3068
michael@0 3069
michael@0 3070 }
michael@0 3071 </script>
michael@0 3072 <img src="image_green.png" id="green_6.png" class="resource">
michael@0 3073
michael@0 3074 <!-- [[[ test_2d.drawImage.incomplete.html ]]] -->
michael@0 3075
michael@0 3076 <p>Canvas test: 2d.drawImage.incomplete</p>
michael@0 3077 <canvas id="c116" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3078 <script>
michael@0 3079
michael@0 3080 function test_2d_drawImage_incomplete() {
michael@0 3081
michael@0 3082 var canvas = document.getElementById('c116');
michael@0 3083 var ctx = canvas.getContext('2d');
michael@0 3084
michael@0 3085 var img = new Image();
michael@0 3086 todo(img.complete === false, "img.complete === false");
michael@0 3087 var _thrown = undefined; try {
michael@0 3088 ctx.drawImage(img, 0, 0);
michael@0 3089 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 3090
michael@0 3091
michael@0 3092 }
michael@0 3093 </script>
michael@0 3094
michael@0 3095 <!-- [[[ test_2d.drawImage.negativedest.html ]]] -->
michael@0 3096
michael@0 3097 <p>Canvas test: 2d.drawImage.negativedest</p>
michael@0 3098 <canvas id="c117" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3099 <script>
michael@0 3100
michael@0 3101
michael@0 3102 function test_2d_drawImage_negativedest() {
michael@0 3103
michael@0 3104 var canvas = document.getElementById('c117');
michael@0 3105 var ctx = canvas.getContext('2d');
michael@0 3106
michael@0 3107 var _thrown_outer = false;
michael@0 3108 try {
michael@0 3109
michael@0 3110 ctx.fillStyle = '#f00';
michael@0 3111 ctx.fillRect(0, 0, 100, 50);
michael@0 3112 ctx.drawImage(document.getElementById('ggrr-256x256_1.png'), 100, 78, 50, 50, 0, 50, 50, -50);
michael@0 3113 ctx.drawImage(document.getElementById('ggrr-256x256_1.png'), 100, 128, 50, -50, 100, 50, -50, -50);
michael@0 3114 isPixel(ctx, 1,1, 0,255,0,255, 2);
michael@0 3115 isPixel(ctx, 1,48, 0,255,0,255, 2);
michael@0 3116 isPixel(ctx, 98,1, 0,255,0,255, 2);
michael@0 3117 isPixel(ctx, 98,48, 0,255,0,255, 2);
michael@0 3118 isPixel(ctx, 48,1, 0,255,0,255, 2);
michael@0 3119 isPixel(ctx, 48,48, 0,255,0,255, 2);
michael@0 3120 isPixel(ctx, 51,1, 0,255,0,255, 2);
michael@0 3121 isPixel(ctx, 51,48, 0,255,0,255, 2);
michael@0 3122 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 3123 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 3124
michael@0 3125 } catch (e) {
michael@0 3126 _thrown_outer = true;
michael@0 3127 }
michael@0 3128 todo(!_thrown_outer, 'should not throw exception');
michael@0 3129
michael@0 3130
michael@0 3131 }
michael@0 3132 </script>
michael@0 3133 <img src="image_ggrr-256x256.png" id="ggrr-256x256_1.png" class="resource">
michael@0 3134
michael@0 3135 <!-- [[[ test_2d.drawImage.negativesource.html ]]] -->
michael@0 3136
michael@0 3137 <p>Canvas test: 2d.drawImage.negativesource</p>
michael@0 3138 <canvas id="c118" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3139 <script>
michael@0 3140
michael@0 3141
michael@0 3142 function test_2d_drawImage_negativesource() {
michael@0 3143
michael@0 3144 var canvas = document.getElementById('c118');
michael@0 3145 var ctx = canvas.getContext('2d');
michael@0 3146
michael@0 3147 var _thrown_outer = false;
michael@0 3148 try {
michael@0 3149
michael@0 3150 ctx.fillStyle = '#f00';
michael@0 3151 ctx.fillRect(0, 0, 100, 50);
michael@0 3152 ctx.drawImage(document.getElementById('ggrr-256x256_2.png'), 100, 78, -100, 50, 0, 0, 50, 50);
michael@0 3153 ctx.drawImage(document.getElementById('ggrr-256x256_2.png'), 100, 128, -100, -50, 50, 0, 50, 50);
michael@0 3154 isPixel(ctx, 1,1, 0,255,0,255, 2);
michael@0 3155 isPixel(ctx, 1,48, 0,255,0,255, 2);
michael@0 3156 isPixel(ctx, 98,1, 0,255,0,255, 2);
michael@0 3157 isPixel(ctx, 98,48, 0,255,0,255, 2);
michael@0 3158 isPixel(ctx, 48,1, 0,255,0,255, 2);
michael@0 3159 isPixel(ctx, 48,48, 0,255,0,255, 2);
michael@0 3160 isPixel(ctx, 51,1, 0,255,0,255, 2);
michael@0 3161 isPixel(ctx, 51,48, 0,255,0,255, 2);
michael@0 3162 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 3163 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 3164
michael@0 3165 } catch (e) {
michael@0 3166 _thrown_outer = true;
michael@0 3167 }
michael@0 3168 todo(!_thrown_outer, 'should not throw exception');
michael@0 3169
michael@0 3170
michael@0 3171 }
michael@0 3172 </script>
michael@0 3173 <img src="image_ggrr-256x256.png" id="ggrr-256x256_2.png" class="resource">
michael@0 3174
michael@0 3175 <!-- [[[ test_2d.drawImage.nonfinite.html ]]] -->
michael@0 3176
michael@0 3177 <p>Canvas test: 2d.drawImage.nonfinite</p>
michael@0 3178 <!-- Testing: drawImage() with Infinity/NaN is ignored -->
michael@0 3179 <canvas id="c119" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3180 <script>
michael@0 3181
michael@0 3182
michael@0 3183 function test_2d_drawImage_nonfinite() {
michael@0 3184
michael@0 3185 var canvas = document.getElementById('c119');
michael@0 3186 var ctx = canvas.getContext('2d');
michael@0 3187
michael@0 3188 var _thrown_outer = false;
michael@0 3189
michael@0 3190 try {
michael@0 3191
michael@0 3192 ctx.fillStyle = '#0f0';
michael@0 3193 ctx.fillRect(0, 0, 100, 50);
michael@0 3194 var red = document.getElementById('red_10.png');
michael@0 3195 ctx.drawImage(red, Infinity, 0);
michael@0 3196 ctx.drawImage(red, -Infinity, 0);
michael@0 3197 ctx.drawImage(red, NaN, 0);
michael@0 3198 ctx.drawImage(red, 0, Infinity);
michael@0 3199 ctx.drawImage(red, 0, -Infinity);
michael@0 3200 ctx.drawImage(red, 0, NaN);
michael@0 3201 ctx.drawImage(red, Infinity, Infinity);
michael@0 3202 ctx.drawImage(red, Infinity, 0, 100, 50);
michael@0 3203 ctx.drawImage(red, -Infinity, 0, 100, 50);
michael@0 3204 ctx.drawImage(red, NaN, 0, 100, 50);
michael@0 3205 ctx.drawImage(red, 0, Infinity, 100, 50);
michael@0 3206 ctx.drawImage(red, 0, -Infinity, 100, 50);
michael@0 3207 ctx.drawImage(red, 0, NaN, 100, 50);
michael@0 3208 ctx.drawImage(red, 0, 0, Infinity, 50);
michael@0 3209 ctx.drawImage(red, 0, 0, -Infinity, 50);
michael@0 3210 ctx.drawImage(red, 0, 0, NaN, 50);
michael@0 3211 ctx.drawImage(red, 0, 0, 100, Infinity);
michael@0 3212 ctx.drawImage(red, 0, 0, 100, -Infinity);
michael@0 3213 ctx.drawImage(red, 0, 0, 100, NaN);
michael@0 3214 ctx.drawImage(red, Infinity, Infinity, 100, 50);
michael@0 3215 ctx.drawImage(red, Infinity, Infinity, Infinity, 50);
michael@0 3216 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity);
michael@0 3217 ctx.drawImage(red, Infinity, Infinity, 100, Infinity);
michael@0 3218 ctx.drawImage(red, Infinity, 0, Infinity, 50);
michael@0 3219 ctx.drawImage(red, Infinity, 0, Infinity, Infinity);
michael@0 3220 ctx.drawImage(red, Infinity, 0, 100, Infinity);
michael@0 3221 ctx.drawImage(red, 0, Infinity, Infinity, 50);
michael@0 3222 ctx.drawImage(red, 0, Infinity, Infinity, Infinity);
michael@0 3223 ctx.drawImage(red, 0, Infinity, 100, Infinity);
michael@0 3224 ctx.drawImage(red, 0, 0, Infinity, Infinity);
michael@0 3225 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, 50);
michael@0 3226 ctx.drawImage(red, -Infinity, 0, 100, 50, 0, 0, 100, 50);
michael@0 3227 ctx.drawImage(red, NaN, 0, 100, 50, 0, 0, 100, 50);
michael@0 3228 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, 50);
michael@0 3229 ctx.drawImage(red, 0, -Infinity, 100, 50, 0, 0, 100, 50);
michael@0 3230 ctx.drawImage(red, 0, NaN, 100, 50, 0, 0, 100, 50);
michael@0 3231 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, 50);
michael@0 3232 ctx.drawImage(red, 0, 0, -Infinity, 50, 0, 0, 100, 50);
michael@0 3233 ctx.drawImage(red, 0, 0, NaN, 50, 0, 0, 100, 50);
michael@0 3234 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, 50);
michael@0 3235 ctx.drawImage(red, 0, 0, 100, -Infinity, 0, 0, 100, 50);
michael@0 3236 ctx.drawImage(red, 0, 0, 100, NaN, 0, 0, 100, 50);
michael@0 3237 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, 50);
michael@0 3238 ctx.drawImage(red, 0, 0, 100, 50, -Infinity, 0, 100, 50);
michael@0 3239 ctx.drawImage(red, 0, 0, 100, 50, NaN, 0, 100, 50);
michael@0 3240 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, 50);
michael@0 3241 ctx.drawImage(red, 0, 0, 100, 50, 0, -Infinity, 100, 50);
michael@0 3242 ctx.drawImage(red, 0, 0, 100, 50, 0, NaN, 100, 50);
michael@0 3243 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, 50);
michael@0 3244 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, -Infinity, 50);
michael@0 3245 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, NaN, 50);
michael@0 3246 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, Infinity);
michael@0 3247 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, -Infinity);
michael@0 3248 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, NaN);
michael@0 3249 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, 50);
michael@0 3250 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50);
michael@0 3251 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50);
michael@0 3252 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
michael@0 3253 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
michael@0 3254 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3255 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3256 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3257 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
michael@0 3258 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3259 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
michael@0 3260 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
michael@0 3261 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
michael@0 3262 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3263 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
michael@0 3264 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
michael@0 3265 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 3266 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
michael@0 3267 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50);
michael@0 3268 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
michael@0 3269 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
michael@0 3270 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3271 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
michael@0 3272 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
michael@0 3273 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
michael@0 3274 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
michael@0 3275 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50);
michael@0 3276 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
michael@0 3277 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
michael@0 3278 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
michael@0 3279 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50);
michael@0 3280 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
michael@0 3281 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity);
michael@0 3282 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50);
michael@0 3283 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50);
michael@0 3284 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
michael@0 3285 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3286 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3287 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3288 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
michael@0 3289 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3290 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
michael@0 3291 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50);
michael@0 3292 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
michael@0 3293 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3294 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
michael@0 3295 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50);
michael@0 3296 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
michael@0 3297 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity);
michael@0 3298 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50);
michael@0 3299 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50);
michael@0 3300 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
michael@0 3301 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3302 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
michael@0 3303 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50);
michael@0 3304 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
michael@0 3305 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity);
michael@0 3306 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50);
michael@0 3307 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50);
michael@0 3308 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
michael@0 3309 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity);
michael@0 3310 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50);
michael@0 3311 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity);
michael@0 3312 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity);
michael@0 3313 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, 50);
michael@0 3314 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50);
michael@0 3315 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50);
michael@0 3316 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
michael@0 3317 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3318 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3319 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3320 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
michael@0 3321 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3322 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
michael@0 3323 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50);
michael@0 3324 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
michael@0 3325 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3326 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
michael@0 3327 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50);
michael@0 3328 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 3329 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity);
michael@0 3330 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50);
michael@0 3331 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50);
michael@0 3332 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
michael@0 3333 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3334 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
michael@0 3335 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50);
michael@0 3336 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
michael@0 3337 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity);
michael@0 3338 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50);
michael@0 3339 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50);
michael@0 3340 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
michael@0 3341 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity);
michael@0 3342 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50);
michael@0 3343 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity);
michael@0 3344 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity);
michael@0 3345 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, 50);
michael@0 3346 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50);
michael@0 3347 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50);
michael@0 3348 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3349 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3350 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3351 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50);
michael@0 3352 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3353 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity);
michael@0 3354 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50);
michael@0 3355 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50);
michael@0 3356 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3357 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity);
michael@0 3358 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50);
michael@0 3359 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity);
michael@0 3360 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity);
michael@0 3361 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, 50);
michael@0 3362 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50);
michael@0 3363 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50);
michael@0 3364 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3365 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity);
michael@0 3366 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50);
michael@0 3367 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity);
michael@0 3368 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity);
michael@0 3369 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, 50);
michael@0 3370 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50);
michael@0 3371 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity);
michael@0 3372 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity);
michael@0 3373 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, 50);
michael@0 3374 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity);
michael@0 3375 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, Infinity);
michael@0 3376 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, 50);
michael@0 3377 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50);
michael@0 3378 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
michael@0 3379 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
michael@0 3380 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3381 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3382 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3383 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
michael@0 3384 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3385 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
michael@0 3386 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
michael@0 3387 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
michael@0 3388 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3389 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
michael@0 3390 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
michael@0 3391 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 3392 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
michael@0 3393 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50);
michael@0 3394 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
michael@0 3395 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
michael@0 3396 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3397 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
michael@0 3398 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
michael@0 3399 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
michael@0 3400 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
michael@0 3401 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50);
michael@0 3402 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
michael@0 3403 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
michael@0 3404 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
michael@0 3405 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50);
michael@0 3406 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
michael@0 3407 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity);
michael@0 3408 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, 50);
michael@0 3409 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50);
michael@0 3410 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
michael@0 3411 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3412 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3413 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3414 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
michael@0 3415 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3416 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
michael@0 3417 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50);
michael@0 3418 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
michael@0 3419 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3420 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
michael@0 3421 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50);
michael@0 3422 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
michael@0 3423 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity);
michael@0 3424 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, 50);
michael@0 3425 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50);
michael@0 3426 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
michael@0 3427 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3428 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
michael@0 3429 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50);
michael@0 3430 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
michael@0 3431 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity);
michael@0 3432 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, 50);
michael@0 3433 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50);
michael@0 3434 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
michael@0 3435 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity);
michael@0 3436 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, 50);
michael@0 3437 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity);
michael@0 3438 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, Infinity);
michael@0 3439 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, 50);
michael@0 3440 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50);
michael@0 3441 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
michael@0 3442 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3443 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3444 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3445 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
michael@0 3446 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3447 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
michael@0 3448 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50);
michael@0 3449 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
michael@0 3450 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3451 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
michael@0 3452 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50);
michael@0 3453 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 3454 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity);
michael@0 3455 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, 50);
michael@0 3456 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50);
michael@0 3457 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
michael@0 3458 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3459 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
michael@0 3460 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50);
michael@0 3461 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
michael@0 3462 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity);
michael@0 3463 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, 50);
michael@0 3464 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50);
michael@0 3465 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
michael@0 3466 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity);
michael@0 3467 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, 50);
michael@0 3468 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity);
michael@0 3469 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, Infinity);
michael@0 3470 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, 50);
michael@0 3471 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50);
michael@0 3472 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 3473 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 3474 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
michael@0 3475 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50);
michael@0 3476 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 3477 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity);
michael@0 3478 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, 50);
michael@0 3479 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50);
michael@0 3480 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 3481 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity);
michael@0 3482 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, 50);
michael@0 3483 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity);
michael@0 3484 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, Infinity);
michael@0 3485 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, 50);
michael@0 3486 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50);
michael@0 3487 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 3488 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity);
michael@0 3489 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, 50);
michael@0 3490 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity);
michael@0 3491 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, Infinity);
michael@0 3492 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, 50);
michael@0 3493 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity);
michael@0 3494 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, Infinity);
michael@0 3495 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, Infinity);
michael@0 3496 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3497
michael@0 3498 } catch (e) {
michael@0 3499 _thrown_outer = true;
michael@0 3500 }
michael@0 3501 ok(!_thrown_outer, 'should not throw exception');
michael@0 3502
michael@0 3503
michael@0 3504 }
michael@0 3505 </script>
michael@0 3506 <img src="image_red.png" id="red_10.png" class="resource">
michael@0 3507
michael@0 3508 <!-- [[[ test_2d.drawImage.nowrap.html ]]] -->
michael@0 3509
michael@0 3510 <p>Canvas test: 2d.drawImage.nowrap</p>
michael@0 3511 <!-- Testing: Stretched images do not get pixels wrapping around the edges -->
michael@0 3512 <canvas id="c120" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3513 <script>
michael@0 3514
michael@0 3515
michael@0 3516 function test_2d_drawImage_nowrap() {
michael@0 3517
michael@0 3518 var canvas = document.getElementById('c120');
michael@0 3519 var ctx = canvas.getContext('2d');
michael@0 3520
michael@0 3521 ctx.fillStyle = '#0f0';
michael@0 3522 ctx.fillRect(0, 0, 100, 50);
michael@0 3523 ctx.drawImage(document.getElementById('redtransparent_1.png'), -1950, 0, 2000, 50);
michael@0 3524 isPixel(ctx, 45,25, 0,255,0,255, 2);
michael@0 3525 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3526 isPixel(ctx, 55,25, 0,255,0,255, 2);
michael@0 3527
michael@0 3528
michael@0 3529 }
michael@0 3530 </script>
michael@0 3531 <img src="image_redtransparent.png" id="redtransparent_1.png" class="resource">
michael@0 3532
michael@0 3533 <!-- [[[ test_2d.drawImage.null.html ]]] -->
michael@0 3534
michael@0 3535 <p>Canvas test: 2d.drawImage.null</p>
michael@0 3536 <canvas id="c121" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3537 <script>
michael@0 3538
michael@0 3539 function test_2d_drawImage_null() {
michael@0 3540
michael@0 3541 var canvas = document.getElementById('c121');
michael@0 3542 var ctx = canvas.getContext('2d');
michael@0 3543
michael@0 3544 var _thrown = undefined; try {
michael@0 3545 ctx.drawImage(null, 0, 0);
michael@0 3546 } catch (e) { _thrown = e };
michael@0 3547
michael@0 3548 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 3549
michael@0 3550 }
michael@0 3551 </script>
michael@0 3552
michael@0 3553 <!-- [[[ test_2d.drawImage.outsidesource.html ]]] -->
michael@0 3554
michael@0 3555 <p>Canvas test: 2d.drawImage.outsidesource</p>
michael@0 3556 <canvas id="c122" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3557 <script>
michael@0 3558
michael@0 3559
michael@0 3560
michael@0 3561 function test_2d_drawImage_outsidesource() {
michael@0 3562
michael@0 3563 var canvas = document.getElementById('c122');
michael@0 3564 var ctx = canvas.getContext('2d');
michael@0 3565
michael@0 3566 var _thrown_outer = false;
michael@0 3567 try {
michael@0 3568
michael@0 3569 ctx.drawImage(document.getElementById('green_7.png'), 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50);
michael@0 3570 ctx.drawImage(document.getElementById('green_7.png'), 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50);
michael@0 3571 ctx.drawImage(document.getElementById('green_7.png'), 100, 50, -5, -5, 0, 0, 100, 50);
michael@0 3572 var _thrown = undefined; try {
michael@0 3573 ctx.drawImage(document.getElementById('red_11.png'), -0.001, 0, 100, 50, 0, 0, 100, 50);
michael@0 3574 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3575 var _thrown = undefined; try {
michael@0 3576 ctx.drawImage(document.getElementById('red_11.png'), 0, -0.001, 100, 50, 0, 0, 100, 50);
michael@0 3577 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3578 var _thrown = undefined; try {
michael@0 3579 ctx.drawImage(document.getElementById('red_11.png'), 0, 0, 100.001, 50, 0, 0, 100, 50);
michael@0 3580 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3581 var _thrown = undefined; try {
michael@0 3582 ctx.drawImage(document.getElementById('red_11.png'), 0, 0, 100, 50.001, 0, 0, 100, 50);
michael@0 3583 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3584 var _thrown = undefined; try {
michael@0 3585 ctx.drawImage(document.getElementById('red_11.png'), 50, 0, 50.001, 50, 0, 0, 100, 50);
michael@0 3586 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3587 var _thrown = undefined; try {
michael@0 3588 ctx.drawImage(document.getElementById('red_11.png'), 0, 0, -5, 5, 0, 0, 100, 50);
michael@0 3589 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3590 var _thrown = undefined; try {
michael@0 3591 ctx.drawImage(document.getElementById('red_11.png'), 0, 0, 5, -5, 0, 0, 100, 50);
michael@0 3592 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3593 var _thrown = undefined; try {
michael@0 3594 ctx.drawImage(document.getElementById('red_11.png'), 110, 60, -20, -20, 0, 0, 100, 50);
michael@0 3595 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3596 todo_isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3597
michael@0 3598 } catch (e) {
michael@0 3599 _thrown_outer = true;
michael@0 3600 }
michael@0 3601 todo(!_thrown_outer, 'should not throw exception');
michael@0 3602
michael@0 3603
michael@0 3604 }
michael@0 3605 </script>
michael@0 3606 <img src="image_green.png" id="green_7.png" class="resource">
michael@0 3607 <img src="image_red.png" id="red_11.png" class="resource">
michael@0 3608
michael@0 3609 <!-- [[[ test_2d.drawImage.path.html ]]] -->
michael@0 3610
michael@0 3611 <p>Canvas test: 2d.drawImage.path</p>
michael@0 3612 <canvas id="c123" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3613 <script>
michael@0 3614
michael@0 3615
michael@0 3616 function test_2d_drawImage_path() {
michael@0 3617
michael@0 3618 var canvas = document.getElementById('c123');
michael@0 3619 var ctx = canvas.getContext('2d');
michael@0 3620
michael@0 3621 ctx.fillStyle = '#0f0';
michael@0 3622 ctx.rect(0, 0, 100, 50);
michael@0 3623 ctx.drawImage(document.getElementById('red_12.png'), 0, 0);
michael@0 3624 ctx.fill();
michael@0 3625 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3626
michael@0 3627
michael@0 3628 }
michael@0 3629 </script>
michael@0 3630 <img src="image_red.png" id="red_12.png" class="resource">
michael@0 3631
michael@0 3632 <!-- [[[ test_2d.drawImage.self.1.html ]]] -->
michael@0 3633
michael@0 3634 <p>Canvas test: 2d.drawImage.self.1 - bug 433235</p>
michael@0 3635 <canvas id="c124" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3636 <script>
michael@0 3637
michael@0 3638
michael@0 3639 function test_2d_drawImage_self_1() {
michael@0 3640
michael@0 3641 var canvas = document.getElementById('c124');
michael@0 3642 var ctx = canvas.getContext('2d');
michael@0 3643
michael@0 3644 ctx.fillStyle = '#0f0';
michael@0 3645 ctx.fillRect(0, 0, 50, 50);
michael@0 3646 ctx.fillStyle = '#f00';
michael@0 3647 ctx.fillRect(50, 0, 50, 50);
michael@0 3648 ctx.drawImage(canvas, 50, 0);
michael@0 3649
michael@0 3650 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 3651 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 3652 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 3653 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 3654
michael@0 3655
michael@0 3656 }
michael@0 3657 </script>
michael@0 3658
michael@0 3659 <!-- [[[ test_2d.drawImage.self.2.html ]]] -->
michael@0 3660
michael@0 3661 <p>Canvas test: 2d.drawImage.self.2 - bug 433235</p>
michael@0 3662 <canvas id="c125" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3663 <script>
michael@0 3664
michael@0 3665
michael@0 3666 function test_2d_drawImage_self_2() {
michael@0 3667
michael@0 3668 var canvas = document.getElementById('c125');
michael@0 3669 var ctx = canvas.getContext('2d');
michael@0 3670
michael@0 3671 ctx.fillStyle = '#0f0';
michael@0 3672 ctx.fillRect(0, 1, 100, 49);
michael@0 3673 ctx.fillStyle = '#f00';
michael@0 3674 ctx.fillRect(0, 0, 100, 1);
michael@0 3675 ctx.drawImage(canvas, 0, 1);
michael@0 3676 ctx.fillStyle = '#0f0';
michael@0 3677 ctx.fillRect(0, 0, 100, 2);
michael@0 3678
michael@0 3679 isPixel(ctx, 0,0, 0,255,0,255, 2);
michael@0 3680 isPixel(ctx, 99,0, 0,255,0,255, 2);
michael@0 3681 isPixel(ctx, 0,49, 0,255,0,255, 2);
michael@0 3682 isPixel(ctx, 99,49, 0,255,0,255, 2);
michael@0 3683
michael@0 3684
michael@0 3685 }
michael@0 3686 </script>
michael@0 3687
michael@0 3688 <!-- [[[ test_2d.drawImage.transform.html ]]] -->
michael@0 3689
michael@0 3690 <p>Canvas test: 2d.drawImage.transform</p>
michael@0 3691 <canvas id="c126" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3692 <script>
michael@0 3693
michael@0 3694
michael@0 3695 function test_2d_drawImage_transform() {
michael@0 3696
michael@0 3697 var canvas = document.getElementById('c126');
michael@0 3698 var ctx = canvas.getContext('2d');
michael@0 3699
michael@0 3700 ctx.fillStyle = '#0f0';
michael@0 3701 ctx.fillRect(0, 0, 100, 50);
michael@0 3702 ctx.translate(100, 0);
michael@0 3703 ctx.drawImage(document.getElementById('red_13.png'), 0, 0);
michael@0 3704 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3705
michael@0 3706
michael@0 3707 }
michael@0 3708 </script>
michael@0 3709 <img src="image_red.png" id="red_13.png" class="resource">
michael@0 3710
michael@0 3711 <!-- [[[ test_2d.drawImage.wrongtype.html ]]] -->
michael@0 3712
michael@0 3713 <p>Canvas test: 2d.drawImage.wrongtype</p>
michael@0 3714 <canvas id="c127" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3715 <script>
michael@0 3716
michael@0 3717 function test_2d_drawImage_wrongtype() {
michael@0 3718
michael@0 3719 var canvas = document.getElementById('c127');
michael@0 3720 var ctx = canvas.getContext('2d');
michael@0 3721
michael@0 3722 var _thrown = undefined; try {
michael@0 3723 ctx.drawImage(undefined, 0, 0);
michael@0 3724 } catch (e) { _thrown = e };
michael@0 3725 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 3726
michael@0 3727 var _thrown = undefined; try {
michael@0 3728 ctx.drawImage(0, 0, 0);
michael@0 3729 } catch (e) { _thrown = e };
michael@0 3730 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 3731
michael@0 3732 var _thrown = undefined; try {
michael@0 3733 ctx.drawImage("", 0, 0);
michael@0 3734 } catch (e) { _thrown = e };
michael@0 3735 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 3736
michael@0 3737 var _thrown = undefined; try {
michael@0 3738 ctx.drawImage(document.createElement('p'), 0, 0);
michael@0 3739 } catch (e) { _thrown = e };
michael@0 3740 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 3741
michael@0 3742 }
michael@0 3743 </script>
michael@0 3744
michael@0 3745 <!-- [[[ test_2d.drawImage.zerosource.html ]]] -->
michael@0 3746
michael@0 3747 <p>Canvas test: 2d.drawImage.zerosource</p>
michael@0 3748 <!-- Testing: drawImage with zero-sized source rectangle throws INDEX_SIZE_ERR -->
michael@0 3749 <canvas id="c128" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3750 <script>
michael@0 3751
michael@0 3752
michael@0 3753 function test_2d_drawImage_zerosource() {
michael@0 3754
michael@0 3755 var canvas = document.getElementById('c128');
michael@0 3756 var ctx = canvas.getContext('2d');
michael@0 3757
michael@0 3758 ctx.fillStyle = '#0f0';
michael@0 3759 ctx.fillRect(0, 0, 100, 50);
michael@0 3760 var _thrown = undefined; try {
michael@0 3761 ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 0, 1, 0, 0, 100, 50);
michael@0 3762 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3763 var _thrown = undefined; try {
michael@0 3764 ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 1, 0, 0, 0, 100, 50);
michael@0 3765 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3766 var _thrown = undefined; try {
michael@0 3767 ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 0, 0, 0, 0, 100, 50);
michael@0 3768 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 3769 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 3770
michael@0 3771
michael@0 3772 }
michael@0 3773 </script>
michael@0 3774 <img src="image_red.png" id="red_14.png" class="resource">
michael@0 3775
michael@0 3776 <!-- [[[ test_2d.fillRect.basic.html ]]] -->
michael@0 3777
michael@0 3778 <p>Canvas test: 2d.fillRect.basic</p>
michael@0 3779 <canvas id="c129" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3780 <script>
michael@0 3781
michael@0 3782
michael@0 3783 function test_2d_fillRect_basic() {
michael@0 3784
michael@0 3785 var canvas = document.getElementById('c129');
michael@0 3786 var ctx = canvas.getContext('2d');
michael@0 3787
michael@0 3788 ctx.fillStyle = '#0f0';
michael@0 3789 ctx.fillRect(0, 0, 100, 50);
michael@0 3790 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3791
michael@0 3792
michael@0 3793 }
michael@0 3794 </script>
michael@0 3795
michael@0 3796 <!-- [[[ test_2d.fillRect.clip.html ]]] -->
michael@0 3797
michael@0 3798 <p>Canvas test: 2d.fillRect.clip</p>
michael@0 3799 <canvas id="c130" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3800 <script>
michael@0 3801
michael@0 3802
michael@0 3803 function test_2d_fillRect_clip() {
michael@0 3804
michael@0 3805 var canvas = document.getElementById('c130');
michael@0 3806 var ctx = canvas.getContext('2d');
michael@0 3807
michael@0 3808 ctx.fillStyle = '#0f0';
michael@0 3809 ctx.fillRect(0, 0, 100, 50);
michael@0 3810
michael@0 3811 ctx.beginPath();
michael@0 3812 ctx.rect(0, 0, 16, 16);
michael@0 3813 ctx.clip();
michael@0 3814
michael@0 3815 ctx.fillStyle = '#f00';
michael@0 3816 ctx.fillRect(0, 0, 100, 50);
michael@0 3817
michael@0 3818 ctx.fillStyle = '#0f0';
michael@0 3819 ctx.fillRect(0, 0, 16, 16);
michael@0 3820
michael@0 3821 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3822
michael@0 3823
michael@0 3824 }
michael@0 3825 </script>
michael@0 3826
michael@0 3827 <!-- [[[ test_2d.fillRect.negative.html ]]] -->
michael@0 3828
michael@0 3829 <p>Canvas test: 2d.fillRect.negative</p>
michael@0 3830 <canvas id="c131" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3831 <script>
michael@0 3832
michael@0 3833
michael@0 3834 function test_2d_fillRect_negative() {
michael@0 3835
michael@0 3836 var canvas = document.getElementById('c131');
michael@0 3837 var ctx = canvas.getContext('2d');
michael@0 3838
michael@0 3839 ctx.fillStyle = '#f00';
michael@0 3840 ctx.fillRect(0, 0, 100, 50);
michael@0 3841 ctx.fillStyle = '#0f0';
michael@0 3842 ctx.fillRect(0, 0, 50, 25);
michael@0 3843 ctx.fillRect(100, 0, -50, 25);
michael@0 3844 ctx.fillRect(0, 50, 50, -25);
michael@0 3845 ctx.fillRect(100, 50, -50, -25);
michael@0 3846 isPixel(ctx, 25,12, 0,255,0,255, 0);
michael@0 3847 isPixel(ctx, 75,12, 0,255,0,255, 0);
michael@0 3848 isPixel(ctx, 25,37, 0,255,0,255, 0);
michael@0 3849 isPixel(ctx, 75,37, 0,255,0,255, 0);
michael@0 3850
michael@0 3851
michael@0 3852 }
michael@0 3853 </script>
michael@0 3854
michael@0 3855 <!-- [[[ test_2d.fillRect.nonfinite.html ]]] -->
michael@0 3856
michael@0 3857 <p>Canvas test: 2d.fillRect.nonfinite</p>
michael@0 3858 <!-- Testing: fillRect() with Infinity/NaN is ignored -->
michael@0 3859 <canvas id="c132" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3860 <script>
michael@0 3861
michael@0 3862
michael@0 3863 function test_2d_fillRect_nonfinite() {
michael@0 3864
michael@0 3865 var canvas = document.getElementById('c132');
michael@0 3866 var ctx = canvas.getContext('2d');
michael@0 3867
michael@0 3868 var _thrown_outer = false;
michael@0 3869 try {
michael@0 3870
michael@0 3871 ctx.fillStyle = '#0f0';
michael@0 3872 ctx.fillRect(0, 0, 100, 50);
michael@0 3873
michael@0 3874 ctx.fillStyle = '#f00';
michael@0 3875 ctx.fillRect(Infinity, 0, 100, 50);
michael@0 3876 ctx.fillRect(-Infinity, 0, 100, 50);
michael@0 3877 ctx.fillRect(NaN, 0, 100, 50);
michael@0 3878 ctx.fillRect(0, Infinity, 100, 50);
michael@0 3879 ctx.fillRect(0, -Infinity, 100, 50);
michael@0 3880 ctx.fillRect(0, NaN, 100, 50);
michael@0 3881 ctx.fillRect(0, 0, Infinity, 50);
michael@0 3882 ctx.fillRect(0, 0, -Infinity, 50);
michael@0 3883 ctx.fillRect(0, 0, NaN, 50);
michael@0 3884 ctx.fillRect(0, 0, 100, Infinity);
michael@0 3885 ctx.fillRect(0, 0, 100, -Infinity);
michael@0 3886 ctx.fillRect(0, 0, 100, NaN);
michael@0 3887 ctx.fillRect(Infinity, Infinity, 100, 50);
michael@0 3888 ctx.fillRect(Infinity, Infinity, Infinity, 50);
michael@0 3889 ctx.fillRect(Infinity, Infinity, Infinity, Infinity);
michael@0 3890 ctx.fillRect(Infinity, Infinity, 100, Infinity);
michael@0 3891 ctx.fillRect(Infinity, 0, Infinity, 50);
michael@0 3892 ctx.fillRect(Infinity, 0, Infinity, Infinity);
michael@0 3893 ctx.fillRect(Infinity, 0, 100, Infinity);
michael@0 3894 ctx.fillRect(0, Infinity, Infinity, 50);
michael@0 3895 ctx.fillRect(0, Infinity, Infinity, Infinity);
michael@0 3896 ctx.fillRect(0, Infinity, 100, Infinity);
michael@0 3897 ctx.fillRect(0, 0, Infinity, Infinity);
michael@0 3898
michael@0 3899 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3900
michael@0 3901 } catch (e) {
michael@0 3902 _thrown_outer = true;
michael@0 3903 }
michael@0 3904 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 3905
michael@0 3906
michael@0 3907 }
michael@0 3908 </script>
michael@0 3909
michael@0 3910 <!-- [[[ test_2d.fillRect.path.html ]]] -->
michael@0 3911
michael@0 3912 <p>Canvas test: 2d.fillRect.path</p>
michael@0 3913 <canvas id="c133" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3914 <script>
michael@0 3915
michael@0 3916
michael@0 3917 function test_2d_fillRect_path() {
michael@0 3918
michael@0 3919 var canvas = document.getElementById('c133');
michael@0 3920 var ctx = canvas.getContext('2d');
michael@0 3921
michael@0 3922 ctx.beginPath();
michael@0 3923 ctx.rect(0, 0, 100, 50);
michael@0 3924 ctx.fillStyle = '#f00';
michael@0 3925 ctx.fillRect(0, 0, 16, 16);
michael@0 3926 ctx.fillStyle = '#0f0';
michael@0 3927 ctx.fill();
michael@0 3928 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3929
michael@0 3930
michael@0 3931 }
michael@0 3932 </script>
michael@0 3933
michael@0 3934 <!-- [[[ test_2d.fillRect.shadow.html ]]] -->
michael@0 3935
michael@0 3936 <p>Canvas test: 2d.fillRect.shadow</p>
michael@0 3937 <canvas id="c134" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3938 <script>
michael@0 3939
michael@0 3940
michael@0 3941 function test_2d_fillRect_shadow() {
michael@0 3942
michael@0 3943 var canvas = document.getElementById('c134');
michael@0 3944 var ctx = canvas.getContext('2d');
michael@0 3945
michael@0 3946 ctx.fillStyle = '#0f0';
michael@0 3947 ctx.fillRect(0, 0, 100, 50);
michael@0 3948
michael@0 3949 ctx.fillStyle = '#f00';
michael@0 3950 ctx.shadowBlur = 0;
michael@0 3951 ctx.shadowOffsetX = 0;
michael@0 3952 ctx.shadowOffsetY = 50;
michael@0 3953
michael@0 3954 // Shadows are optional, so just test that if they apply to fill() then they apply to fillRect() too
michael@0 3955 ctx.beginPath();
michael@0 3956 ctx.rect(0, -50, 100, 50);
michael@0 3957 ctx.shadowColor = '#f00';
michael@0 3958 ctx.fill();
michael@0 3959
michael@0 3960 ctx.shadowColor = '#0f0';
michael@0 3961 ctx.fillRect(0, -50, 100, 50);
michael@0 3962
michael@0 3963 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3964
michael@0 3965
michael@0 3966 }
michael@0 3967 </script>
michael@0 3968
michael@0 3969 <!-- [[[ test_2d.fillRect.transform.html ]]] -->
michael@0 3970
michael@0 3971 <p>Canvas test: 2d.fillRect.transform</p>
michael@0 3972 <canvas id="c135" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3973 <script>
michael@0 3974
michael@0 3975
michael@0 3976 function test_2d_fillRect_transform() {
michael@0 3977
michael@0 3978 var canvas = document.getElementById('c135');
michael@0 3979 var ctx = canvas.getContext('2d');
michael@0 3980
michael@0 3981 ctx.scale(10, 10);
michael@0 3982 ctx.translate(0, 5);
michael@0 3983 ctx.fillStyle = '#0f0';
michael@0 3984 ctx.fillRect(0, -5, 10, 5);
michael@0 3985 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 3986
michael@0 3987
michael@0 3988 }
michael@0 3989 </script>
michael@0 3990
michael@0 3991 <!-- [[[ test_2d.fillRect.zero.html ]]] -->
michael@0 3992
michael@0 3993 <p>Canvas test: 2d.fillRect.zero</p>
michael@0 3994 <canvas id="c136" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 3995 <script>
michael@0 3996
michael@0 3997
michael@0 3998 function test_2d_fillRect_zero() {
michael@0 3999
michael@0 4000 var canvas = document.getElementById('c136');
michael@0 4001 var ctx = canvas.getContext('2d');
michael@0 4002
michael@0 4003 ctx.fillStyle = '#0f0';
michael@0 4004 ctx.fillRect(0, 0, 100, 50);
michael@0 4005 ctx.fillStyle = '#f00';
michael@0 4006 ctx.fillRect(0, 0, 100, 0);
michael@0 4007 ctx.fillRect(0, 0, 0, 50);
michael@0 4008 ctx.fillRect(0, 0, 0, 0);
michael@0 4009 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4010
michael@0 4011
michael@0 4012 }
michael@0 4013 </script>
michael@0 4014
michael@0 4015 <!-- [[[ test_2d.fillStyle.default.html ]]] -->
michael@0 4016
michael@0 4017 <p>Canvas test: 2d.fillStyle.default</p>
michael@0 4018 <canvas id="c137" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4019 <script>
michael@0 4020
michael@0 4021 function test_2d_fillStyle_default() {
michael@0 4022
michael@0 4023 var canvas = document.getElementById('c137');
michael@0 4024 var ctx = canvas.getContext('2d');
michael@0 4025
michael@0 4026 ok(ctx.fillStyle == '#000000', "ctx.fillStyle == '#000000'");
michael@0 4027
michael@0 4028
michael@0 4029 }
michael@0 4030 </script>
michael@0 4031
michael@0 4032 <!-- [[[ test_2d.fillStyle.get.semitransparent.html ]]] -->
michael@0 4033
michael@0 4034 <p>Canvas test: 2d.fillStyle.get.semitransparent</p>
michael@0 4035 <canvas id="c138" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4036 <script>
michael@0 4037
michael@0 4038 function test_2d_fillStyle_get_semitransparent() {
michael@0 4039
michael@0 4040 var canvas = document.getElementById('c138');
michael@0 4041 var ctx = canvas.getContext('2d');
michael@0 4042
michael@0 4043 ctx.fillStyle = 'rgba(255,255,255,0.45)';
michael@0 4044 ok(/^rgba\(255, 255, 255, 0\.4\d+\)$/.test(ctx.fillStyle), "ctx.fillStyle =~ /^rgba\\(255, 255, 255, 0\\.4\\d+\\)$/");
michael@0 4045
michael@0 4046
michael@0 4047 }
michael@0 4048 </script>
michael@0 4049
michael@0 4050 <!-- [[[ test_2d.fillStyle.get.solid.html ]]] -->
michael@0 4051
michael@0 4052 <p>Canvas test: 2d.fillStyle.get.solid</p>
michael@0 4053 <canvas id="c139" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4054 <script>
michael@0 4055
michael@0 4056 function test_2d_fillStyle_get_solid() {
michael@0 4057
michael@0 4058 var canvas = document.getElementById('c139');
michael@0 4059 var ctx = canvas.getContext('2d');
michael@0 4060
michael@0 4061 ctx.fillStyle = '#fa0';
michael@0 4062 ok(ctx.fillStyle === '#ffaa00', "ctx.fillStyle === '#ffaa00'");
michael@0 4063
michael@0 4064
michael@0 4065 }
michael@0 4066 </script>
michael@0 4067
michael@0 4068 <!-- [[[ test_2d.fillStyle.get.transparent.html ]]] -->
michael@0 4069
michael@0 4070 <p>Canvas test: 2d.fillStyle.get.transparent</p>
michael@0 4071 <canvas id="c140" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4072 <script>
michael@0 4073
michael@0 4074 function test_2d_fillStyle_get_transparent() {
michael@0 4075
michael@0 4076 var canvas = document.getElementById('c140');
michael@0 4077 var ctx = canvas.getContext('2d');
michael@0 4078
michael@0 4079 ctx.fillStyle = 'rgba(0,0,0,0)';
michael@0 4080 is(ctx.fillStyle, 'rgba(0, 0, 0, 0)', "ctx.fillStyle should be what we set it to");
michael@0 4081
michael@0 4082
michael@0 4083 }
michael@0 4084 </script>
michael@0 4085
michael@0 4086 <!-- [[[ test_2d.fillStyle.invalidstring.html ]]] -->
michael@0 4087
michael@0 4088 <p>Canvas test: 2d.fillStyle.invalidstring</p>
michael@0 4089 <canvas id="c141" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4090 <script>
michael@0 4091
michael@0 4092
michael@0 4093 function test_2d_fillStyle_invalidstring() {
michael@0 4094
michael@0 4095 var canvas = document.getElementById('c141');
michael@0 4096 var ctx = canvas.getContext('2d');
michael@0 4097
michael@0 4098 ctx.fillStyle = '#f00';
michael@0 4099 ctx.fillRect(0, 0, 100, 50);
michael@0 4100 ctx.fillStyle = '#0f0';
michael@0 4101 ctx.fillStyle = 'invalid';
michael@0 4102 ctx.fillRect(0, 0, 100, 50);
michael@0 4103 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4104
michael@0 4105
michael@0 4106 }
michael@0 4107 </script>
michael@0 4108
michael@0 4109 <!-- [[[ test_2d.fillStyle.invalidtype.html ]]] -->
michael@0 4110
michael@0 4111 <p>Canvas test: 2d.fillStyle.invalidtype</p>
michael@0 4112 <canvas id="c142" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4113 <script>
michael@0 4114
michael@0 4115
michael@0 4116 function test_2d_fillStyle_invalidtype() {
michael@0 4117
michael@0 4118 var canvas = document.getElementById('c142');
michael@0 4119 var ctx = canvas.getContext('2d');
michael@0 4120
michael@0 4121 ctx.fillStyle = '#f00';
michael@0 4122 ctx.fillRect(0, 0, 100, 50);
michael@0 4123 ctx.fillStyle = '#0f0';
michael@0 4124 ctx.fillStyle = null;
michael@0 4125 ctx.fillRect(0, 0, 100, 50);
michael@0 4126 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4127
michael@0 4128
michael@0 4129 }
michael@0 4130 </script>
michael@0 4131
michael@0 4132 <!-- [[[ test_2d.fillStyle.parse.current.basic.html ]]] -->
michael@0 4133
michael@0 4134 <p>Canvas test: 2d.fillStyle.parse.current.basic</p>
michael@0 4135 <!-- Testing: currentColor is computed from the canvas element -->
michael@0 4136 <canvas id="c143" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4137 <script>
michael@0 4138
michael@0 4139
michael@0 4140
michael@0 4141 function test_2d_fillStyle_parse_current_basic() {
michael@0 4142
michael@0 4143 var canvas = document.getElementById('c143');
michael@0 4144 var ctx = canvas.getContext('2d');
michael@0 4145
michael@0 4146 canvas.setAttribute('style', 'color: #0f0');
michael@0 4147 ctx.fillStyle = '#f00';
michael@0 4148 ctx.fillStyle = 'currentColor';
michael@0 4149 ctx.fillRect(0, 0, 100, 50);
michael@0 4150 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4151
michael@0 4152
michael@0 4153 }
michael@0 4154 </script>
michael@0 4155
michael@0 4156 <!-- [[[ test_2d.fillStyle.parse.current.changed.html ]]] -->
michael@0 4157
michael@0 4158 <p>Canvas test: 2d.fillStyle.parse.current.changed</p>
michael@0 4159 <!-- Testing: currentColor is computed when the attribute is set, not when it is painted -->
michael@0 4160 <canvas id="c144" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4161 <script>
michael@0 4162
michael@0 4163
michael@0 4164
michael@0 4165 function test_2d_fillStyle_parse_current_changed() {
michael@0 4166
michael@0 4167 var canvas = document.getElementById('c144');
michael@0 4168 var ctx = canvas.getContext('2d');
michael@0 4169
michael@0 4170 canvas.setAttribute('style', 'color: #0f0');
michael@0 4171 ctx.fillStyle = '#f00';
michael@0 4172 ctx.fillStyle = 'currentColor';
michael@0 4173 canvas.setAttribute('style', 'color: #f00');
michael@0 4174 ctx.fillRect(0, 0, 100, 50);
michael@0 4175 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4176
michael@0 4177
michael@0 4178 }
michael@0 4179 </script>
michael@0 4180
michael@0 4181 <!-- [[[ test_2d.fillStyle.parse.current.removed.html ]]] -->
michael@0 4182
michael@0 4183 <p>Canvas test: 2d.fillStyle.parse.current.removed</p>
michael@0 4184 <!-- Testing: currentColor is solid black when the canvas element is not in a document -->
michael@0 4185 <canvas id="c145" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4186 <script>
michael@0 4187
michael@0 4188
michael@0 4189
michael@0 4190 function test_2d_fillStyle_parse_current_removed() {
michael@0 4191
michael@0 4192 var canvas = document.getElementById('c145');
michael@0 4193 var ctx = canvas.getContext('2d');
michael@0 4194
michael@0 4195 // Try not to let it undetectably incorrectly pick up opaque-black
michael@0 4196 // from other parts of the document:
michael@0 4197 document.body.parentNode.setAttribute('style', 'color: #f00');
michael@0 4198 document.body.setAttribute('style', 'color: #f00');
michael@0 4199 canvas.setAttribute('style', 'color: #f00');
michael@0 4200
michael@0 4201 var canvas2 = document.createElement('canvas');
michael@0 4202 var ctx2 = canvas2.getContext('2d');
michael@0 4203 ctx2.fillStyle = '#f00';
michael@0 4204 ctx2.fillStyle = 'currentColor';
michael@0 4205 ctx2.fillRect(0, 0, 100, 50);
michael@0 4206 ctx.drawImage(canvas2, 0, 0);
michael@0 4207
michael@0 4208 document.body.parentNode.removeAttribute('style');
michael@0 4209 document.body.removeAttribute('style');
michael@0 4210
michael@0 4211 isPixel(ctx, 50,25, 0,0,0,255, 0);
michael@0 4212
michael@0 4213
michael@0 4214 }
michael@0 4215 </script>
michael@0 4216
michael@0 4217 <!-- [[[ test_2d.fillStyle.parse.hex3.html ]]] -->
michael@0 4218
michael@0 4219 <p>Canvas test: 2d.fillStyle.parse.hex3</p>
michael@0 4220 <canvas id="c146" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4221 <script>
michael@0 4222
michael@0 4223
michael@0 4224 function test_2d_fillStyle_parse_hex3() {
michael@0 4225
michael@0 4226 var canvas = document.getElementById('c146');
michael@0 4227 var ctx = canvas.getContext('2d');
michael@0 4228
michael@0 4229
michael@0 4230 ctx.fillStyle = '#f00';
michael@0 4231 ctx.fillStyle = '#0f0';
michael@0 4232 ctx.fillRect(0, 0, 100, 50);
michael@0 4233 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4234
michael@0 4235
michael@0 4236 }
michael@0 4237 </script>
michael@0 4238
michael@0 4239 <!-- [[[ test_2d.fillStyle.parse.hex6.html ]]] -->
michael@0 4240
michael@0 4241 <p>Canvas test: 2d.fillStyle.parse.hex6</p>
michael@0 4242 <canvas id="c147" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4243 <script>
michael@0 4244
michael@0 4245
michael@0 4246 function test_2d_fillStyle_parse_hex6() {
michael@0 4247
michael@0 4248 var canvas = document.getElementById('c147');
michael@0 4249 var ctx = canvas.getContext('2d');
michael@0 4250
michael@0 4251
michael@0 4252 ctx.fillStyle = '#f00';
michael@0 4253 ctx.fillStyle = '#00fF00';
michael@0 4254 ctx.fillRect(0, 0, 100, 50);
michael@0 4255 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4256
michael@0 4257
michael@0 4258 }
michael@0 4259 </script>
michael@0 4260
michael@0 4261 <!-- [[[ test_2d.fillStyle.parse.hsl-1.html ]]] -->
michael@0 4262
michael@0 4263 <p>Canvas test: 2d.fillStyle.parse.hsl-1</p>
michael@0 4264 <canvas id="c148" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4265 <script>
michael@0 4266
michael@0 4267
michael@0 4268 function test_2d_fillStyle_parse_hsl_1() {
michael@0 4269
michael@0 4270 var canvas = document.getElementById('c148');
michael@0 4271 var ctx = canvas.getContext('2d');
michael@0 4272
michael@0 4273
michael@0 4274 ctx.fillStyle = '#f00';
michael@0 4275 ctx.fillStyle = 'hsl(120, 100%, 50%)';
michael@0 4276 ctx.fillRect(0, 0, 100, 50);
michael@0 4277 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4278
michael@0 4279
michael@0 4280 }
michael@0 4281 </script>
michael@0 4282
michael@0 4283 <!-- [[[ test_2d.fillStyle.parse.hsl-2.html ]]] -->
michael@0 4284
michael@0 4285 <p>Canvas test: 2d.fillStyle.parse.hsl-2</p>
michael@0 4286 <canvas id="c149" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4287 <script>
michael@0 4288
michael@0 4289
michael@0 4290 function test_2d_fillStyle_parse_hsl_2() {
michael@0 4291
michael@0 4292 var canvas = document.getElementById('c149');
michael@0 4293 var ctx = canvas.getContext('2d');
michael@0 4294
michael@0 4295
michael@0 4296 ctx.fillStyle = '#f00';
michael@0 4297 ctx.fillStyle = 'hsl( -240 , 100% , 50% )';
michael@0 4298 ctx.fillRect(0, 0, 100, 50);
michael@0 4299 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4300
michael@0 4301
michael@0 4302 }
michael@0 4303 </script>
michael@0 4304
michael@0 4305 <!-- [[[ test_2d.fillStyle.parse.hsl-3.html ]]] -->
michael@0 4306
michael@0 4307 <p>Canvas test: 2d.fillStyle.parse.hsl-3</p>
michael@0 4308 <canvas id="c150" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4309 <script>
michael@0 4310
michael@0 4311
michael@0 4312 function test_2d_fillStyle_parse_hsl_3() {
michael@0 4313
michael@0 4314 var canvas = document.getElementById('c150');
michael@0 4315 var ctx = canvas.getContext('2d');
michael@0 4316
michael@0 4317
michael@0 4318 ctx.fillStyle = '#f00';
michael@0 4319 ctx.fillStyle = 'hsl(360120, 100%, 50%)';
michael@0 4320 ctx.fillRect(0, 0, 100, 50);
michael@0 4321 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4322
michael@0 4323
michael@0 4324 }
michael@0 4325 </script>
michael@0 4326
michael@0 4327 <!-- [[[ test_2d.fillStyle.parse.hsl-4.html ]]] -->
michael@0 4328
michael@0 4329 <p>Canvas test: 2d.fillStyle.parse.hsl-4</p>
michael@0 4330 <canvas id="c151" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4331 <script>
michael@0 4332
michael@0 4333
michael@0 4334 function test_2d_fillStyle_parse_hsl_4() {
michael@0 4335
michael@0 4336 var canvas = document.getElementById('c151');
michael@0 4337 var ctx = canvas.getContext('2d');
michael@0 4338
michael@0 4339
michael@0 4340 ctx.fillStyle = '#f00';
michael@0 4341 ctx.fillStyle = 'hsl(-360240, 100%, 50%)';
michael@0 4342 ctx.fillRect(0, 0, 100, 50);
michael@0 4343 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4344
michael@0 4345
michael@0 4346 }
michael@0 4347 </script>
michael@0 4348
michael@0 4349 <!-- [[[ test_2d.fillStyle.parse.hsl-5.html ]]] -->
michael@0 4350
michael@0 4351 <p>Canvas test: 2d.fillStyle.parse.hsl-5</p>
michael@0 4352 <canvas id="c152" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4353 <script>
michael@0 4354
michael@0 4355
michael@0 4356 function test_2d_fillStyle_parse_hsl_5() {
michael@0 4357
michael@0 4358 var canvas = document.getElementById('c152');
michael@0 4359 var ctx = canvas.getContext('2d');
michael@0 4360
michael@0 4361
michael@0 4362 ctx.fillStyle = '#f00';
michael@0 4363 ctx.fillStyle = 'hsl(120.0, 100.0%, 50.0%)';
michael@0 4364 ctx.fillRect(0, 0, 100, 50);
michael@0 4365 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4366
michael@0 4367
michael@0 4368 }
michael@0 4369 </script>
michael@0 4370
michael@0 4371 <!-- [[[ test_2d.fillStyle.parse.hsl-clamp-1.html ]]] -->
michael@0 4372
michael@0 4373 <p>Canvas test: 2d.fillStyle.parse.hsl-clamp-1</p>
michael@0 4374 <canvas id="c153" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4375 <script>
michael@0 4376
michael@0 4377
michael@0 4378 function test_2d_fillStyle_parse_hsl_clamp_1() {
michael@0 4379
michael@0 4380 var canvas = document.getElementById('c153');
michael@0 4381 var ctx = canvas.getContext('2d');
michael@0 4382
michael@0 4383
michael@0 4384 ctx.fillStyle = '#f00';
michael@0 4385 ctx.fillStyle = 'hsl(120, 200%, 50%)';
michael@0 4386 ctx.fillRect(0, 0, 100, 50);
michael@0 4387 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4388
michael@0 4389
michael@0 4390 }
michael@0 4391 </script>
michael@0 4392
michael@0 4393 <!-- [[[ test_2d.fillStyle.parse.hsl-clamp-2.html ]]] -->
michael@0 4394
michael@0 4395 <p>Canvas test: 2d.fillStyle.parse.hsl-clamp-2</p>
michael@0 4396 <canvas id="c154" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4397 <script>
michael@0 4398
michael@0 4399
michael@0 4400 function test_2d_fillStyle_parse_hsl_clamp_2() {
michael@0 4401
michael@0 4402 var canvas = document.getElementById('c154');
michael@0 4403 var ctx = canvas.getContext('2d');
michael@0 4404
michael@0 4405
michael@0 4406 ctx.fillStyle = '#f00';
michael@0 4407 ctx.fillStyle = 'hsl(120, -200%, 49.9%)';
michael@0 4408 ctx.fillRect(0, 0, 100, 50);
michael@0 4409 isPixel(ctx, 50,25, 127,127,127,255, 0);
michael@0 4410
michael@0 4411
michael@0 4412 }
michael@0 4413 </script>
michael@0 4414
michael@0 4415 <!-- [[[ test_2d.fillStyle.parse.hsl-clamp-3.html ]]] -->
michael@0 4416
michael@0 4417 <p>Canvas test: 2d.fillStyle.parse.hsl-clamp-3</p>
michael@0 4418 <canvas id="c155" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4419 <script>
michael@0 4420
michael@0 4421
michael@0 4422 function test_2d_fillStyle_parse_hsl_clamp_3() {
michael@0 4423
michael@0 4424 var canvas = document.getElementById('c155');
michael@0 4425 var ctx = canvas.getContext('2d');
michael@0 4426
michael@0 4427
michael@0 4428 ctx.fillStyle = '#f00';
michael@0 4429 ctx.fillStyle = 'hsl(120, 100%, 200%)';
michael@0 4430 ctx.fillRect(0, 0, 100, 50);
michael@0 4431 isPixel(ctx, 50,25, 255,255,255,255, 0);
michael@0 4432
michael@0 4433
michael@0 4434 }
michael@0 4435 </script>
michael@0 4436
michael@0 4437 <!-- [[[ test_2d.fillStyle.parse.hsl-clamp-4.html ]]] -->
michael@0 4438
michael@0 4439 <p>Canvas test: 2d.fillStyle.parse.hsl-clamp-4</p>
michael@0 4440 <canvas id="c156" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4441 <script>
michael@0 4442
michael@0 4443
michael@0 4444 function test_2d_fillStyle_parse_hsl_clamp_4() {
michael@0 4445
michael@0 4446 var canvas = document.getElementById('c156');
michael@0 4447 var ctx = canvas.getContext('2d');
michael@0 4448
michael@0 4449
michael@0 4450 ctx.fillStyle = '#f00';
michael@0 4451 ctx.fillStyle = 'hsl(120, 100%, -200%)';
michael@0 4452 ctx.fillRect(0, 0, 100, 50);
michael@0 4453 isPixel(ctx, 50,25, 0,0,0,255, 0);
michael@0 4454
michael@0 4455
michael@0 4456 }
michael@0 4457 </script>
michael@0 4458
michael@0 4459 <!-- [[[ test_2d.fillStyle.parse.hsla-1.html ]]] -->
michael@0 4460
michael@0 4461 <p>Canvas test: 2d.fillStyle.parse.hsla-1</p>
michael@0 4462 <canvas id="c157" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4463 <script>
michael@0 4464
michael@0 4465
michael@0 4466 function test_2d_fillStyle_parse_hsla_1() {
michael@0 4467
michael@0 4468 var canvas = document.getElementById('c157');
michael@0 4469 var ctx = canvas.getContext('2d');
michael@0 4470
michael@0 4471
michael@0 4472 ctx.fillStyle = '#f00';
michael@0 4473 ctx.fillStyle = 'hsla(120, 100%, 50%, 0.499)';
michael@0 4474 ctx.fillRect(0, 0, 100, 50);
michael@0 4475 isPixel(ctx, 50,25, 0,255,0,127, 0);
michael@0 4476
michael@0 4477
michael@0 4478 }
michael@0 4479 </script>
michael@0 4480
michael@0 4481 <!-- [[[ test_2d.fillStyle.parse.hsla-2.html ]]] -->
michael@0 4482
michael@0 4483 <p>Canvas test: 2d.fillStyle.parse.hsla-2</p>
michael@0 4484 <canvas id="c158" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4485 <script>
michael@0 4486
michael@0 4487
michael@0 4488 function test_2d_fillStyle_parse_hsla_2() {
michael@0 4489
michael@0 4490 var canvas = document.getElementById('c158');
michael@0 4491 var ctx = canvas.getContext('2d');
michael@0 4492
michael@0 4493
michael@0 4494 ctx.fillStyle = '#f00';
michael@0 4495 ctx.fillStyle = 'hsla( 120.0 , 100.0% , 50.0% , 1 )';
michael@0 4496 ctx.fillRect(0, 0, 100, 50);
michael@0 4497 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4498
michael@0 4499
michael@0 4500 }
michael@0 4501 </script>
michael@0 4502
michael@0 4503 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-1.html ]]] -->
michael@0 4504
michael@0 4505 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-1</p>
michael@0 4506 <canvas id="c159" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4507 <script>
michael@0 4508
michael@0 4509
michael@0 4510 function test_2d_fillStyle_parse_hsla_clamp_1() {
michael@0 4511
michael@0 4512 var canvas = document.getElementById('c159');
michael@0 4513 var ctx = canvas.getContext('2d');
michael@0 4514
michael@0 4515
michael@0 4516 ctx.fillStyle = '#f00';
michael@0 4517 ctx.fillStyle = 'hsla(120, 200%, 50%, 1)';
michael@0 4518 ctx.fillRect(0, 0, 100, 50);
michael@0 4519 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4520
michael@0 4521
michael@0 4522 }
michael@0 4523 </script>
michael@0 4524
michael@0 4525 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-2.html ]]] -->
michael@0 4526
michael@0 4527 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-2</p>
michael@0 4528 <canvas id="c160" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4529 <script>
michael@0 4530
michael@0 4531
michael@0 4532 function test_2d_fillStyle_parse_hsla_clamp_2() {
michael@0 4533
michael@0 4534 var canvas = document.getElementById('c160');
michael@0 4535 var ctx = canvas.getContext('2d');
michael@0 4536
michael@0 4537
michael@0 4538 ctx.fillStyle = '#f00';
michael@0 4539 ctx.fillStyle = 'hsla(120, -200%, 49.9%, 1)';
michael@0 4540 ctx.fillRect(0, 0, 100, 50);
michael@0 4541 isPixel(ctx, 50,25, 127,127,127,255, 0);
michael@0 4542
michael@0 4543
michael@0 4544 }
michael@0 4545 </script>
michael@0 4546
michael@0 4547 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-3.html ]]] -->
michael@0 4548
michael@0 4549 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-3</p>
michael@0 4550 <canvas id="c161" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4551 <script>
michael@0 4552
michael@0 4553
michael@0 4554 function test_2d_fillStyle_parse_hsla_clamp_3() {
michael@0 4555
michael@0 4556 var canvas = document.getElementById('c161');
michael@0 4557 var ctx = canvas.getContext('2d');
michael@0 4558
michael@0 4559
michael@0 4560 ctx.fillStyle = '#f00';
michael@0 4561 ctx.fillStyle = 'hsla(120, 100%, 200%, 1)';
michael@0 4562 ctx.fillRect(0, 0, 100, 50);
michael@0 4563 isPixel(ctx, 50,25, 255,255,255,255, 0);
michael@0 4564
michael@0 4565
michael@0 4566 }
michael@0 4567 </script>
michael@0 4568
michael@0 4569 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-4.html ]]] -->
michael@0 4570
michael@0 4571 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-4</p>
michael@0 4572 <canvas id="c162" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4573 <script>
michael@0 4574
michael@0 4575
michael@0 4576 function test_2d_fillStyle_parse_hsla_clamp_4() {
michael@0 4577
michael@0 4578 var canvas = document.getElementById('c162');
michael@0 4579 var ctx = canvas.getContext('2d');
michael@0 4580
michael@0 4581
michael@0 4582 ctx.fillStyle = '#f00';
michael@0 4583 ctx.fillStyle = 'hsla(120, 100%, -200%, 1)';
michael@0 4584 ctx.fillRect(0, 0, 100, 50);
michael@0 4585 isPixel(ctx, 50,25, 0,0,0,255, 0);
michael@0 4586
michael@0 4587
michael@0 4588 }
michael@0 4589 </script>
michael@0 4590
michael@0 4591 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-5.html ]]] -->
michael@0 4592
michael@0 4593 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-5</p>
michael@0 4594 <canvas id="c163" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4595 <script>
michael@0 4596
michael@0 4597
michael@0 4598 function test_2d_fillStyle_parse_hsla_clamp_5() {
michael@0 4599
michael@0 4600 var canvas = document.getElementById('c163');
michael@0 4601 var ctx = canvas.getContext('2d');
michael@0 4602
michael@0 4603
michael@0 4604 ctx.fillStyle = '#f00';
michael@0 4605 ctx.fillStyle = 'hsla(120, 100%, 50%, 2)';
michael@0 4606 ctx.fillRect(0, 0, 100, 50);
michael@0 4607 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4608
michael@0 4609
michael@0 4610 }
michael@0 4611 </script>
michael@0 4612
michael@0 4613 <!-- [[[ test_2d.fillStyle.parse.hsla-clamp-6.html ]]] -->
michael@0 4614
michael@0 4615 <p>Canvas test: 2d.fillStyle.parse.hsla-clamp-6</p>
michael@0 4616 <canvas id="c164" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4617 <script>
michael@0 4618
michael@0 4619
michael@0 4620 function test_2d_fillStyle_parse_hsla_clamp_6() {
michael@0 4621
michael@0 4622 var canvas = document.getElementById('c164');
michael@0 4623 var ctx = canvas.getContext('2d');
michael@0 4624
michael@0 4625
michael@0 4626 ctx.fillStyle = '#f00';
michael@0 4627 ctx.fillStyle = 'hsla(120, 100%, 0%, -2)';
michael@0 4628 ctx.fillRect(0, 0, 100, 50);
michael@0 4629 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 4630
michael@0 4631
michael@0 4632 }
michael@0 4633 </script>
michael@0 4634
michael@0 4635 <!-- [[[ test_2d.fillStyle.parse.html4.html ]]] -->
michael@0 4636
michael@0 4637 <p>Canvas test: 2d.fillStyle.parse.html4</p>
michael@0 4638 <canvas id="c165" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4639 <script>
michael@0 4640
michael@0 4641
michael@0 4642 function test_2d_fillStyle_parse_html4() {
michael@0 4643
michael@0 4644 var canvas = document.getElementById('c165');
michael@0 4645 var ctx = canvas.getContext('2d');
michael@0 4646
michael@0 4647
michael@0 4648 ctx.fillStyle = '#f00';
michael@0 4649 ctx.fillStyle = 'limE';
michael@0 4650 ctx.fillRect(0, 0, 100, 50);
michael@0 4651 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4652
michael@0 4653
michael@0 4654 }
michael@0 4655 </script>
michael@0 4656
michael@0 4657 <!-- [[[ test_2d.fillStyle.parse.invalid.hex3.html ]]] -->
michael@0 4658
michael@0 4659 <p>Canvas test: 2d.fillStyle.parse.invalid.hex3</p>
michael@0 4660 <canvas id="c166" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4661 <script>
michael@0 4662
michael@0 4663
michael@0 4664 function test_2d_fillStyle_parse_invalid_hex3() {
michael@0 4665
michael@0 4666 var canvas = document.getElementById('c166');
michael@0 4667 var ctx = canvas.getContext('2d');
michael@0 4668
michael@0 4669
michael@0 4670 ctx.fillStyle = '#0f0';
michael@0 4671 try { ctx.fillStyle = '#g00'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4672 ctx.fillRect(0, 0, 100, 50);
michael@0 4673 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4674
michael@0 4675
michael@0 4676 }
michael@0 4677 </script>
michael@0 4678
michael@0 4679 <!-- [[[ test_2d.fillStyle.parse.invalid.hex6.html ]]] -->
michael@0 4680
michael@0 4681 <p>Canvas test: 2d.fillStyle.parse.invalid.hex6</p>
michael@0 4682 <canvas id="c167" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4683 <script>
michael@0 4684
michael@0 4685
michael@0 4686 function test_2d_fillStyle_parse_invalid_hex6() {
michael@0 4687
michael@0 4688 var canvas = document.getElementById('c167');
michael@0 4689 var ctx = canvas.getContext('2d');
michael@0 4690
michael@0 4691
michael@0 4692 ctx.fillStyle = '#0f0';
michael@0 4693 try { ctx.fillStyle = '#fg0000'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4694 ctx.fillRect(0, 0, 100, 50);
michael@0 4695 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4696
michael@0 4697
michael@0 4698 }
michael@0 4699 </script>
michael@0 4700
michael@0 4701 <!-- [[[ test_2d.fillStyle.parse.invalid.hsl-1.html ]]] -->
michael@0 4702
michael@0 4703 <p>Canvas test: 2d.fillStyle.parse.invalid.hsl-1</p>
michael@0 4704 <canvas id="c168" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4705 <script>
michael@0 4706
michael@0 4707
michael@0 4708 function test_2d_fillStyle_parse_invalid_hsl_1() {
michael@0 4709
michael@0 4710 var canvas = document.getElementById('c168');
michael@0 4711 var ctx = canvas.getContext('2d');
michael@0 4712
michael@0 4713
michael@0 4714 ctx.fillStyle = '#0f0';
michael@0 4715 try { ctx.fillStyle = 'hsl(0%, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4716 ctx.fillRect(0, 0, 100, 50);
michael@0 4717 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4718
michael@0 4719
michael@0 4720 }
michael@0 4721 </script>
michael@0 4722
michael@0 4723 <!-- [[[ test_2d.fillStyle.parse.invalid.hsl-2.html ]]] -->
michael@0 4724
michael@0 4725 <p>Canvas test: 2d.fillStyle.parse.invalid.hsl-2</p>
michael@0 4726 <canvas id="c169" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4727 <script>
michael@0 4728
michael@0 4729
michael@0 4730 function test_2d_fillStyle_parse_invalid_hsl_2() {
michael@0 4731
michael@0 4732 var canvas = document.getElementById('c169');
michael@0 4733 var ctx = canvas.getContext('2d');
michael@0 4734
michael@0 4735
michael@0 4736 ctx.fillStyle = '#0f0';
michael@0 4737 try { ctx.fillStyle = 'hsl(z, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4738 ctx.fillRect(0, 0, 100, 50);
michael@0 4739 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4740
michael@0 4741
michael@0 4742 }
michael@0 4743 </script>
michael@0 4744
michael@0 4745 <!-- [[[ test_2d.fillStyle.parse.invalid.hsl-3.html ]]] -->
michael@0 4746
michael@0 4747 <p>Canvas test: 2d.fillStyle.parse.invalid.hsl-3</p>
michael@0 4748 <canvas id="c170" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4749 <script>
michael@0 4750
michael@0 4751
michael@0 4752 function test_2d_fillStyle_parse_invalid_hsl_3() {
michael@0 4753
michael@0 4754 var canvas = document.getElementById('c170');
michael@0 4755 var ctx = canvas.getContext('2d');
michael@0 4756
michael@0 4757
michael@0 4758 ctx.fillStyle = '#0f0';
michael@0 4759 try { ctx.fillStyle = 'hsl(0, 0, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4760 ctx.fillRect(0, 0, 100, 50);
michael@0 4761 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4762
michael@0 4763
michael@0 4764 }
michael@0 4765 </script>
michael@0 4766
michael@0 4767 <!-- [[[ test_2d.fillStyle.parse.invalid.hsl-4.html ]]] -->
michael@0 4768
michael@0 4769 <p>Canvas test: 2d.fillStyle.parse.invalid.hsl-4</p>
michael@0 4770 <canvas id="c171" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4771 <script>
michael@0 4772
michael@0 4773
michael@0 4774 function test_2d_fillStyle_parse_invalid_hsl_4() {
michael@0 4775
michael@0 4776 var canvas = document.getElementById('c171');
michael@0 4777 var ctx = canvas.getContext('2d');
michael@0 4778
michael@0 4779
michael@0 4780 ctx.fillStyle = '#0f0';
michael@0 4781 try { ctx.fillStyle = 'hsl(0, 100%, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4782 ctx.fillRect(0, 0, 100, 50);
michael@0 4783 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4784
michael@0 4785
michael@0 4786 }
michael@0 4787 </script>
michael@0 4788
michael@0 4789 <!-- [[[ test_2d.fillStyle.parse.invalid.hsl-5.html ]]] -->
michael@0 4790
michael@0 4791 <p>Canvas test: 2d.fillStyle.parse.invalid.hsl-5</p>
michael@0 4792 <canvas id="c172" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4793 <script>
michael@0 4794
michael@0 4795
michael@0 4796 function test_2d_fillStyle_parse_invalid_hsl_5() {
michael@0 4797
michael@0 4798 var canvas = document.getElementById('c172');
michael@0 4799 var ctx = canvas.getContext('2d');
michael@0 4800
michael@0 4801
michael@0 4802 ctx.fillStyle = '#0f0';
michael@0 4803 try { ctx.fillStyle = 'hsl(0, 100%, 100%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4804 ctx.fillRect(0, 0, 100, 50);
michael@0 4805 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4806
michael@0 4807
michael@0 4808 }
michael@0 4809 </script>
michael@0 4810
michael@0 4811 <!-- [[[ test_2d.fillStyle.parse.invalid.hsla-1.html ]]] -->
michael@0 4812
michael@0 4813 <p>Canvas test: 2d.fillStyle.parse.invalid.hsla-1</p>
michael@0 4814 <canvas id="c173" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4815 <script>
michael@0 4816
michael@0 4817
michael@0 4818 function test_2d_fillStyle_parse_invalid_hsla_1() {
michael@0 4819
michael@0 4820 var canvas = document.getElementById('c173');
michael@0 4821 var ctx = canvas.getContext('2d');
michael@0 4822
michael@0 4823
michael@0 4824 ctx.fillStyle = '#0f0';
michael@0 4825 try { ctx.fillStyle = 'hsla(0%, 100%, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4826 ctx.fillRect(0, 0, 100, 50);
michael@0 4827 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4828
michael@0 4829
michael@0 4830 }
michael@0 4831 </script>
michael@0 4832
michael@0 4833 <!-- [[[ test_2d.fillStyle.parse.invalid.hsla-2.html ]]] -->
michael@0 4834
michael@0 4835 <p>Canvas test: 2d.fillStyle.parse.invalid.hsla-2</p>
michael@0 4836 <canvas id="c174" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4837 <script>
michael@0 4838
michael@0 4839
michael@0 4840 function test_2d_fillStyle_parse_invalid_hsla_2() {
michael@0 4841
michael@0 4842 var canvas = document.getElementById('c174');
michael@0 4843 var ctx = canvas.getContext('2d');
michael@0 4844
michael@0 4845
michael@0 4846 ctx.fillStyle = '#0f0';
michael@0 4847 try { ctx.fillStyle = 'hsla(0, 0, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4848 ctx.fillRect(0, 0, 100, 50);
michael@0 4849 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4850
michael@0 4851
michael@0 4852 }
michael@0 4853 </script>
michael@0 4854
michael@0 4855 <!-- [[[ test_2d.fillStyle.parse.invalid.name-1.html ]]] -->
michael@0 4856
michael@0 4857 <p>Canvas test: 2d.fillStyle.parse.invalid.name-1</p>
michael@0 4858 <canvas id="c174a" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4859 <script>
michael@0 4860
michael@0 4861
michael@0 4862 function test_2d_fillStyle_parse_invalid_name_1() {
michael@0 4863
michael@0 4864 var canvas = document.getElementById('c174a');
michael@0 4865 var ctx = canvas.getContext('2d');
michael@0 4866
michael@0 4867 ctx.fillStyle = '#0f0';
michael@0 4868 try { ctx.fillStyle = 'darkbrown'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4869 ctx.fillRect(0, 0, 100, 50);
michael@0 4870 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4871
michael@0 4872
michael@0 4873 }
michael@0 4874 </script>
michael@0 4875
michael@0 4876 <!-- [[[ test_2d.fillStyle.parse.invalid.name-2.html ]]] -->
michael@0 4877
michael@0 4878 <p>Canvas test: 2d.fillStyle.parse.invalid.name-2</p>
michael@0 4879 <canvas id="c174b" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4880 <script>
michael@0 4881
michael@0 4882
michael@0 4883 function test_2d_fillStyle_parse_invalid_name_2() {
michael@0 4884
michael@0 4885 var canvas = document.getElementById('c174b');
michael@0 4886 var ctx = canvas.getContext('2d');
michael@0 4887
michael@0 4888 ctx.fillStyle = '#0f0';
michael@0 4889 try { ctx.fillStyle = 'firebrick1'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4890 ctx.fillRect(0, 0, 100, 50);
michael@0 4891 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4892
michael@0 4893
michael@0 4894 }
michael@0 4895 </script>
michael@0 4896
michael@0 4897 <!-- [[[ test_2d.fillStyle.parse.invalid.name-3.html ]]] -->
michael@0 4898
michael@0 4899 <p>Canvas test: 2d.fillStyle.parse.invalid.name-3</p>
michael@0 4900 <canvas id="c174c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4901 <script>
michael@0 4902
michael@0 4903
michael@0 4904 function test_2d_fillStyle_parse_invalid_name_3() {
michael@0 4905
michael@0 4906 var canvas = document.getElementById('c174c');
michael@0 4907 var ctx = canvas.getContext('2d');
michael@0 4908
michael@0 4909 ctx.fillStyle = '#0f0';
michael@0 4910 try { ctx.fillStyle = 'red blue'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4911 ctx.fillRect(0, 0, 100, 50);
michael@0 4912 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4913
michael@0 4914
michael@0 4915 }
michael@0 4916 </script>
michael@0 4917
michael@0 4918 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-1.html ]]] -->
michael@0 4919
michael@0 4920 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-1</p>
michael@0 4921 <canvas id="c175" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4922 <script>
michael@0 4923
michael@0 4924
michael@0 4925 function test_2d_fillStyle_parse_invalid_rgb_1() {
michael@0 4926
michael@0 4927 var canvas = document.getElementById('c175');
michael@0 4928 var ctx = canvas.getContext('2d');
michael@0 4929
michael@0 4930
michael@0 4931 ctx.fillStyle = '#0f0';
michael@0 4932 try { ctx.fillStyle = 'rgb(255.0, 0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4933 ctx.fillRect(0, 0, 100, 50);
michael@0 4934 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4935
michael@0 4936
michael@0 4937 }
michael@0 4938 </script>
michael@0 4939
michael@0 4940 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-2.html ]]] -->
michael@0 4941
michael@0 4942 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-2</p>
michael@0 4943 <canvas id="c176" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4944 <script>
michael@0 4945
michael@0 4946
michael@0 4947 function test_2d_fillStyle_parse_invalid_rgb_2() {
michael@0 4948
michael@0 4949 var canvas = document.getElementById('c176');
michael@0 4950 var ctx = canvas.getContext('2d');
michael@0 4951
michael@0 4952
michael@0 4953 ctx.fillStyle = '#0f0';
michael@0 4954 try { ctx.fillStyle = 'rgb(255, 0.0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4955 ctx.fillRect(0, 0, 100, 50);
michael@0 4956 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4957
michael@0 4958
michael@0 4959 }
michael@0 4960 </script>
michael@0 4961
michael@0 4962 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-3.html ]]] -->
michael@0 4963
michael@0 4964 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-3</p>
michael@0 4965 <canvas id="c177" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4966 <script>
michael@0 4967
michael@0 4968
michael@0 4969 function test_2d_fillStyle_parse_invalid_rgb_3() {
michael@0 4970
michael@0 4971 var canvas = document.getElementById('c177');
michael@0 4972 var ctx = canvas.getContext('2d');
michael@0 4973
michael@0 4974
michael@0 4975 ctx.fillStyle = '#0f0';
michael@0 4976 try { ctx.fillStyle = 'rgb(255.0, 0, 0,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4977 ctx.fillRect(0, 0, 100, 50);
michael@0 4978 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 4979
michael@0 4980
michael@0 4981 }
michael@0 4982 </script>
michael@0 4983
michael@0 4984 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-4.html ]]] -->
michael@0 4985
michael@0 4986 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-4</p>
michael@0 4987 <canvas id="c178" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 4988 <script>
michael@0 4989
michael@0 4990
michael@0 4991 function test_2d_fillStyle_parse_invalid_rgb_4() {
michael@0 4992
michael@0 4993 var canvas = document.getElementById('c178');
michael@0 4994 var ctx = canvas.getContext('2d');
michael@0 4995
michael@0 4996
michael@0 4997 ctx.fillStyle = '#0f0';
michael@0 4998 try { ctx.fillStyle = 'rgb(100%, 0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 4999 ctx.fillRect(0, 0, 100, 50);
michael@0 5000 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5001
michael@0 5002
michael@0 5003 }
michael@0 5004 </script>
michael@0 5005
michael@0 5006 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-5.html ]]] -->
michael@0 5007
michael@0 5008 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-5</p>
michael@0 5009 <canvas id="c179" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5010 <script>
michael@0 5011
michael@0 5012
michael@0 5013 function test_2d_fillStyle_parse_invalid_rgb_5() {
michael@0 5014
michael@0 5015 var canvas = document.getElementById('c179');
michael@0 5016 var ctx = canvas.getContext('2d');
michael@0 5017
michael@0 5018
michael@0 5019 ctx.fillStyle = '#0f0';
michael@0 5020 try { ctx.fillStyle = 'rgb(255 0 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5021 ctx.fillRect(0, 0, 100, 50);
michael@0 5022 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5023
michael@0 5024
michael@0 5025 }
michael@0 5026 </script>
michael@0 5027
michael@0 5028 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-6.html ]]] -->
michael@0 5029
michael@0 5030 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-6</p>
michael@0 5031 <canvas id="c180" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5032 <script>
michael@0 5033
michael@0 5034
michael@0 5035 function test_2d_fillStyle_parse_invalid_rgb_6() {
michael@0 5036
michael@0 5037 var canvas = document.getElementById('c180');
michael@0 5038 var ctx = canvas.getContext('2d');
michael@0 5039
michael@0 5040
michael@0 5041 ctx.fillStyle = '#0f0';
michael@0 5042 try { ctx.fillStyle = 'rgb(255, - 1, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5043 ctx.fillRect(0, 0, 100, 50);
michael@0 5044 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5045
michael@0 5046
michael@0 5047 }
michael@0 5048 </script>
michael@0 5049
michael@0 5050 <!-- [[[ test_2d.fillStyle.parse.invalid.rgb-7.html ]]] -->
michael@0 5051
michael@0 5052 <p>Canvas test: 2d.fillStyle.parse.invalid.rgb-7</p>
michael@0 5053 <canvas id="c181" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5054 <script>
michael@0 5055
michael@0 5056
michael@0 5057 function test_2d_fillStyle_parse_invalid_rgb_7() {
michael@0 5058
michael@0 5059 var canvas = document.getElementById('c181');
michael@0 5060 var ctx = canvas.getContext('2d');
michael@0 5061
michael@0 5062
michael@0 5063 ctx.fillStyle = '#0f0';
michael@0 5064 try { ctx.fillStyle = 'rgb(255, 0, 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5065 ctx.fillRect(0, 0, 100, 50);
michael@0 5066 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5067
michael@0 5068
michael@0 5069 }
michael@0 5070 </script>
michael@0 5071
michael@0 5072 <!-- [[[ test_2d.fillStyle.parse.invalid.rgba-1.html ]]] -->
michael@0 5073
michael@0 5074 <p>Canvas test: 2d.fillStyle.parse.invalid.rgba-1</p>
michael@0 5075 <canvas id="c182" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5076 <script>
michael@0 5077
michael@0 5078
michael@0 5079 function test_2d_fillStyle_parse_invalid_rgba_1() {
michael@0 5080
michael@0 5081 var canvas = document.getElementById('c182');
michael@0 5082 var ctx = canvas.getContext('2d');
michael@0 5083
michael@0 5084
michael@0 5085 ctx.fillStyle = '#0f0';
michael@0 5086 try { ctx.fillStyle = 'rgba(255, 0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5087 ctx.fillRect(0, 0, 100, 50);
michael@0 5088 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5089
michael@0 5090
michael@0 5091 }
michael@0 5092 </script>
michael@0 5093
michael@0 5094 <!-- [[[ test_2d.fillStyle.parse.invalid.rgba-2.html ]]] -->
michael@0 5095
michael@0 5096 <p>Canvas test: 2d.fillStyle.parse.invalid.rgba-2</p>
michael@0 5097 <canvas id="c183" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5098 <script>
michael@0 5099
michael@0 5100
michael@0 5101 function test_2d_fillStyle_parse_invalid_rgba_2() {
michael@0 5102
michael@0 5103 var canvas = document.getElementById('c183');
michael@0 5104 var ctx = canvas.getContext('2d');
michael@0 5105
michael@0 5106
michael@0 5107 ctx.fillStyle = '#0f0';
michael@0 5108 try { ctx.fillStyle = 'rgba(255.0, 0, 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5109 ctx.fillRect(0, 0, 100, 50);
michael@0 5110 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5111
michael@0 5112
michael@0 5113 }
michael@0 5114 </script>
michael@0 5115
michael@0 5116 <!-- [[[ test_2d.fillStyle.parse.invalid.rgba-3.html ]]] -->
michael@0 5117
michael@0 5118 <p>Canvas test: 2d.fillStyle.parse.invalid.rgba-3</p>
michael@0 5119 <canvas id="c184" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5120 <script>
michael@0 5121
michael@0 5122
michael@0 5123 function test_2d_fillStyle_parse_invalid_rgba_3() {
michael@0 5124
michael@0 5125 var canvas = document.getElementById('c184');
michael@0 5126 var ctx = canvas.getContext('2d');
michael@0 5127
michael@0 5128
michael@0 5129 ctx.fillStyle = '#0f0';
michael@0 5130 try { ctx.fillStyle = 'rgba(100%, 0, 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5131 ctx.fillRect(0, 0, 100, 50);
michael@0 5132 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5133
michael@0 5134
michael@0 5135 }
michael@0 5136 </script>
michael@0 5137
michael@0 5138 <!-- [[[ test_2d.fillStyle.parse.invalid.rgba-4.html ]]] -->
michael@0 5139
michael@0 5140 <p>Canvas test: 2d.fillStyle.parse.invalid.rgba-4</p>
michael@0 5141 <canvas id="c185" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5142 <script>
michael@0 5143
michael@0 5144
michael@0 5145 function test_2d_fillStyle_parse_invalid_rgba_4() {
michael@0 5146
michael@0 5147 var canvas = document.getElementById('c185');
michael@0 5148 var ctx = canvas.getContext('2d');
michael@0 5149
michael@0 5150
michael@0 5151 ctx.fillStyle = '#0f0';
michael@0 5152 try { ctx.fillStyle = 'rgba(255, 0, 0, 100%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5153 ctx.fillRect(0, 0, 100, 50);
michael@0 5154 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5155
michael@0 5156
michael@0 5157 }
michael@0 5158 </script>
michael@0 5159
michael@0 5160 <!-- [[[ test_2d.fillStyle.parse.invalid.rgba-5.html ]]] -->
michael@0 5161
michael@0 5162 <p>Canvas test: 2d.fillStyle.parse.invalid.rgba-5</p>
michael@0 5163 <canvas id="c186" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5164 <script>
michael@0 5165
michael@0 5166
michael@0 5167 function test_2d_fillStyle_parse_invalid_rgba_5() {
michael@0 5168
michael@0 5169 var canvas = document.getElementById('c186');
michael@0 5170 var ctx = canvas.getContext('2d');
michael@0 5171
michael@0 5172
michael@0 5173 ctx.fillStyle = '#0f0';
michael@0 5174 try { ctx.fillStyle = 'rgba(255, 0, 0, 1. 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does
michael@0 5175 ctx.fillRect(0, 0, 100, 50);
michael@0 5176 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5177
michael@0 5178
michael@0 5179 }
michael@0 5180 </script>
michael@0 5181
michael@0 5182 <!-- [[[ test_2d.fillStyle.parse.rgb-clamp-1.html ]]] -->
michael@0 5183
michael@0 5184 <p>Canvas test: 2d.fillStyle.parse.rgb-clamp-1</p>
michael@0 5185 <canvas id="c187" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5186 <script>
michael@0 5187
michael@0 5188
michael@0 5189 function test_2d_fillStyle_parse_rgb_clamp_1() {
michael@0 5190
michael@0 5191 var canvas = document.getElementById('c187');
michael@0 5192 var ctx = canvas.getContext('2d');
michael@0 5193
michael@0 5194
michael@0 5195 ctx.fillStyle = '#f00';
michael@0 5196 ctx.fillStyle = 'rgb(-1000, 1000, -1000)';
michael@0 5197 ctx.fillRect(0, 0, 100, 50);
michael@0 5198 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5199
michael@0 5200
michael@0 5201 }
michael@0 5202 </script>
michael@0 5203
michael@0 5204 <!-- [[[ test_2d.fillStyle.parse.rgb-clamp-2.html ]]] -->
michael@0 5205
michael@0 5206 <p>Canvas test: 2d.fillStyle.parse.rgb-clamp-2</p>
michael@0 5207 <canvas id="c188" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5208 <script>
michael@0 5209
michael@0 5210
michael@0 5211 function test_2d_fillStyle_parse_rgb_clamp_2() {
michael@0 5212
michael@0 5213 var canvas = document.getElementById('c188');
michael@0 5214 var ctx = canvas.getContext('2d');
michael@0 5215
michael@0 5216
michael@0 5217 ctx.fillStyle = '#f00';
michael@0 5218 ctx.fillStyle = 'rgb(-200%, 200%, -200%)';
michael@0 5219 ctx.fillRect(0, 0, 100, 50);
michael@0 5220 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5221
michael@0 5222
michael@0 5223 }
michael@0 5224 </script>
michael@0 5225
michael@0 5226 <!-- [[[ test_2d.fillStyle.parse.rgb-clamp-3.html ]]] -->
michael@0 5227
michael@0 5228 <p>Canvas test: 2d.fillStyle.parse.rgb-clamp-3</p>
michael@0 5229 <canvas id="c189" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5230 <script>
michael@0 5231
michael@0 5232
michael@0 5233 function test_2d_fillStyle_parse_rgb_clamp_3() {
michael@0 5234
michael@0 5235 var canvas = document.getElementById('c189');
michael@0 5236 var ctx = canvas.getContext('2d');
michael@0 5237
michael@0 5238
michael@0 5239 ctx.fillStyle = '#f00';
michael@0 5240 ctx.fillStyle = 'rgb(-2147483649, 4294967298, -18446744073709551619)';
michael@0 5241 ctx.fillRect(0, 0, 100, 50);
michael@0 5242 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5243
michael@0 5244
michael@0 5245 }
michael@0 5246 </script>
michael@0 5247
michael@0 5248 <!-- [[[ test_2d.fillStyle.parse.rgb-clamp-4.html ]]] -->
michael@0 5249
michael@0 5250 <p>Canvas test: 2d.fillStyle.parse.rgb-clamp-4</p>
michael@0 5251 <canvas id="c190" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5252 <script>
michael@0 5253
michael@0 5254
michael@0 5255 function test_2d_fillStyle_parse_rgb_clamp_4() {
michael@0 5256
michael@0 5257 var canvas = document.getElementById('c190');
michael@0 5258 var ctx = canvas.getContext('2d');
michael@0 5259
michael@0 5260
michael@0 5261 ctx.fillStyle = '#f00';
michael@0 5262 ctx.fillStyle = 'rgb(-1000000000000000000000000000000000000000, 1000000000000000000000000000000000000000, -1000000000000000000000000000000000000000)';
michael@0 5263 ctx.fillRect(0, 0, 100, 50);
michael@0 5264 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5265
michael@0 5266
michael@0 5267 }
michael@0 5268 </script>
michael@0 5269
michael@0 5270 <!-- [[[ test_2d.fillStyle.parse.rgb-clamp-5.html ]]] -->
michael@0 5271
michael@0 5272 <p>Canvas test: 2d.fillStyle.parse.rgb-clamp-5</p>
michael@0 5273 <canvas id="c191" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5274 <script>
michael@0 5275
michael@0 5276
michael@0 5277 function test_2d_fillStyle_parse_rgb_clamp_5() {
michael@0 5278
michael@0 5279 var canvas = document.getElementById('c191');
michael@0 5280 var ctx = canvas.getContext('2d');
michael@0 5281
michael@0 5282
michael@0 5283 ctx.fillStyle = '#f00';
michael@0 5284 ctx.fillStyle = 'rgb(-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)';
michael@0 5285 ctx.fillRect(0, 0, 100, 50);
michael@0 5286 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5287
michael@0 5288
michael@0 5289 }
michael@0 5290 </script>
michael@0 5291
michael@0 5292 <!-- [[[ test_2d.fillStyle.parse.rgb-num.html ]]] -->
michael@0 5293
michael@0 5294 <p>Canvas test: 2d.fillStyle.parse.rgb-num</p>
michael@0 5295 <canvas id="c192" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5296 <script>
michael@0 5297
michael@0 5298
michael@0 5299 function test_2d_fillStyle_parse_rgb_num() {
michael@0 5300
michael@0 5301 var canvas = document.getElementById('c192');
michael@0 5302 var ctx = canvas.getContext('2d');
michael@0 5303
michael@0 5304
michael@0 5305 ctx.fillStyle = '#f00';
michael@0 5306 ctx.fillStyle = 'rgb(0,255,0)';
michael@0 5307 ctx.fillRect(0, 0, 100, 50);
michael@0 5308 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5309
michael@0 5310
michael@0 5311 }
michael@0 5312 </script>
michael@0 5313
michael@0 5314 <!-- [[[ test_2d.fillStyle.parse.rgb-percent.html ]]] -->
michael@0 5315
michael@0 5316 <p>Canvas test: 2d.fillStyle.parse.rgb-percent</p>
michael@0 5317 <canvas id="c193" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5318 <script>
michael@0 5319
michael@0 5320
michael@0 5321 function test_2d_fillStyle_parse_rgb_percent() {
michael@0 5322
michael@0 5323 var canvas = document.getElementById('c193');
michael@0 5324 var ctx = canvas.getContext('2d');
michael@0 5325
michael@0 5326
michael@0 5327 ctx.fillStyle = '#f00';
michael@0 5328 ctx.fillStyle = 'rgb(0% ,100% ,0%)';
michael@0 5329 ctx.fillRect(0, 0, 100, 50);
michael@0 5330 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5331
michael@0 5332
michael@0 5333 }
michael@0 5334 </script>
michael@0 5335
michael@0 5336 <!-- [[[ test_2d.fillStyle.parse.rgba-clamp-1.html ]]] -->
michael@0 5337
michael@0 5338 <p>Canvas test: 2d.fillStyle.parse.rgba-clamp-1</p>
michael@0 5339 <canvas id="c194" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5340 <script>
michael@0 5341
michael@0 5342
michael@0 5343 function test_2d_fillStyle_parse_rgba_clamp_1() {
michael@0 5344
michael@0 5345 var canvas = document.getElementById('c194');
michael@0 5346 var ctx = canvas.getContext('2d');
michael@0 5347
michael@0 5348
michael@0 5349 ctx.fillStyle = '#f00';
michael@0 5350 ctx.fillStyle = 'rgba(0, 255, 0, -2)';
michael@0 5351 ctx.fillRect(0, 0, 100, 50);
michael@0 5352 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 5353
michael@0 5354
michael@0 5355 }
michael@0 5356 </script>
michael@0 5357
michael@0 5358 <!-- [[[ test_2d.fillStyle.parse.rgba-clamp-2.html ]]] -->
michael@0 5359
michael@0 5360 <p>Canvas test: 2d.fillStyle.parse.rgba-clamp-2</p>
michael@0 5361 <canvas id="c195" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5362 <script>
michael@0 5363
michael@0 5364
michael@0 5365 function test_2d_fillStyle_parse_rgba_clamp_2() {
michael@0 5366
michael@0 5367 var canvas = document.getElementById('c195');
michael@0 5368 var ctx = canvas.getContext('2d');
michael@0 5369
michael@0 5370
michael@0 5371 ctx.fillStyle = '#f00';
michael@0 5372 ctx.fillStyle = 'rgba(0, 255, 0, 2)';
michael@0 5373 ctx.fillRect(0, 0, 100, 50);
michael@0 5374 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5375
michael@0 5376
michael@0 5377 }
michael@0 5378 </script>
michael@0 5379
michael@0 5380 <!-- [[[ test_2d.fillStyle.parse.rgba-num-1.html ]]] -->
michael@0 5381
michael@0 5382 <p>Canvas test: 2d.fillStyle.parse.rgba-num-1</p>
michael@0 5383 <canvas id="c196" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5384 <script>
michael@0 5385
michael@0 5386
michael@0 5387 function test_2d_fillStyle_parse_rgba_num_1() {
michael@0 5388
michael@0 5389 var canvas = document.getElementById('c196');
michael@0 5390 var ctx = canvas.getContext('2d');
michael@0 5391
michael@0 5392
michael@0 5393 ctx.fillStyle = '#f00';
michael@0 5394 ctx.fillStyle = 'rgba( 0 , 255 , 0 , .499 )';
michael@0 5395 ctx.fillRect(0, 0, 100, 50);
michael@0 5396 isPixel(ctx, 50,25, 0,255,0,127, 0);
michael@0 5397
michael@0 5398
michael@0 5399 }
michael@0 5400 </script>
michael@0 5401
michael@0 5402 <!-- [[[ test_2d.fillStyle.parse.rgba-num-2.html ]]] -->
michael@0 5403
michael@0 5404 <p>Canvas test: 2d.fillStyle.parse.rgba-num-2</p>
michael@0 5405 <canvas id="c197" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5406 <script>
michael@0 5407
michael@0 5408
michael@0 5409 function test_2d_fillStyle_parse_rgba_num_2() {
michael@0 5410
michael@0 5411 var canvas = document.getElementById('c197');
michael@0 5412 var ctx = canvas.getContext('2d');
michael@0 5413
michael@0 5414
michael@0 5415 ctx.fillStyle = '#f00';
michael@0 5416 ctx.fillStyle = 'rgba( 0 , 255 , 0 , 0.499 )';
michael@0 5417 ctx.fillRect(0, 0, 100, 50);
michael@0 5418 isPixel(ctx, 50,25, 0,255,0,127, 0);
michael@0 5419
michael@0 5420
michael@0 5421 }
michael@0 5422 </script>
michael@0 5423
michael@0 5424 <!-- [[[ test_2d.fillStyle.parse.rgba-percent.html ]]] -->
michael@0 5425
michael@0 5426 <p>Canvas test: 2d.fillStyle.parse.rgba-percent</p>
michael@0 5427 <canvas id="c198" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5428 <script>
michael@0 5429
michael@0 5430
michael@0 5431 function test_2d_fillStyle_parse_rgba_percent() {
michael@0 5432
michael@0 5433 var canvas = document.getElementById('c198');
michael@0 5434 var ctx = canvas.getContext('2d');
michael@0 5435
michael@0 5436
michael@0 5437 ctx.fillStyle = '#f00';
michael@0 5438 ctx.fillStyle = 'rgba(0%,100%,0%,0.499)';
michael@0 5439 ctx.fillRect(0, 0, 100, 50);
michael@0 5440 isPixel(ctx, 50,25, 0,255,0,127, 0);
michael@0 5441
michael@0 5442
michael@0 5443 }
michael@0 5444 </script>
michael@0 5445
michael@0 5446 <!-- [[[ test_2d.fillStyle.parse.rgba-solid-1.html ]]] -->
michael@0 5447
michael@0 5448 <p>Canvas test: 2d.fillStyle.parse.rgba-solid-1</p>
michael@0 5449 <canvas id="c199" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5450 <script>
michael@0 5451
michael@0 5452
michael@0 5453 function test_2d_fillStyle_parse_rgba_solid_1() {
michael@0 5454
michael@0 5455 var canvas = document.getElementById('c199');
michael@0 5456 var ctx = canvas.getContext('2d');
michael@0 5457
michael@0 5458
michael@0 5459 ctx.fillStyle = '#f00';
michael@0 5460 ctx.fillStyle = 'rgba( 0 , 255 , 0 , 1 )';
michael@0 5461 ctx.fillRect(0, 0, 100, 50);
michael@0 5462 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5463
michael@0 5464
michael@0 5465 }
michael@0 5466 </script>
michael@0 5467
michael@0 5468 <!-- [[[ test_2d.fillStyle.parse.rgba-solid-2.html ]]] -->
michael@0 5469
michael@0 5470 <p>Canvas test: 2d.fillStyle.parse.rgba-solid-2</p>
michael@0 5471 <canvas id="c200" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5472 <script>
michael@0 5473
michael@0 5474
michael@0 5475 function test_2d_fillStyle_parse_rgba_solid_2() {
michael@0 5476
michael@0 5477 var canvas = document.getElementById('c200');
michael@0 5478 var ctx = canvas.getContext('2d');
michael@0 5479
michael@0 5480
michael@0 5481 ctx.fillStyle = '#f00';
michael@0 5482 ctx.fillStyle = 'rgba( 0 , 255 , 0 , 1.0 )';
michael@0 5483 ctx.fillRect(0, 0, 100, 50);
michael@0 5484 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5485
michael@0 5486
michael@0 5487 }
michael@0 5488 </script>
michael@0 5489
michael@0 5490 <!-- [[[ test_2d.fillStyle.parse.svg-1.html ]]] -->
michael@0 5491
michael@0 5492 <p>Canvas test: 2d.fillStyle.parse.svg-1</p>
michael@0 5493 <canvas id="c201" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5494 <script>
michael@0 5495
michael@0 5496
michael@0 5497 function test_2d_fillStyle_parse_svg_1() {
michael@0 5498
michael@0 5499 var canvas = document.getElementById('c201');
michael@0 5500 var ctx = canvas.getContext('2d');
michael@0 5501
michael@0 5502
michael@0 5503 ctx.fillStyle = '#f00';
michael@0 5504 ctx.fillStyle = 'gray';
michael@0 5505 ctx.fillRect(0, 0, 100, 50);
michael@0 5506 isPixel(ctx, 50,25, 128,128,128,255, 0);
michael@0 5507
michael@0 5508
michael@0 5509 }
michael@0 5510 </script>
michael@0 5511
michael@0 5512 <!-- [[[ test_2d.fillStyle.parse.svg-2.html ]]] -->
michael@0 5513
michael@0 5514 <p>Canvas test: 2d.fillStyle.parse.svg-2</p>
michael@0 5515 <canvas id="c202" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5516 <script>
michael@0 5517
michael@0 5518
michael@0 5519 function test_2d_fillStyle_parse_svg_2() {
michael@0 5520
michael@0 5521 var canvas = document.getElementById('c202');
michael@0 5522 var ctx = canvas.getContext('2d');
michael@0 5523
michael@0 5524
michael@0 5525 ctx.fillStyle = '#f00';
michael@0 5526 ctx.fillStyle = 'grey';
michael@0 5527 ctx.fillRect(0, 0, 100, 50);
michael@0 5528 isPixel(ctx, 50,25, 128,128,128,255, 0);
michael@0 5529
michael@0 5530
michael@0 5531 }
michael@0 5532 </script>
michael@0 5533
michael@0 5534 <!-- [[[ test_2d.fillStyle.parse.system.html ]]] -->
michael@0 5535
michael@0 5536 <p>Canvas test: 2d.fillStyle.parse.system</p>
michael@0 5537 <canvas id="c203" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5538 <script>
michael@0 5539
michael@0 5540 function test_2d_fillStyle_parse_system() {
michael@0 5541
michael@0 5542 var canvas = document.getElementById('c203');
michael@0 5543 var ctx = canvas.getContext('2d');
michael@0 5544
michael@0 5545
michael@0 5546 ctx.fillStyle = '#f00';
michael@0 5547 ctx.fillStyle = 'ThreeDDarkShadow';
michael@0 5548 ok(/^#(?!(FF0000|ff0000|f00)$)/.test(ctx.fillStyle), "ctx.fillStyle =~ /^#(?!(FF0000|ff0000|f00)$)/"); // test that it's not red
michael@0 5549
michael@0 5550
michael@0 5551 }
michael@0 5552 </script>
michael@0 5553
michael@0 5554 <!-- [[[ test_2d.fillStyle.parse.transparent-1.html ]]] -->
michael@0 5555
michael@0 5556 <p>Canvas test: 2d.fillStyle.parse.transparent-1</p>
michael@0 5557 <canvas id="c204" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5558 <script>
michael@0 5559
michael@0 5560
michael@0 5561 function test_2d_fillStyle_parse_transparent_1() {
michael@0 5562
michael@0 5563 var canvas = document.getElementById('c204');
michael@0 5564 var ctx = canvas.getContext('2d');
michael@0 5565
michael@0 5566
michael@0 5567 ctx.fillStyle = '#f00';
michael@0 5568 ctx.fillStyle = 'transparent';
michael@0 5569 ctx.fillRect(0, 0, 100, 50);
michael@0 5570 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 5571
michael@0 5572
michael@0 5573 }
michael@0 5574 </script>
michael@0 5575
michael@0 5576 <!-- [[[ test_2d.fillStyle.parse.transparent-2.html ]]] -->
michael@0 5577
michael@0 5578 <p>Canvas test: 2d.fillStyle.parse.transparent-2</p>
michael@0 5579 <canvas id="c205" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5580 <script>
michael@0 5581
michael@0 5582
michael@0 5583 function test_2d_fillStyle_parse_transparent_2() {
michael@0 5584
michael@0 5585 var canvas = document.getElementById('c205');
michael@0 5586 var ctx = canvas.getContext('2d');
michael@0 5587
michael@0 5588
michael@0 5589 ctx.fillStyle = '#f00';
michael@0 5590 ctx.fillStyle = 'TrAnSpArEnT';
michael@0 5591 ctx.fillRect(0, 0, 100, 50);
michael@0 5592 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 5593
michael@0 5594
michael@0 5595 }
michael@0 5596 </script>
michael@0 5597
michael@0 5598 <!-- [[[ test_2d.getcontext.exists.html ]]] -->
michael@0 5599
michael@0 5600 <p>Canvas test: 2d.getcontext.exists</p>
michael@0 5601 <!-- Testing: The 2D context is implemented -->
michael@0 5602 <canvas id="c206" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5603 <script>
michael@0 5604
michael@0 5605 function test_2d_getcontext_exists() {
michael@0 5606
michael@0 5607 var canvas = document.getElementById('c206');
michael@0 5608 var ctx = canvas.getContext('2d');
michael@0 5609
michael@0 5610 ok(canvas.getContext('2d') !== null, "canvas.getContext('2d') !== null");
michael@0 5611
michael@0 5612
michael@0 5613 }
michael@0 5614 </script>
michael@0 5615
michael@0 5616 <!-- [[[ test_2d.getcontext.shared.html ]]] -->
michael@0 5617
michael@0 5618 <p>Canvas test: 2d.getcontext.shared</p>
michael@0 5619 <!-- Testing: getContext('2d') returns objects which share canvas state -->
michael@0 5620 <canvas id="c207" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5621 <script>
michael@0 5622
michael@0 5623
michael@0 5624 function test_2d_getcontext_shared() {
michael@0 5625
michael@0 5626 var canvas = document.getElementById('c207');
michael@0 5627 var ctx = canvas.getContext('2d');
michael@0 5628
michael@0 5629 var ctx2 = canvas.getContext('2d');
michael@0 5630 ctx.fillStyle = '#f00';
michael@0 5631 ctx2.fillStyle = '#0f0';
michael@0 5632 ctx.fillRect(0, 0, 100, 50);
michael@0 5633 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5634
michael@0 5635
michael@0 5636 }
michael@0 5637 </script>
michael@0 5638
michael@0 5639 <!-- [[[ test_2d.getcontext.unique.html ]]] -->
michael@0 5640
michael@0 5641 <p>Canvas test: 2d.getcontext.unique</p>
michael@0 5642 <!-- Testing: getContext('2d') returns the same object -->
michael@0 5643 <canvas id="c208" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5644 <script>
michael@0 5645
michael@0 5646 function test_2d_getcontext_unique() {
michael@0 5647
michael@0 5648 var canvas = document.getElementById('c208');
michael@0 5649 var ctx = canvas.getContext('2d');
michael@0 5650
michael@0 5651 ok(canvas.getContext('2d') === canvas.getContext('2d'), "canvas.getContext('2d') === canvas.getContext('2d')");
michael@0 5652
michael@0 5653
michael@0 5654 }
michael@0 5655 </script>
michael@0 5656
michael@0 5657 <!-- [[[ test_2d.gradient.empty.html ]]] -->
michael@0 5658
michael@0 5659 <p>Canvas test: 2d.gradient.empty</p>
michael@0 5660 <canvas id="c209" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5661 <script>
michael@0 5662
michael@0 5663
michael@0 5664 function test_2d_gradient_empty() {
michael@0 5665
michael@0 5666 var canvas = document.getElementById('c209');
michael@0 5667 var ctx = canvas.getContext('2d');
michael@0 5668
michael@0 5669 ctx.fillStyle = '#0f0';
michael@0 5670 ctx.fillRect(0, 0, 100, 50);
michael@0 5671 var g = ctx.createLinearGradient(0, 0, 0, 50);
michael@0 5672 ctx.fillStyle = g;
michael@0 5673 ctx.fillRect(0, 0, 100, 50);
michael@0 5674 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 5675
michael@0 5676
michael@0 5677 }
michael@0 5678 </script>
michael@0 5679
michael@0 5680 <!-- [[[ test_2d.gradient.interpolate.alpha.html ]]] -->
michael@0 5681
michael@0 5682 <p>Canvas test: 2d.gradient.interpolate.alpha</p>
michael@0 5683 <canvas id="c210" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5684 <script>
michael@0 5685
michael@0 5686
michael@0 5687 function test_2d_gradient_interpolate_alpha() {
michael@0 5688
michael@0 5689 var canvas = document.getElementById('c210');
michael@0 5690 var ctx = canvas.getContext('2d');
michael@0 5691
michael@0 5692 ctx.fillStyle = '#ff0';
michael@0 5693 ctx.fillRect(0, 0, 100, 50);
michael@0 5694 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 5695 g.addColorStop(0, 'rgba(0,0,255, 0)');
michael@0 5696 g.addColorStop(1, 'rgba(0,0,255, 1)');
michael@0 5697 ctx.fillStyle = g;
michael@0 5698 ctx.fillRect(0, 0, 100, 50);
michael@0 5699 isPixel(ctx, 25,25, 191,191,63,255, 3);
michael@0 5700 isPixel(ctx, 50,25, 127,127,127,255, 3);
michael@0 5701 isPixel(ctx, 75,25, 63,63,191,255, 3);
michael@0 5702
michael@0 5703
michael@0 5704 }
michael@0 5705 </script>
michael@0 5706
michael@0 5707 <!-- [[[ test_2d.gradient.interpolate.colour.html ]]] -->
michael@0 5708
michael@0 5709 <p>Canvas test: 2d.gradient.interpolate.colour</p>
michael@0 5710 <canvas id="c211" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5711 <script>
michael@0 5712
michael@0 5713
michael@0 5714 function test_2d_gradient_interpolate_colour() {
michael@0 5715
michael@0 5716 var canvas = document.getElementById('c211');
michael@0 5717 var ctx = canvas.getContext('2d');
michael@0 5718
michael@0 5719 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 5720 g.addColorStop(0, '#ff0');
michael@0 5721 g.addColorStop(1, '#00f');
michael@0 5722 ctx.fillStyle = g;
michael@0 5723 ctx.fillRect(0, 0, 100, 50);
michael@0 5724 isPixel(ctx, 25,25, 191,191,63,255, 3);
michael@0 5725 isPixel(ctx, 50,25, 127,127,127,255, 3);
michael@0 5726 isPixel(ctx, 75,25, 63,63,191,255, 3);
michael@0 5727
michael@0 5728
michael@0 5729 }
michael@0 5730 </script>
michael@0 5731
michael@0 5732 <!-- [[[ test_2d.gradient.interpolate.colouralpha.html ]]] -->
michael@0 5733
michael@0 5734 <p>Canvas test: 2d.gradient.interpolate.colouralpha</p>
michael@0 5735 <canvas id="c212" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5736 <script>
michael@0 5737
michael@0 5738
michael@0 5739 function test_2d_gradient_interpolate_colouralpha() {
michael@0 5740
michael@0 5741 var canvas = document.getElementById('c212');
michael@0 5742 var ctx = canvas.getContext('2d');
michael@0 5743
michael@0 5744 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 5745 g.addColorStop(0, 'rgba(255,255,0, 0)');
michael@0 5746 g.addColorStop(1, 'rgba(0,0,255, 1)');
michael@0 5747 ctx.fillStyle = g;
michael@0 5748 ctx.fillRect(0, 0, 100, 50);
michael@0 5749 isPixel(ctx, 25,25, 191,191,63,63, 3);
michael@0 5750 isPixel(ctx, 50,25, 127,127,127,127, 3);
michael@0 5751 isPixel(ctx, 75,25, 63,63,191,191, 3);
michael@0 5752
michael@0 5753
michael@0 5754 }
michael@0 5755 </script>
michael@0 5756
michael@0 5757 <!-- [[[ test_2d.gradient.interpolate.multiple.html ]]] -->
michael@0 5758
michael@0 5759 <p>Canvas test: 2d.gradient.interpolate.multiple</p>
michael@0 5760 <canvas id="c213" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5761 <script>
michael@0 5762
michael@0 5763
michael@0 5764 function test_2d_gradient_interpolate_multiple() {
michael@0 5765
michael@0 5766 var canvas = document.getElementById('c213');
michael@0 5767 var ctx = canvas.getContext('2d');
michael@0 5768
michael@0 5769 canvas.width = 200;
michael@0 5770 var g = ctx.createLinearGradient(0, 0, 200, 0);
michael@0 5771 g.addColorStop(0, '#ff0');
michael@0 5772 g.addColorStop(0.5, '#0ff');
michael@0 5773 g.addColorStop(1, '#f0f');
michael@0 5774 ctx.fillStyle = g;
michael@0 5775 ctx.fillRect(0, 0, 200, 50);
michael@0 5776 isPixel(ctx, 50,25, 127,255,127,255, 3);
michael@0 5777 isPixel(ctx, 100,25, 0,255,255,255, 3);
michael@0 5778 isPixel(ctx, 150,25, 127,127,255,255, 3);
michael@0 5779
michael@0 5780
michael@0 5781 }
michael@0 5782 </script>
michael@0 5783
michael@0 5784 <!-- [[[ test_2d.gradient.interpolate.outside.html ]]] -->
michael@0 5785
michael@0 5786 <p>Canvas test: 2d.gradient.interpolate.outside</p>
michael@0 5787 <canvas id="c214" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5788 <script>
michael@0 5789
michael@0 5790
michael@0 5791 function test_2d_gradient_interpolate_outside() {
michael@0 5792
michael@0 5793 var canvas = document.getElementById('c214');
michael@0 5794 var ctx = canvas.getContext('2d');
michael@0 5795
michael@0 5796 ctx.fillStyle = '#f00';
michael@0 5797 ctx.fillRect(0, 0, 100, 50);
michael@0 5798
michael@0 5799 var g = ctx.createLinearGradient(25, 0, 75, 0);
michael@0 5800 g.addColorStop(0.4, '#0f0');
michael@0 5801 g.addColorStop(0.6, '#0f0');
michael@0 5802
michael@0 5803 ctx.fillStyle = g;
michael@0 5804 ctx.fillRect(0, 0, 100, 50);
michael@0 5805 isPixel(ctx, 20,25, 0,255,0,255, 2);
michael@0 5806 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 5807 isPixel(ctx, 80,25, 0,255,0,255, 2);
michael@0 5808
michael@0 5809
michael@0 5810 }
michael@0 5811 </script>
michael@0 5812
michael@0 5813 <!-- [[[ test_2d.gradient.interpolate.overlap.html ]]] -->
michael@0 5814
michael@0 5815 <p>Canvas test: 2d.gradient.interpolate.overlap</p>
michael@0 5816 <canvas id="c215" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5817 <script>
michael@0 5818
michael@0 5819
michael@0 5820 function test_2d_gradient_interpolate_overlap() {
michael@0 5821
michael@0 5822 var canvas = document.getElementById('c215');
michael@0 5823 var ctx = canvas.getContext('2d');
michael@0 5824
michael@0 5825 if (!IsD2DEnabled() && !IsMacOSX10_5orOlder()) {
michael@0 5826 // On D2D the different nature of how gradients
michael@0 5827 // are drawn makes it so we cannot guarantee these stops are completely
michael@0 5828 // hard.
michael@0 5829
michael@0 5830 // On OS X 10.5 quartz is confused by the overlapping stops: Bug #715235
michael@0 5831 canvas.width = 200;
michael@0 5832 var g = ctx.createLinearGradient(0, 0, 200, 0);
michael@0 5833 g.addColorStop(0, '#f00');
michael@0 5834 g.addColorStop(0, '#ff0');
michael@0 5835 g.addColorStop(0.25, '#00f');
michael@0 5836 g.addColorStop(0.25, '#0f0');
michael@0 5837 g.addColorStop(0.25, '#0f0');
michael@0 5838 g.addColorStop(0.25, '#0f0');
michael@0 5839 g.addColorStop(0.25, '#ff0');
michael@0 5840 g.addColorStop(0.5, '#00f');
michael@0 5841 g.addColorStop(0.5, '#0f0');
michael@0 5842 g.addColorStop(0.75, '#00f');
michael@0 5843 g.addColorStop(0.75, '#f00');
michael@0 5844 g.addColorStop(0.75, '#ff0');
michael@0 5845 g.addColorStop(0.5, '#0f0');
michael@0 5846 g.addColorStop(0.5, '#0f0');
michael@0 5847 g.addColorStop(0.5, '#ff0');
michael@0 5848 g.addColorStop(1, '#00f');
michael@0 5849 ctx.fillStyle = g;
michael@0 5850 ctx.fillRect(0, 0, 200, 50);
michael@0 5851 isPixel(ctx, 49,25, 0,0,255,255, 16);
michael@0 5852 isPixel(ctx, 51,25, 255,255,0,255, 16);
michael@0 5853 isPixel(ctx, 99,25, 0,0,255,255, 16);
michael@0 5854 isPixel(ctx, 101,25, 255,255,0,255, 16);
michael@0 5855 isPixel(ctx, 149,25, 0,0,255,255, 16);
michael@0 5856 isPixel(ctx, 151,25, 255,255,0,255, 16);
michael@0 5857 }
michael@0 5858 }
michael@0 5859 </script>
michael@0 5860
michael@0 5861 <!-- [[[ test_2d.gradient.interpolate.overlap2.html ]]] -->
michael@0 5862
michael@0 5863 <p>Canvas test: 2d.gradient.interpolate.overlap2</p>
michael@0 5864 <canvas id="c216" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5865 <script>
michael@0 5866
michael@0 5867
michael@0 5868 function test_2d_gradient_interpolate_overlap2() {
michael@0 5869
michael@0 5870 var canvas = document.getElementById('c216');
michael@0 5871 var ctx = canvas.getContext('2d');
michael@0 5872
michael@0 5873 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 5874 var ps = [ 0, 1/10, 1/4, 1/3, 1/2, 3/4, 1 ];
michael@0 5875 for (var p = 0; p < ps.length; ++p)
michael@0 5876 {
michael@0 5877 g.addColorStop(ps[p], '#0f0');
michael@0 5878 for (var i = 0; i < 15; ++i)
michael@0 5879 g.addColorStop(ps[p], '#f00');
michael@0 5880 g.addColorStop(ps[p], '#0f0');
michael@0 5881 }
michael@0 5882 ctx.fillStyle = g;
michael@0 5883 ctx.fillRect(0, 0, 100, 50);
michael@0 5884
michael@0 5885 if (!IsMacOSX10_5orOlder()) {
michael@0 5886 // On OS X 10.5 quartz is confused by the overlapping stops: Bug #715235
michael@0 5887 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 5888 isPixel(ctx, 30,25, 0,255,0,255, 0);
michael@0 5889 isPixel(ctx, 40,25, 0,255,0,255, 0);
michael@0 5890 isPixel(ctx, 60,25, 0,255,0,255, 0);
michael@0 5891 isPixel(ctx, 80,25, 0,255,0,255, 0);
michael@0 5892 }
michael@0 5893
michael@0 5894 }
michael@0 5895 </script>
michael@0 5896
michael@0 5897 <!-- [[[ test_2d.gradient.interpolate.solid.html ]]] -->
michael@0 5898
michael@0 5899 <p>Canvas test: 2d.gradient.interpolate.solid</p>
michael@0 5900 <canvas id="c217" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5901 <script>
michael@0 5902
michael@0 5903
michael@0 5904 function test_2d_gradient_interpolate_solid() {
michael@0 5905
michael@0 5906 var canvas = document.getElementById('c217');
michael@0 5907 var ctx = canvas.getContext('2d');
michael@0 5908
michael@0 5909 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 5910 g.addColorStop(0, '#0f0');
michael@0 5911 g.addColorStop(1, '#0f0');
michael@0 5912 ctx.fillStyle = g;
michael@0 5913 ctx.fillRect(0, 0, 100, 50);
michael@0 5914 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 5915
michael@0 5916
michael@0 5917 }
michael@0 5918 </script>
michael@0 5919
michael@0 5920 <!-- [[[ test_2d.gradient.interpolate.vertical.html ]]] -->
michael@0 5921
michael@0 5922 <p>Canvas test: 2d.gradient.interpolate.vertical</p>
michael@0 5923 <canvas id="c218" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5924 <script>
michael@0 5925
michael@0 5926
michael@0 5927 function test_2d_gradient_interpolate_vertical() {
michael@0 5928
michael@0 5929 var canvas = document.getElementById('c218');
michael@0 5930 var ctx = canvas.getContext('2d');
michael@0 5931
michael@0 5932 var g = ctx.createLinearGradient(0, 0, 0, 50);
michael@0 5933 g.addColorStop(0, '#ff0');
michael@0 5934 g.addColorStop(1, '#00f');
michael@0 5935 ctx.fillStyle = g;
michael@0 5936 ctx.fillRect(0, 0, 100, 50);
michael@0 5937 isPixel(ctx, 50,12, 191,191,63,255, 10);
michael@0 5938 isPixel(ctx, 50,25, 127,127,127,255, 5);
michael@0 5939 isPixel(ctx, 50,37, 63,63,191,255, 10);
michael@0 5940
michael@0 5941
michael@0 5942 }
michael@0 5943 </script>
michael@0 5944
michael@0 5945 <!-- [[[ test_2d.gradient.interpolate.zerosize.html ]]] -->
michael@0 5946
michael@0 5947 <p>Canvas test: 2d.gradient.interpolate.zerosize</p>
michael@0 5948 <canvas id="c219" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5949 <script>
michael@0 5950
michael@0 5951
michael@0 5952
michael@0 5953 function test_2d_gradient_interpolate_zerosize() {
michael@0 5954
michael@0 5955 var canvas = document.getElementById('c219');
michael@0 5956 var ctx = canvas.getContext('2d');
michael@0 5957
michael@0 5958 ctx.fillStyle = '#0f0';
michael@0 5959 ctx.fillRect(0, 0, 100, 50);
michael@0 5960
michael@0 5961 var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction)
michael@0 5962 g.addColorStop(0, '#f00');
michael@0 5963 g.addColorStop(1, '#f00');
michael@0 5964 ctx.fillStyle = g;
michael@0 5965 ctx.fillRect(0, 0, 100, 50);
michael@0 5966
michael@0 5967 todo_isPixel(ctx, 40,20, 0,255,0,255, 2);
michael@0 5968
michael@0 5969 }
michael@0 5970 </script>
michael@0 5971
michael@0 5972 <!-- [[[ test_2d.gradient.linear.nonfinite.html ]]] -->
michael@0 5973
michael@0 5974 <p>Canvas test: 2d.gradient.linear.nonfinite</p>
michael@0 5975 <!-- Testing: createLinearGradient() throws NOT_SUPPORTED_ERR if arguments are not finite -->
michael@0 5976 <canvas id="c220" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 5977 <script>
michael@0 5978
michael@0 5979 function test_2d_gradient_linear_nonfinite() {
michael@0 5980
michael@0 5981 var canvas = document.getElementById('c220');
michael@0 5982 var ctx = canvas.getContext('2d');
michael@0 5983
michael@0 5984 var _thrown = undefined; try {
michael@0 5985 ctx.createLinearGradient(Infinity, 0, 1, 0);
michael@0 5986 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 5987 var _thrown = undefined; try {
michael@0 5988 ctx.createLinearGradient(-Infinity, 0, 1, 0);
michael@0 5989 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 5990 var _thrown = undefined; try {
michael@0 5991 ctx.createLinearGradient(NaN, 0, 1, 0);
michael@0 5992 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 5993 var _thrown = undefined; try {
michael@0 5994 ctx.createLinearGradient(0, Infinity, 1, 0);
michael@0 5995 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 5996 var _thrown = undefined; try {
michael@0 5997 ctx.createLinearGradient(0, -Infinity, 1, 0);
michael@0 5998 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 5999 var _thrown = undefined; try {
michael@0 6000 ctx.createLinearGradient(0, NaN, 1, 0);
michael@0 6001 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6002 var _thrown = undefined; try {
michael@0 6003 ctx.createLinearGradient(0, 0, Infinity, 0);
michael@0 6004 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6005 var _thrown = undefined; try {
michael@0 6006 ctx.createLinearGradient(0, 0, -Infinity, 0);
michael@0 6007 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6008 var _thrown = undefined; try {
michael@0 6009 ctx.createLinearGradient(0, 0, NaN, 0);
michael@0 6010 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6011 var _thrown = undefined; try {
michael@0 6012 ctx.createLinearGradient(0, 0, 1, Infinity);
michael@0 6013 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6014 var _thrown = undefined; try {
michael@0 6015 ctx.createLinearGradient(0, 0, 1, -Infinity);
michael@0 6016 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6017 var _thrown = undefined; try {
michael@0 6018 ctx.createLinearGradient(0, 0, 1, NaN);
michael@0 6019 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6020 var _thrown = undefined; try {
michael@0 6021 ctx.createLinearGradient(Infinity, Infinity, 1, 0);
michael@0 6022 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6023 var _thrown = undefined; try {
michael@0 6024 ctx.createLinearGradient(Infinity, Infinity, Infinity, 0);
michael@0 6025 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6026 var _thrown = undefined; try {
michael@0 6027 ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity);
michael@0 6028 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6029 var _thrown = undefined; try {
michael@0 6030 ctx.createLinearGradient(Infinity, Infinity, 1, Infinity);
michael@0 6031 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6032 var _thrown = undefined; try {
michael@0 6033 ctx.createLinearGradient(Infinity, 0, Infinity, 0);
michael@0 6034 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6035 var _thrown = undefined; try {
michael@0 6036 ctx.createLinearGradient(Infinity, 0, Infinity, Infinity);
michael@0 6037 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6038 var _thrown = undefined; try {
michael@0 6039 ctx.createLinearGradient(Infinity, 0, 1, Infinity);
michael@0 6040 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6041 var _thrown = undefined; try {
michael@0 6042 ctx.createLinearGradient(0, Infinity, Infinity, 0);
michael@0 6043 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6044 var _thrown = undefined; try {
michael@0 6045 ctx.createLinearGradient(0, Infinity, Infinity, Infinity);
michael@0 6046 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6047 var _thrown = undefined; try {
michael@0 6048 ctx.createLinearGradient(0, Infinity, 1, Infinity);
michael@0 6049 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6050 var _thrown = undefined; try {
michael@0 6051 ctx.createLinearGradient(0, 0, Infinity, Infinity);
michael@0 6052 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6053
michael@0 6054
michael@0 6055 }
michael@0 6056 </script>
michael@0 6057
michael@0 6058 <!-- [[[ test_2d.gradient.linear.transform.1.html ]]] -->
michael@0 6059
michael@0 6060 <p>Canvas test: 2d.gradient.linear.transform.1</p>
michael@0 6061 <!-- Testing: Linear gradient coordinates are relative to the coordinate space at the time of filling -->
michael@0 6062 <canvas id="c221" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6063 <script>
michael@0 6064
michael@0 6065
michael@0 6066 function test_2d_gradient_linear_transform_1() {
michael@0 6067
michael@0 6068 var canvas = document.getElementById('c221');
michael@0 6069 var ctx = canvas.getContext('2d');
michael@0 6070
michael@0 6071 var g = ctx.createLinearGradient(0, 0, 200, 0);
michael@0 6072 g.addColorStop(0, '#f00');
michael@0 6073 g.addColorStop(0.25, '#0f0');
michael@0 6074 g.addColorStop(0.75, '#0f0');
michael@0 6075 g.addColorStop(1, '#f00');
michael@0 6076 ctx.fillStyle = g;
michael@0 6077 ctx.translate(-50, 0);
michael@0 6078 ctx.fillRect(50, 0, 100, 50);
michael@0 6079 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 6080 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6081 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 6082
michael@0 6083
michael@0 6084 }
michael@0 6085 </script>
michael@0 6086
michael@0 6087 <!-- [[[ test_2d.gradient.linear.transform.2.html ]]] -->
michael@0 6088
michael@0 6089 <p>Canvas test: 2d.gradient.linear.transform.2</p>
michael@0 6090 <!-- Testing: Linear gradient coordinates are relative to the coordinate space at the time of filling -->
michael@0 6091 <canvas id="c222" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6092 <script>
michael@0 6093
michael@0 6094
michael@0 6095 function test_2d_gradient_linear_transform_2() {
michael@0 6096
michael@0 6097 var canvas = document.getElementById('c222');
michael@0 6098 var ctx = canvas.getContext('2d');
michael@0 6099
michael@0 6100 ctx.translate(100, 0);
michael@0 6101 var g = ctx.createLinearGradient(0, 0, 200, 0);
michael@0 6102 g.addColorStop(0, '#f00');
michael@0 6103 g.addColorStop(0.25, '#0f0');
michael@0 6104 g.addColorStop(0.75, '#0f0');
michael@0 6105 g.addColorStop(1, '#f00');
michael@0 6106 ctx.fillStyle = g;
michael@0 6107 ctx.translate(-150, 0);
michael@0 6108 ctx.fillRect(50, 0, 100, 50);
michael@0 6109 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 6110 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6111 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 6112
michael@0 6113
michael@0 6114 }
michael@0 6115 </script>
michael@0 6116
michael@0 6117 <!-- [[[ test_2d.gradient.linear.transform.3.html ]]] -->
michael@0 6118
michael@0 6119 <p>Canvas test: 2d.gradient.linear.transform.3</p>
michael@0 6120 <!-- Testing: Linear gradient transforms do not experience broken caching effects -->
michael@0 6121 <canvas id="c223" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6122 <script>
michael@0 6123
michael@0 6124
michael@0 6125
michael@0 6126 function test_2d_gradient_linear_transform_3() {
michael@0 6127
michael@0 6128 var canvas = document.getElementById('c223');
michael@0 6129 var ctx = canvas.getContext('2d');
michael@0 6130
michael@0 6131 var g = ctx.createLinearGradient(0, 0, 200, 0);
michael@0 6132 g.addColorStop(0, '#f00');
michael@0 6133 g.addColorStop(0.25, '#0f0');
michael@0 6134 g.addColorStop(0.75, '#0f0');
michael@0 6135 g.addColorStop(1, '#f00');
michael@0 6136 ctx.fillStyle = g;
michael@0 6137 ctx.fillRect(0, 0, 100, 50);
michael@0 6138 ctx.translate(-50, 0);
michael@0 6139 ctx.fillRect(50, 0, 100, 50);
michael@0 6140
michael@0 6141 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 6142 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6143 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 6144 }
michael@0 6145 </script>
michael@0 6146
michael@0 6147 <!-- [[[ test_2d.gradient.object.compare.html ]]] -->
michael@0 6148
michael@0 6149 <p>Canvas test: 2d.gradient.object.compare</p>
michael@0 6150 <canvas id="c224" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6151 <script>
michael@0 6152
michael@0 6153 function test_2d_gradient_object_compare() {
michael@0 6154
michael@0 6155 var canvas = document.getElementById('c224');
michael@0 6156 var ctx = canvas.getContext('2d');
michael@0 6157
michael@0 6158 var g1 = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 6159 var g2 = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 6160 ok(g1 !== g2, "g1 !== g2");
michael@0 6161 ctx.fillStyle = g1;
michael@0 6162 ok(ctx.fillStyle === g1, "ctx.fillStyle === g1");
michael@0 6163
michael@0 6164
michael@0 6165 }
michael@0 6166 </script>
michael@0 6167
michael@0 6168 <!-- [[[ test_2d.gradient.object.crosscanvas.html ]]] -->
michael@0 6169
michael@0 6170 <p>Canvas test: 2d.gradient.object.crosscanvas</p>
michael@0 6171 <canvas id="c225" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6172 <script>
michael@0 6173
michael@0 6174
michael@0 6175 function test_2d_gradient_object_crosscanvas() {
michael@0 6176
michael@0 6177 var canvas = document.getElementById('c225');
michael@0 6178 var ctx = canvas.getContext('2d');
michael@0 6179
michael@0 6180 ctx.fillStyle = '#f00';
michael@0 6181 ctx.fillRect(0, 0, 100, 50);
michael@0 6182 var g = document.createElement('canvas').getContext('2d').createLinearGradient(0, 0, 100, 0);
michael@0 6183 g.addColorStop(0, '#0f0');
michael@0 6184 g.addColorStop(1, '#0f0');
michael@0 6185 ctx.fillStyle = g;
michael@0 6186 ctx.fillRect(0, 0, 100, 50);
michael@0 6187 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 6188
michael@0 6189
michael@0 6190 }
michael@0 6191 </script>
michael@0 6192
michael@0 6193 <!-- [[[ test_2d.gradient.object.invalidcolour.html ]]] -->
michael@0 6194
michael@0 6195 <p>Canvas test: 2d.gradient.object.invalidcolour</p>
michael@0 6196 <canvas id="c226" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6197 <script>
michael@0 6198
michael@0 6199 function test_2d_gradient_object_invalidcolour() {
michael@0 6200
michael@0 6201 var canvas = document.getElementById('c226');
michael@0 6202 var ctx = canvas.getContext('2d');
michael@0 6203
michael@0 6204 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 6205 var _thrown = undefined; try {
michael@0 6206 g.addColorStop(0, "");
michael@0 6207 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 6208 var _thrown = undefined; try {
michael@0 6209 g.addColorStop(0, 'undefined');
michael@0 6210 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 6211
michael@0 6212
michael@0 6213 }
michael@0 6214 </script>
michael@0 6215
michael@0 6216 <!-- [[[ test_2d.gradient.object.invalidoffset.html ]]] -->
michael@0 6217
michael@0 6218 <p>Canvas test: 2d.gradient.object.invalidoffset</p>
michael@0 6219 <canvas id="c227" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6220 <script>
michael@0 6221
michael@0 6222 function test_2d_gradient_object_invalidoffset() {
michael@0 6223
michael@0 6224 var canvas = document.getElementById('c227');
michael@0 6225 var ctx = canvas.getContext('2d');
michael@0 6226
michael@0 6227 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 6228 var _thrown = undefined; try {
michael@0 6229 g.addColorStop(-1, '#000');
michael@0 6230 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 6231 var _thrown = undefined; try {
michael@0 6232 g.addColorStop(2, '#000');
michael@0 6233 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 6234 var _thrown = undefined; try {
michael@0 6235 g.addColorStop(Infinity, '#000');
michael@0 6236 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 6237 var _thrown = undefined; try {
michael@0 6238 g.addColorStop(-Infinity, '#000');
michael@0 6239 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 6240 var _thrown = undefined; try {
michael@0 6241 g.addColorStop(NaN, '#000');
michael@0 6242 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 6243
michael@0 6244
michael@0 6245 }
michael@0 6246 </script>
michael@0 6247
michael@0 6248 <!-- [[[ test_2d.gradient.object.return.html ]]] -->
michael@0 6249
michael@0 6250 <p>Canvas test: 2d.gradient.object.return</p>
michael@0 6251 <!-- Testing: createLinearGradient() and createRadialGradient() returns objects implementing CanvasGradient -->
michael@0 6252 <canvas id="c228" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6253 <script>
michael@0 6254
michael@0 6255 function test_2d_gradient_object_return() {
michael@0 6256
michael@0 6257 var canvas = document.getElementById('c228');
michael@0 6258 var ctx = canvas.getContext('2d');
michael@0 6259
michael@0 6260 window.CanvasGradient.prototype.thisImplementsCanvasGradient = true;
michael@0 6261
michael@0 6262 var g1 = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 6263 ok(g1.addColorStop !== undefined, "g1.addColorStop !== undefined");
michael@0 6264 ok(g1.thisImplementsCanvasGradient === true, "g1.thisImplementsCanvasGradient === true");
michael@0 6265
michael@0 6266 var g2 = ctx.createRadialGradient(0, 0, 10, 0, 0, 20);
michael@0 6267 ok(g2.addColorStop !== undefined, "g2.addColorStop !== undefined");
michael@0 6268 ok(g2.thisImplementsCanvasGradient === true, "g2.thisImplementsCanvasGradient === true");
michael@0 6269
michael@0 6270
michael@0 6271 }
michael@0 6272 </script>
michael@0 6273
michael@0 6274 <!-- [[[ test_2d.gradient.object.type.html ]]] -->
michael@0 6275
michael@0 6276 <p>Canvas test: 2d.gradient.object.type</p>
michael@0 6277 <!-- Testing: window.CanvasGradient exists and has the right properties -->
michael@0 6278 <canvas id="c229" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6279 <script>
michael@0 6280
michael@0 6281 function test_2d_gradient_object_type() {
michael@0 6282
michael@0 6283 var canvas = document.getElementById('c229');
michael@0 6284 var ctx = canvas.getContext('2d');
michael@0 6285
michael@0 6286 ok(window.CanvasGradient !== undefined, "window.CanvasGradient !== undefined");
michael@0 6287 ok(window.CanvasGradient.prototype.addColorStop !== undefined, "window.CanvasGradient.prototype.addColorStop !== undefined");
michael@0 6288
michael@0 6289
michael@0 6290 }
michael@0 6291 </script>
michael@0 6292
michael@0 6293 <!-- [[[ test_2d.gradient.object.update.html ]]] -->
michael@0 6294
michael@0 6295 <p>Canvas test: 2d.gradient.object.update</p>
michael@0 6296 <canvas id="c230" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6297 <script>
michael@0 6298
michael@0 6299
michael@0 6300 function test_2d_gradient_object_update() {
michael@0 6301
michael@0 6302 var canvas = document.getElementById('c230');
michael@0 6303 var ctx = canvas.getContext('2d');
michael@0 6304
michael@0 6305 var g = ctx.createLinearGradient(-100, 0, 200, 0);
michael@0 6306 g.addColorStop(0, '#f00');
michael@0 6307 g.addColorStop(1, '#f00');
michael@0 6308 ctx.fillStyle = g;
michael@0 6309 g.addColorStop(0.1, '#0f0');
michael@0 6310 g.addColorStop(0.9, '#0f0');
michael@0 6311 ctx.fillRect(0, 0, 100, 50);
michael@0 6312 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 6313
michael@0 6314
michael@0 6315 }
michael@0 6316 </script>
michael@0 6317
michael@0 6318 <!-- [[[ test_2d.gradient.radial.cone.behind.html ]]] -->
michael@0 6319
michael@0 6320 <p>Canvas test: 2d.gradient.radial.cone.behind</p>
michael@0 6321 <canvas id="c231" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6322 <script>
michael@0 6323
michael@0 6324
michael@0 6325
michael@0 6326 function test_2d_gradient_radial_cone_behind() {
michael@0 6327
michael@0 6328 var canvas = document.getElementById('c231');
michael@0 6329 var ctx = canvas.getContext('2d');
michael@0 6330
michael@0 6331 ctx.fillStyle = '#0f0';
michael@0 6332 ctx.fillRect(0, 0, 100, 50);
michael@0 6333
michael@0 6334 var g = ctx.createRadialGradient(120, 25, 10, 211, 25, 100);
michael@0 6335 g.addColorStop(0, '#f00');
michael@0 6336 g.addColorStop(1, '#f00');
michael@0 6337 ctx.fillStyle = g;
michael@0 6338 ctx.fillRect(0, 0, 100, 50);
michael@0 6339
michael@0 6340 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6341 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6342 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6343 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6344 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6345 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6346 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6347 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6348 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6349
michael@0 6350
michael@0 6351 }
michael@0 6352 </script>
michael@0 6353
michael@0 6354 <!-- [[[ test_2d.gradient.radial.cone.beside.html ]]] -->
michael@0 6355
michael@0 6356 <p>Canvas test: 2d.gradient.radial.cone.beside</p>
michael@0 6357 <canvas id="c232" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6358 <script>
michael@0 6359
michael@0 6360
michael@0 6361
michael@0 6362 function test_2d_gradient_radial_cone_beside() {
michael@0 6363
michael@0 6364 var canvas = document.getElementById('c232');
michael@0 6365 var ctx = canvas.getContext('2d');
michael@0 6366
michael@0 6367 ctx.fillStyle = '#0f0';
michael@0 6368 ctx.fillRect(0, 0, 100, 50);
michael@0 6369
michael@0 6370 var g = ctx.createRadialGradient(0, 100, 40, 100, 100, 50);
michael@0 6371 g.addColorStop(0, '#f00');
michael@0 6372 g.addColorStop(1, '#f00');
michael@0 6373 ctx.fillStyle = g;
michael@0 6374 ctx.fillRect(0, 0, 100, 50);
michael@0 6375
michael@0 6376 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6377 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6378 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6379 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6380 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6381 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6382 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6383 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6384 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6385
michael@0 6386
michael@0 6387 }
michael@0 6388 </script>
michael@0 6389
michael@0 6390 <!-- [[[ test_2d.gradient.radial.cone.bottom.html ]]] -->
michael@0 6391
michael@0 6392 <p>Canvas test: 2d.gradient.radial.cone.bottom</p>
michael@0 6393 <canvas id="c233" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6394 <script>
michael@0 6395
michael@0 6396
michael@0 6397 function test_2d_gradient_radial_cone_bottom() {
michael@0 6398
michael@0 6399 var canvas = document.getElementById('c233');
michael@0 6400 var ctx = canvas.getContext('2d');
michael@0 6401
michael@0 6402 ctx.fillStyle = '#f00';
michael@0 6403 ctx.fillRect(0, 0, 100, 50);
michael@0 6404
michael@0 6405 var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 101);
michael@0 6406 g.addColorStop(0, '#0f0');
michael@0 6407 g.addColorStop(1, '#f00');
michael@0 6408 ctx.fillStyle = g;
michael@0 6409 ctx.fillRect(0, 0, 100, 50);
michael@0 6410
michael@0 6411 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6412 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6413 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6414 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6415 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6416 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6417 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6418 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6419 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6420
michael@0 6421
michael@0 6422 }
michael@0 6423 </script>
michael@0 6424
michael@0 6425 <!-- [[[ test_2d.gradient.radial.cone.cylinder.html ]]] -->
michael@0 6426
michael@0 6427 <p>Canvas test: 2d.gradient.radial.cone.cylinder</p>
michael@0 6428 <canvas id="c234" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6429 <script>
michael@0 6430
michael@0 6431
michael@0 6432 function test_2d_gradient_radial_cone_cylinder() {
michael@0 6433
michael@0 6434 var canvas = document.getElementById('c234');
michael@0 6435 var ctx = canvas.getContext('2d');
michael@0 6436
michael@0 6437 ctx.fillStyle = '#f00';
michael@0 6438 ctx.fillRect(0, 0, 100, 50);
michael@0 6439
michael@0 6440 var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 100);
michael@0 6441 g.addColorStop(0, '#0f0');
michael@0 6442 g.addColorStop(1, '#f00');
michael@0 6443 ctx.fillStyle = g;
michael@0 6444 ctx.fillRect(0, 0, 100, 50);
michael@0 6445
michael@0 6446 isPixel(ctx, 1, 1, 0, 255, 0, 255, 0);
michael@0 6447 isPixel(ctx, 50, 1, 0, 255, 0, 255, 0);
michael@0 6448 isPixel(ctx, 98, 1, 0, 255, 0, 255, 0);
michael@0 6449 isPixel(ctx, 1, 25, 0, 255, 0, 255, 0);
michael@0 6450 isPixel(ctx, 50, 25, 0, 255, 0, 255, 0);
michael@0 6451 isPixel(ctx, 98, 25, 0, 255, 0, 255, 0);
michael@0 6452 isPixel(ctx, 1, 48, 0, 255, 0, 255, 0);
michael@0 6453 isPixel(ctx, 50, 48, 0, 255, 0, 255, 0);
michael@0 6454 isPixel(ctx, 98, 48, 0, 255, 0, 255, 0);
michael@0 6455
michael@0 6456 }
michael@0 6457 </script>
michael@0 6458
michael@0 6459 <!-- [[[ test_2d.gradient.radial.cone.front.html ]]] -->
michael@0 6460
michael@0 6461 <p>Canvas test: 2d.gradient.radial.cone.front</p>
michael@0 6462 <canvas id="c235" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6463 <script>
michael@0 6464
michael@0 6465
michael@0 6466 function test_2d_gradient_radial_cone_front() {
michael@0 6467
michael@0 6468 var canvas = document.getElementById('c235');
michael@0 6469 var ctx = canvas.getContext('2d');
michael@0 6470
michael@0 6471 ctx.fillStyle = '#f00';
michael@0 6472 ctx.fillRect(0, 0, 100, 50);
michael@0 6473
michael@0 6474 var g = ctx.createRadialGradient(311, 25, 10, 210, 25, 100);
michael@0 6475 g.addColorStop(0, '#f00');
michael@0 6476 g.addColorStop(1, '#0f0');
michael@0 6477 ctx.fillStyle = g;
michael@0 6478 ctx.fillRect(0, 0, 100, 50);
michael@0 6479
michael@0 6480 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6481 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6482 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6483 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6484 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6485 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6486 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6487 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6488 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6489
michael@0 6490
michael@0 6491 }
michael@0 6492 </script>
michael@0 6493
michael@0 6494 <!-- [[[ test_2d.gradient.radial.cone.shape1.html ]]] -->
michael@0 6495
michael@0 6496 <p>Canvas test: 2d.gradient.radial.cone.shape1</p>
michael@0 6497 <canvas id="c236" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6498 <script>
michael@0 6499
michael@0 6500
michael@0 6501 function test_2d_gradient_radial_cone_shape1() {
michael@0 6502
michael@0 6503 var canvas = document.getElementById('c236');
michael@0 6504 var ctx = canvas.getContext('2d');
michael@0 6505
michael@0 6506 var tol = 1; // tolerance to avoid antialiasing artifacts
michael@0 6507
michael@0 6508 ctx.fillStyle = '#0f0';
michael@0 6509 ctx.fillRect(0, 0, 100, 50);
michael@0 6510
michael@0 6511 ctx.fillStyle = '#f00';
michael@0 6512 ctx.beginPath();
michael@0 6513 ctx.moveTo(30+tol, 40);
michael@0 6514 ctx.lineTo(110, -20+tol);
michael@0 6515 ctx.lineTo(110, 100-tol);
michael@0 6516 ctx.fill();
michael@0 6517
michael@0 6518 var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4);
michael@0 6519 g.addColorStop(0, '#0f0');
michael@0 6520 g.addColorStop(1, '#0f0');
michael@0 6521 ctx.fillStyle = g;
michael@0 6522 ctx.fillRect(0, 0, 100, 50);
michael@0 6523
michael@0 6524 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6525 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6526 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6527 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6528 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6529 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6530 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6531 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6532 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6533
michael@0 6534
michael@0 6535 }
michael@0 6536 </script>
michael@0 6537
michael@0 6538 <!-- [[[ test_2d.gradient.radial.cone.shape2.html ]]] -->
michael@0 6539
michael@0 6540 <p>Canvas test: 2d.gradient.radial.cone.shape2</p>
michael@0 6541 <canvas id="c237" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6542 <script>
michael@0 6543
michael@0 6544
michael@0 6545
michael@0 6546 function test_2d_gradient_radial_cone_shape2() {
michael@0 6547
michael@0 6548 var canvas = document.getElementById('c237');
michael@0 6549 var ctx = canvas.getContext('2d');
michael@0 6550
michael@0 6551 var tol = 1; // tolerance to avoid antialiasing artifacts
michael@0 6552
michael@0 6553 ctx.fillStyle = '#0f0';
michael@0 6554 ctx.fillRect(0, 0, 100, 50);
michael@0 6555
michael@0 6556 var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4);
michael@0 6557 g.addColorStop(0, '#f00');
michael@0 6558 g.addColorStop(1, '#f00');
michael@0 6559 ctx.fillStyle = g;
michael@0 6560 ctx.fillRect(0, 0, 100, 50);
michael@0 6561
michael@0 6562 ctx.fillStyle = '#0f0';
michael@0 6563 ctx.beginPath();
michael@0 6564 ctx.moveTo(30-tol, 40);
michael@0 6565 ctx.lineTo(110, -20-tol);
michael@0 6566 ctx.lineTo(110, 100+tol);
michael@0 6567 ctx.fill();
michael@0 6568
michael@0 6569 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6570 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6571 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6572 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6573 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6574 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6575 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6576 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6577 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6578
michael@0 6579
michael@0 6580 }
michael@0 6581 </script>
michael@0 6582
michael@0 6583 <!-- [[[ test_2d.gradient.radial.cone.top.html ]]] -->
michael@0 6584
michael@0 6585 <p>Canvas test: 2d.gradient.radial.cone.top</p>
michael@0 6586 <canvas id="c238" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6587 <script>
michael@0 6588
michael@0 6589
michael@0 6590 function test_2d_gradient_radial_cone_top() {
michael@0 6591
michael@0 6592 var canvas = document.getElementById('c238');
michael@0 6593 var ctx = canvas.getContext('2d');
michael@0 6594
michael@0 6595 ctx.fillStyle = '#f00';
michael@0 6596 ctx.fillRect(0, 0, 100, 50);
michael@0 6597
michael@0 6598 var g = ctx.createRadialGradient(230, 25, 100, 100, 25, 101);
michael@0 6599 g.addColorStop(0, '#f00');
michael@0 6600 g.addColorStop(1, '#0f0');
michael@0 6601 ctx.fillStyle = g;
michael@0 6602 ctx.fillRect(0, 0, 100, 50);
michael@0 6603
michael@0 6604 isPixel(ctx, 1, 1, 0, 255, 0, 255, 0);
michael@0 6605 isPixel(ctx, 50, 1, 0, 255, 0, 255, 0);
michael@0 6606 isPixel(ctx, 98, 1, 0, 255, 0, 255, 0);
michael@0 6607 isPixel(ctx, 1, 25, 0, 255, 0, 255, 0);
michael@0 6608 isPixel(ctx, 50, 25, 0, 255, 0, 255, 0);
michael@0 6609 isPixel(ctx, 98, 25, 0, 255, 0, 255, 0);
michael@0 6610 isPixel(ctx, 1, 48, 0, 255, 0, 255, 0);
michael@0 6611 isPixel(ctx, 50, 48, 0, 255, 0, 255, 0);
michael@0 6612 isPixel(ctx, 98, 48, 0, 255, 0, 255, 0);
michael@0 6613
michael@0 6614 }
michael@0 6615 </script>
michael@0 6616
michael@0 6617 <!-- [[[ test_2d.gradient.radial.equal.html ]]] -->
michael@0 6618
michael@0 6619 <p>Canvas test: 2d.gradient.radial.equal</p>
michael@0 6620 <canvas id="c239" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6621 <script>
michael@0 6622
michael@0 6623
michael@0 6624
michael@0 6625 function test_2d_gradient_radial_equal() {
michael@0 6626
michael@0 6627 var canvas = document.getElementById('c239');
michael@0 6628 var ctx = canvas.getContext('2d');
michael@0 6629
michael@0 6630 ctx.fillStyle = '#0f0';
michael@0 6631 ctx.fillRect(0, 0, 100, 50);
michael@0 6632
michael@0 6633 var g = ctx.createRadialGradient(50, 25, 20, 50, 25, 20);
michael@0 6634 g.addColorStop(0, '#f00');
michael@0 6635 g.addColorStop(1, '#f00');
michael@0 6636 ctx.fillStyle = g;
michael@0 6637 ctx.fillRect(0, 0, 100, 50);
michael@0 6638
michael@0 6639 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6640 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6641 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6642 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6643 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6644 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6645 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6646 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6647 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6648
michael@0 6649
michael@0 6650 }
michael@0 6651 </script>
michael@0 6652
michael@0 6653 <!-- [[[ test_2d.gradient.radial.inside1.html ]]] -->
michael@0 6654
michael@0 6655 <p>Canvas test: 2d.gradient.radial.inside1</p>
michael@0 6656 <canvas id="c240" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6657 <script>
michael@0 6658
michael@0 6659
michael@0 6660 function test_2d_gradient_radial_inside1() {
michael@0 6661
michael@0 6662 if (IsAcceleratedSkia())
michael@0 6663 return;
michael@0 6664
michael@0 6665 var canvas = document.getElementById('c240');
michael@0 6666 var ctx = canvas.getContext('2d');
michael@0 6667
michael@0 6668 ctx.fillStyle = '#f00';
michael@0 6669 ctx.fillRect(0, 0, 100, 50);
michael@0 6670
michael@0 6671 var g = ctx.createRadialGradient(50, 25, 100, 50, 25, 200);
michael@0 6672 g.addColorStop(0, '#0f0');
michael@0 6673 g.addColorStop(1, '#f00');
michael@0 6674 ctx.fillStyle = g;
michael@0 6675 ctx.fillRect(0, 0, 100, 50);
michael@0 6676
michael@0 6677 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6678 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6679 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6680 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6681 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6682 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6683 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6684 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6685 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6686
michael@0 6687
michael@0 6688 }
michael@0 6689 </script>
michael@0 6690
michael@0 6691 <!-- [[[ test_2d.gradient.radial.inside2.html ]]] -->
michael@0 6692
michael@0 6693 <p>Canvas test: 2d.gradient.radial.inside2</p>
michael@0 6694 <canvas id="c241" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6695 <script>
michael@0 6696
michael@0 6697
michael@0 6698 function test_2d_gradient_radial_inside2() {
michael@0 6699
michael@0 6700 var canvas = document.getElementById('c241');
michael@0 6701 var ctx = canvas.getContext('2d');
michael@0 6702
michael@0 6703 ctx.fillStyle = '#f00';
michael@0 6704 ctx.fillRect(0, 0, 100, 50);
michael@0 6705
michael@0 6706 var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100);
michael@0 6707 g.addColorStop(0, '#f00');
michael@0 6708 g.addColorStop(1, '#0f0');
michael@0 6709 ctx.fillStyle = g;
michael@0 6710 ctx.fillRect(0, 0, 100, 50);
michael@0 6711
michael@0 6712 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6713 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6714 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6715 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6716 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6717 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6718 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6719 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6720 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6721
michael@0 6722
michael@0 6723 }
michael@0 6724 </script>
michael@0 6725
michael@0 6726 <!-- [[[ test_2d.gradient.radial.inside3.html ]]] -->
michael@0 6727
michael@0 6728 <p>Canvas test: 2d.gradient.radial.inside3</p>
michael@0 6729 <canvas id="c242" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6730 <script>
michael@0 6731
michael@0 6732
michael@0 6733 function test_2d_gradient_radial_inside3() {
michael@0 6734
michael@0 6735 var canvas = document.getElementById('c242');
michael@0 6736 var ctx = canvas.getContext('2d');
michael@0 6737
michael@0 6738 ctx.fillStyle = '#f00';
michael@0 6739 ctx.fillRect(0, 0, 100, 50);
michael@0 6740
michael@0 6741 var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100);
michael@0 6742 g.addColorStop(0, '#f00');
michael@0 6743 g.addColorStop(0.993, '#f00');
michael@0 6744 g.addColorStop(1, '#0f0');
michael@0 6745 ctx.fillStyle = g;
michael@0 6746 ctx.fillRect(0, 0, 100, 50);
michael@0 6747
michael@0 6748 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 6749 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 6750 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 6751 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 6752 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 6753 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 6754 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 6755 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 6756 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 6757
michael@0 6758
michael@0 6759 }
michael@0 6760 </script>
michael@0 6761
michael@0 6762 <!-- [[[ test_2d.gradient.radial.negative.html ]]] -->
michael@0 6763
michael@0 6764 <p>Canvas test: 2d.gradient.radial.negative</p>
michael@0 6765 <!-- Testing: createRadialGradient() throws INDEX_SIZE_ERR if either radius is negative -->
michael@0 6766 <canvas id="c243" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6767 <script>
michael@0 6768
michael@0 6769 function test_2d_gradient_radial_negative() {
michael@0 6770
michael@0 6771 var canvas = document.getElementById('c243');
michael@0 6772 var ctx = canvas.getContext('2d');
michael@0 6773
michael@0 6774 var _thrown = undefined; try {
michael@0 6775 ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1);
michael@0 6776 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 6777 var _thrown = undefined; try {
michael@0 6778 ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1);
michael@0 6779 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 6780 var _thrown = undefined; try {
michael@0 6781 ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1);
michael@0 6782 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 6783
michael@0 6784
michael@0 6785 }
michael@0 6786 </script>
michael@0 6787
michael@0 6788 <!-- [[[ test_2d.gradient.radial.nonfinite.html ]]] -->
michael@0 6789
michael@0 6790 <p>Canvas test: 2d.gradient.radial.nonfinite</p>
michael@0 6791 <!-- Testing: createRadialGradient() throws NOT_SUPPORTED_ERR if arguments are not finite -->
michael@0 6792 <canvas id="c244" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 6793 <script>
michael@0 6794
michael@0 6795 function test_2d_gradient_radial_nonfinite() {
michael@0 6796
michael@0 6797 var canvas = document.getElementById('c244');
michael@0 6798 var ctx = canvas.getContext('2d');
michael@0 6799
michael@0 6800 var _thrown = undefined; try {
michael@0 6801 ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1);
michael@0 6802 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6803 var _thrown = undefined; try {
michael@0 6804 ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1);
michael@0 6805 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6806 var _thrown = undefined; try {
michael@0 6807 ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1);
michael@0 6808 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6809 var _thrown = undefined; try {
michael@0 6810 ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1);
michael@0 6811 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6812 var _thrown = undefined; try {
michael@0 6813 ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1);
michael@0 6814 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6815 var _thrown = undefined; try {
michael@0 6816 ctx.createRadialGradient(0, NaN, 1, 0, 0, 1);
michael@0 6817 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6818 var _thrown = undefined; try {
michael@0 6819 ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1);
michael@0 6820 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6821 var _thrown = undefined; try {
michael@0 6822 ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1);
michael@0 6823 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6824 var _thrown = undefined; try {
michael@0 6825 ctx.createRadialGradient(0, 0, NaN, 0, 0, 1);
michael@0 6826 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6827 var _thrown = undefined; try {
michael@0 6828 ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1);
michael@0 6829 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6830 var _thrown = undefined; try {
michael@0 6831 ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1);
michael@0 6832 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6833 var _thrown = undefined; try {
michael@0 6834 ctx.createRadialGradient(0, 0, 1, NaN, 0, 1);
michael@0 6835 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6836 var _thrown = undefined; try {
michael@0 6837 ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1);
michael@0 6838 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6839 var _thrown = undefined; try {
michael@0 6840 ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1);
michael@0 6841 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6842 var _thrown = undefined; try {
michael@0 6843 ctx.createRadialGradient(0, 0, 1, 0, NaN, 1);
michael@0 6844 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6845 var _thrown = undefined; try {
michael@0 6846 ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity);
michael@0 6847 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6848 var _thrown = undefined; try {
michael@0 6849 ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity);
michael@0 6850 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6851 var _thrown = undefined; try {
michael@0 6852 ctx.createRadialGradient(0, 0, 1, 0, 0, NaN);
michael@0 6853 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6854 var _thrown = undefined; try {
michael@0 6855 ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1);
michael@0 6856 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6857 var _thrown = undefined; try {
michael@0 6858 ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1);
michael@0 6859 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6860 var _thrown = undefined; try {
michael@0 6861 ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1);
michael@0 6862 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6863 var _thrown = undefined; try {
michael@0 6864 ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1);
michael@0 6865 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6866 var _thrown = undefined; try {
michael@0 6867 ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 6868 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6869 var _thrown = undefined; try {
michael@0 6870 ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 6871 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6872 var _thrown = undefined; try {
michael@0 6873 ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1);
michael@0 6874 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6875 var _thrown = undefined; try {
michael@0 6876 ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 6877 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6878 var _thrown = undefined; try {
michael@0 6879 ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity);
michael@0 6880 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6881 var _thrown = undefined; try {
michael@0 6882 ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1);
michael@0 6883 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6884 var _thrown = undefined; try {
michael@0 6885 ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1);
michael@0 6886 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6887 var _thrown = undefined; try {
michael@0 6888 ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity);
michael@0 6889 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6890 var _thrown = undefined; try {
michael@0 6891 ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity);
michael@0 6892 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6893 var _thrown = undefined; try {
michael@0 6894 ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1);
michael@0 6895 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6896 var _thrown = undefined; try {
michael@0 6897 ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity);
michael@0 6898 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6899 var _thrown = undefined; try {
michael@0 6900 ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity);
michael@0 6901 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6902 var _thrown = undefined; try {
michael@0 6903 ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1);
michael@0 6904 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6905 var _thrown = undefined; try {
michael@0 6906 ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1);
michael@0 6907 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6908 var _thrown = undefined; try {
michael@0 6909 ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1);
michael@0 6910 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6911 var _thrown = undefined; try {
michael@0 6912 ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 6913 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6914 var _thrown = undefined; try {
michael@0 6915 ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity);
michael@0 6916 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6917 var _thrown = undefined; try {
michael@0 6918 ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1);
michael@0 6919 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6920 var _thrown = undefined; try {
michael@0 6921 ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity);
michael@0 6922 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6923 var _thrown = undefined; try {
michael@0 6924 ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity);
michael@0 6925 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6926 var _thrown = undefined; try {
michael@0 6927 ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1);
michael@0 6928 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6929 var _thrown = undefined; try {
michael@0 6930 ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1);
michael@0 6931 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6932 var _thrown = undefined; try {
michael@0 6933 ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity);
michael@0 6934 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6935 var _thrown = undefined; try {
michael@0 6936 ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity);
michael@0 6937 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6938 var _thrown = undefined; try {
michael@0 6939 ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1);
michael@0 6940 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6941 var _thrown = undefined; try {
michael@0 6942 ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity);
michael@0 6943 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6944 var _thrown = undefined; try {
michael@0 6945 ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity);
michael@0 6946 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6947 var _thrown = undefined; try {
michael@0 6948 ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1);
michael@0 6949 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6950 var _thrown = undefined; try {
michael@0 6951 ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1);
michael@0 6952 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6953 var _thrown = undefined; try {
michael@0 6954 ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1);
michael@0 6955 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6956 var _thrown = undefined; try {
michael@0 6957 ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 6958 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6959 var _thrown = undefined; try {
michael@0 6960 ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 6961 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6962 var _thrown = undefined; try {
michael@0 6963 ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1);
michael@0 6964 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6965 var _thrown = undefined; try {
michael@0 6966 ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 6967 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6968 var _thrown = undefined; try {
michael@0 6969 ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity);
michael@0 6970 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6971 var _thrown = undefined; try {
michael@0 6972 ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1);
michael@0 6973 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6974 var _thrown = undefined; try {
michael@0 6975 ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1);
michael@0 6976 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6977 var _thrown = undefined; try {
michael@0 6978 ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity);
michael@0 6979 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6980 var _thrown = undefined; try {
michael@0 6981 ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity);
michael@0 6982 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6983 var _thrown = undefined; try {
michael@0 6984 ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1);
michael@0 6985 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6986 var _thrown = undefined; try {
michael@0 6987 ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity);
michael@0 6988 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6989 var _thrown = undefined; try {
michael@0 6990 ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity);
michael@0 6991 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6992 var _thrown = undefined; try {
michael@0 6993 ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1);
michael@0 6994 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6995 var _thrown = undefined; try {
michael@0 6996 ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1);
michael@0 6997 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 6998 var _thrown = undefined; try {
michael@0 6999 ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 7000 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7001 var _thrown = undefined; try {
michael@0 7002 ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity);
michael@0 7003 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7004 var _thrown = undefined; try {
michael@0 7005 ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1);
michael@0 7006 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7007 var _thrown = undefined; try {
michael@0 7008 ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity);
michael@0 7009 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7010 var _thrown = undefined; try {
michael@0 7011 ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity);
michael@0 7012 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7013 var _thrown = undefined; try {
michael@0 7014 ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1);
michael@0 7015 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7016 var _thrown = undefined; try {
michael@0 7017 ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity);
michael@0 7018 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7019 var _thrown = undefined; try {
michael@0 7020 ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity);
michael@0 7021 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7022 var _thrown = undefined; try {
michael@0 7023 ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity);
michael@0 7024 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7025
michael@0 7026
michael@0 7027 }
michael@0 7028 </script>
michael@0 7029
michael@0 7030 <!-- [[[ test_2d.gradient.radial.outside1.html ]]] -->
michael@0 7031
michael@0 7032 <p>Canvas test: 2d.gradient.radial.outside1</p>
michael@0 7033 <canvas id="c245" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7034 <script>
michael@0 7035
michael@0 7036
michael@0 7037 function test_2d_gradient_radial_outside1() {
michael@0 7038
michael@0 7039 var canvas = document.getElementById('c245');
michael@0 7040 var ctx = canvas.getContext('2d');
michael@0 7041
michael@0 7042 ctx.fillStyle = '#f00';
michael@0 7043 ctx.fillRect(0, 0, 100, 50);
michael@0 7044
michael@0 7045 var g = ctx.createRadialGradient(200, 25, 10, 200, 25, 20);
michael@0 7046 g.addColorStop(0, '#f00');
michael@0 7047 g.addColorStop(1, '#0f0');
michael@0 7048 ctx.fillStyle = g;
michael@0 7049 ctx.fillRect(0, 0, 100, 50);
michael@0 7050
michael@0 7051 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7052 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7053 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7054 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7055 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7056 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7057 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7058 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7059 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7060
michael@0 7061
michael@0 7062 }
michael@0 7063 </script>
michael@0 7064
michael@0 7065 <!-- [[[ test_2d.gradient.radial.outside2.html ]]] -->
michael@0 7066
michael@0 7067 <p>Canvas test: 2d.gradient.radial.outside2</p>
michael@0 7068 <canvas id="c246" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7069 <script>
michael@0 7070
michael@0 7071
michael@0 7072
michael@0 7073 function test_2d_gradient_radial_outside2() {
michael@0 7074
michael@0 7075 var canvas = document.getElementById('c246');
michael@0 7076 var ctx = canvas.getContext('2d');
michael@0 7077
michael@0 7078 ctx.fillStyle = '#f00';
michael@0 7079 ctx.fillRect(0, 0, 100, 50);
michael@0 7080
michael@0 7081 var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10);
michael@0 7082 g.addColorStop(0, '#0f0');
michael@0 7083 g.addColorStop(1, '#f00');
michael@0 7084 ctx.fillStyle = g;
michael@0 7085 ctx.fillRect(0, 0, 100, 50);
michael@0 7086
michael@0 7087 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7088 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7089 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7090 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7091 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7092 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7093 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7094 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7095 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7096
michael@0 7097
michael@0 7098 }
michael@0 7099 </script>
michael@0 7100
michael@0 7101 <!-- [[[ test_2d.gradient.radial.outside3.html ]]] -->
michael@0 7102
michael@0 7103 <p>Canvas test: 2d.gradient.radial.outside3</p>
michael@0 7104 <canvas id="c247" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7105 <script>
michael@0 7106
michael@0 7107
michael@0 7108
michael@0 7109 function test_2d_gradient_radial_outside3() {
michael@0 7110
michael@0 7111 var canvas = document.getElementById('c247');
michael@0 7112 var ctx = canvas.getContext('2d');
michael@0 7113
michael@0 7114 ctx.fillStyle = '#f00';
michael@0 7115 ctx.fillRect(0, 0, 100, 50);
michael@0 7116
michael@0 7117 var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10);
michael@0 7118 g.addColorStop(0, '#0f0');
michael@0 7119 g.addColorStop(0.001, '#f00');
michael@0 7120 g.addColorStop(1, '#f00');
michael@0 7121 ctx.fillStyle = g;
michael@0 7122 ctx.fillRect(0, 0, 100, 50);
michael@0 7123
michael@0 7124 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7125 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7126 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7127 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7128 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7129 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7130 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7131 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7132 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7133
michael@0 7134
michael@0 7135 }
michael@0 7136 </script>
michael@0 7137
michael@0 7138 <!-- [[[ test_2d.gradient.radial.touch1.html ]]] -->
michael@0 7139
michael@0 7140 <p>Canvas test: 2d.gradient.radial.touch1</p>
michael@0 7141 <canvas id="c248" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7142 <script>
michael@0 7143
michael@0 7144
michael@0 7145
michael@0 7146 function test_2d_gradient_radial_touch1() {
michael@0 7147
michael@0 7148 var canvas = document.getElementById('c248');
michael@0 7149 var ctx = canvas.getContext('2d');
michael@0 7150
michael@0 7151 ctx.fillStyle = '#0f0';
michael@0 7152 ctx.fillRect(0, 0, 100, 50);
michael@0 7153
michael@0 7154 var g = ctx.createRadialGradient(150, 25, 50, 200, 25, 100);
michael@0 7155 g.addColorStop(0, '#f00');
michael@0 7156 g.addColorStop(1, '#f00');
michael@0 7157 ctx.fillStyle = g;
michael@0 7158 ctx.fillRect(0, 0, 100, 50);
michael@0 7159
michael@0 7160 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7161 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7162 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7163 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7164 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7165 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7166 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7167 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7168 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7169
michael@0 7170
michael@0 7171 }
michael@0 7172 </script>
michael@0 7173
michael@0 7174 <!-- [[[ test_2d.gradient.radial.touch2.html ]]] -->
michael@0 7175
michael@0 7176 <p>Canvas test: 2d.gradient.radial.touch2</p>
michael@0 7177 <canvas id="c249" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7178 <script>
michael@0 7179
michael@0 7180
michael@0 7181
michael@0 7182 function test_2d_gradient_radial_touch2() {
michael@0 7183
michael@0 7184 var canvas = document.getElementById('c249');
michael@0 7185 var ctx = canvas.getContext('2d');
michael@0 7186
michael@0 7187 ctx.fillStyle = '#f00';
michael@0 7188 ctx.fillRect(0, 0, 100, 50);
michael@0 7189
michael@0 7190 var g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150);
michael@0 7191 g.addColorStop(0, '#f00');
michael@0 7192 g.addColorStop(0.01, '#0f0');
michael@0 7193 g.addColorStop(0.99, '#0f0');
michael@0 7194 g.addColorStop(1, '#f00');
michael@0 7195 ctx.fillStyle = g;
michael@0 7196 ctx.fillRect(0, 0, 100, 50);
michael@0 7197
michael@0 7198 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7199 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7200 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7201 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7202 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7203 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7204 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7205 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7206 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7207
michael@0 7208
michael@0 7209 }
michael@0 7210 </script>
michael@0 7211
michael@0 7212 <!-- [[[ test_2d.gradient.radial.touch3.html ]]] -->
michael@0 7213
michael@0 7214 <p>Canvas test: 2d.gradient.radial.touch3</p>
michael@0 7215 <canvas id="c250" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7216 <script>
michael@0 7217
michael@0 7218
michael@0 7219
michael@0 7220 function test_2d_gradient_radial_touch3() {
michael@0 7221
michael@0 7222 var canvas = document.getElementById('c250');
michael@0 7223 var ctx = canvas.getContext('2d');
michael@0 7224
michael@0 7225 ctx.fillStyle = '#0f0';
michael@0 7226 ctx.fillRect(0, 0, 100, 50);
michael@0 7227
michael@0 7228 var g = ctx.createRadialGradient(120, -15, 25, 140, -30, 50);
michael@0 7229 g.addColorStop(0, '#f00');
michael@0 7230 g.addColorStop(1, '#f00');
michael@0 7231 ctx.fillStyle = g;
michael@0 7232 ctx.fillRect(0, 0, 100, 50);
michael@0 7233
michael@0 7234 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 7235 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 7236 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 7237 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 7238 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7239 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 7240 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 7241 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 7242 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 7243
michael@0 7244
michael@0 7245 }
michael@0 7246 </script>
michael@0 7247
michael@0 7248 <!-- [[[ test_2d.gradient.radial.transform.1.html ]]] -->
michael@0 7249
michael@0 7250 <p>Canvas test: 2d.gradient.radial.transform.1</p>
michael@0 7251 <!-- Testing: Radial gradient coordinates are relative to the coordinate space at the time of filling -->
michael@0 7252 <canvas id="c251" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7253 <script>
michael@0 7254
michael@0 7255
michael@0 7256 function test_2d_gradient_radial_transform_1() {
michael@0 7257
michael@0 7258 var canvas = document.getElementById('c251');
michael@0 7259 var ctx = canvas.getContext('2d');
michael@0 7260
michael@0 7261 var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
michael@0 7262 g.addColorStop(0, '#0f0');
michael@0 7263 g.addColorStop(0.5, '#0f0');
michael@0 7264 g.addColorStop(0.51, '#f00');
michael@0 7265 g.addColorStop(1, '#f00');
michael@0 7266 ctx.fillStyle = g;
michael@0 7267 ctx.translate(50, 25);
michael@0 7268 ctx.scale(10, 10);
michael@0 7269 ctx.fillRect(-5, -2.5, 10, 5);
michael@0 7270 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 7271 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7272 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 7273
michael@0 7274
michael@0 7275 }
michael@0 7276 </script>
michael@0 7277
michael@0 7278 <!-- [[[ test_2d.gradient.radial.transform.2.html ]]] -->
michael@0 7279
michael@0 7280 <p>Canvas test: 2d.gradient.radial.transform.2</p>
michael@0 7281 <!-- Testing: Radial gradient coordinates are relative to the coordinate space at the time of filling -->
michael@0 7282 <canvas id="c252" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7283 <script>
michael@0 7284
michael@0 7285
michael@0 7286 function test_2d_gradient_radial_transform_2() {
michael@0 7287
michael@0 7288 var canvas = document.getElementById('c252');
michael@0 7289 var ctx = canvas.getContext('2d');
michael@0 7290
michael@0 7291 ctx.translate(100, 0);
michael@0 7292 var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
michael@0 7293 g.addColorStop(0, '#0f0');
michael@0 7294 g.addColorStop(0.5, '#0f0');
michael@0 7295 g.addColorStop(0.51, '#f00');
michael@0 7296 g.addColorStop(1, '#f00');
michael@0 7297 ctx.fillStyle = g;
michael@0 7298 ctx.translate(-50, 25);
michael@0 7299 ctx.scale(10, 10);
michael@0 7300 ctx.fillRect(-5, -2.5, 10, 5);
michael@0 7301 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 7302 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7303 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 7304
michael@0 7305
michael@0 7306 }
michael@0 7307 </script>
michael@0 7308
michael@0 7309 <!-- [[[ test_2d.gradient.radial.transform.3.html ]]] -->
michael@0 7310
michael@0 7311 <p>Canvas test: 2d.gradient.radial.transform.3</p>
michael@0 7312 <!-- Testing: Radial gradient transforms do not experience broken caching effects -->
michael@0 7313 <canvas id="c253" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7314 <script>
michael@0 7315
michael@0 7316
michael@0 7317
michael@0 7318 function test_2d_gradient_radial_transform_3() {
michael@0 7319
michael@0 7320 var canvas = document.getElementById('c253');
michael@0 7321 var ctx = canvas.getContext('2d');
michael@0 7322
michael@0 7323 var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
michael@0 7324 g.addColorStop(0, '#0f0');
michael@0 7325 g.addColorStop(0.5, '#0f0');
michael@0 7326 g.addColorStop(0.51, '#f00');
michael@0 7327 g.addColorStop(1, '#f00');
michael@0 7328 ctx.fillStyle = g;
michael@0 7329 ctx.fillRect(0, 0, 100, 50);
michael@0 7330 ctx.translate(50, 25);
michael@0 7331 ctx.scale(10, 10);
michael@0 7332 ctx.fillRect(-5, -2.5, 10, 5);
michael@0 7333
michael@0 7334 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 7335 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 7336 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 7337
michael@0 7338 }
michael@0 7339 </script>
michael@0 7340
michael@0 7341 <!-- [[[ test_2d.imageData.create.basic.html ]]] -->
michael@0 7342
michael@0 7343 <p>Canvas test: 2d.imageData.create.basic - bug 433004</p>
michael@0 7344 <!-- Testing: createImageData() exists and returns something -->
michael@0 7345 <canvas id="c254" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7346 <script>
michael@0 7347
michael@0 7348 function test_2d_imageData_create_basic() {
michael@0 7349
michael@0 7350 var canvas = document.getElementById('c254');
michael@0 7351 var ctx = canvas.getContext('2d');
michael@0 7352
michael@0 7353 ok(ctx.createImageData(1, 1) !== null, "ctx.createImageData(1, 1) !== null");
michael@0 7354
michael@0 7355
michael@0 7356 }
michael@0 7357 </script>
michael@0 7358
michael@0 7359 <!-- [[[ test_2d.imageData.create1.basic.html ]]] -->
michael@0 7360
michael@0 7361 <p>Canvas test: 2d.imageData.create1.basic - bug 630040</p>
michael@0 7362 <!-- Testing: createImageData(imgdata) exists and returns something -->
michael@0 7363 <canvas id="c254a" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7364 <script>
michael@0 7365
michael@0 7366 function test_2d_imageData_create1_basic() {
michael@0 7367
michael@0 7368 var canvas = document.getElementById('c254a');
michael@0 7369 var ctx = canvas.getContext('2d');
michael@0 7370
michael@0 7371 ok(ctx.createImageData(ctx.createImageData(1, 1)) != null, "ctx.createImageData(ctx.createImageData(1, 1)) != null");
michael@0 7372
michael@0 7373
michael@0 7374 }
michael@0 7375 </script>
michael@0 7376
michael@0 7377 <!-- [[[ test_2d.imageData.create.initial.html ]]] -->
michael@0 7378
michael@0 7379 <p>Canvas test: 2d.imageData.create.initial - bug 433004</p>
michael@0 7380 <!-- Testing: createImageData() returns transparent black data of the right size -->
michael@0 7381 <canvas id="c255" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7382 <script>
michael@0 7383
michael@0 7384 function test_2d_imageData_create_initial() {
michael@0 7385
michael@0 7386 var canvas = document.getElementById('c255');
michael@0 7387 var ctx = canvas.getContext('2d');
michael@0 7388
michael@0 7389 var imgdata = ctx.createImageData(10, 20);
michael@0 7390 ok(imgdata.data.length == imgdata.width*imgdata.height*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
michael@0 7391 ok(imgdata.width < imgdata.height, "imgdata.width < imgdata.height");
michael@0 7392 ok(imgdata.width > 0, "imgdata.width > 0");
michael@0 7393 var isTransparentBlack = true;
michael@0 7394 for (var i = 0; i < imgdata.data.length; ++i)
michael@0 7395 if (imgdata.data[i] !== 0)
michael@0 7396 isTransparentBlack = false;
michael@0 7397 ok(isTransparentBlack, "isTransparentBlack");
michael@0 7398
michael@0 7399
michael@0 7400 }
michael@0 7401 </script>
michael@0 7402
michael@0 7403 <!-- [[[ test_2d.imageData.create1.initial.html ]]] -->
michael@0 7404
michael@0 7405 <p>Canvas test: 2d.imageData.create1.initial - bug 630040</p>
michael@0 7406 <!-- Testing: createImageData(imgdata) returns transparent black data of the right size -->
michael@0 7407 <canvas id="c255a" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7408 <script>
michael@0 7409
michael@0 7410 function test_2d_imageData_create1_initial() {
michael@0 7411
michael@0 7412 var canvas = document.getElementById('c255a');
michael@0 7413 var ctx = canvas.getContext('2d');
michael@0 7414
michael@0 7415 ctx.fillStyle = '#0f0';
michael@0 7416 ctx.fillRect(0, 0, 100, 50);
michael@0 7417 var imgdata1 = ctx.getImageData(0, 0, 10, 20);
michael@0 7418 var imgdata2 = ctx.createImageData(imgdata1);
michael@0 7419 ok(imgdata2.data.length == imgdata1.data.length, "imgdata2.data.length == imgdata1.data.length");
michael@0 7420 ok(imgdata2.width == imgdata1.width, "imgdata2.width == imgdata1.width");
michael@0 7421 ok(imgdata2.height == imgdata1.height, "imgdata2.height == imgdata1.height");
michael@0 7422 var isTransparentBlack = true;
michael@0 7423 for (var i = 0; i < imgdata2.data.length; ++i)
michael@0 7424 if (imgdata2.data[i] !== 0)
michael@0 7425 isTransparentBlack = false;
michael@0 7426 ok(isTransparentBlack, "isTransparentBlack");
michael@0 7427
michael@0 7428
michael@0 7429 }
michael@0 7430 </script>
michael@0 7431
michael@0 7432 <!-- [[[ test_2d.imageData.create.large.html ]]] -->
michael@0 7433
michael@0 7434 <p>Canvas test: 2d.imageData.create.large - bug 433004</p>
michael@0 7435 <!-- Testing: createImageData() works for sizes much larger than the canvas -->
michael@0 7436 <canvas id="c256" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7437 <script>
michael@0 7438
michael@0 7439 function test_2d_imageData_create_large() {
michael@0 7440
michael@0 7441 var canvas = document.getElementById('c256');
michael@0 7442 var ctx = canvas.getContext('2d');
michael@0 7443
michael@0 7444 var _thrown_outer = false;
michael@0 7445
michael@0 7446 var imgdata = ctx.createImageData(1000, 2000);
michael@0 7447 ok(imgdata.data.length == imgdata.width*imgdata.height*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
michael@0 7448 ok(imgdata.width < imgdata.height, "imgdata.width < imgdata.height");
michael@0 7449 ok(imgdata.width > 0, "imgdata.width > 0");
michael@0 7450 var isTransparentBlack = true;
michael@0 7451 for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling)
michael@0 7452 if (imgdata.data[i] !== 0)
michael@0 7453 isTransparentBlack = false;
michael@0 7454 ok(isTransparentBlack, "isTransparentBlack");
michael@0 7455
michael@0 7456
michael@0 7457 }
michael@0 7458 </script>
michael@0 7459
michael@0 7460 <!-- [[[ test_2d.imageData.create.negative.html ]]] -->
michael@0 7461
michael@0 7462 <p>Canvas test: 2d.imageData.create.negative - bug 433004</p>
michael@0 7463 <!-- Testing: createImageData() takes the absolute magnitude of the size arguments -->
michael@0 7464 <canvas id="c257" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7465 <script>
michael@0 7466
michael@0 7467 function test_2d_imageData_create_negative() {
michael@0 7468
michael@0 7469 var canvas = document.getElementById('c257');
michael@0 7470 var ctx = canvas.getContext('2d');
michael@0 7471
michael@0 7472 var _thrown_outer = false;
michael@0 7473 try {
michael@0 7474
michael@0 7475 var imgdata1 = ctx.createImageData(10, 20);
michael@0 7476 var imgdata2 = ctx.createImageData(-10, 20);
michael@0 7477 var imgdata3 = ctx.createImageData(10, -20);
michael@0 7478 var imgdata4 = ctx.createImageData(-10, -20);
michael@0 7479 ok(imgdata1.data.length == imgdata2.data.length, "imgdata1.data.length == imgdata2.data.length");
michael@0 7480 ok(imgdata2.data.length == imgdata3.data.length, "imgdata2.data.length == imgdata3.data.length");
michael@0 7481 ok(imgdata3.data.length == imgdata4.data.length, "imgdata3.data.length == imgdata4.data.length");
michael@0 7482
michael@0 7483 } catch (e) {
michael@0 7484 _thrown_outer = true;
michael@0 7485 }
michael@0 7486 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 7487
michael@0 7488
michael@0 7489 }
michael@0 7490 </script>
michael@0 7491
michael@0 7492 <!-- [[[ test_2d.imageData.create.nonfinite.html ]]] -->
michael@0 7493
michael@0 7494 <p>Canvas test: 2d.imageData.create.nonfinite - bug 433004</p>
michael@0 7495 <!-- Testing: createImageData() throws NOT_SUPPORTED_ERR if arguments are not finite -->
michael@0 7496 <canvas id="c258" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7497 <script>
michael@0 7498
michael@0 7499 function test_2d_imageData_create_nonfinite() {
michael@0 7500
michael@0 7501 var canvas = document.getElementById('c258');
michael@0 7502 var ctx = canvas.getContext('2d');
michael@0 7503
michael@0 7504 var _thrown = undefined; try {
michael@0 7505 ctx.createImageData(Infinity, 10);
michael@0 7506 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7507 var _thrown = undefined; try {
michael@0 7508 ctx.createImageData(-Infinity, 10);
michael@0 7509 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7510 var _thrown = undefined; try {
michael@0 7511 ctx.createImageData(NaN, 10);
michael@0 7512 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7513 var _thrown = undefined; try {
michael@0 7514 ctx.createImageData(10, Infinity);
michael@0 7515 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7516 var _thrown = undefined; try {
michael@0 7517 ctx.createImageData(10, -Infinity);
michael@0 7518 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7519 var _thrown = undefined; try {
michael@0 7520 ctx.createImageData(10, NaN);
michael@0 7521 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7522 var _thrown = undefined; try {
michael@0 7523 ctx.createImageData(Infinity, Infinity);
michael@0 7524 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7525 var _thrown = undefined; try {
michael@0 7526 ctx.createImageData({valueOf:function() Infinity}, 10);
michael@0 7527 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7528 var _thrown = undefined; try {
michael@0 7529 ctx.createImageData({valueOf:function() -Infinity}, 10);
michael@0 7530 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7531 var _thrown = undefined; try {
michael@0 7532 ctx.createImageData({valueOf:function() NaN}, 10);
michael@0 7533 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7534 var _thrown = undefined; try {
michael@0 7535 ctx.createImageData(10, {valueOf:function() Infinity});
michael@0 7536 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7537 var _thrown = undefined; try {
michael@0 7538 ctx.createImageData(10, {valueOf:function() -Infinity});
michael@0 7539 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7540 var _thrown = undefined; try {
michael@0 7541 ctx.createImageData(10, {valueOf:function() NaN});
michael@0 7542 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7543 var _thrown = undefined; try {
michael@0 7544 ctx.createImageData({valueOf:function() Infinity}, {valueOf:function() Infinity});
michael@0 7545 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7546
michael@0 7547
michael@0 7548 }
michael@0 7549 </script>
michael@0 7550
michael@0 7551 <!-- [[[ test_2d.imageData.create.round.html ]]] -->
michael@0 7552
michael@0 7553 <p>Canvas test: 2d.imageData.create.round - bug 433004</p>
michael@0 7554 <!-- Testing: createImageData(w, h) is rounded the same as getImageData(0, 0, w, h) -->
michael@0 7555 <canvas id="c259" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7556 <script>
michael@0 7557
michael@0 7558 function test_2d_imageData_create_round() {
michael@0 7559
michael@0 7560 var canvas = document.getElementById('c259');
michael@0 7561 var ctx = canvas.getContext('2d');
michael@0 7562
michael@0 7563 var _thrown_outer = false;
michael@0 7564
michael@0 7565 var imgdata1 = ctx.createImageData(10.01, 10.99);
michael@0 7566 var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99);
michael@0 7567 is(imgdata1.width, imgdata2.width, "imgdata1.width == imgdata2.width");
michael@0 7568 is(imgdata1.height, imgdata2.height, "imgdata1.height == imgdata2.height");
michael@0 7569
michael@0 7570
michael@0 7571 }
michael@0 7572 </script>
michael@0 7573
michael@0 7574 <!-- [[[ test_2d.imageData.create.tiny.html ]]] -->
michael@0 7575
michael@0 7576 <p>Canvas test: 2d.imageData.create.tiny - bug 433004</p>
michael@0 7577 <!-- Testing: createImageData() works for sizes smaller than one pixel -->
michael@0 7578 <canvas id="c260" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7579 <script>
michael@0 7580
michael@0 7581 function test_2d_imageData_create_tiny() {
michael@0 7582
michael@0 7583 var canvas = document.getElementById('c260');
michael@0 7584 var ctx = canvas.getContext('2d');
michael@0 7585
michael@0 7586 var _thrown_outer = false;
michael@0 7587 try {
michael@0 7588
michael@0 7589 var imgdata = ctx.createImageData(0.0001, 0.0001);
michael@0 7590 ok(imgdata.data.length == imgdata.width*imgdata.height*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
michael@0 7591 ok(imgdata.width == 1, "imgdata.width == 1");
michael@0 7592 ok(imgdata.height == 1, "imgdata.height == 1");
michael@0 7593 var isTransparentBlack = true;
michael@0 7594 for (var i = 0; i < imgdata.data.length; ++i)
michael@0 7595 if (imgdata.data[i] !== 0)
michael@0 7596 isTransparentBlack = false;
michael@0 7597 ok(isTransparentBlack, "isTransparentBlack");
michael@0 7598
michael@0 7599 } catch (e) {
michael@0 7600 _thrown_outer = true;
michael@0 7601 }
michael@0 7602 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 7603
michael@0 7604
michael@0 7605 }
michael@0 7606 </script>
michael@0 7607
michael@0 7608 <!-- [[[ test_2d.imageData.create.type.html ]]] -->
michael@0 7609
michael@0 7610 <p>Canvas test: 2d.imageData.create.type - bug 433004</p>
michael@0 7611 <!-- Testing: createImageData() returns an ImageData object containing a Uint8ClampedArray object -->
michael@0 7612 <canvas id="c261" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7613 <script>
michael@0 7614
michael@0 7615 function test_2d_imageData_create_type() {
michael@0 7616
michael@0 7617 var canvas = document.getElementById('c261');
michael@0 7618 var ctx = canvas.getContext('2d');
michael@0 7619
michael@0 7620 ok(window.ImageData !== undefined, "window.ImageData !== undefined");
michael@0 7621 ok(window.Uint8ClampedArray !== undefined, "window.Uint8ClampedArray !== undefined");
michael@0 7622 window.ImageData.prototype.thisImplementsImageData = true;
michael@0 7623 window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true;
michael@0 7624 var imgdata = ctx.createImageData(1, 1);
michael@0 7625 ok(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData");
michael@0 7626 ok(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray");
michael@0 7627
michael@0 7628
michael@0 7629 }
michael@0 7630 </script>
michael@0 7631
michael@0 7632 <!-- [[[ test_2d.imageData.create1.type.html ]]] -->
michael@0 7633
michael@0 7634 <p>Canvas test: 2d.imageData.create1.type - bug 630040</p>
michael@0 7635 <!-- Testing: createImageData(imgdata) returns an ImageData object containing a Uint8ClampedArray object -->
michael@0 7636 <canvas id="c261a" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7637 <script>
michael@0 7638
michael@0 7639 function test_2d_imageData_create1_type() {
michael@0 7640
michael@0 7641 var canvas = document.getElementById('c261a');
michael@0 7642 var ctx = canvas.getContext('2d');
michael@0 7643
michael@0 7644 ok(window.ImageData !== undefined, "window.ImageData !== undefined");
michael@0 7645 ok(window.Uint8ClampedArray !== undefined, "window.Uint8ClampedArray !== undefined");
michael@0 7646 window.ImageData.prototype.thisImplementsImageData = true;
michael@0 7647 window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true;
michael@0 7648 var imgdata = ctx.createImageData(ctx.createImageData(1, 1));
michael@0 7649 ok(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData");
michael@0 7650 ok(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray");
michael@0 7651
michael@0 7652
michael@0 7653 }
michael@0 7654 </script>
michael@0 7655
michael@0 7656 <!-- [[[ test_2d.imageData.create.zero.html ]]] -->
michael@0 7657
michael@0 7658 <p>Canvas test: 2d.imageData.create.zero - bug 433004</p>
michael@0 7659 <!-- Testing: createImageData() throws INDEX_SIZE_ERR if size is zero -->
michael@0 7660 <canvas id="c262" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7661 <script>
michael@0 7662
michael@0 7663 function test_2d_imageData_create_zero() {
michael@0 7664
michael@0 7665 var canvas = document.getElementById('c262');
michael@0 7666 var ctx = canvas.getContext('2d');
michael@0 7667
michael@0 7668 var _thrown = undefined; try {
michael@0 7669 ctx.createImageData(10, 0);
michael@0 7670 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 7671 var _thrown = undefined; try {
michael@0 7672 ctx.createImageData(0, 10);
michael@0 7673 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 7674 var _thrown = undefined; try {
michael@0 7675 ctx.createImageData(0, 0);
michael@0 7676 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 7677
michael@0 7678
michael@0 7679 }
michael@0 7680 </script>
michael@0 7681
michael@0 7682 <!-- [[[ test_2d.imageData.create1.zero.html ]]] -->
michael@0 7683
michael@0 7684 <p>Canvas test: 2d.imageData.create1.zero - bug 630040</p>
michael@0 7685 <!-- Testing: createImageData(null) throws TypeError -->
michael@0 7686 <canvas id="c262a" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7687 <script>
michael@0 7688
michael@0 7689 function test_2d_imageData_create1_zero() {
michael@0 7690
michael@0 7691 var canvas = document.getElementById('c262a');
michael@0 7692 var ctx = canvas.getContext('2d');
michael@0 7693
michael@0 7694 var _thrown = undefined; try {
michael@0 7695 ctx.createImageData(null);
michael@0 7696 } catch (e) { _thrown = e };
michael@0 7697 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 7698
michael@0 7699
michael@0 7700 }
michael@0 7701 </script>
michael@0 7702
michael@0 7703 <!-- [[[ test_2d.imageData.get.basic.html ]]] -->
michael@0 7704
michael@0 7705 <p>Canvas test: 2d.imageData.get.basic</p>
michael@0 7706 <!-- Testing: getImageData() exists and returns something -->
michael@0 7707 <canvas id="c263" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7708 <script>
michael@0 7709
michael@0 7710 function test_2d_imageData_get_basic() {
michael@0 7711
michael@0 7712 var canvas = document.getElementById('c263');
michael@0 7713 var ctx = canvas.getContext('2d');
michael@0 7714
michael@0 7715 ok(ctx.getImageData(0, 0, 100, 50) !== null, "ctx.getImageData(0, 0, 100, 50) !== null");
michael@0 7716
michael@0 7717
michael@0 7718 }
michael@0 7719 </script>
michael@0 7720
michael@0 7721 <!-- [[[ test_2d.imageData.get.clamp.html ]]] -->
michael@0 7722
michael@0 7723 <p>Canvas test: 2d.imageData.get.clamp</p>
michael@0 7724 <!-- Testing: getImageData() clamps colours to the range [0, 255] -->
michael@0 7725 <canvas id="c264" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7726 <script>
michael@0 7727
michael@0 7728 function test_2d_imageData_get_clamp() {
michael@0 7729
michael@0 7730 var canvas = document.getElementById('c264');
michael@0 7731 var ctx = canvas.getContext('2d');
michael@0 7732
michael@0 7733 ctx.fillStyle = 'rgb(-100, -200, -300)';
michael@0 7734 ctx.fillRect(0, 0, 100, 50);
michael@0 7735 ctx.fillStyle = 'rgb(256, 300, 400)';
michael@0 7736 ctx.fillRect(20, 10, 60, 10);
michael@0 7737 var imgdata1 = ctx.getImageData(10, 5, 1, 1);
michael@0 7738 ok(imgdata1.data[0] === 0, "imgdata1.data[\""+(0)+"\"] === 0");
michael@0 7739 ok(imgdata1.data[1] === 0, "imgdata1.data[\""+(1)+"\"] === 0");
michael@0 7740 ok(imgdata1.data[2] === 0, "imgdata1.data[\""+(2)+"\"] === 0");
michael@0 7741 var imgdata2 = ctx.getImageData(30, 15, 1, 1);
michael@0 7742 ok(imgdata2.data[0] === 255, "imgdata2.data[\""+(0)+"\"] === 255");
michael@0 7743 ok(imgdata2.data[1] === 255, "imgdata2.data[\""+(1)+"\"] === 255");
michael@0 7744 ok(imgdata2.data[2] === 255, "imgdata2.data[\""+(2)+"\"] === 255");
michael@0 7745
michael@0 7746
michael@0 7747 }
michael@0 7748 </script>
michael@0 7749
michael@0 7750 <!-- [[[ test_2d.imageData.get.nonfinite.html ]]] -->
michael@0 7751
michael@0 7752 <p>Canvas test: 2d.imageData.get.nonfinite</p>
michael@0 7753 <!-- Testing: getImageData() throws NOT_SUPPORTED_ERR if arguments are not finite -->
michael@0 7754 <canvas id="c265" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7755 <script>
michael@0 7756
michael@0 7757 function test_2d_imageData_get_nonfinite() {
michael@0 7758
michael@0 7759 var canvas = document.getElementById('c265');
michael@0 7760 var ctx = canvas.getContext('2d');
michael@0 7761
michael@0 7762 var _thrown = undefined; try {
michael@0 7763 ctx.getImageData(Infinity, 10, 10, 10);
michael@0 7764 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7765 var _thrown = undefined; try {
michael@0 7766 ctx.getImageData(-Infinity, 10, 10, 10);
michael@0 7767 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7768 var _thrown = undefined; try {
michael@0 7769 ctx.getImageData(NaN, 10, 10, 10);
michael@0 7770 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7771 var _thrown = undefined; try {
michael@0 7772 ctx.getImageData(10, Infinity, 10, 10);
michael@0 7773 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7774 var _thrown = undefined; try {
michael@0 7775 ctx.getImageData(10, -Infinity, 10, 10);
michael@0 7776 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7777 var _thrown = undefined; try {
michael@0 7778 ctx.getImageData(10, NaN, 10, 10);
michael@0 7779 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7780 var _thrown = undefined; try {
michael@0 7781 ctx.getImageData(10, 10, Infinity, 10);
michael@0 7782 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7783 var _thrown = undefined; try {
michael@0 7784 ctx.getImageData(10, 10, -Infinity, 10);
michael@0 7785 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7786 var _thrown = undefined; try {
michael@0 7787 ctx.getImageData(10, 10, NaN, 10);
michael@0 7788 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7789 var _thrown = undefined; try {
michael@0 7790 ctx.getImageData(10, 10, 10, Infinity);
michael@0 7791 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7792 var _thrown = undefined; try {
michael@0 7793 ctx.getImageData(10, 10, 10, -Infinity);
michael@0 7794 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7795 var _thrown = undefined; try {
michael@0 7796 ctx.getImageData(10, 10, 10, NaN);
michael@0 7797 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7798 var _thrown = undefined; try {
michael@0 7799 ctx.getImageData(Infinity, Infinity, 10, 10);
michael@0 7800 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7801 var _thrown = undefined; try {
michael@0 7802 ctx.getImageData(Infinity, Infinity, Infinity, 10);
michael@0 7803 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7804 var _thrown = undefined; try {
michael@0 7805 ctx.getImageData(Infinity, Infinity, Infinity, Infinity);
michael@0 7806 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7807 var _thrown = undefined; try {
michael@0 7808 ctx.getImageData(Infinity, Infinity, 10, Infinity);
michael@0 7809 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7810 var _thrown = undefined; try {
michael@0 7811 ctx.getImageData(Infinity, 10, Infinity, 10);
michael@0 7812 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7813 var _thrown = undefined; try {
michael@0 7814 ctx.getImageData(Infinity, 10, Infinity, Infinity);
michael@0 7815 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7816 var _thrown = undefined; try {
michael@0 7817 ctx.getImageData(Infinity, 10, 10, Infinity);
michael@0 7818 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7819 var _thrown = undefined; try {
michael@0 7820 ctx.getImageData(10, Infinity, Infinity, 10);
michael@0 7821 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7822 var _thrown = undefined; try {
michael@0 7823 ctx.getImageData(10, Infinity, Infinity, Infinity);
michael@0 7824 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7825 var _thrown = undefined; try {
michael@0 7826 ctx.getImageData(10, Infinity, 10, Infinity);
michael@0 7827 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7828 var _thrown = undefined; try {
michael@0 7829 ctx.getImageData(10, 10, Infinity, Infinity);
michael@0 7830 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7831 var _thrown = undefined; try {
michael@0 7832 ctx.getImageData({valueOf:function() Infinity}, 10, 10, 10);
michael@0 7833 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7834 var _thrown = undefined; try {
michael@0 7835 ctx.getImageData({valueOf:function() -Infinity}, 10, 10, 10);
michael@0 7836 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7837 var _thrown = undefined; try {
michael@0 7838 ctx.getImageData({valueOf:function() NaN}, 10, 10, 10);
michael@0 7839 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7840 var _thrown = undefined; try {
michael@0 7841 ctx.getImageData(10, {valueOf:function() Infinity}, 10, 10);
michael@0 7842 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7843 var _thrown = undefined; try {
michael@0 7844 ctx.getImageData(10, {valueOf:function() -Infinity}, 10, 10);
michael@0 7845 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7846 var _thrown = undefined; try {
michael@0 7847 ctx.getImageData(10, {valueOf:function() NaN}, 10, 10);
michael@0 7848 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7849 var _thrown = undefined; try {
michael@0 7850 ctx.getImageData(10, 10, {valueOf:function() Infinity}, 10);
michael@0 7851 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7852 var _thrown = undefined; try {
michael@0 7853 ctx.getImageData(10, 10, {valueOf:function() -Infinity}, 10);
michael@0 7854 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7855 var _thrown = undefined; try {
michael@0 7856 ctx.getImageData(10, 10, {valueOf:function() NaN}, 10);
michael@0 7857 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7858 var _thrown = undefined; try {
michael@0 7859 ctx.getImageData(10, 10, 10, {valueOf:function() Infinity});
michael@0 7860 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7861 var _thrown = undefined; try {
michael@0 7862 ctx.getImageData(10, 10, 10, {valueOf:function() -Infinity});
michael@0 7863 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7864 var _thrown = undefined; try {
michael@0 7865 ctx.getImageData(10, 10, 10, {valueOf:function() NaN});
michael@0 7866 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7867 var _thrown = undefined; try {
michael@0 7868 ctx.getImageData({valueOf:function() Infinity}, {valueOf:function() Infinity}, 10, 10);
michael@0 7869 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7870 var _thrown = undefined; try {
michael@0 7871 ctx.getImageData({valueOf:function() Infinity}, {valueOf:function() Infinity}, {valueOf:function() Infinity}, 10);
michael@0 7872 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7873 var _thrown = undefined; try {
michael@0 7874 ctx.getImageData({valueOf:function() Infinity}, {valueOf:function() Infinity}, {valueOf:function() Infinity}, {valueOf:function() Infinity});
michael@0 7875 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7876 var _thrown = undefined; try {
michael@0 7877 ctx.getImageData({valueOf:function() Infinity}, {valueOf:function() Infinity}, 10, {valueOf:function() Infinity});
michael@0 7878 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7879 var _thrown = undefined; try {
michael@0 7880 ctx.getImageData({valueOf:function() Infinity}, 10, {valueOf:function() Infinity}, 10);
michael@0 7881 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7882 var _thrown = undefined; try {
michael@0 7883 ctx.getImageData({valueOf:function() Infinity}, 10, {valueOf:function() Infinity}, {valueOf:function() Infinity});
michael@0 7884 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7885 var _thrown = undefined; try {
michael@0 7886 ctx.getImageData({valueOf:function() Infinity}, 10, 10, {valueOf:function() Infinity});
michael@0 7887 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7888 var _thrown = undefined; try {
michael@0 7889 ctx.getImageData(10, {valueOf:function() Infinity}, {valueOf:function() Infinity}, 10);
michael@0 7890 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7891 var _thrown = undefined; try {
michael@0 7892 ctx.getImageData(10, {valueOf:function() Infinity}, {valueOf:function() Infinity}, {valueOf:function() Infinity});
michael@0 7893 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7894 var _thrown = undefined; try {
michael@0 7895 ctx.getImageData(10, {valueOf:function() Infinity}, 10, {valueOf:function() Infinity});
michael@0 7896 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7897 var _thrown = undefined; try {
michael@0 7898 ctx.getImageData(10, 10, {valueOf:function() Infinity}, {valueOf:function() Infinity});
michael@0 7899 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 7900
michael@0 7901
michael@0 7902 }
michael@0 7903 </script>
michael@0 7904
michael@0 7905 <!-- [[[ test_2d.imageData.get.nonpremul.html ]]] -->
michael@0 7906
michael@0 7907 <p>Canvas test: 2d.imageData.get.nonpremul</p>
michael@0 7908 <!-- Testing: getImageData() returns non-premultiplied colours -->
michael@0 7909 <canvas id="c266" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7910 <script>
michael@0 7911
michael@0 7912 function test_2d_imageData_get_nonpremul() {
michael@0 7913
michael@0 7914 var canvas = document.getElementById('c266');
michael@0 7915 var ctx = canvas.getContext('2d');
michael@0 7916
michael@0 7917 ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
michael@0 7918 ctx.fillRect(0, 0, 100, 50);
michael@0 7919 var imgdata = ctx.getImageData(10, 10, 10, 10);
michael@0 7920 ok(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200");
michael@0 7921 ok(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200");
michael@0 7922 ok(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200");
michael@0 7923 ok(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100");
michael@0 7924 ok(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200");
michael@0 7925
michael@0 7926
michael@0 7927 }
michael@0 7928 </script>
michael@0 7929
michael@0 7930 <!-- [[[ test_2d.imageData.get.order.alpha.html ]]] -->
michael@0 7931
michael@0 7932 <p>Canvas test: 2d.imageData.get.order.alpha</p>
michael@0 7933 <!-- Testing: getImageData() returns A in the fourth component -->
michael@0 7934 <canvas id="c267" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7935 <script>
michael@0 7936
michael@0 7937 function test_2d_imageData_get_order_alpha() {
michael@0 7938
michael@0 7939 var canvas = document.getElementById('c267');
michael@0 7940 var ctx = canvas.getContext('2d');
michael@0 7941
michael@0 7942 ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
michael@0 7943 ctx.fillRect(0, 0, 100, 50);
michael@0 7944 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 7945 ok(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200");
michael@0 7946 ok(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100");
michael@0 7947
michael@0 7948
michael@0 7949 }
michael@0 7950 </script>
michael@0 7951
michael@0 7952 <!-- [[[ test_2d.imageData.get.order.cols.html ]]] -->
michael@0 7953
michael@0 7954 <p>Canvas test: 2d.imageData.get.order.cols</p>
michael@0 7955 <!-- Testing: getImageData() returns leftmost columns first -->
michael@0 7956 <canvas id="c268" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7957 <script>
michael@0 7958
michael@0 7959 function test_2d_imageData_get_order_cols() {
michael@0 7960
michael@0 7961 var canvas = document.getElementById('c268');
michael@0 7962 var ctx = canvas.getContext('2d');
michael@0 7963
michael@0 7964 ctx.fillStyle = '#fff';
michael@0 7965 ctx.fillRect(0, 0, 100, 50);
michael@0 7966 ctx.fillStyle = '#000';
michael@0 7967 ctx.fillRect(0, 0, 2, 50);
michael@0 7968 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 7969 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 7970 ok(imgdata.data[Math.round(imgdata.width/2*4)] === 255, "imgdata.data[Math.round(imgdata.width/2*4)] === 255");
michael@0 7971 ok(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)] === 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)] === 0");
michael@0 7972
michael@0 7973
michael@0 7974 }
michael@0 7975 </script>
michael@0 7976
michael@0 7977 <!-- [[[ test_2d.imageData.get.order.rgb.html ]]] -->
michael@0 7978
michael@0 7979 <p>Canvas test: 2d.imageData.get.order.rgb</p>
michael@0 7980 <!-- Testing: getImageData() returns R then G then B -->
michael@0 7981 <canvas id="c269" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 7982 <script>
michael@0 7983
michael@0 7984 function test_2d_imageData_get_order_rgb() {
michael@0 7985
michael@0 7986 var canvas = document.getElementById('c269');
michael@0 7987 var ctx = canvas.getContext('2d');
michael@0 7988
michael@0 7989 ctx.fillStyle = '#48c';
michael@0 7990 ctx.fillRect(0, 0, 100, 50);
michael@0 7991 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 7992 ok(imgdata.data[0] === 0x44, "imgdata.data[\""+(0)+"\"] === 0x44");
michael@0 7993 ok(imgdata.data[1] === 0x88, "imgdata.data[\""+(1)+"\"] === 0x88");
michael@0 7994 ok(imgdata.data[2] === 0xCC, "imgdata.data[\""+(2)+"\"] === 0xCC");
michael@0 7995 ok(imgdata.data[3] === 255, "imgdata.data[\""+(3)+"\"] === 255");
michael@0 7996
michael@0 7997
michael@0 7998 }
michael@0 7999 </script>
michael@0 8000
michael@0 8001 <!-- [[[ test_2d.imageData.get.order.rows.html ]]] -->
michael@0 8002
michael@0 8003 <p>Canvas test: 2d.imageData.get.order.rows</p>
michael@0 8004 <!-- Testing: getImageData() returns topmost rows first -->
michael@0 8005 <canvas id="c270" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8006 <script>
michael@0 8007
michael@0 8008 function test_2d_imageData_get_order_rows() {
michael@0 8009
michael@0 8010 var canvas = document.getElementById('c270');
michael@0 8011 var ctx = canvas.getContext('2d');
michael@0 8012
michael@0 8013 ctx.fillStyle = '#fff';
michael@0 8014 ctx.fillRect(0, 0, 100, 50);
michael@0 8015 ctx.fillStyle = '#000';
michael@0 8016 ctx.fillRect(0, 0, 100, 2);
michael@0 8017 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8018 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8019 ok(imgdata.data[Math.floor(imgdata.width/2*4)] === 0, "imgdata.data[Math.floor(imgdata.width/2*4)] === 0");
michael@0 8020 ok(imgdata.data[(imgdata.height/2)*imgdata.width*4] === 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4] === 255");
michael@0 8021
michael@0 8022
michael@0 8023 }
michael@0 8024 </script>
michael@0 8025
michael@0 8026 <!-- [[[ test_2d.imageData.get.range.html ]]] -->
michael@0 8027
michael@0 8028 <p>Canvas test: 2d.imageData.get.range</p>
michael@0 8029 <!-- Testing: getImageData() returns values in the range [0, 255] -->
michael@0 8030 <canvas id="c271" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8031 <script>
michael@0 8032
michael@0 8033 function test_2d_imageData_get_range() {
michael@0 8034
michael@0 8035 var canvas = document.getElementById('c271');
michael@0 8036 var ctx = canvas.getContext('2d');
michael@0 8037
michael@0 8038 ctx.fillStyle = '#000';
michael@0 8039 ctx.fillRect(0, 0, 100, 50);
michael@0 8040 ctx.fillStyle = '#fff';
michael@0 8041 ctx.fillRect(20, 10, 60, 10);
michael@0 8042 var imgdata1 = ctx.getImageData(10, 5, 1, 1);
michael@0 8043 ok(imgdata1.data[0] === 0, "imgdata1.data[\""+(0)+"\"] === 0");
michael@0 8044 var imgdata2 = ctx.getImageData(30, 15, 1, 1);
michael@0 8045 ok(imgdata2.data[0] === 255, "imgdata2.data[\""+(0)+"\"] === 255");
michael@0 8046
michael@0 8047
michael@0 8048 }
michael@0 8049 </script>
michael@0 8050
michael@0 8051 <!-- [[[ test_2d.imageData.get.source.negative.html ]]] -->
michael@0 8052
michael@0 8053 <p>Canvas test: 2d.imageData.get.source.negative</p>
michael@0 8054 <!-- Testing: getImageData() works with negative width and height -->
michael@0 8055 <canvas id="c272" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8056 <script>
michael@0 8057
michael@0 8058 function test_2d_imageData_get_source_negative() {
michael@0 8059
michael@0 8060 var canvas = document.getElementById('c272');
michael@0 8061 var ctx = canvas.getContext('2d');
michael@0 8062
michael@0 8063 ctx.fillStyle = '#000';
michael@0 8064 ctx.fillRect(0, 0, 100, 50);
michael@0 8065 ctx.fillStyle = '#fff';
michael@0 8066 ctx.fillRect(20, 10, 60, 10);
michael@0 8067
michael@0 8068 var imgdata1 = ctx.getImageData(85, 25, -10, -10);
michael@0 8069 ok(imgdata1.data[0] === 255, "imgdata1.data[\""+(0)+"\"] === 255");
michael@0 8070 ok(imgdata1.data[1] === 255, "imgdata1.data[\""+(1)+"\"] === 255");
michael@0 8071 ok(imgdata1.data[2] === 255, "imgdata1.data[\""+(2)+"\"] === 255");
michael@0 8072 ok(imgdata1.data[3] === 255, "imgdata1.data[\""+(3)+"\"] === 255");
michael@0 8073 ok(imgdata1.data[imgdata1.data.length-4+0] === 0, "imgdata1.data[imgdata1.data.length-4+0] === 0");
michael@0 8074 ok(imgdata1.data[imgdata1.data.length-4+1] === 0, "imgdata1.data[imgdata1.data.length-4+1] === 0");
michael@0 8075 ok(imgdata1.data[imgdata1.data.length-4+2] === 0, "imgdata1.data[imgdata1.data.length-4+2] === 0");
michael@0 8076 ok(imgdata1.data[imgdata1.data.length-4+3] === 255, "imgdata1.data[imgdata1.data.length-4+3] === 255");
michael@0 8077
michael@0 8078 var imgdata2 = ctx.getImageData(0, 0, -1, -1);
michael@0 8079 ok(imgdata2.data[0] === 0, "imgdata2.data[\""+(0)+"\"] === 0");
michael@0 8080 ok(imgdata2.data[1] === 0, "imgdata2.data[\""+(1)+"\"] === 0");
michael@0 8081 ok(imgdata2.data[2] === 0, "imgdata2.data[\""+(2)+"\"] === 0");
michael@0 8082 ok(imgdata2.data[3] === 0, "imgdata2.data[\""+(3)+"\"] === 0");
michael@0 8083
michael@0 8084
michael@0 8085 }
michael@0 8086 </script>
michael@0 8087
michael@0 8088 <!-- [[[ test_2d.imageData.get.source.outside.html ]]] -->
michael@0 8089
michael@0 8090 <p>Canvas test: 2d.imageData.get.source.outside</p>
michael@0 8091 <!-- Testing: getImageData() returns transparent black outside the canvas -->
michael@0 8092 <canvas id="c273" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8093 <script>
michael@0 8094
michael@0 8095 function test_2d_imageData_get_source_outside() {
michael@0 8096
michael@0 8097 var canvas = document.getElementById('c273');
michael@0 8098 var ctx = canvas.getContext('2d');
michael@0 8099
michael@0 8100 var _thrown_outer = false;
michael@0 8101 try {
michael@0 8102
michael@0 8103 ctx.fillStyle = '#08f';
michael@0 8104 ctx.fillRect(0, 0, 100, 50);
michael@0 8105
michael@0 8106 var imgdata1 = ctx.getImageData(-10, 5, 1, 1);
michael@0 8107 ok(imgdata1.data[0] === 0, "imgdata1.data[\""+(0)+"\"] === 0");
michael@0 8108 ok(imgdata1.data[1] === 0, "imgdata1.data[\""+(1)+"\"] === 0");
michael@0 8109 ok(imgdata1.data[2] === 0, "imgdata1.data[\""+(2)+"\"] === 0");
michael@0 8110 ok(imgdata1.data[3] === 0, "imgdata1.data[\""+(3)+"\"] === 0");
michael@0 8111
michael@0 8112 var imgdata2 = ctx.getImageData(10, -5, 1, 1);
michael@0 8113 ok(imgdata2.data[0] === 0, "imgdata2.data[\""+(0)+"\"] === 0");
michael@0 8114 ok(imgdata2.data[1] === 0, "imgdata2.data[\""+(1)+"\"] === 0");
michael@0 8115 ok(imgdata2.data[2] === 0, "imgdata2.data[\""+(2)+"\"] === 0");
michael@0 8116 ok(imgdata2.data[3] === 0, "imgdata2.data[\""+(3)+"\"] === 0");
michael@0 8117
michael@0 8118 var imgdata3 = ctx.getImageData(200, 5, 1, 1);
michael@0 8119 ok(imgdata3.data[0] === 0, "imgdata3.data[\""+(0)+"\"] === 0");
michael@0 8120 ok(imgdata3.data[1] === 0, "imgdata3.data[\""+(1)+"\"] === 0");
michael@0 8121 ok(imgdata3.data[2] === 0, "imgdata3.data[\""+(2)+"\"] === 0");
michael@0 8122 ok(imgdata3.data[3] === 0, "imgdata3.data[\""+(3)+"\"] === 0");
michael@0 8123
michael@0 8124 var imgdata4 = ctx.getImageData(10, 60, 1, 1);
michael@0 8125 ok(imgdata4.data[0] === 0, "imgdata4.data[\""+(0)+"\"] === 0");
michael@0 8126 ok(imgdata4.data[1] === 0, "imgdata4.data[\""+(1)+"\"] === 0");
michael@0 8127 ok(imgdata4.data[2] === 0, "imgdata4.data[\""+(2)+"\"] === 0");
michael@0 8128 ok(imgdata4.data[3] === 0, "imgdata4.data[\""+(3)+"\"] === 0");
michael@0 8129
michael@0 8130 var imgdata5 = ctx.getImageData(100, 10, 1, 1);
michael@0 8131 ok(imgdata5.data[0] === 0, "imgdata5.data[\""+(0)+"\"] === 0");
michael@0 8132 ok(imgdata5.data[1] === 0, "imgdata5.data[\""+(1)+"\"] === 0");
michael@0 8133 ok(imgdata5.data[2] === 0, "imgdata5.data[\""+(2)+"\"] === 0");
michael@0 8134 ok(imgdata5.data[3] === 0, "imgdata5.data[\""+(3)+"\"] === 0");
michael@0 8135
michael@0 8136 var imgdata6 = ctx.getImageData(0, 10, 1, 1);
michael@0 8137 ok(imgdata6.data[0] === 0, "imgdata6.data[\""+(0)+"\"] === 0");
michael@0 8138 ok(imgdata6.data[1] === 136, "imgdata6.data[\""+(1)+"\"] === 136");
michael@0 8139 ok(imgdata6.data[2] === 255, "imgdata6.data[\""+(2)+"\"] === 255");
michael@0 8140 ok(imgdata6.data[3] === 255, "imgdata6.data[\""+(3)+"\"] === 255");
michael@0 8141
michael@0 8142 var imgdata7 = ctx.getImageData(-10, 10, 20, 20);
michael@0 8143 ok(imgdata7.data[ 0*4+0] === 0, "imgdata7.data[ 0*4+0] === 0");
michael@0 8144 ok(imgdata7.data[ 0*4+1] === 0, "imgdata7.data[ 0*4+1] === 0");
michael@0 8145 ok(imgdata7.data[ 0*4+2] === 0, "imgdata7.data[ 0*4+2] === 0");
michael@0 8146 ok(imgdata7.data[ 0*4+3] === 0, "imgdata7.data[ 0*4+3] === 0");
michael@0 8147 ok(imgdata7.data[ 9*4+0] === 0, "imgdata7.data[ 9*4+0] === 0");
michael@0 8148 ok(imgdata7.data[ 9*4+1] === 0, "imgdata7.data[ 9*4+1] === 0");
michael@0 8149 ok(imgdata7.data[ 9*4+2] === 0, "imgdata7.data[ 9*4+2] === 0");
michael@0 8150 ok(imgdata7.data[ 9*4+3] === 0, "imgdata7.data[ 9*4+3] === 0");
michael@0 8151 ok(imgdata7.data[10*4+0] === 0, "imgdata7.data[10*4+0] === 0");
michael@0 8152 ok(imgdata7.data[10*4+1] === 136, "imgdata7.data[10*4+1] === 136");
michael@0 8153 ok(imgdata7.data[10*4+2] === 255, "imgdata7.data[10*4+2] === 255");
michael@0 8154 ok(imgdata7.data[10*4+3] === 255, "imgdata7.data[10*4+3] === 255");
michael@0 8155 ok(imgdata7.data[19*4+0] === 0, "imgdata7.data[19*4+0] === 0");
michael@0 8156 ok(imgdata7.data[19*4+1] === 136, "imgdata7.data[19*4+1] === 136");
michael@0 8157 ok(imgdata7.data[19*4+2] === 255, "imgdata7.data[19*4+2] === 255");
michael@0 8158 ok(imgdata7.data[19*4+3] === 255, "imgdata7.data[19*4+3] === 255");
michael@0 8159 ok(imgdata7.data[20*4+0] === 0, "imgdata7.data[20*4+0] === 0");
michael@0 8160 ok(imgdata7.data[20*4+1] === 0, "imgdata7.data[20*4+1] === 0");
michael@0 8161 ok(imgdata7.data[20*4+2] === 0, "imgdata7.data[20*4+2] === 0");
michael@0 8162 ok(imgdata7.data[20*4+3] === 0, "imgdata7.data[20*4+3] === 0");
michael@0 8163
michael@0 8164 } catch (e) {
michael@0 8165 _thrown_outer = true;
michael@0 8166 }
michael@0 8167 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8168
michael@0 8169
michael@0 8170 }
michael@0 8171 </script>
michael@0 8172
michael@0 8173 <!-- [[[ test_2d.imageData.get.source.size.html ]]] -->
michael@0 8174
michael@0 8175 <p>Canvas test: 2d.imageData.get.source.size</p>
michael@0 8176 <!-- Testing: getImageData() returns bigger ImageData for bigger source rectangle -->
michael@0 8177 <canvas id="c274" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8178 <script>
michael@0 8179
michael@0 8180 function test_2d_imageData_get_source_size() {
michael@0 8181
michael@0 8182 var canvas = document.getElementById('c274');
michael@0 8183 var ctx = canvas.getContext('2d');
michael@0 8184
michael@0 8185 var imgdata1 = ctx.getImageData(0, 0, 10, 10);
michael@0 8186 var imgdata2 = ctx.getImageData(0, 0, 20, 20);
michael@0 8187 ok(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width");
michael@0 8188 ok(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height");
michael@0 8189
michael@0 8190
michael@0 8191 }
michael@0 8192 </script>
michael@0 8193
michael@0 8194 <!-- [[[ test_2d.imageData.get.tiny.html ]]] -->
michael@0 8195
michael@0 8196 <p>Canvas test: 2d.imageData.get.tiny</p>
michael@0 8197 <!-- Testing: getImageData() works for sizes smaller than one pixel -->
michael@0 8198 <canvas id="c275" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8199 <script>
michael@0 8200
michael@0 8201 function test_2d_imageData_get_tiny() {
michael@0 8202
michael@0 8203 var canvas = document.getElementById('c275');
michael@0 8204 var ctx = canvas.getContext('2d');
michael@0 8205
michael@0 8206 var _thrown_outer = false;
michael@0 8207 try {
michael@0 8208
michael@0 8209 var imgdata = ctx.getImageData(0, 0, 0.0001, 0.0001);
michael@0 8210 ok(imgdata.data.length == imgdata.width*imgdata.height*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
michael@0 8211 ok(imgdata.width == 1, "imgdata.width == 1");
michael@0 8212 ok(imgdata.height == 1, "imgdata.height == 1");
michael@0 8213
michael@0 8214 } catch (e) {
michael@0 8215 _thrown_outer = true;
michael@0 8216 }
michael@0 8217 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8218
michael@0 8219
michael@0 8220 }
michael@0 8221 </script>
michael@0 8222
michael@0 8223 <!-- [[[ test_2d.imageData.get.type.html ]]] -->
michael@0 8224
michael@0 8225 <p>Canvas test: 2d.imageData.get.type</p>
michael@0 8226 <!-- Testing: getImageData() returns an ImageData object containing a Uint8ClampedArray object -->
michael@0 8227 <canvas id="c276" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8228 <script>
michael@0 8229
michael@0 8230 function test_2d_imageData_get_type() {
michael@0 8231
michael@0 8232 var canvas = document.getElementById('c276');
michael@0 8233 var ctx = canvas.getContext('2d');
michael@0 8234
michael@0 8235 ok(window.ImageData !== undefined, "window.ImageData !== undefined");
michael@0 8236 ok(window.Uint8ClampedArray !== undefined, "window.Uint8ClampedArray !== undefined");
michael@0 8237 window.ImageData.prototype.thisImplementsImageData = true;
michael@0 8238 window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true;
michael@0 8239 var imgdata = ctx.getImageData(0, 0, 1, 1);
michael@0 8240 ok(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData");
michael@0 8241 ok(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray");
michael@0 8242
michael@0 8243
michael@0 8244 }
michael@0 8245 </script>
michael@0 8246
michael@0 8247 <!-- [[[ test_2d.imageData.get.unaffected.html ]]] -->
michael@0 8248
michael@0 8249 <p>Canvas test: 2d.imageData.get.unaffected</p>
michael@0 8250 <!-- Testing: getImageData() is not affected by context state -->
michael@0 8251 <canvas id="c277" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8252 <script>
michael@0 8253
michael@0 8254
michael@0 8255 function test_2d_imageData_get_unaffected() {
michael@0 8256
michael@0 8257 var canvas = document.getElementById('c277');
michael@0 8258 var ctx = canvas.getContext('2d');
michael@0 8259
michael@0 8260 ctx.fillStyle = '#0f0';
michael@0 8261 ctx.fillRect(0, 0, 50, 50)
michael@0 8262 ctx.fillStyle = '#f00';
michael@0 8263 ctx.fillRect(50, 0, 50, 50)
michael@0 8264 ctx.save();
michael@0 8265 ctx.translate(50, 0);
michael@0 8266 ctx.globalAlpha = 0.1;
michael@0 8267 ctx.globalCompositeOperation = 'destination-atop';
michael@0 8268 ctx.shadowColor = '#f00';
michael@0 8269 ctx.rect(0, 0, 5, 5);
michael@0 8270 ctx.clip();
michael@0 8271 var imgdata = ctx.getImageData(0, 0, 50, 50);
michael@0 8272 ctx.restore();
michael@0 8273 ctx.putImageData(imgdata, 50, 0);
michael@0 8274 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 8275 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 8276
michael@0 8277
michael@0 8278 }
michael@0 8279 </script>
michael@0 8280
michael@0 8281 <!-- [[[ test_2d.imageData.get.zero.html ]]] -->
michael@0 8282
michael@0 8283 <p>Canvas test: 2d.imageData.get.zero</p>
michael@0 8284 <!-- Testing: getImageData() throws INDEX_SIZE_ERR if size is zero -->
michael@0 8285 <canvas id="c278" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8286 <script>
michael@0 8287
michael@0 8288 function test_2d_imageData_get_zero() {
michael@0 8289
michael@0 8290 var canvas = document.getElementById('c278');
michael@0 8291 var ctx = canvas.getContext('2d');
michael@0 8292
michael@0 8293 var _thrown = undefined; try {
michael@0 8294 ctx.getImageData(1, 1, 10, 0);
michael@0 8295 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 8296 var _thrown = undefined; try {
michael@0 8297 ctx.getImageData(1, 1, 0, 10);
michael@0 8298 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 8299 var _thrown = undefined; try {
michael@0 8300 ctx.getImageData(1, 1, 0, 0);
michael@0 8301 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 8302
michael@0 8303
michael@0 8304 }
michael@0 8305 </script>
michael@0 8306
michael@0 8307 <!-- [[[ test_2d.imageData.object.clamp.html ]]] -->
michael@0 8308
michael@0 8309 <p>Canvas test: 2d.imageData.object.clamp</p>
michael@0 8310 <!-- Testing: ImageData.data clamps numbers to [0, 255] -->
michael@0 8311 <canvas id="c279" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8312 <script>
michael@0 8313
michael@0 8314 function test_2d_imageData_object_clamp() {
michael@0 8315
michael@0 8316 var canvas = document.getElementById('c279');
michael@0 8317 var ctx = canvas.getContext('2d');
michael@0 8318
michael@0 8319 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8320
michael@0 8321 imgdata.data[0] = 100;
michael@0 8322 imgdata.data[0] = 300;
michael@0 8323 ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
michael@0 8324 imgdata.data[0] = 100;
michael@0 8325 imgdata.data[0] = -100;
michael@0 8326 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8327
michael@0 8328 imgdata.data[0] = 100;
michael@0 8329 imgdata.data[0] = 200+Math.pow(2, 32);
michael@0 8330 ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
michael@0 8331 imgdata.data[0] = 100;
michael@0 8332 imgdata.data[0] = -200-Math.pow(2, 32);
michael@0 8333 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8334
michael@0 8335 imgdata.data[0] = 100;
michael@0 8336 imgdata.data[0] = Math.pow(10, 39);
michael@0 8337 ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
michael@0 8338 imgdata.data[0] = 100;
michael@0 8339 imgdata.data[0] = -Math.pow(10, 39);
michael@0 8340 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8341
michael@0 8342 imgdata.data[0] = 100;
michael@0 8343 imgdata.data[0] = -Infinity;
michael@0 8344 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8345 imgdata.data[0] = 100;
michael@0 8346 imgdata.data[0] = Infinity;
michael@0 8347 ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
michael@0 8348
michael@0 8349
michael@0 8350 }
michael@0 8351 </script>
michael@0 8352
michael@0 8353 <!-- [[[ test_2d.imageData.object.ctor.html ]]] -->
michael@0 8354
michael@0 8355 <p>Canvas test: 2d.imageData.object.ctor</p>
michael@0 8356 <!-- Testing: ImageData does not have a usable constructor -->
michael@0 8357 <canvas id="c280" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8358 <script>
michael@0 8359
michael@0 8360 function test_2d_imageData_object_ctor() {
michael@0 8361
michael@0 8362 var canvas = document.getElementById('c280');
michael@0 8363 var ctx = canvas.getContext('2d');
michael@0 8364
michael@0 8365 ok(window.ImageData !== undefined, "window.ImageData !== undefined");
michael@0 8366
michael@0 8367 var _thrown_outer = false;
michael@0 8368 try {
michael@0 8369
michael@0 8370 new window.ImageData(1,1);
michael@0 8371
michael@0 8372 } catch (e) {
michael@0 8373 _thrown_outer = true;
michael@0 8374 }
michael@0 8375 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8376
michael@0 8377
michael@0 8378 }
michael@0 8379 </script>
michael@0 8380
michael@0 8381 <!-- [[[ test_2d.imageData.object.nan.html ]]] -->
michael@0 8382
michael@0 8383 <p>Canvas test: 2d.imageData.object.nan</p>
michael@0 8384 <!-- Testing: ImageData.data converts NaN to 0 -->
michael@0 8385 <canvas id="c281" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8386 <script>
michael@0 8387
michael@0 8388 function test_2d_imageData_object_nan() {
michael@0 8389
michael@0 8390 var canvas = document.getElementById('c281');
michael@0 8391 var ctx = canvas.getContext('2d');
michael@0 8392
michael@0 8393 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8394 imgdata.data[0] = 100;
michael@0 8395 imgdata.data[0] = NaN;
michael@0 8396 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8397 imgdata.data[0] = 100;
michael@0 8398 imgdata.data[0] = "cheese";
michael@0 8399 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8400
michael@0 8401
michael@0 8402 }
michael@0 8403 </script>
michael@0 8404
michael@0 8405 <!-- [[[ test_2d.imageData.object.properties.html ]]] -->
michael@0 8406
michael@0 8407 <p>Canvas test: 2d.imageData.object.properties</p>
michael@0 8408 <!-- Testing: ImageData objects have the right properties -->
michael@0 8409 <canvas id="c282" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8410 <script>
michael@0 8411
michael@0 8412 function test_2d_imageData_object_properties() {
michael@0 8413
michael@0 8414 var canvas = document.getElementById('c282');
michael@0 8415 var ctx = canvas.getContext('2d');
michael@0 8416
michael@0 8417 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8418 ok(typeof(imgdata.width) == 'number', "typeof(imgdata.width) == 'number'");
michael@0 8419 ok(typeof(imgdata.height) == 'number', "typeof(imgdata.height) == 'number'");
michael@0 8420 ok(typeof(imgdata.data) == 'object', "typeof(imgdata.data) == 'object'");
michael@0 8421
michael@0 8422
michael@0 8423 }
michael@0 8424 </script>
michael@0 8425
michael@0 8426 <!-- [[[ test_2d.imageData.object.readonly.html ]]] -->
michael@0 8427
michael@0 8428 <p>Canvas test: 2d.imageData.object.readonly</p>
michael@0 8429 <!-- Testing: ImageData objects properties are read-only -->
michael@0 8430 <canvas id="c283" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8431 <script>
michael@0 8432
michael@0 8433 function test_2d_imageData_object_readonly() {
michael@0 8434
michael@0 8435 var canvas = document.getElementById('c283');
michael@0 8436 var ctx = canvas.getContext('2d');
michael@0 8437
michael@0 8438 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8439 var w = imgdata.width;
michael@0 8440 var h = imgdata.height;
michael@0 8441 var d = imgdata.data;
michael@0 8442 imgdata.width = 123;
michael@0 8443 imgdata.height = 123;
michael@0 8444 imgdata.data = [100,100,100,100];
michael@0 8445 ok(imgdata.width === w, "imgdata.width === w");
michael@0 8446 ok(imgdata.height === h, "imgdata.height === h");
michael@0 8447 ok(imgdata.data === d, "imgdata.data === d");
michael@0 8448 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8449 ok(imgdata.data[1] === 0, "imgdata.data[\""+(1)+"\"] === 0");
michael@0 8450 ok(imgdata.data[2] === 0, "imgdata.data[\""+(2)+"\"] === 0");
michael@0 8451 ok(imgdata.data[3] === 0, "imgdata.data[\""+(3)+"\"] === 0");
michael@0 8452
michael@0 8453
michael@0 8454 }
michael@0 8455 </script>
michael@0 8456
michael@0 8457 <!-- [[[ test_2d.imageData.object.round.html ]]] -->
michael@0 8458
michael@0 8459 <p>Canvas test: 2d.imageData.object.round</p>
michael@0 8460 <!-- Testing: ImageData.data rounds numbers with convertToIntegerTiesToEven -->
michael@0 8461 <canvas id="c284" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8462 <script>
michael@0 8463
michael@0 8464 function test_2d_imageData_object_round() {
michael@0 8465
michael@0 8466 var canvas = document.getElementById('c284');
michael@0 8467 var ctx = canvas.getContext('2d');
michael@0 8468
michael@0 8469 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8470 imgdata.data[0] = 0.499;
michael@0 8471 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8472 imgdata.data[0] = 0.5;
michael@0 8473 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8474 imgdata.data[0] = 0.501;
michael@0 8475 ok(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
michael@0 8476 imgdata.data[0] = 1.499;
michael@0 8477 ok(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
michael@0 8478 imgdata.data[0] = 1.5;
michael@0 8479 ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
michael@0 8480 imgdata.data[0] = 1.501;
michael@0 8481 ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
michael@0 8482 imgdata.data[0] = 2.5;
michael@0 8483 ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
michael@0 8484 imgdata.data[0] = 3.5;
michael@0 8485 ok(imgdata.data[0] === 4, "imgdata.data[\""+(0)+"\"] === 4");
michael@0 8486 imgdata.data[0] = 252.5;
michael@0 8487 ok(imgdata.data[0] === 252, "imgdata.data[\""+(0)+"\"] === 252");
michael@0 8488 imgdata.data[0] = 253.5;
michael@0 8489 ok(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
michael@0 8490 imgdata.data[0] = 254.5;
michael@0 8491 ok(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
michael@0 8492
michael@0 8493
michael@0 8494 }
michael@0 8495 </script>
michael@0 8496
michael@0 8497 <!-- [[[ test_2d.imageData.object.set.html ]]] -->
michael@0 8498
michael@0 8499 <p>Canvas test: 2d.imageData.object.set</p>
michael@0 8500 <!-- Testing: ImageData.data can be modified -->
michael@0 8501 <canvas id="c285" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8502 <script>
michael@0 8503
michael@0 8504 function test_2d_imageData_object_set() {
michael@0 8505
michael@0 8506 var canvas = document.getElementById('c285');
michael@0 8507 var ctx = canvas.getContext('2d');
michael@0 8508
michael@0 8509 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8510 imgdata.data[0] = 100;
michael@0 8511 ok(imgdata.data[0] === 100, "imgdata.data[\""+(0)+"\"] === 100");
michael@0 8512 imgdata.data[0] = 200;
michael@0 8513 ok(imgdata.data[0] === 200, "imgdata.data[\""+(0)+"\"] === 200");
michael@0 8514
michael@0 8515
michael@0 8516 }
michael@0 8517 </script>
michael@0 8518
michael@0 8519 <!-- [[[ test_2d.imageData.object.string.html ]]] -->
michael@0 8520
michael@0 8521 <p>Canvas test: 2d.imageData.object.string</p>
michael@0 8522 <!-- Testing: ImageData.data converts strings to numbers with ToNumber -->
michael@0 8523 <canvas id="c286" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8524 <script>
michael@0 8525
michael@0 8526 function test_2d_imageData_object_string() {
michael@0 8527
michael@0 8528 var canvas = document.getElementById('c286');
michael@0 8529 var ctx = canvas.getContext('2d');
michael@0 8530
michael@0 8531 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8532 imgdata.data[0] = 100;
michael@0 8533 imgdata.data[0] = "110";
michael@0 8534 ok(imgdata.data[0] === 110, "imgdata.data[\""+(0)+"\"] === 110");
michael@0 8535 imgdata.data[0] = 100;
michael@0 8536 imgdata.data[0] = "0x78";
michael@0 8537 ok(imgdata.data[0] === 120, "imgdata.data[\""+(0)+"\"] === 120");
michael@0 8538 imgdata.data[0] = 100;
michael@0 8539 imgdata.data[0] = " +130e0 ";
michael@0 8540 ok(imgdata.data[0] === 130, "imgdata.data[\""+(0)+"\"] === 130");
michael@0 8541
michael@0 8542
michael@0 8543 }
michael@0 8544 </script>
michael@0 8545
michael@0 8546 <!-- [[[ test_2d.imageData.object.undefined.html ]]] -->
michael@0 8547
michael@0 8548 <p>Canvas test: 2d.imageData.object.undefined</p>
michael@0 8549 <!-- Testing: ImageData.data converts undefined to 0 -->
michael@0 8550 <canvas id="c287" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8551 <script>
michael@0 8552
michael@0 8553 function test_2d_imageData_object_undefined() {
michael@0 8554
michael@0 8555 var canvas = document.getElementById('c287');
michael@0 8556 var ctx = canvas.getContext('2d');
michael@0 8557
michael@0 8558 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8559 imgdata.data[0] = 100;
michael@0 8560 imgdata.data[0] = undefined;
michael@0 8561 ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
michael@0 8562
michael@0 8563
michael@0 8564 }
michael@0 8565 </script>
michael@0 8566
michael@0 8567 <!-- [[[ test_2d.imageData.put.alpha.html ]]] -->
michael@0 8568
michael@0 8569 <p>Canvas test: 2d.imageData.put.alpha</p>
michael@0 8570 <!-- Testing: putImageData() puts non-solid image data correctly -->
michael@0 8571 <canvas id="c288" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8572 <script>
michael@0 8573
michael@0 8574
michael@0 8575 function test_2d_imageData_put_alpha() {
michael@0 8576
michael@0 8577 var canvas = document.getElementById('c288');
michael@0 8578 var ctx = canvas.getContext('2d');
michael@0 8579
michael@0 8580 ctx.fillStyle = 'rgba(0, 255, 0, 0.25)';
michael@0 8581 ctx.fillRect(0, 0, 100, 50)
michael@0 8582 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8583 ctx.fillStyle = '#f00';
michael@0 8584 ctx.fillRect(0, 0, 100, 50)
michael@0 8585 ctx.putImageData(imgdata, 0, 0);
michael@0 8586 isPixel(ctx, 50,25, 0,255,0,64, 2);
michael@0 8587
michael@0 8588
michael@0 8589 }
michael@0 8590 </script>
michael@0 8591
michael@0 8592 <!-- [[[ test_2d.imageData.put.basic.html ]]] -->
michael@0 8593
michael@0 8594 <p>Canvas test: 2d.imageData.put.basic</p>
michael@0 8595 <!-- Testing: putImageData() puts image data from getImageData() onto the canvas -->
michael@0 8596 <canvas id="c289" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8597 <script>
michael@0 8598
michael@0 8599
michael@0 8600 function test_2d_imageData_put_basic() {
michael@0 8601
michael@0 8602 var canvas = document.getElementById('c289');
michael@0 8603 var ctx = canvas.getContext('2d');
michael@0 8604
michael@0 8605 ctx.fillStyle = '#0f0';
michael@0 8606 ctx.fillRect(0, 0, 100, 50)
michael@0 8607 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8608 ctx.fillStyle = '#f00';
michael@0 8609 ctx.fillRect(0, 0, 100, 50)
michael@0 8610 ctx.putImageData(imgdata, 0, 0);
michael@0 8611 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8612
michael@0 8613
michael@0 8614 }
michael@0 8615 </script>
michael@0 8616
michael@0 8617 <!-- [[[ test_2d.imageData.put.clip.html ]]] -->
michael@0 8618
michael@0 8619 <p>Canvas test: 2d.imageData.put.clip - bug 433397</p>
michael@0 8620 <!-- Testing: putImageData() is not affected by clipping regions -->
michael@0 8621 <canvas id="c290" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8622 <script>
michael@0 8623
michael@0 8624
michael@0 8625
michael@0 8626 function test_2d_imageData_put_clip() {
michael@0 8627
michael@0 8628 var canvas = document.getElementById('c290');
michael@0 8629 var ctx = canvas.getContext('2d');
michael@0 8630
michael@0 8631 ctx.fillStyle = '#0f0';
michael@0 8632 ctx.fillRect(0, 0, 100, 50)
michael@0 8633 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8634 ctx.fillStyle = '#f00';
michael@0 8635 ctx.fillRect(0, 0, 100, 50)
michael@0 8636 ctx.beginPath();
michael@0 8637 ctx.rect(0, 0, 50, 50);
michael@0 8638 ctx.clip();
michael@0 8639 ctx.putImageData(imgdata, 0, 0);
michael@0 8640 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 8641 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 8642
michael@0 8643
michael@0 8644 }
michael@0 8645 </script>
michael@0 8646
michael@0 8647 <!-- [[[ test_2d.imageData.put.created.html ]]] -->
michael@0 8648
michael@0 8649 <p>Canvas test: 2d.imageData.put.created - bug 433004</p>
michael@0 8650 <!-- Testing: putImageData() puts image data from createImageData() onto the canvas -->
michael@0 8651 <canvas id="c291" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8652 <script>
michael@0 8653
michael@0 8654
michael@0 8655 function test_2d_imageData_put_created() {
michael@0 8656
michael@0 8657 var canvas = document.getElementById('c291');
michael@0 8658 var ctx = canvas.getContext('2d');
michael@0 8659
michael@0 8660 var imgdata = ctx.createImageData(100, 50);
michael@0 8661 for (var i = 0; i < imgdata.data.length; i += 4) {
michael@0 8662 imgdata.data[i] = 0;
michael@0 8663 imgdata.data[i+1] = 255;
michael@0 8664 imgdata.data[i+2] = 0;
michael@0 8665 imgdata.data[i+3] = 255;
michael@0 8666 }
michael@0 8667 ctx.fillStyle = '#f00';
michael@0 8668 ctx.fillRect(0, 0, 100, 50)
michael@0 8669 ctx.putImageData(imgdata, 0, 0);
michael@0 8670 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8671
michael@0 8672
michael@0 8673 }
michael@0 8674 </script>
michael@0 8675
michael@0 8676 <!-- [[[ test_2d.imageData.put.cross.html ]]] -->
michael@0 8677
michael@0 8678 <p>Canvas test: 2d.imageData.put.cross</p>
michael@0 8679 <!-- Testing: putImageData() accepts image data got from a different canvas -->
michael@0 8680 <canvas id="c292" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8681 <script>
michael@0 8682
michael@0 8683
michael@0 8684 function test_2d_imageData_put_cross() {
michael@0 8685
michael@0 8686 var canvas = document.getElementById('c292');
michael@0 8687 var ctx = canvas.getContext('2d');
michael@0 8688
michael@0 8689 var canvas2 = document.createElement('canvas');
michael@0 8690 var ctx2 = canvas2.getContext('2d');
michael@0 8691 ctx2.fillStyle = '#0f0';
michael@0 8692 ctx2.fillRect(0, 0, 100, 50)
michael@0 8693 var imgdata = ctx2.getImageData(0, 0, 100, 50);
michael@0 8694 ctx.fillStyle = '#f00';
michael@0 8695 ctx.fillRect(0, 0, 100, 50)
michael@0 8696 ctx.putImageData(imgdata, 0, 0);
michael@0 8697 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8698
michael@0 8699
michael@0 8700 }
michael@0 8701 </script>
michael@0 8702
michael@0 8703 <!-- [[[ test_2d.imageData.put.dirty.negative.html ]]] -->
michael@0 8704
michael@0 8705 <p>Canvas test: 2d.imageData.put.dirty.negative</p>
michael@0 8706 <!-- Testing: putImageData() handles negative-sized dirty rectangles correctly -->
michael@0 8707 <canvas id="c293" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8708 <script>
michael@0 8709
michael@0 8710
michael@0 8711 function test_2d_imageData_put_dirty_negative() {
michael@0 8712
michael@0 8713 var canvas = document.getElementById('c293');
michael@0 8714 var ctx = canvas.getContext('2d');
michael@0 8715
michael@0 8716 var _thrown_outer = false;
michael@0 8717 try {
michael@0 8718
michael@0 8719 ctx.fillStyle = '#f00';
michael@0 8720 ctx.fillRect(0, 0, 100, 50)
michael@0 8721 ctx.fillStyle = '#0f0';
michael@0 8722 ctx.fillRect(0, 0, 20, 20)
michael@0 8723
michael@0 8724 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8725
michael@0 8726 ctx.fillStyle = '#0f0';
michael@0 8727 ctx.fillRect(0, 0, 100, 50)
michael@0 8728 ctx.fillStyle = '#f00';
michael@0 8729 ctx.fillRect(40, 20, 20, 20)
michael@0 8730 ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20);
michael@0 8731
michael@0 8732 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8733 isPixel(ctx, 35,25, 0,255,0,255, 2);
michael@0 8734 isPixel(ctx, 65,25, 0,255,0,255, 2);
michael@0 8735 isPixel(ctx, 50,15, 0,255,0,255, 2);
michael@0 8736 isPixel(ctx, 50,45, 0,255,0,255, 2);
michael@0 8737
michael@0 8738 } catch (e) {
michael@0 8739 _thrown_outer = true;
michael@0 8740 }
michael@0 8741 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8742
michael@0 8743
michael@0 8744 }
michael@0 8745 </script>
michael@0 8746
michael@0 8747 <!-- [[[ test_2d.imageData.put.dirty.outside.html ]]] -->
michael@0 8748
michael@0 8749 <p>Canvas test: 2d.imageData.put.dirty.outside</p>
michael@0 8750 <!-- Testing: putImageData() handles dirty rectangles outside the canvas correctly -->
michael@0 8751 <canvas id="c294" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8752 <script>
michael@0 8753
michael@0 8754
michael@0 8755 function test_2d_imageData_put_dirty_outside() {
michael@0 8756
michael@0 8757 var canvas = document.getElementById('c294');
michael@0 8758 var ctx = canvas.getContext('2d');
michael@0 8759
michael@0 8760 var _thrown_outer = false;
michael@0 8761 try {
michael@0 8762
michael@0 8763 ctx.fillStyle = '#f00';
michael@0 8764 ctx.fillRect(0, 0, 100, 50)
michael@0 8765
michael@0 8766 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8767
michael@0 8768 ctx.fillStyle = '#0f0';
michael@0 8769 ctx.fillRect(0, 0, 100, 50)
michael@0 8770
michael@0 8771 ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20);
michael@0 8772 ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50);
michael@0 8773 ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20);
michael@0 8774 ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20);
michael@0 8775
michael@0 8776 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8777 isPixel(ctx, 98,15, 0,255,0,255, 2);
michael@0 8778 isPixel(ctx, 98,25, 0,255,0,255, 2);
michael@0 8779 isPixel(ctx, 98,45, 0,255,0,255, 2);
michael@0 8780 isPixel(ctx, 1,5, 0,255,0,255, 2);
michael@0 8781 isPixel(ctx, 1,25, 0,255,0,255, 2);
michael@0 8782 isPixel(ctx, 1,45, 0,255,0,255, 2);
michael@0 8783
michael@0 8784 } catch (e) {
michael@0 8785 _thrown_outer = true;
michael@0 8786 }
michael@0 8787 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8788
michael@0 8789
michael@0 8790 }
michael@0 8791 </script>
michael@0 8792
michael@0 8793 <!-- [[[ test_2d.imageData.put.dirty.rect1.html ]]] -->
michael@0 8794
michael@0 8795 <p>Canvas test: 2d.imageData.put.dirty.rect1</p>
michael@0 8796 <!-- Testing: putImageData() only modifies areas inside the dirty rectangle, using width and height -->
michael@0 8797 <canvas id="c295" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8798 <script>
michael@0 8799
michael@0 8800
michael@0 8801 function test_2d_imageData_put_dirty_rect1() {
michael@0 8802
michael@0 8803 var canvas = document.getElementById('c295');
michael@0 8804 var ctx = canvas.getContext('2d');
michael@0 8805
michael@0 8806 var _thrown_outer = false;
michael@0 8807 try {
michael@0 8808
michael@0 8809 ctx.fillStyle = '#f00';
michael@0 8810 ctx.fillRect(0, 0, 100, 50)
michael@0 8811 ctx.fillStyle = '#0f0';
michael@0 8812 ctx.fillRect(0, 0, 20, 20)
michael@0 8813
michael@0 8814 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8815
michael@0 8816 ctx.fillStyle = '#0f0';
michael@0 8817 ctx.fillRect(0, 0, 100, 50)
michael@0 8818 ctx.fillStyle = '#f00';
michael@0 8819 ctx.fillRect(40, 20, 20, 20)
michael@0 8820 ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20);
michael@0 8821
michael@0 8822 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8823 isPixel(ctx, 35,25, 0,255,0,255, 2);
michael@0 8824 isPixel(ctx, 65,25, 0,255,0,255, 2);
michael@0 8825 isPixel(ctx, 50,15, 0,255,0,255, 2);
michael@0 8826 isPixel(ctx, 50,45, 0,255,0,255, 2);
michael@0 8827
michael@0 8828 } catch (e) {
michael@0 8829 _thrown_outer = true;
michael@0 8830 }
michael@0 8831 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8832
michael@0 8833
michael@0 8834 }
michael@0 8835 </script>
michael@0 8836
michael@0 8837 <!-- [[[ test_2d.imageData.put.dirty.rect2.html ]]] -->
michael@0 8838
michael@0 8839 <p>Canvas test: 2d.imageData.put.dirty.rect2</p>
michael@0 8840 <!-- Testing: putImageData() only modifies areas inside the dirty rectangle, using x and y -->
michael@0 8841 <canvas id="c296" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8842 <script>
michael@0 8843
michael@0 8844
michael@0 8845 function test_2d_imageData_put_dirty_rect2() {
michael@0 8846
michael@0 8847 var canvas = document.getElementById('c296');
michael@0 8848 var ctx = canvas.getContext('2d');
michael@0 8849
michael@0 8850 var _thrown_outer = false;
michael@0 8851 try {
michael@0 8852
michael@0 8853 ctx.fillStyle = '#f00';
michael@0 8854 ctx.fillRect(0, 0, 100, 50)
michael@0 8855 ctx.fillStyle = '#0f0';
michael@0 8856 ctx.fillRect(60, 30, 20, 20)
michael@0 8857
michael@0 8858 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8859
michael@0 8860 ctx.fillStyle = '#0f0';
michael@0 8861 ctx.fillRect(0, 0, 100, 50)
michael@0 8862 ctx.fillStyle = '#f00';
michael@0 8863 ctx.fillRect(40, 20, 20, 20)
michael@0 8864 ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20);
michael@0 8865
michael@0 8866 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8867 isPixel(ctx, 35,25, 0,255,0,255, 2);
michael@0 8868 isPixel(ctx, 65,25, 0,255,0,255, 2);
michael@0 8869 isPixel(ctx, 50,15, 0,255,0,255, 2);
michael@0 8870 isPixel(ctx, 50,45, 0,255,0,255, 2);
michael@0 8871
michael@0 8872 } catch (e) {
michael@0 8873 _thrown_outer = true;
michael@0 8874 }
michael@0 8875 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 8876
michael@0 8877
michael@0 8878 }
michael@0 8879 </script>
michael@0 8880
michael@0 8881 <!-- [[[ test_2d.imageData.put.dirty.zero.html ]]] -->
michael@0 8882
michael@0 8883 <p>Canvas test: 2d.imageData.put.dirty.zero</p>
michael@0 8884 <!-- Testing: putImageData() with zero-sized dirty rectangle puts nothing -->
michael@0 8885 <canvas id="c297" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8886 <script>
michael@0 8887
michael@0 8888
michael@0 8889
michael@0 8890 function test_2d_imageData_put_dirty_zero() {
michael@0 8891
michael@0 8892 var canvas = document.getElementById('c297');
michael@0 8893 var ctx = canvas.getContext('2d');
michael@0 8894
michael@0 8895 ctx.fillStyle = '#f00';
michael@0 8896 ctx.fillRect(0, 0, 100, 50)
michael@0 8897 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 8898 ctx.fillStyle = '#0f0';
michael@0 8899 ctx.fillRect(0, 0, 100, 50)
michael@0 8900 ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0);
michael@0 8901 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8902
michael@0 8903
michael@0 8904 }
michael@0 8905 </script>
michael@0 8906
michael@0 8907 <!-- [[[ test_2d.imageData.put.modified.html ]]] -->
michael@0 8908
michael@0 8909 <p>Canvas test: 2d.imageData.put.modified</p>
michael@0 8910 <!-- Testing: putImageData() puts modified image data correctly -->
michael@0 8911 <canvas id="c298" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8912 <script>
michael@0 8913
michael@0 8914
michael@0 8915 function test_2d_imageData_put_modified() {
michael@0 8916
michael@0 8917 var canvas = document.getElementById('c298');
michael@0 8918 var ctx = canvas.getContext('2d');
michael@0 8919
michael@0 8920 ctx.fillStyle = '#0f0';
michael@0 8921 ctx.fillRect(0, 0, 100, 50)
michael@0 8922 ctx.fillStyle = '#f00';
michael@0 8923 ctx.fillRect(45, 20, 10, 10)
michael@0 8924 var imgdata = ctx.getImageData(45, 20, 10, 10);
michael@0 8925 for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4)
michael@0 8926 {
michael@0 8927 imgdata.data[i] = 0;
michael@0 8928 imgdata.data[i+1] = 255;
michael@0 8929 }
michael@0 8930 ctx.putImageData(imgdata, 45, 20);
michael@0 8931 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 8932
michael@0 8933
michael@0 8934 }
michael@0 8935 </script>
michael@0 8936
michael@0 8937 <!-- [[[ test_2d.imageData.put.nonfinite.html ]]] -->
michael@0 8938
michael@0 8939 <p>Canvas test: 2d.imageData.put.nonfinite</p>
michael@0 8940 <!-- Testing: putImageData() throws NOT_SUPPORTED_ERR if arguments are not finite -->
michael@0 8941 <canvas id="c299" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 8942 <script>
michael@0 8943
michael@0 8944 function test_2d_imageData_put_nonfinite() {
michael@0 8945
michael@0 8946 var canvas = document.getElementById('c299');
michael@0 8947 var ctx = canvas.getContext('2d');
michael@0 8948
michael@0 8949 var imgdata = ctx.getImageData(0, 0, 10, 10);
michael@0 8950 var _thrown = undefined; try {
michael@0 8951 ctx.putImageData(imgdata, Infinity, 10);
michael@0 8952 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8953 var _thrown = undefined; try {
michael@0 8954 ctx.putImageData(imgdata, -Infinity, 10);
michael@0 8955 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8956 var _thrown = undefined; try {
michael@0 8957 ctx.putImageData(imgdata, NaN, 10);
michael@0 8958 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8959 var _thrown = undefined; try {
michael@0 8960 ctx.putImageData(imgdata, 10, Infinity);
michael@0 8961 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8962 var _thrown = undefined; try {
michael@0 8963 ctx.putImageData(imgdata, 10, -Infinity);
michael@0 8964 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8965 var _thrown = undefined; try {
michael@0 8966 ctx.putImageData(imgdata, 10, NaN);
michael@0 8967 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8968 var _thrown = undefined; try {
michael@0 8969 ctx.putImageData(imgdata, Infinity, Infinity);
michael@0 8970 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8971 var _thrown = undefined; try {
michael@0 8972 ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10);
michael@0 8973 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8974 var _thrown = undefined; try {
michael@0 8975 ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10);
michael@0 8976 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8977 var _thrown = undefined; try {
michael@0 8978 ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10);
michael@0 8979 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8980 var _thrown = undefined; try {
michael@0 8981 ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10);
michael@0 8982 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8983 var _thrown = undefined; try {
michael@0 8984 ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10);
michael@0 8985 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8986 var _thrown = undefined; try {
michael@0 8987 ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10);
michael@0 8988 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8989 var _thrown = undefined; try {
michael@0 8990 ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10);
michael@0 8991 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8992 var _thrown = undefined; try {
michael@0 8993 ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10);
michael@0 8994 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8995 var _thrown = undefined; try {
michael@0 8996 ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10);
michael@0 8997 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 8998 var _thrown = undefined; try {
michael@0 8999 ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10);
michael@0 9000 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9001 var _thrown = undefined; try {
michael@0 9002 ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10);
michael@0 9003 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9004 var _thrown = undefined; try {
michael@0 9005 ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10);
michael@0 9006 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9007 var _thrown = undefined; try {
michael@0 9008 ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10);
michael@0 9009 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9010 var _thrown = undefined; try {
michael@0 9011 ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10);
michael@0 9012 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9013 var _thrown = undefined; try {
michael@0 9014 ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10);
michael@0 9015 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9016 var _thrown = undefined; try {
michael@0 9017 ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity);
michael@0 9018 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9019 var _thrown = undefined; try {
michael@0 9020 ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity);
michael@0 9021 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9022 var _thrown = undefined; try {
michael@0 9023 ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN);
michael@0 9024 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9025 var _thrown = undefined; try {
michael@0 9026 ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10);
michael@0 9027 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9028 var _thrown = undefined; try {
michael@0 9029 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10);
michael@0 9030 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9031 var _thrown = undefined; try {
michael@0 9032 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10);
michael@0 9033 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9034 var _thrown = undefined; try {
michael@0 9035 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10);
michael@0 9036 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9037 var _thrown = undefined; try {
michael@0 9038 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 9039 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9040 var _thrown = undefined; try {
michael@0 9041 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity);
michael@0 9042 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9043 var _thrown = undefined; try {
michael@0 9044 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10);
michael@0 9045 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9046 var _thrown = undefined; try {
michael@0 9047 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity);
michael@0 9048 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9049 var _thrown = undefined; try {
michael@0 9050 ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity);
michael@0 9051 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9052 var _thrown = undefined; try {
michael@0 9053 ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10);
michael@0 9054 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9055 var _thrown = undefined; try {
michael@0 9056 ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10);
michael@0 9057 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9058 var _thrown = undefined; try {
michael@0 9059 ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity);
michael@0 9060 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9061 var _thrown = undefined; try {
michael@0 9062 ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity);
michael@0 9063 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9064 var _thrown = undefined; try {
michael@0 9065 ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10);
michael@0 9066 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9067 var _thrown = undefined; try {
michael@0 9068 ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity);
michael@0 9069 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9070 var _thrown = undefined; try {
michael@0 9071 ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity);
michael@0 9072 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9073 var _thrown = undefined; try {
michael@0 9074 ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10);
michael@0 9075 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9076 var _thrown = undefined; try {
michael@0 9077 ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10);
michael@0 9078 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9079 var _thrown = undefined; try {
michael@0 9080 ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10);
michael@0 9081 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9082 var _thrown = undefined; try {
michael@0 9083 ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity);
michael@0 9084 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9085 var _thrown = undefined; try {
michael@0 9086 ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity);
michael@0 9087 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9088 var _thrown = undefined; try {
michael@0 9089 ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10);
michael@0 9090 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9091 var _thrown = undefined; try {
michael@0 9092 ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity);
michael@0 9093 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9094 var _thrown = undefined; try {
michael@0 9095 ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity);
michael@0 9096 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9097 var _thrown = undefined; try {
michael@0 9098 ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10);
michael@0 9099 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9100 var _thrown = undefined; try {
michael@0 9101 ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10);
michael@0 9102 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9103 var _thrown = undefined; try {
michael@0 9104 ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity);
michael@0 9105 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9106 var _thrown = undefined; try {
michael@0 9107 ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity);
michael@0 9108 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9109 var _thrown = undefined; try {
michael@0 9110 ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10);
michael@0 9111 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9112 var _thrown = undefined; try {
michael@0 9113 ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity);
michael@0 9114 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9115 var _thrown = undefined; try {
michael@0 9116 ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity);
michael@0 9117 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9118 var _thrown = undefined; try {
michael@0 9119 ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10);
michael@0 9120 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9121 var _thrown = undefined; try {
michael@0 9122 ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10);
michael@0 9123 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9124 var _thrown = undefined; try {
michael@0 9125 ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10);
michael@0 9126 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9127 var _thrown = undefined; try {
michael@0 9128 ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 9129 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9130 var _thrown = undefined; try {
michael@0 9131 ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity);
michael@0 9132 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9133 var _thrown = undefined; try {
michael@0 9134 ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10);
michael@0 9135 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9136 var _thrown = undefined; try {
michael@0 9137 ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity);
michael@0 9138 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9139 var _thrown = undefined; try {
michael@0 9140 ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity);
michael@0 9141 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9142 var _thrown = undefined; try {
michael@0 9143 ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10);
michael@0 9144 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9145 var _thrown = undefined; try {
michael@0 9146 ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10);
michael@0 9147 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9148 var _thrown = undefined; try {
michael@0 9149 ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity);
michael@0 9150 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9151 var _thrown = undefined; try {
michael@0 9152 ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity);
michael@0 9153 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9154 var _thrown = undefined; try {
michael@0 9155 ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10);
michael@0 9156 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9157 var _thrown = undefined; try {
michael@0 9158 ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity);
michael@0 9159 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9160 var _thrown = undefined; try {
michael@0 9161 ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity);
michael@0 9162 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9163 var _thrown = undefined; try {
michael@0 9164 ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10);
michael@0 9165 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9166 var _thrown = undefined; try {
michael@0 9167 ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10);
michael@0 9168 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9169 var _thrown = undefined; try {
michael@0 9170 ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity);
michael@0 9171 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9172 var _thrown = undefined; try {
michael@0 9173 ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity);
michael@0 9174 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9175 var _thrown = undefined; try {
michael@0 9176 ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10);
michael@0 9177 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9178 var _thrown = undefined; try {
michael@0 9179 ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity);
michael@0 9180 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9181 var _thrown = undefined; try {
michael@0 9182 ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity);
michael@0 9183 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9184 var _thrown = undefined; try {
michael@0 9185 ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10);
michael@0 9186 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9187 var _thrown = undefined; try {
michael@0 9188 ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity);
michael@0 9189 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9190 var _thrown = undefined; try {
michael@0 9191 ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity);
michael@0 9192 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9193 var _thrown = undefined; try {
michael@0 9194 ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity);
michael@0 9195 } catch (e) { _thrown = e }; ok(_thrown && _thrown instanceof TypeError, "should throw TypeError");
michael@0 9196
michael@0 9197
michael@0 9198 }
michael@0 9199 </script>
michael@0 9200
michael@0 9201 <!-- [[[ test_2d.imageData.put.null.html ]]] -->
michael@0 9202
michael@0 9203 <p>Canvas test: 2d.imageData.put.null - bug 421715</p>
michael@0 9204 <!-- Testing: putImageData() with null imagedata throws TYPE_MISMATCH_ERR -->
michael@0 9205 <canvas id="c300" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9206 <script>
michael@0 9207
michael@0 9208 function test_2d_imageData_put_null() {
michael@0 9209
michael@0 9210 var canvas = document.getElementById('c300');
michael@0 9211 var ctx = canvas.getContext('2d');
michael@0 9212
michael@0 9213 var _thrown = undefined; try {
michael@0 9214 ctx.putImageData(null, 0, 0);
michael@0 9215 } catch (e) { _thrown = e };
michael@0 9216 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 9217
michael@0 9218 }
michael@0 9219 </script>
michael@0 9220
michael@0 9221 <!-- [[[ test_2d.imageData.put.path.html ]]] -->
michael@0 9222
michael@0 9223 <p>Canvas test: 2d.imageData.put.path</p>
michael@0 9224 <!-- Testing: putImageData() does not affect the current path -->
michael@0 9225 <canvas id="c301" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9226 <script>
michael@0 9227
michael@0 9228
michael@0 9229 function test_2d_imageData_put_path() {
michael@0 9230
michael@0 9231 var canvas = document.getElementById('c301');
michael@0 9232 var ctx = canvas.getContext('2d');
michael@0 9233
michael@0 9234 ctx.fillStyle = '#f00';
michael@0 9235 ctx.fillRect(0, 0, 100, 50)
michael@0 9236 ctx.rect(0, 0, 100, 50);
michael@0 9237 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 9238 ctx.putImageData(imgdata, 0, 0);
michael@0 9239 ctx.fillStyle = '#0f0';
michael@0 9240 ctx.fill();
michael@0 9241 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 9242
michael@0 9243
michael@0 9244 }
michael@0 9245 </script>
michael@0 9246
michael@0 9247 <!-- [[[ test_2d.imageData.put.unaffected.html ]]] -->
michael@0 9248
michael@0 9249 <p>Canvas test: 2d.imageData.put.unaffected</p>
michael@0 9250 <!-- Testing: putImageData() is not affected by context state -->
michael@0 9251 <canvas id="c302" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9252 <script>
michael@0 9253
michael@0 9254
michael@0 9255 function test_2d_imageData_put_unaffected() {
michael@0 9256
michael@0 9257 var canvas = document.getElementById('c302');
michael@0 9258 var ctx = canvas.getContext('2d');
michael@0 9259
michael@0 9260 ctx.fillStyle = '#0f0';
michael@0 9261 ctx.fillRect(0, 0, 100, 50)
michael@0 9262 var imgdata = ctx.getImageData(0, 0, 100, 50);
michael@0 9263 ctx.fillStyle = '#f00';
michael@0 9264 ctx.fillRect(0, 0, 100, 50)
michael@0 9265 ctx.globalAlpha = 0.1;
michael@0 9266 ctx.globalCompositeOperation = 'destination-atop';
michael@0 9267 ctx.shadowColor = '#f00';
michael@0 9268 ctx.translate(100, 50);
michael@0 9269 ctx.scale(0.1, 0.1);
michael@0 9270 ctx.putImageData(imgdata, 0, 0);
michael@0 9271 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 9272
michael@0 9273
michael@0 9274 }
michael@0 9275 </script>
michael@0 9276
michael@0 9277 <!-- [[[ test_2d.imageData.put.unchanged.html ]]] -->
michael@0 9278
michael@0 9279 <p>Canvas test: 2d.imageData.put.unchanged</p>
michael@0 9280 <!-- Testing: putImageData(getImageData(...), ...) has no effect -->
michael@0 9281 <canvas id="c303" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9282 <script>
michael@0 9283
michael@0 9284 function test_2d_imageData_put_unchanged() {
michael@0 9285
michael@0 9286 var canvas = document.getElementById('c303');
michael@0 9287 var ctx = canvas.getContext('2d');
michael@0 9288
michael@0 9289 var i = 0;
michael@0 9290 for (var y = 0; y < 16; ++y) {
michael@0 9291 for (var x = 0; x < 16; ++x, ++i) {
michael@0 9292 ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')';
michael@0 9293 ctx.fillRect(x, y, 1, 1);
michael@0 9294 }
michael@0 9295 }
michael@0 9296 var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
michael@0 9297 var olddata = [];
michael@0 9298 for (var i = 0; i < imgdata1.data.length; ++i)
michael@0 9299 olddata[i] = imgdata1.data[i];
michael@0 9300
michael@0 9301 ctx.putImageData(imgdata1, 0.1, 0.2);
michael@0 9302
michael@0 9303 var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
michael@0 9304 for (var i = 0; i < imgdata2.data.length; ++i) {
michael@0 9305 ok(olddata[i] === imgdata2.data[i], "olddata[\""+(i)+"\"] === imgdata2.data[\""+(i)+"\"]");
michael@0 9306 }
michael@0 9307
michael@0 9308
michael@0 9309 }
michael@0 9310 </script>
michael@0 9311
michael@0 9312 <!-- [[[ test_2d.imageData.put.wrongtype.html ]]] -->
michael@0 9313
michael@0 9314 <p>Canvas test: 2d.imageData.put.wrongtype</p>
michael@0 9315 <!-- Testing: putImageData() does not accept non-ImageData objects -->
michael@0 9316 <canvas id="c304" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9317 <script>
michael@0 9318
michael@0 9319 function test_2d_imageData_put_wrongtype() {
michael@0 9320
michael@0 9321 var canvas = document.getElementById('c304');
michael@0 9322 var ctx = canvas.getContext('2d');
michael@0 9323
michael@0 9324 var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] };
michael@0 9325 var _thrown = undefined; try {
michael@0 9326 ctx.putImageData(imgdata, 0, 0);
michael@0 9327 } catch (e) { _thrown = e };
michael@0 9328 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 9329
michael@0 9330 var _thrown = undefined; try {
michael@0 9331 ctx.putImageData("cheese", 0, 0);
michael@0 9332 } catch (e) { _thrown = e };
michael@0 9333 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 9334
michael@0 9335 var _thrown = undefined; try {
michael@0 9336 ctx.putImageData(42, 0, 0);
michael@0 9337 } catch (e) { _thrown = e };
michael@0 9338 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 9339 }
michael@0 9340 </script>
michael@0 9341
michael@0 9342 <!-- [[[ test_2d.line.cap.butt.html ]]] -->
michael@0 9343
michael@0 9344 <p>Canvas test: 2d.line.cap.butt</p>
michael@0 9345 <!-- Testing: lineCap 'butt' is rendered correctly -->
michael@0 9346 <canvas id="c305" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9347 <script>
michael@0 9348
michael@0 9349
michael@0 9350 function test_2d_line_cap_butt() {
michael@0 9351
michael@0 9352 var canvas = document.getElementById('c305');
michael@0 9353 var ctx = canvas.getContext('2d');
michael@0 9354
michael@0 9355 ctx.fillStyle = '#0f0';
michael@0 9356 ctx.fillRect(0, 0, 100, 50);
michael@0 9357
michael@0 9358 ctx.lineCap = 'butt';
michael@0 9359 ctx.lineWidth = 20;
michael@0 9360
michael@0 9361 ctx.fillStyle = '#f00';
michael@0 9362 ctx.strokeStyle = '#0f0';
michael@0 9363 ctx.fillRect(15, 15, 20, 20);
michael@0 9364 ctx.beginPath();
michael@0 9365 ctx.moveTo(25, 15);
michael@0 9366 ctx.lineTo(25, 35);
michael@0 9367 ctx.stroke();
michael@0 9368
michael@0 9369 ctx.fillStyle = '#0f0';
michael@0 9370 ctx.strokeStyle = '#f00';
michael@0 9371 ctx.beginPath();
michael@0 9372 ctx.moveTo(75, 15);
michael@0 9373 ctx.lineTo(75, 35);
michael@0 9374 ctx.stroke();
michael@0 9375 ctx.fillRect(65, 15, 20, 20);
michael@0 9376
michael@0 9377 isPixel(ctx, 25,14, 0,255,0,255, 0);
michael@0 9378 isPixel(ctx, 25,15, 0,255,0,255, 0);
michael@0 9379 isPixel(ctx, 25,16, 0,255,0,255, 0);
michael@0 9380 isPixel(ctx, 25,34, 0,255,0,255, 0);
michael@0 9381 isPixel(ctx, 25,35, 0,255,0,255, 0);
michael@0 9382 isPixel(ctx, 25,36, 0,255,0,255, 0);
michael@0 9383
michael@0 9384 isPixel(ctx, 75,14, 0,255,0,255, 0);
michael@0 9385 isPixel(ctx, 75,15, 0,255,0,255, 0);
michael@0 9386 isPixel(ctx, 75,16, 0,255,0,255, 0);
michael@0 9387 isPixel(ctx, 75,34, 0,255,0,255, 0);
michael@0 9388 isPixel(ctx, 75,35, 0,255,0,255, 0);
michael@0 9389 isPixel(ctx, 75,36, 0,255,0,255, 0);
michael@0 9390
michael@0 9391
michael@0 9392 }
michael@0 9393 </script>
michael@0 9394
michael@0 9395 <!-- [[[ test_2d.line.cap.closed.html ]]] -->
michael@0 9396
michael@0 9397 <p>Canvas test: 2d.line.cap.closed</p>
michael@0 9398 <!-- Testing: Line caps are not drawn at the corners of an unclosed rectangle -->
michael@0 9399 <canvas id="c306" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9400 <script>
michael@0 9401
michael@0 9402
michael@0 9403 function test_2d_line_cap_closed() {
michael@0 9404
michael@0 9405 var canvas = document.getElementById('c306');
michael@0 9406 var ctx = canvas.getContext('2d');
michael@0 9407
michael@0 9408 ctx.fillStyle = '#0f0';
michael@0 9409 ctx.strokeStyle = '#f00';
michael@0 9410 ctx.fillRect(0, 0, 100, 50);
michael@0 9411
michael@0 9412 ctx.lineJoin = 'bevel';
michael@0 9413 ctx.lineCap = 'square';
michael@0 9414 ctx.lineWidth = 400;
michael@0 9415
michael@0 9416 ctx.beginPath();
michael@0 9417 ctx.moveTo(200, 200);
michael@0 9418 ctx.lineTo(200, 1000);
michael@0 9419 ctx.lineTo(1000, 1000);
michael@0 9420 ctx.lineTo(1000, 200);
michael@0 9421 ctx.closePath();
michael@0 9422 ctx.stroke();
michael@0 9423
michael@0 9424 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9425 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9426 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9427 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9428
michael@0 9429
michael@0 9430 }
michael@0 9431 </script>
michael@0 9432
michael@0 9433 <!-- [[[ test_2d.line.cap.invalid.html ]]] -->
michael@0 9434
michael@0 9435 <p>Canvas test: 2d.line.cap.invalid - bug 401788</p>
michael@0 9436 <!-- Testing: Setting lineCap to invalid values is ignored -->
michael@0 9437 <canvas id="c307" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9438 <script>
michael@0 9439
michael@0 9440 function test_2d_line_cap_invalid() {
michael@0 9441
michael@0 9442 var canvas = document.getElementById('c307');
michael@0 9443 var ctx = canvas.getContext('2d');
michael@0 9444
michael@0 9445 var _thrown_outer = false;
michael@0 9446 try {
michael@0 9447
michael@0 9448 ctx.lineCap = 'butt'
michael@0 9449 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9450
michael@0 9451 ctx.lineCap = 'butt';
michael@0 9452 ctx.lineCap = 'invalid';
michael@0 9453 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9454
michael@0 9455 ctx.lineCap = 'butt';
michael@0 9456 ctx.lineCap = 'ROUND';
michael@0 9457 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9458
michael@0 9459 ctx.lineCap = 'butt';
michael@0 9460 ctx.lineCap = 'round\0';
michael@0 9461 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9462
michael@0 9463 ctx.lineCap = 'butt';
michael@0 9464 ctx.lineCap = 'round ';
michael@0 9465 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9466
michael@0 9467 ctx.lineCap = 'butt';
michael@0 9468 ctx.lineCap = "";
michael@0 9469 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9470
michael@0 9471 ctx.lineCap = 'butt';
michael@0 9472 ctx.lineCap = 'bevel';
michael@0 9473 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9474
michael@0 9475 } catch (e) {
michael@0 9476 _thrown_outer = true;
michael@0 9477 }
michael@0 9478 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 9479
michael@0 9480
michael@0 9481 }
michael@0 9482 </script>
michael@0 9483
michael@0 9484 <!-- [[[ test_2d.line.cap.open.html ]]] -->
michael@0 9485
michael@0 9486 <p>Canvas test: 2d.line.cap.open</p>
michael@0 9487 <!-- Testing: Line caps are drawn at the corners of an unclosed rectangle -->
michael@0 9488 <canvas id="c308" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9489 <script>
michael@0 9490
michael@0 9491
michael@0 9492 function test_2d_line_cap_open() {
michael@0 9493
michael@0 9494 var canvas = document.getElementById('c308');
michael@0 9495 var ctx = canvas.getContext('2d');
michael@0 9496
michael@0 9497 ctx.fillStyle = '#f00';
michael@0 9498 ctx.strokeStyle = '#0f0';
michael@0 9499 ctx.fillRect(0, 0, 100, 50);
michael@0 9500
michael@0 9501 ctx.lineJoin = 'bevel';
michael@0 9502 ctx.lineCap = 'square';
michael@0 9503 ctx.lineWidth = 400;
michael@0 9504
michael@0 9505 ctx.beginPath();
michael@0 9506 ctx.moveTo(200, 200);
michael@0 9507 ctx.lineTo(200, 1000);
michael@0 9508 ctx.lineTo(1000, 1000);
michael@0 9509 ctx.lineTo(1000, 200);
michael@0 9510 ctx.lineTo(200, 200);
michael@0 9511 ctx.stroke();
michael@0 9512
michael@0 9513 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9514 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9515 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9516 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9517
michael@0 9518
michael@0 9519 }
michael@0 9520 </script>
michael@0 9521
michael@0 9522 <!-- [[[ test_2d.line.cap.round.html ]]] -->
michael@0 9523
michael@0 9524 <p>Canvas test: 2d.line.cap.round</p>
michael@0 9525 <!-- Testing: lineCap 'round' is rendered correctly -->
michael@0 9526 <canvas id="c309" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9527 <script>
michael@0 9528
michael@0 9529
michael@0 9530 function test_2d_line_cap_round() {
michael@0 9531
michael@0 9532 var canvas = document.getElementById('c309');
michael@0 9533 var ctx = canvas.getContext('2d');
michael@0 9534
michael@0 9535 ctx.fillStyle = '#0f0';
michael@0 9536 ctx.fillRect(0, 0, 100, 50);
michael@0 9537
michael@0 9538 var tol = 1; // tolerance to avoid antialiasing artifacts
michael@0 9539
michael@0 9540 ctx.lineCap = 'round';
michael@0 9541 ctx.lineWidth = 20;
michael@0 9542
michael@0 9543
michael@0 9544 ctx.fillStyle = '#f00';
michael@0 9545 ctx.strokeStyle = '#0f0';
michael@0 9546
michael@0 9547 ctx.beginPath();
michael@0 9548 ctx.moveTo(35-tol, 15);
michael@0 9549 ctx.arc(25, 15, 10-tol, 0, Math.PI, true);
michael@0 9550 ctx.arc(25, 35, 10-tol, Math.PI, 0, true);
michael@0 9551 ctx.fill();
michael@0 9552
michael@0 9553 ctx.beginPath();
michael@0 9554 ctx.moveTo(25, 15);
michael@0 9555 ctx.lineTo(25, 35);
michael@0 9556 ctx.stroke();
michael@0 9557
michael@0 9558
michael@0 9559 ctx.fillStyle = '#0f0';
michael@0 9560 ctx.strokeStyle = '#f00';
michael@0 9561
michael@0 9562 ctx.beginPath();
michael@0 9563 ctx.moveTo(75, 15);
michael@0 9564 ctx.lineTo(75, 35);
michael@0 9565 ctx.stroke();
michael@0 9566
michael@0 9567 ctx.beginPath();
michael@0 9568 ctx.moveTo(85+tol, 15);
michael@0 9569 ctx.arc(75, 15, 10+tol, 0, Math.PI, true);
michael@0 9570 ctx.arc(75, 35, 10+tol, Math.PI, 0, true);
michael@0 9571 ctx.fill();
michael@0 9572
michael@0 9573 isPixel(ctx, 17,6, 0,255,0,255, 0);
michael@0 9574 isPixel(ctx, 25,6, 0,255,0,255, 0);
michael@0 9575 isPixel(ctx, 32,6, 0,255,0,255, 0);
michael@0 9576 isPixel(ctx, 17,43, 0,255,0,255, 0);
michael@0 9577 isPixel(ctx, 25,43, 0,255,0,255, 0);
michael@0 9578 isPixel(ctx, 32,43, 0,255,0,255, 0);
michael@0 9579
michael@0 9580 isPixel(ctx, 67,6, 0,255,0,255, 0);
michael@0 9581 isPixel(ctx, 75,6, 0,255,0,255, 0);
michael@0 9582 isPixel(ctx, 82,6, 0,255,0,255, 0);
michael@0 9583 isPixel(ctx, 67,43, 0,255,0,255, 0);
michael@0 9584 isPixel(ctx, 75,43, 0,255,0,255, 0);
michael@0 9585 isPixel(ctx, 82,43, 0,255,0,255, 0);
michael@0 9586
michael@0 9587
michael@0 9588 }
michael@0 9589 </script>
michael@0 9590
michael@0 9591 <!-- [[[ test_2d.line.cap.square.html ]]] -->
michael@0 9592
michael@0 9593 <p>Canvas test: 2d.line.cap.square</p>
michael@0 9594 <!-- Testing: lineCap 'square' is rendered correctly -->
michael@0 9595 <canvas id="c310" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9596 <script>
michael@0 9597
michael@0 9598
michael@0 9599 function test_2d_line_cap_square() {
michael@0 9600
michael@0 9601 var canvas = document.getElementById('c310');
michael@0 9602 var ctx = canvas.getContext('2d');
michael@0 9603
michael@0 9604 ctx.fillStyle = '#0f0';
michael@0 9605 ctx.fillRect(0, 0, 100, 50);
michael@0 9606
michael@0 9607 ctx.lineCap = 'square';
michael@0 9608 ctx.lineWidth = 20;
michael@0 9609
michael@0 9610 ctx.fillStyle = '#f00';
michael@0 9611 ctx.strokeStyle = '#0f0';
michael@0 9612 ctx.fillRect(15, 5, 20, 40);
michael@0 9613 ctx.beginPath();
michael@0 9614 ctx.moveTo(25, 15);
michael@0 9615 ctx.lineTo(25, 35);
michael@0 9616 ctx.stroke();
michael@0 9617
michael@0 9618 ctx.fillStyle = '#0f0';
michael@0 9619 ctx.strokeStyle = '#f00';
michael@0 9620 ctx.beginPath();
michael@0 9621 ctx.moveTo(75, 15);
michael@0 9622 ctx.lineTo(75, 35);
michael@0 9623 ctx.stroke();
michael@0 9624 ctx.fillRect(65, 5, 20, 40);
michael@0 9625
michael@0 9626 isPixel(ctx, 25,4, 0,255,0,255, 0);
michael@0 9627 isPixel(ctx, 25,5, 0,255,0,255, 0);
michael@0 9628 isPixel(ctx, 25,6, 0,255,0,255, 0);
michael@0 9629 isPixel(ctx, 25,44, 0,255,0,255, 0);
michael@0 9630 isPixel(ctx, 25,45, 0,255,0,255, 0);
michael@0 9631 isPixel(ctx, 25,46, 0,255,0,255, 0);
michael@0 9632
michael@0 9633 isPixel(ctx, 75,4, 0,255,0,255, 0);
michael@0 9634 isPixel(ctx, 75,5, 0,255,0,255, 0);
michael@0 9635 isPixel(ctx, 75,6, 0,255,0,255, 0);
michael@0 9636 isPixel(ctx, 75,44, 0,255,0,255, 0);
michael@0 9637 isPixel(ctx, 75,45, 0,255,0,255, 0);
michael@0 9638 isPixel(ctx, 75,46, 0,255,0,255, 0);
michael@0 9639
michael@0 9640
michael@0 9641 }
michael@0 9642 </script>
michael@0 9643
michael@0 9644 <!-- [[[ test_2d.line.cross.html ]]] -->
michael@0 9645
michael@0 9646 <p>Canvas test: 2d.line.cross</p>
michael@0 9647 <canvas id="c311" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9648 <script>
michael@0 9649
michael@0 9650
michael@0 9651 function test_2d_line_cross() {
michael@0 9652
michael@0 9653 var canvas = document.getElementById('c311');
michael@0 9654 var ctx = canvas.getContext('2d');
michael@0 9655
michael@0 9656 ctx.fillStyle = '#0f0';
michael@0 9657 ctx.fillRect(0, 0, 100, 50);
michael@0 9658
michael@0 9659 ctx.lineWidth = 200;
michael@0 9660 ctx.lineJoin = 'bevel';
michael@0 9661
michael@0 9662 ctx.strokeStyle = '#f00';
michael@0 9663 ctx.beginPath();
michael@0 9664 ctx.moveTo(110, 50);
michael@0 9665 ctx.lineTo(110, 60);
michael@0 9666 ctx.lineTo(100, 60);
michael@0 9667 ctx.stroke();
michael@0 9668
michael@0 9669 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9670 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9671 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9672 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9673
michael@0 9674
michael@0 9675 }
michael@0 9676 </script>
michael@0 9677
michael@0 9678 <!-- [[[ test_2d.line.defaults.html ]]] -->
michael@0 9679
michael@0 9680 <p>Canvas test: 2d.line.defaults</p>
michael@0 9681 <canvas id="c312" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9682 <script>
michael@0 9683
michael@0 9684 function test_2d_line_defaults() {
michael@0 9685
michael@0 9686 var canvas = document.getElementById('c312');
michael@0 9687 var ctx = canvas.getContext('2d');
michael@0 9688
michael@0 9689 ok(ctx.lineWidth === 1, "ctx.lineWidth === 1");
michael@0 9690 ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
michael@0 9691 ok(ctx.lineJoin === 'miter', "ctx.lineJoin === 'miter'");
michael@0 9692 ok(ctx.miterLimit === 10, "ctx.miterLimit === 10");
michael@0 9693
michael@0 9694
michael@0 9695 }
michael@0 9696 </script>
michael@0 9697
michael@0 9698 <!-- [[[ test_2d.line.join.bevel.html ]]] -->
michael@0 9699
michael@0 9700 <p>Canvas test: 2d.line.join.bevel</p>
michael@0 9701 <!-- Testing: lineJoin 'bevel' is rendered correctly -->
michael@0 9702 <canvas id="c313" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9703 <script>
michael@0 9704
michael@0 9705
michael@0 9706 function test_2d_line_join_bevel() {
michael@0 9707
michael@0 9708 var canvas = document.getElementById('c313');
michael@0 9709 var ctx = canvas.getContext('2d');
michael@0 9710
michael@0 9711 ctx.fillStyle = '#0f0';
michael@0 9712 ctx.fillRect(0, 0, 100, 50);
michael@0 9713
michael@0 9714 var tol = 1; // tolerance to avoid antialiasing artifacts
michael@0 9715
michael@0 9716 ctx.lineJoin = 'bevel';
michael@0 9717 ctx.lineWidth = 20;
michael@0 9718
michael@0 9719 ctx.fillStyle = '#f00';
michael@0 9720 ctx.strokeStyle = '#0f0';
michael@0 9721
michael@0 9722 ctx.fillRect(10, 10, 20, 20);
michael@0 9723 ctx.fillRect(20, 20, 20, 20);
michael@0 9724 ctx.beginPath();
michael@0 9725 ctx.moveTo(30, 20);
michael@0 9726 ctx.lineTo(40-tol, 20);
michael@0 9727 ctx.lineTo(30, 10+tol);
michael@0 9728 ctx.fill();
michael@0 9729
michael@0 9730 ctx.beginPath();
michael@0 9731 ctx.moveTo(10, 20);
michael@0 9732 ctx.lineTo(30, 20);
michael@0 9733 ctx.lineTo(30, 40);
michael@0 9734 ctx.stroke();
michael@0 9735
michael@0 9736
michael@0 9737 ctx.fillStyle = '#0f0';
michael@0 9738 ctx.strokeStyle = '#f00';
michael@0 9739
michael@0 9740 ctx.beginPath();
michael@0 9741 ctx.moveTo(60, 20);
michael@0 9742 ctx.lineTo(80, 20);
michael@0 9743 ctx.lineTo(80, 40);
michael@0 9744 ctx.stroke();
michael@0 9745
michael@0 9746 ctx.fillRect(60, 10, 20, 20);
michael@0 9747 ctx.fillRect(70, 20, 20, 20);
michael@0 9748 ctx.beginPath();
michael@0 9749 ctx.moveTo(80, 20);
michael@0 9750 ctx.lineTo(90+tol, 20);
michael@0 9751 ctx.lineTo(80, 10-tol);
michael@0 9752 ctx.fill();
michael@0 9753
michael@0 9754 isPixel(ctx, 34,16, 0,255,0,255, 0);
michael@0 9755 isPixel(ctx, 34,15, 0,255,0,255, 0);
michael@0 9756 isPixel(ctx, 35,15, 0,255,0,255, 0);
michael@0 9757 isPixel(ctx, 36,15, 0,255,0,255, 0);
michael@0 9758 isPixel(ctx, 36,14, 0,255,0,255, 0);
michael@0 9759
michael@0 9760 isPixel(ctx, 84,16, 0,255,0,255, 0);
michael@0 9761 isPixel(ctx, 84,15, 0,255,0,255, 0);
michael@0 9762 isPixel(ctx, 85,15, 0,255,0,255, 0);
michael@0 9763 isPixel(ctx, 86,15, 0,255,0,255, 0);
michael@0 9764 isPixel(ctx, 86,14, 0,255,0,255, 0);
michael@0 9765
michael@0 9766
michael@0 9767 }
michael@0 9768 </script>
michael@0 9769
michael@0 9770 <!-- [[[ test_2d.line.join.closed.html ]]] -->
michael@0 9771
michael@0 9772 <p>Canvas test: 2d.line.join.closed</p>
michael@0 9773 <!-- Testing: Line joins are drawn at the corner of a closed rectangle -->
michael@0 9774 <canvas id="c314" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9775 <script>
michael@0 9776
michael@0 9777
michael@0 9778 function test_2d_line_join_closed() {
michael@0 9779
michael@0 9780 var canvas = document.getElementById('c314');
michael@0 9781 var ctx = canvas.getContext('2d');
michael@0 9782
michael@0 9783 ctx.fillStyle = '#f00';
michael@0 9784 ctx.strokeStyle = '#0f0';
michael@0 9785 ctx.fillRect(0, 0, 100, 50);
michael@0 9786
michael@0 9787 ctx.lineJoin = 'miter';
michael@0 9788 ctx.lineWidth = 200;
michael@0 9789
michael@0 9790 ctx.beginPath();
michael@0 9791 ctx.moveTo(100, 50);
michael@0 9792 ctx.lineTo(100, 1000);
michael@0 9793 ctx.lineTo(1000, 1000);
michael@0 9794 ctx.lineTo(1000, 50);
michael@0 9795 ctx.closePath();
michael@0 9796 ctx.stroke();
michael@0 9797
michael@0 9798 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9799 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9800 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9801 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9802
michael@0 9803
michael@0 9804 }
michael@0 9805 </script>
michael@0 9806
michael@0 9807 <!-- [[[ test_2d.line.join.invalid.html ]]] -->
michael@0 9808
michael@0 9809 <p>Canvas test: 2d.line.join.invalid - bug 401788</p>
michael@0 9810 <!-- Testing: Setting lineJoin to invalid values is ignored -->
michael@0 9811 <canvas id="c315" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9812 <script>
michael@0 9813
michael@0 9814 function test_2d_line_join_invalid() {
michael@0 9815
michael@0 9816 var canvas = document.getElementById('c315');
michael@0 9817 var ctx = canvas.getContext('2d');
michael@0 9818
michael@0 9819 var _thrown_outer = false;
michael@0 9820 try {
michael@0 9821
michael@0 9822 ctx.lineJoin = 'bevel'
michael@0 9823 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9824
michael@0 9825 ctx.lineJoin = 'bevel';
michael@0 9826 ctx.lineJoin = 'invalid';
michael@0 9827 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9828
michael@0 9829 ctx.lineJoin = 'bevel';
michael@0 9830 ctx.lineJoin = 'ROUND';
michael@0 9831 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9832
michael@0 9833 ctx.lineJoin = 'bevel';
michael@0 9834 ctx.lineJoin = 'round\0';
michael@0 9835 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9836
michael@0 9837 ctx.lineJoin = 'bevel';
michael@0 9838 ctx.lineJoin = 'round ';
michael@0 9839 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9840
michael@0 9841 ctx.lineJoin = 'bevel';
michael@0 9842 ctx.lineJoin = "";
michael@0 9843 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9844
michael@0 9845 ctx.lineJoin = 'bevel';
michael@0 9846 ctx.lineJoin = 'butt';
michael@0 9847 ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
michael@0 9848
michael@0 9849 } catch (e) {
michael@0 9850 _thrown_outer = true;
michael@0 9851 }
michael@0 9852 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 9853
michael@0 9854
michael@0 9855 }
michael@0 9856 </script>
michael@0 9857
michael@0 9858 <!-- [[[ test_2d.line.join.miter.html ]]] -->
michael@0 9859
michael@0 9860 <p>Canvas test: 2d.line.join.miter</p>
michael@0 9861 <!-- Testing: lineJoin 'miter' is rendered correctly -->
michael@0 9862 <canvas id="c316" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9863 <script>
michael@0 9864
michael@0 9865
michael@0 9866 function test_2d_line_join_miter() {
michael@0 9867
michael@0 9868 var canvas = document.getElementById('c316');
michael@0 9869 var ctx = canvas.getContext('2d');
michael@0 9870
michael@0 9871 ctx.fillStyle = '#0f0';
michael@0 9872 ctx.fillRect(0, 0, 100, 50);
michael@0 9873
michael@0 9874 ctx.lineJoin = 'miter';
michael@0 9875 ctx.lineWidth = 20;
michael@0 9876
michael@0 9877 ctx.fillStyle = '#f00';
michael@0 9878 ctx.strokeStyle = '#0f0';
michael@0 9879
michael@0 9880 ctx.fillStyle = '#f00';
michael@0 9881 ctx.strokeStyle = '#0f0';
michael@0 9882
michael@0 9883 ctx.fillRect(10, 10, 30, 20);
michael@0 9884 ctx.fillRect(20, 10, 20, 30);
michael@0 9885
michael@0 9886 ctx.beginPath();
michael@0 9887 ctx.moveTo(10, 20);
michael@0 9888 ctx.lineTo(30, 20);
michael@0 9889 ctx.lineTo(30, 40);
michael@0 9890 ctx.stroke();
michael@0 9891
michael@0 9892
michael@0 9893 ctx.fillStyle = '#0f0';
michael@0 9894 ctx.strokeStyle = '#f00';
michael@0 9895
michael@0 9896 ctx.beginPath();
michael@0 9897 ctx.moveTo(60, 20);
michael@0 9898 ctx.lineTo(80, 20);
michael@0 9899 ctx.lineTo(80, 40);
michael@0 9900 ctx.stroke();
michael@0 9901
michael@0 9902 ctx.fillRect(60, 10, 30, 20);
michael@0 9903 ctx.fillRect(70, 10, 20, 30);
michael@0 9904
michael@0 9905 isPixel(ctx, 38,12, 0,255,0,255, 0);
michael@0 9906 isPixel(ctx, 39,11, 0,255,0,255, 0);
michael@0 9907 isPixel(ctx, 40,10, 0,255,0,255, 0);
michael@0 9908 isPixel(ctx, 41,9, 0,255,0,255, 0);
michael@0 9909 isPixel(ctx, 42,8, 0,255,0,255, 0);
michael@0 9910
michael@0 9911 isPixel(ctx, 88,12, 0,255,0,255, 0);
michael@0 9912 isPixel(ctx, 89,11, 0,255,0,255, 0);
michael@0 9913 isPixel(ctx, 90,10, 0,255,0,255, 0);
michael@0 9914 isPixel(ctx, 91,9, 0,255,0,255, 0);
michael@0 9915 isPixel(ctx, 92,8, 0,255,0,255, 0);
michael@0 9916
michael@0 9917
michael@0 9918 }
michael@0 9919 </script>
michael@0 9920
michael@0 9921 <!-- [[[ test_2d.line.join.open.html ]]] -->
michael@0 9922
michael@0 9923 <p>Canvas test: 2d.line.join.open</p>
michael@0 9924 <!-- Testing: Line joins are not drawn at the corner of an unclosed rectangle -->
michael@0 9925 <canvas id="c317" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9926 <script>
michael@0 9927
michael@0 9928
michael@0 9929 function test_2d_line_join_open() {
michael@0 9930
michael@0 9931 var canvas = document.getElementById('c317');
michael@0 9932 var ctx = canvas.getContext('2d');
michael@0 9933
michael@0 9934 ctx.fillStyle = '#0f0';
michael@0 9935 ctx.strokeStyle = '#f00';
michael@0 9936 ctx.fillRect(0, 0, 100, 50);
michael@0 9937
michael@0 9938 ctx.lineJoin = 'miter';
michael@0 9939 ctx.lineWidth = 200;
michael@0 9940
michael@0 9941 ctx.beginPath();
michael@0 9942 ctx.moveTo(100, 50);
michael@0 9943 ctx.lineTo(100, 1000);
michael@0 9944 ctx.lineTo(1000, 1000);
michael@0 9945 ctx.lineTo(1000, 50);
michael@0 9946 ctx.lineTo(100, 50);
michael@0 9947 ctx.stroke();
michael@0 9948
michael@0 9949 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9950 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9951 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9952 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9953
michael@0 9954
michael@0 9955 }
michael@0 9956 </script>
michael@0 9957
michael@0 9958 <!-- [[[ test_2d.line.join.parallel.html ]]] -->
michael@0 9959
michael@0 9960 <p>Canvas test: 2d.line.join.parallel</p>
michael@0 9961 <!-- Testing: Line joins are drawn at 180-degree joins -->
michael@0 9962 <canvas id="c318" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9963 <script>
michael@0 9964
michael@0 9965
michael@0 9966 function test_2d_line_join_parallel() {
michael@0 9967
michael@0 9968 var canvas = document.getElementById('c318');
michael@0 9969 var ctx = canvas.getContext('2d');
michael@0 9970
michael@0 9971 ctx.fillStyle = '#f00';
michael@0 9972 ctx.fillRect(0, 0, 100, 50);
michael@0 9973
michael@0 9974 ctx.strokeStyle = '#0f0';
michael@0 9975 ctx.lineWidth = 300;
michael@0 9976 ctx.lineJoin = 'round';
michael@0 9977 ctx.beginPath();
michael@0 9978 ctx.moveTo(-100, 25);
michael@0 9979 ctx.lineTo(0, 25);
michael@0 9980 ctx.lineTo(-100, 25);
michael@0 9981 ctx.stroke();
michael@0 9982
michael@0 9983 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 9984 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 9985 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 9986 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 9987
michael@0 9988
michael@0 9989 }
michael@0 9990 </script>
michael@0 9991
michael@0 9992 <!-- [[[ test_2d.line.join.round.html ]]] -->
michael@0 9993
michael@0 9994 <p>Canvas test: 2d.line.join.round</p>
michael@0 9995 <!-- Testing: lineJoin 'round' is rendered correctly -->
michael@0 9996 <canvas id="c319" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 9997 <script>
michael@0 9998
michael@0 9999
michael@0 10000 function test_2d_line_join_round() {
michael@0 10001
michael@0 10002 var canvas = document.getElementById('c319');
michael@0 10003 var ctx = canvas.getContext('2d');
michael@0 10004
michael@0 10005 ctx.fillStyle = '#0f0';
michael@0 10006 ctx.fillRect(0, 0, 100, 50);
michael@0 10007
michael@0 10008 var tol = 1; // tolerance to avoid antialiasing artifacts
michael@0 10009
michael@0 10010 ctx.lineJoin = 'round';
michael@0 10011 ctx.lineWidth = 20;
michael@0 10012
michael@0 10013 ctx.fillStyle = '#f00';
michael@0 10014 ctx.strokeStyle = '#0f0';
michael@0 10015
michael@0 10016 ctx.fillRect(10, 10, 20, 20);
michael@0 10017 ctx.fillRect(20, 20, 20, 20);
michael@0 10018 ctx.beginPath();
michael@0 10019 ctx.moveTo(30, 20);
michael@0 10020 ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true);
michael@0 10021 ctx.fill();
michael@0 10022
michael@0 10023 ctx.beginPath();
michael@0 10024 ctx.moveTo(10, 20);
michael@0 10025 ctx.lineTo(30, 20);
michael@0 10026 ctx.lineTo(30, 40);
michael@0 10027 ctx.stroke();
michael@0 10028
michael@0 10029
michael@0 10030 ctx.fillStyle = '#0f0';
michael@0 10031 ctx.strokeStyle = '#f00';
michael@0 10032
michael@0 10033 ctx.beginPath();
michael@0 10034 ctx.moveTo(60, 20);
michael@0 10035 ctx.lineTo(80, 20);
michael@0 10036 ctx.lineTo(80, 40);
michael@0 10037 ctx.stroke();
michael@0 10038
michael@0 10039 ctx.fillRect(60, 10, 20, 20);
michael@0 10040 ctx.fillRect(70, 20, 20, 20);
michael@0 10041 ctx.beginPath();
michael@0 10042 ctx.moveTo(80, 20);
michael@0 10043 ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true);
michael@0 10044 ctx.fill();
michael@0 10045
michael@0 10046 isPixel(ctx, 36,14, 0,255,0,255, 0);
michael@0 10047 isPixel(ctx, 36,13, 0,255,0,255, 0);
michael@0 10048 isPixel(ctx, 37,13, 0,255,0,255, 0);
michael@0 10049 isPixel(ctx, 38,13, 0,255,0,255, 0);
michael@0 10050 isPixel(ctx, 38,12, 0,255,0,255, 0);
michael@0 10051
michael@0 10052 isPixel(ctx, 86,14, 0,255,0,255, 0);
michael@0 10053 isPixel(ctx, 86,13, 0,255,0,255, 0);
michael@0 10054 isPixel(ctx, 87,13, 0,255,0,255, 0);
michael@0 10055 isPixel(ctx, 88,13, 0,255,0,255, 0);
michael@0 10056 isPixel(ctx, 88,12, 0,255,0,255, 0);
michael@0 10057
michael@0 10058
michael@0 10059 }
michael@0 10060 </script>
michael@0 10061
michael@0 10062 <!-- [[[ test_2d.line.miter.acute.html ]]] -->
michael@0 10063
michael@0 10064 <p>Canvas test: 2d.line.miter.acute</p>
michael@0 10065 <!-- Testing: Miter joins are drawn correctly with acute angles -->
michael@0 10066 <canvas id="c320" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10067 <script>
michael@0 10068
michael@0 10069
michael@0 10070 function test_2d_line_miter_acute() {
michael@0 10071
michael@0 10072 var canvas = document.getElementById('c320');
michael@0 10073 var ctx = canvas.getContext('2d');
michael@0 10074
michael@0 10075 ctx.fillStyle = '#f00';
michael@0 10076 ctx.fillRect(0, 0, 100, 50);
michael@0 10077
michael@0 10078 ctx.lineWidth = 200;
michael@0 10079 ctx.lineJoin = 'miter';
michael@0 10080
michael@0 10081 ctx.strokeStyle = '#0f0';
michael@0 10082 ctx.miterLimit = 2.614;
michael@0 10083 ctx.beginPath();
michael@0 10084 ctx.moveTo(100, 1000);
michael@0 10085 ctx.lineTo(100, 100);
michael@0 10086 ctx.lineTo(1000, 1000);
michael@0 10087 ctx.stroke();
michael@0 10088
michael@0 10089 ctx.strokeStyle = '#f00';
michael@0 10090 ctx.miterLimit = 2.613;
michael@0 10091 ctx.beginPath();
michael@0 10092 ctx.moveTo(100, 1000);
michael@0 10093 ctx.lineTo(100, 100);
michael@0 10094 ctx.lineTo(1000, 1000);
michael@0 10095 ctx.stroke();
michael@0 10096
michael@0 10097 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10098 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10099 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10100 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10101
michael@0 10102
michael@0 10103 }
michael@0 10104 </script>
michael@0 10105
michael@0 10106 <!-- [[[ test_2d.line.miter.exceeded.html ]]] -->
michael@0 10107
michael@0 10108 <p>Canvas test: 2d.line.miter.exceeded</p>
michael@0 10109 <!-- Testing: Miter joins are not drawn when the miter limit is exceeded -->
michael@0 10110 <canvas id="c321" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10111 <script>
michael@0 10112
michael@0 10113
michael@0 10114 function test_2d_line_miter_exceeded() {
michael@0 10115
michael@0 10116 var canvas = document.getElementById('c321');
michael@0 10117 var ctx = canvas.getContext('2d');
michael@0 10118
michael@0 10119 ctx.fillStyle = '#0f0';
michael@0 10120 ctx.fillRect(0, 0, 100, 50);
michael@0 10121
michael@0 10122 ctx.lineWidth = 400;
michael@0 10123 ctx.lineJoin = 'miter';
michael@0 10124
michael@0 10125 ctx.strokeStyle = '#f00';
michael@0 10126 ctx.miterLimit = 1.414;
michael@0 10127 ctx.beginPath();
michael@0 10128 ctx.moveTo(200, 1000);
michael@0 10129 ctx.lineTo(200, 200);
michael@0 10130 ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case
michael@0 10131 ctx.stroke();
michael@0 10132
michael@0 10133 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10134 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10135 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10136 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10137
michael@0 10138
michael@0 10139 }
michael@0 10140 </script>
michael@0 10141
michael@0 10142 <!-- [[[ test_2d.line.miter.invalid.html ]]] -->
michael@0 10143
michael@0 10144 <p>Canvas test: 2d.line.miter.invalid</p>
michael@0 10145 <!-- Testing: Setting miterLimit to invalid values is ignored -->
michael@0 10146 <canvas id="c322" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10147 <script>
michael@0 10148
michael@0 10149 function test_2d_line_miter_invalid() {
michael@0 10150
michael@0 10151 var canvas = document.getElementById('c322');
michael@0 10152 var ctx = canvas.getContext('2d');
michael@0 10153
michael@0 10154 var _thrown_outer = false;
michael@0 10155 try {
michael@0 10156
michael@0 10157 ctx.miterLimit = 1.5;
michael@0 10158 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10159
michael@0 10160 ctx.miterLimit = 1.5;
michael@0 10161 ctx.miterLimit = 0;
michael@0 10162 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10163
michael@0 10164 ctx.miterLimit = 1.5;
michael@0 10165 ctx.miterLimit = -1;
michael@0 10166 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10167
michael@0 10168 ctx.miterLimit = 1.5;
michael@0 10169 ctx.miterLimit = Infinity;
michael@0 10170 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10171
michael@0 10172 ctx.miterLimit = 1.5;
michael@0 10173 ctx.miterLimit = -Infinity;
michael@0 10174 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10175
michael@0 10176 ctx.miterLimit = 1.5;
michael@0 10177 ctx.miterLimit = NaN;
michael@0 10178 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
michael@0 10179
michael@0 10180 } catch (e) {
michael@0 10181 _thrown_outer = true;
michael@0 10182 }
michael@0 10183 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 10184
michael@0 10185
michael@0 10186 }
michael@0 10187 </script>
michael@0 10188
michael@0 10189 <!-- [[[ test_2d.line.miter.lineedge.html ]]] -->
michael@0 10190
michael@0 10191 <p>Canvas test: 2d.line.miter.lineedge - bug 401791</p>
michael@0 10192 <!-- Testing: Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle -->
michael@0 10193 <canvas id="c323" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10194 <script>
michael@0 10195
michael@0 10196
michael@0 10197 function test_2d_line_miter_lineedge() {
michael@0 10198
michael@0 10199 var canvas = document.getElementById('c323');
michael@0 10200 var ctx = canvas.getContext('2d');
michael@0 10201
michael@0 10202 ctx.fillStyle = '#0f0';
michael@0 10203 ctx.fillRect(0, 0, 100, 50);
michael@0 10204
michael@0 10205 ctx.lineWidth = 200;
michael@0 10206 ctx.lineJoin = 'miter';
michael@0 10207
michael@0 10208 ctx.strokeStyle = '#f00';
michael@0 10209 ctx.miterLimit = 1.414;
michael@0 10210 ctx.beginPath();
michael@0 10211 ctx.strokeRect(100, 25, 200, 0);
michael@0 10212
michael@0 10213 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10214 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10215 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10216 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10217
michael@0 10218
michael@0 10219 }
michael@0 10220 </script>
michael@0 10221
michael@0 10222 <!-- [[[ test_2d.line.miter.obtuse.html ]]] -->
michael@0 10223
michael@0 10224 <p>Canvas test: 2d.line.miter.obtuse</p>
michael@0 10225 <!-- Testing: Miter joins are drawn correctly with obtuse angles -->
michael@0 10226 <canvas id="c324" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10227 <script>
michael@0 10228
michael@0 10229
michael@0 10230 function test_2d_line_miter_obtuse() {
michael@0 10231
michael@0 10232 var canvas = document.getElementById('c324');
michael@0 10233 var ctx = canvas.getContext('2d');
michael@0 10234
michael@0 10235 ctx.fillStyle = '#f00';
michael@0 10236 ctx.fillRect(0, 0, 100, 50);
michael@0 10237
michael@0 10238 var x=800;
michael@0 10239 var y=300;
michael@0 10240 ctx.lineWidth = 1600;
michael@0 10241 ctx.lineJoin = 'miter';
michael@0 10242
michael@0 10243 ctx.strokeStyle = '#0f0';
michael@0 10244 ctx.miterLimit = 1.083;
michael@0 10245 ctx.beginPath();
michael@0 10246 ctx.moveTo(800, 10000);
michael@0 10247 ctx.lineTo(800, 300);
michael@0 10248 ctx.lineTo(10000, -8900);
michael@0 10249 ctx.stroke();
michael@0 10250
michael@0 10251 ctx.strokeStyle = '#f00';
michael@0 10252 ctx.miterLimit = 1.082;
michael@0 10253 ctx.beginPath();
michael@0 10254 ctx.moveTo(800, 10000);
michael@0 10255 ctx.lineTo(800, 300);
michael@0 10256 ctx.lineTo(10000, -8900);
michael@0 10257 ctx.stroke();
michael@0 10258
michael@0 10259 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10260 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10261 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10262 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10263
michael@0 10264
michael@0 10265 }
michael@0 10266 </script>
michael@0 10267
michael@0 10268 <!-- [[[ test_2d.line.miter.rightangle.html ]]] -->
michael@0 10269
michael@0 10270 <p>Canvas test: 2d.line.miter.rightangle - bug 401791</p>
michael@0 10271 <!-- Testing: Miter joins are not drawn when the miter limit is exceeded, on exact right angles -->
michael@0 10272 <canvas id="c325" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10273 <script>
michael@0 10274
michael@0 10275
michael@0 10276 function test_2d_line_miter_rightangle() {
michael@0 10277
michael@0 10278 var canvas = document.getElementById('c325');
michael@0 10279 var ctx = canvas.getContext('2d');
michael@0 10280
michael@0 10281 ctx.fillStyle = '#0f0';
michael@0 10282 ctx.fillRect(0, 0, 100, 50);
michael@0 10283
michael@0 10284 ctx.lineWidth = 400;
michael@0 10285 ctx.lineJoin = 'miter';
michael@0 10286
michael@0 10287 ctx.strokeStyle = '#f00';
michael@0 10288 ctx.miterLimit = 1.414;
michael@0 10289 ctx.beginPath();
michael@0 10290 ctx.moveTo(200, 1000);
michael@0 10291 ctx.lineTo(200, 200);
michael@0 10292 ctx.lineTo(1000, 200);
michael@0 10293 ctx.stroke();
michael@0 10294
michael@0 10295 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10296 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10297 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10298 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10299
michael@0 10300
michael@0 10301 }
michael@0 10302 </script>
michael@0 10303
michael@0 10304 <!-- [[[ test_2d.line.miter.within.html ]]] -->
michael@0 10305
michael@0 10306 <p>Canvas test: 2d.line.miter.within</p>
michael@0 10307 <!-- Testing: Miter joins are drawn when the miter limit is not quite exceeded -->
michael@0 10308 <canvas id="c326" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10309 <script>
michael@0 10310
michael@0 10311
michael@0 10312 function test_2d_line_miter_within() {
michael@0 10313
michael@0 10314 var canvas = document.getElementById('c326');
michael@0 10315 var ctx = canvas.getContext('2d');
michael@0 10316
michael@0 10317 ctx.fillStyle = '#f00';
michael@0 10318 ctx.fillRect(0, 0, 100, 50);
michael@0 10319
michael@0 10320 ctx.lineWidth = 400;
michael@0 10321 ctx.lineJoin = 'miter';
michael@0 10322
michael@0 10323 ctx.strokeStyle = '#0f0';
michael@0 10324 ctx.miterLimit = 1.416;
michael@0 10325 ctx.beginPath();
michael@0 10326 ctx.moveTo(200, 1000);
michael@0 10327 ctx.lineTo(200, 200);
michael@0 10328 ctx.lineTo(1000, 201);
michael@0 10329 ctx.stroke();
michael@0 10330
michael@0 10331 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10332 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10333 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10334 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10335
michael@0 10336
michael@0 10337 }
michael@0 10338 </script>
michael@0 10339
michael@0 10340 <!-- [[[ test_2d.line.union.html ]]] -->
michael@0 10341
michael@0 10342 <p>Canvas test: 2d.line.union</p>
michael@0 10343 <canvas id="c327" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10344 <script>
michael@0 10345
michael@0 10346
michael@0 10347 function test_2d_line_union() {
michael@0 10348
michael@0 10349 var canvas = document.getElementById('c327');
michael@0 10350 var ctx = canvas.getContext('2d');
michael@0 10351
michael@0 10352 ctx.fillStyle = '#f00';
michael@0 10353 ctx.fillRect(0, 0, 100, 50);
michael@0 10354
michael@0 10355 ctx.lineWidth = 100;
michael@0 10356 ctx.lineCap = 'round';
michael@0 10357
michael@0 10358 ctx.strokeStyle = '#0f0';
michael@0 10359 ctx.beginPath();
michael@0 10360 ctx.moveTo(0, 24);
michael@0 10361 ctx.lineTo(100, 25);
michael@0 10362 ctx.lineTo(0, 26);
michael@0 10363 ctx.closePath();
michael@0 10364 ctx.stroke();
michael@0 10365
michael@0 10366 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10367 isPixel(ctx, 25,1, 0,255,0,255, 0);
michael@0 10368 isPixel(ctx, 48,1, 0,255,0,255, 0);
michael@0 10369 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10370 isPixel(ctx, 25,1, 0,255,0,255, 0);
michael@0 10371 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 10372
michael@0 10373
michael@0 10374 }
michael@0 10375 </script>
michael@0 10376
michael@0 10377 <!-- [[[ test_2d.line.width.basic.html ]]] -->
michael@0 10378
michael@0 10379 <p>Canvas test: 2d.line.width.basic</p>
michael@0 10380 <!-- Testing: lineWidth determines the width of line strokes -->
michael@0 10381 <canvas id="c328" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10382 <script>
michael@0 10383
michael@0 10384
michael@0 10385 function test_2d_line_width_basic() {
michael@0 10386
michael@0 10387 var canvas = document.getElementById('c328');
michael@0 10388 var ctx = canvas.getContext('2d');
michael@0 10389
michael@0 10390 ctx.fillStyle = '#0f0';
michael@0 10391 ctx.fillRect(0, 0, 100, 50);
michael@0 10392
michael@0 10393 ctx.lineWidth = 20;
michael@0 10394 // Draw a green line over a red box, to check the line is not too small
michael@0 10395 ctx.fillStyle = '#f00';
michael@0 10396 ctx.strokeStyle = '#0f0';
michael@0 10397 ctx.fillRect(15, 15, 20, 20);
michael@0 10398 ctx.beginPath();
michael@0 10399 ctx.moveTo(25, 15);
michael@0 10400 ctx.lineTo(25, 35);
michael@0 10401 ctx.stroke();
michael@0 10402
michael@0 10403 // Draw a green box over a red line, to check the line is not too large
michael@0 10404 ctx.fillStyle = '#0f0';
michael@0 10405 ctx.strokeStyle = '#f00';
michael@0 10406 ctx.beginPath();
michael@0 10407 ctx.moveTo(75, 15);
michael@0 10408 ctx.lineTo(75, 35);
michael@0 10409 ctx.stroke();
michael@0 10410 ctx.fillRect(65, 15, 20, 20);
michael@0 10411
michael@0 10412 isPixel(ctx, 14,25, 0,255,0,255, 0);
michael@0 10413 isPixel(ctx, 15,25, 0,255,0,255, 0);
michael@0 10414 isPixel(ctx, 16,25, 0,255,0,255, 0);
michael@0 10415 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 10416 isPixel(ctx, 34,25, 0,255,0,255, 0);
michael@0 10417 isPixel(ctx, 35,25, 0,255,0,255, 0);
michael@0 10418 isPixel(ctx, 36,25, 0,255,0,255, 0);
michael@0 10419
michael@0 10420 isPixel(ctx, 64,25, 0,255,0,255, 0);
michael@0 10421 isPixel(ctx, 65,25, 0,255,0,255, 0);
michael@0 10422 isPixel(ctx, 66,25, 0,255,0,255, 0);
michael@0 10423 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 10424 isPixel(ctx, 84,25, 0,255,0,255, 0);
michael@0 10425 isPixel(ctx, 85,25, 0,255,0,255, 0);
michael@0 10426 isPixel(ctx, 86,25, 0,255,0,255, 0);
michael@0 10427
michael@0 10428
michael@0 10429 }
michael@0 10430 </script>
michael@0 10431
michael@0 10432 <!-- [[[ test_2d.line.width.invalid.html ]]] -->
michael@0 10433
michael@0 10434 <p>Canvas test: 2d.line.width.invalid</p>
michael@0 10435 <!-- Testing: Setting lineWidth to invalid values is ignored -->
michael@0 10436 <canvas id="c329" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10437 <script>
michael@0 10438
michael@0 10439 function test_2d_line_width_invalid() {
michael@0 10440
michael@0 10441 var canvas = document.getElementById('c329');
michael@0 10442 var ctx = canvas.getContext('2d');
michael@0 10443
michael@0 10444 var _thrown_outer = false;
michael@0 10445 try {
michael@0 10446
michael@0 10447 ctx.lineWidth = 1.5;
michael@0 10448 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10449
michael@0 10450 ctx.lineWidth = 1.5;
michael@0 10451 ctx.lineWidth = 0;
michael@0 10452 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10453
michael@0 10454 ctx.lineWidth = 1.5;
michael@0 10455 ctx.lineWidth = -1;
michael@0 10456 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10457
michael@0 10458 ctx.lineWidth = 1.5;
michael@0 10459 ctx.lineWidth = Infinity;
michael@0 10460 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10461
michael@0 10462 ctx.lineWidth = 1.5;
michael@0 10463 ctx.lineWidth = -Infinity;
michael@0 10464 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10465
michael@0 10466 ctx.lineWidth = 1.5;
michael@0 10467 ctx.lineWidth = NaN;
michael@0 10468 ok(ctx.lineWidth === 1.5, "ctx.lineWidth === 1.5");
michael@0 10469
michael@0 10470 } catch (e) {
michael@0 10471 _thrown_outer = true;
michael@0 10472 }
michael@0 10473 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 10474
michael@0 10475
michael@0 10476 }
michael@0 10477 </script>
michael@0 10478
michael@0 10479 <!-- [[[ test_2d.line.width.transformed.html ]]] -->
michael@0 10480
michael@0 10481 <p>Canvas test: 2d.line.width.transformed</p>
michael@0 10482 <!-- Testing: Line stroke widths are affected by scale transformations -->
michael@0 10483 <canvas id="c330" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10484 <script>
michael@0 10485
michael@0 10486
michael@0 10487 function test_2d_line_width_transformed() {
michael@0 10488
michael@0 10489 var canvas = document.getElementById('c330');
michael@0 10490 var ctx = canvas.getContext('2d');
michael@0 10491
michael@0 10492 ctx.fillStyle = '#0f0';
michael@0 10493 ctx.fillRect(0, 0, 100, 50);
michael@0 10494
michael@0 10495 ctx.lineWidth = 4;
michael@0 10496 // Draw a green line over a red box, to check the line is not too small
michael@0 10497 ctx.fillStyle = '#f00';
michael@0 10498 ctx.strokeStyle = '#0f0';
michael@0 10499 ctx.fillRect(15, 15, 20, 20);
michael@0 10500 ctx.save();
michael@0 10501 ctx.scale(5, 1);
michael@0 10502 ctx.beginPath();
michael@0 10503 ctx.moveTo(5, 15);
michael@0 10504 ctx.lineTo(5, 35);
michael@0 10505 ctx.stroke();
michael@0 10506 ctx.restore();
michael@0 10507
michael@0 10508 // Draw a green box over a red line, to check the line is not too large
michael@0 10509 ctx.fillStyle = '#0f0';
michael@0 10510 ctx.strokeStyle = '#f00';
michael@0 10511 ctx.save();
michael@0 10512 ctx.scale(-5, 1);
michael@0 10513 ctx.beginPath();
michael@0 10514 ctx.moveTo(-15, 15);
michael@0 10515 ctx.lineTo(-15, 35);
michael@0 10516 ctx.stroke();
michael@0 10517 ctx.restore();
michael@0 10518 ctx.fillRect(65, 15, 20, 20);
michael@0 10519
michael@0 10520 isPixel(ctx, 14,25, 0,255,0,255, 0);
michael@0 10521 isPixel(ctx, 15,25, 0,255,0,255, 0);
michael@0 10522 isPixel(ctx, 16,25, 0,255,0,255, 0);
michael@0 10523 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 10524 isPixel(ctx, 34,25, 0,255,0,255, 0);
michael@0 10525 isPixel(ctx, 35,25, 0,255,0,255, 0);
michael@0 10526 isPixel(ctx, 36,25, 0,255,0,255, 0);
michael@0 10527
michael@0 10528 isPixel(ctx, 64,25, 0,255,0,255, 0);
michael@0 10529 isPixel(ctx, 65,25, 0,255,0,255, 0);
michael@0 10530 isPixel(ctx, 66,25, 0,255,0,255, 0);
michael@0 10531 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 10532 isPixel(ctx, 84,25, 0,255,0,255, 0);
michael@0 10533 isPixel(ctx, 85,25, 0,255,0,255, 0);
michael@0 10534 isPixel(ctx, 86,25, 0,255,0,255, 0);
michael@0 10535
michael@0 10536
michael@0 10537 }
michael@0 10538 </script>
michael@0 10539
michael@0 10540 <!-- [[[ test_2d.missingargs.html ]]] -->
michael@0 10541
michael@0 10542 <p>Canvas test: 2d.missingargs</p>
michael@0 10543 <!-- Testing: Missing arguments cause NOT_SUPPORTED_ERR -->
michael@0 10544 <canvas id="c331" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10545 <script>
michael@0 10546
michael@0 10547 function test_2d_missingargs() {
michael@0 10548
michael@0 10549 var canvas = document.getElementById('c331');
michael@0 10550 var ctx = canvas.getContext('2d');
michael@0 10551
michael@0 10552 var _thrown = undefined; try {
michael@0 10553 ctx.scale();
michael@0 10554 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10555 var _thrown = undefined; try {
michael@0 10556 ctx.scale(1);
michael@0 10557 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10558 var _thrown = undefined; try {
michael@0 10559 ctx.rotate();
michael@0 10560 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10561 var _thrown = undefined; try {
michael@0 10562 ctx.translate();
michael@0 10563 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10564 var _thrown = undefined; try {
michael@0 10565 ctx.translate(0);
michael@0 10566 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10567 if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
michael@0 10568 var _thrown = undefined; try {
michael@0 10569 ctx.transform();
michael@0 10570 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10571 var _thrown = undefined; try {
michael@0 10572 ctx.transform(1);
michael@0 10573 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10574 var _thrown = undefined; try {
michael@0 10575 ctx.transform(1, 0);
michael@0 10576 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10577 var _thrown = undefined; try {
michael@0 10578 ctx.transform(1, 0, 0);
michael@0 10579 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10580 var _thrown = undefined; try {
michael@0 10581 ctx.transform(1, 0, 0, 1);
michael@0 10582 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10583 var _thrown = undefined; try {
michael@0 10584 ctx.transform(1, 0, 0, 1, 0);
michael@0 10585 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10586 }
michael@0 10587 if (ctx.setTransform) {
michael@0 10588 var _thrown = undefined; try {
michael@0 10589 ctx.setTransform();
michael@0 10590 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10591 var _thrown = undefined; try {
michael@0 10592 ctx.setTransform(1);
michael@0 10593 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10594 var _thrown = undefined; try {
michael@0 10595 ctx.setTransform(1, 0);
michael@0 10596 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10597 var _thrown = undefined; try {
michael@0 10598 ctx.setTransform(1, 0, 0);
michael@0 10599 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10600 var _thrown = undefined; try {
michael@0 10601 ctx.setTransform(1, 0, 0, 1);
michael@0 10602 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10603 var _thrown = undefined; try {
michael@0 10604 ctx.setTransform(1, 0, 0, 1, 0);
michael@0 10605 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10606 }
michael@0 10607 var _thrown = undefined; try {
michael@0 10608 ctx.createLinearGradient();
michael@0 10609 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10610 var _thrown = undefined; try {
michael@0 10611 ctx.createLinearGradient(0);
michael@0 10612 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10613 var _thrown = undefined; try {
michael@0 10614 ctx.createLinearGradient(0, 0);
michael@0 10615 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10616 var _thrown = undefined; try {
michael@0 10617 ctx.createLinearGradient(0, 0, 1);
michael@0 10618 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10619 var _thrown = undefined; try {
michael@0 10620 ctx.createRadialGradient();
michael@0 10621 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10622 var _thrown = undefined; try {
michael@0 10623 ctx.createRadialGradient(0);
michael@0 10624 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10625 var _thrown = undefined; try {
michael@0 10626 ctx.createRadialGradient(0, 0);
michael@0 10627 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10628 var _thrown = undefined; try {
michael@0 10629 ctx.createRadialGradient(0, 0, 1);
michael@0 10630 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10631 var _thrown = undefined; try {
michael@0 10632 ctx.createRadialGradient(0, 0, 1, 0);
michael@0 10633 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10634 var _thrown = undefined; try {
michael@0 10635 ctx.createRadialGradient(0, 0, 1, 0, 0);
michael@0 10636 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10637 var _thrown = undefined; try {
michael@0 10638 ctx.createPattern(canvas);
michael@0 10639 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10640 var _thrown = undefined; try {
michael@0 10641 ctx.clearRect();
michael@0 10642 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10643 var _thrown = undefined; try {
michael@0 10644 ctx.clearRect(0);
michael@0 10645 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10646 var _thrown = undefined; try {
michael@0 10647 ctx.clearRect(0, 0);
michael@0 10648 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10649 var _thrown = undefined; try {
michael@0 10650 ctx.clearRect(0, 0, 0);
michael@0 10651 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10652 var _thrown = undefined; try {
michael@0 10653 ctx.fillRect();
michael@0 10654 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10655 var _thrown = undefined; try {
michael@0 10656 ctx.fillRect(0);
michael@0 10657 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10658 var _thrown = undefined; try {
michael@0 10659 ctx.fillRect(0, 0);
michael@0 10660 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10661 var _thrown = undefined; try {
michael@0 10662 ctx.fillRect(0, 0, 0);
michael@0 10663 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10664 var _thrown = undefined; try {
michael@0 10665 ctx.strokeRect();
michael@0 10666 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10667 var _thrown = undefined; try {
michael@0 10668 ctx.strokeRect(0);
michael@0 10669 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10670 var _thrown = undefined; try {
michael@0 10671 ctx.strokeRect(0, 0);
michael@0 10672 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10673 var _thrown = undefined; try {
michael@0 10674 ctx.strokeRect(0, 0, 0);
michael@0 10675 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10676 var _thrown = undefined; try {
michael@0 10677 ctx.moveTo();
michael@0 10678 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10679 var _thrown = undefined; try {
michael@0 10680 ctx.moveTo(0);
michael@0 10681 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10682 var _thrown = undefined; try {
michael@0 10683 ctx.lineTo();
michael@0 10684 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10685 var _thrown = undefined; try {
michael@0 10686 ctx.lineTo(0);
michael@0 10687 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10688 var _thrown = undefined; try {
michael@0 10689 ctx.quadraticCurveTo();
michael@0 10690 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10691 var _thrown = undefined; try {
michael@0 10692 ctx.quadraticCurveTo(0);
michael@0 10693 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10694 var _thrown = undefined; try {
michael@0 10695 ctx.quadraticCurveTo(0, 0);
michael@0 10696 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10697 var _thrown = undefined; try {
michael@0 10698 ctx.quadraticCurveTo(0, 0, 0);
michael@0 10699 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10700 var _thrown = undefined; try {
michael@0 10701 ctx.bezierCurveTo();
michael@0 10702 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10703 var _thrown = undefined; try {
michael@0 10704 ctx.bezierCurveTo(0);
michael@0 10705 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10706 var _thrown = undefined; try {
michael@0 10707 ctx.bezierCurveTo(0, 0);
michael@0 10708 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10709 var _thrown = undefined; try {
michael@0 10710 ctx.bezierCurveTo(0, 0, 0);
michael@0 10711 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10712 var _thrown = undefined; try {
michael@0 10713 ctx.bezierCurveTo(0, 0, 0, 0);
michael@0 10714 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10715 var _thrown = undefined; try {
michael@0 10716 ctx.bezierCurveTo(0, 0, 0, 0, 0);
michael@0 10717 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10718 var _thrown = undefined; try {
michael@0 10719 ctx.arcTo();
michael@0 10720 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10721 var _thrown = undefined; try {
michael@0 10722 ctx.arcTo(0);
michael@0 10723 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10724 var _thrown = undefined; try {
michael@0 10725 ctx.arcTo(0, 0);
michael@0 10726 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10727 var _thrown = undefined; try {
michael@0 10728 ctx.arcTo(0, 0, 0);
michael@0 10729 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10730 var _thrown = undefined; try {
michael@0 10731 ctx.arcTo(0, 0, 0, 0);
michael@0 10732 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10733 var _thrown = undefined; try {
michael@0 10734 ctx.rect();
michael@0 10735 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10736 var _thrown = undefined; try {
michael@0 10737 ctx.rect(0);
michael@0 10738 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10739 var _thrown = undefined; try {
michael@0 10740 ctx.rect(0, 0);
michael@0 10741 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10742 var _thrown = undefined; try {
michael@0 10743 ctx.rect(0, 0, 0);
michael@0 10744 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10745 var _thrown = undefined; try {
michael@0 10746 ctx.arc();
michael@0 10747 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10748 var _thrown = undefined; try {
michael@0 10749 ctx.arc(0);
michael@0 10750 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10751 var _thrown = undefined; try {
michael@0 10752 ctx.arc(0, 0);
michael@0 10753 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10754 var _thrown = undefined; try {
michael@0 10755 ctx.arc(0, 0, 1);
michael@0 10756 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10757 var _thrown = undefined; try {
michael@0 10758 ctx.arc(0, 0, 1, 0);
michael@0 10759 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10760 var _thrown = undefined; try {
michael@0 10761 ctx.arc(0, 0, 1, 0, 0);
michael@0 10762 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10763 if (ctx.isPointInPath) {
michael@0 10764 var _thrown = undefined; try {
michael@0 10765 ctx.isPointInPath();
michael@0 10766 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10767 var _thrown = undefined; try {
michael@0 10768 ctx.isPointInPath(0);
michael@0 10769 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10770 }
michael@0 10771 var _thrown = undefined; try {
michael@0 10772 ctx.drawImage();
michael@0 10773 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10774 var _thrown = undefined; try {
michael@0 10775 ctx.drawImage(canvas);
michael@0 10776 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10777 var _thrown = undefined; try {
michael@0 10778 ctx.drawImage(canvas, 0);
michael@0 10779 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10780 // TODO: n >= 3 args on drawImage could be either a valid overload,
michael@0 10781 // or too few for another overload, or too many for another
michael@0 10782 // overload - what should happen?
michael@0 10783 if (ctx.createImageData) {
michael@0 10784 var _thrown = undefined; try {
michael@0 10785 ctx.createImageData();
michael@0 10786 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10787 var _thrown = undefined; try {
michael@0 10788 ctx.createImageData(1);
michael@0 10789 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10790 }
michael@0 10791 if (ctx.getImageData) {
michael@0 10792 var _thrown = undefined; try {
michael@0 10793 ctx.getImageData();
michael@0 10794 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10795 var _thrown = undefined; try {
michael@0 10796 ctx.getImageData(0);
michael@0 10797 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10798 var _thrown = undefined; try {
michael@0 10799 ctx.getImageData(0, 0);
michael@0 10800 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10801 var _thrown = undefined; try {
michael@0 10802 ctx.getImageData(0, 0, 1);
michael@0 10803 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10804 }
michael@0 10805 if (ctx.putImageData) {
michael@0 10806 var imgdata = ctx.getImageData(0, 0, 1, 1);
michael@0 10807 var _thrown = undefined; try {
michael@0 10808 ctx.putImageData();
michael@0 10809 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10810 var _thrown = undefined; try {
michael@0 10811 ctx.putImageData(imgdata);
michael@0 10812 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10813 var _thrown = undefined; try {
michael@0 10814 ctx.putImageData(imgdata, 0);
michael@0 10815 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10816 }
michael@0 10817 var g = ctx.createLinearGradient(0, 0, 0, 0);
michael@0 10818 var _thrown = undefined; try {
michael@0 10819 g.addColorStop();
michael@0 10820 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10821 var _thrown = undefined; try {
michael@0 10822 g.addColorStop(0);
michael@0 10823 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 10824
michael@0 10825
michael@0 10826 }
michael@0 10827 </script>
michael@0 10828
michael@0 10829 <!-- [[[ test_2d.path.arc.angle.1.html ]]] -->
michael@0 10830
michael@0 10831 <p>Canvas test: 2d.path.arc.angle.1</p>
michael@0 10832 <!-- Testing: arc() draws pi/2 .. -pi anticlockwise correctly -->
michael@0 10833 <canvas id="c332" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10834 <script>
michael@0 10835
michael@0 10836
michael@0 10837 function test_2d_path_arc_angle_1() {
michael@0 10838
michael@0 10839 var canvas = document.getElementById('c332');
michael@0 10840 var ctx = canvas.getContext('2d');
michael@0 10841
michael@0 10842 ctx.fillStyle = '#0f0';
michael@0 10843 ctx.fillRect(0, 0, 100, 50);
michael@0 10844 ctx.fillStyle = '#f00';
michael@0 10845 ctx.beginPath();
michael@0 10846 ctx.moveTo(100, 0);
michael@0 10847 ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true);
michael@0 10848 ctx.fill();
michael@0 10849 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 10850
michael@0 10851
michael@0 10852 }
michael@0 10853 </script>
michael@0 10854
michael@0 10855 <!-- [[[ test_2d.path.arc.angle.2.html ]]] -->
michael@0 10856
michael@0 10857 <p>Canvas test: 2d.path.arc.angle.2</p>
michael@0 10858 <!-- Testing: arc() draws -3pi/2 .. -pi anticlockwise correctly -->
michael@0 10859 <canvas id="c333" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10860 <script>
michael@0 10861
michael@0 10862
michael@0 10863 function test_2d_path_arc_angle_2() {
michael@0 10864
michael@0 10865 var canvas = document.getElementById('c333');
michael@0 10866 var ctx = canvas.getContext('2d');
michael@0 10867
michael@0 10868 ctx.fillStyle = '#0f0';
michael@0 10869 ctx.fillRect(0, 0, 100, 50);
michael@0 10870 ctx.fillStyle = '#f00';
michael@0 10871 ctx.beginPath();
michael@0 10872 ctx.moveTo(100, 0);
michael@0 10873 ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true);
michael@0 10874 ctx.fill();
michael@0 10875 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 10876
michael@0 10877
michael@0 10878 }
michael@0 10879 </script>
michael@0 10880
michael@0 10881 <!-- [[[ test_2d.path.arc.angle.3.html ]]] -->
michael@0 10882
michael@0 10883 <p>Canvas test: 2d.path.arc.angle.3</p>
michael@0 10884 <!-- Testing: arc() wraps angles mod 2pi when anticlockwise and end > start+2pi -->
michael@0 10885 <canvas id="c334" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10886 <script>
michael@0 10887
michael@0 10888
michael@0 10889 function test_2d_path_arc_angle_3() {
michael@0 10890
michael@0 10891 var canvas = document.getElementById('c334');
michael@0 10892 var ctx = canvas.getContext('2d');
michael@0 10893
michael@0 10894 ctx.fillStyle = '#0f0';
michael@0 10895 ctx.fillRect(0, 0, 100, 50);
michael@0 10896 ctx.fillStyle = '#f00';
michael@0 10897 ctx.beginPath();
michael@0 10898 ctx.moveTo(100, 0);
michael@0 10899 ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true);
michael@0 10900 ctx.fill();
michael@0 10901 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 10902
michael@0 10903
michael@0 10904 }
michael@0 10905 </script>
michael@0 10906
michael@0 10907 <!-- [[[ test_2d.path.arc.angle.4.html ]]] -->
michael@0 10908
michael@0 10909 <p>Canvas test: 2d.path.arc.angle.4</p>
michael@0 10910 <!-- Testing: arc() draws a full circle when clockwise and end > start+2pi -->
michael@0 10911 <canvas id="c335" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10912 <script>
michael@0 10913
michael@0 10914
michael@0 10915 function test_2d_path_arc_angle_4() {
michael@0 10916
michael@0 10917 var canvas = document.getElementById('c335');
michael@0 10918 var ctx = canvas.getContext('2d');
michael@0 10919
michael@0 10920 ctx.fillStyle = '#f00';
michael@0 10921 ctx.fillRect(0, 0, 100, 50);
michael@0 10922 ctx.fillStyle = '#0f0';
michael@0 10923 ctx.beginPath();
michael@0 10924 ctx.moveTo(50, 25);
michael@0 10925 ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false);
michael@0 10926 ctx.fill();
michael@0 10927 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10928 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 10929 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10930 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 10931
michael@0 10932
michael@0 10933 }
michael@0 10934 </script>
michael@0 10935
michael@0 10936 <!-- [[[ test_2d.path.arc.angle.5.html ]]] -->
michael@0 10937
michael@0 10938 <p>Canvas test: 2d.path.arc.angle.5</p>
michael@0 10939 <!-- Testing: arc() wraps angles mod 2pi when clockwise and start > end+2pi -->
michael@0 10940 <canvas id="c336" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10941 <script>
michael@0 10942
michael@0 10943
michael@0 10944 function test_2d_path_arc_angle_5() {
michael@0 10945
michael@0 10946 var canvas = document.getElementById('c336');
michael@0 10947 var ctx = canvas.getContext('2d');
michael@0 10948
michael@0 10949 ctx.fillStyle = '#0f0';
michael@0 10950 ctx.fillRect(0, 0, 100, 50);
michael@0 10951 ctx.fillStyle = '#f00';
michael@0 10952 ctx.beginPath();
michael@0 10953 ctx.moveTo(100, 0);
michael@0 10954 ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false);
michael@0 10955 ctx.fill();
michael@0 10956 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 10957
michael@0 10958
michael@0 10959 }
michael@0 10960 </script>
michael@0 10961
michael@0 10962 <!-- [[[ test_2d.path.arc.angle.6.html ]]] -->
michael@0 10963
michael@0 10964 <p>Canvas test: 2d.path.arc.angle.6</p>
michael@0 10965 <!-- Testing: arc() draws a full circle when anticlockwise and start > end+2pi -->
michael@0 10966 <canvas id="c337" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10967 <script>
michael@0 10968
michael@0 10969
michael@0 10970 function test_2d_path_arc_angle_6() {
michael@0 10971
michael@0 10972 var canvas = document.getElementById('c337');
michael@0 10973 var ctx = canvas.getContext('2d');
michael@0 10974
michael@0 10975 ctx.fillStyle = '#f00';
michael@0 10976 ctx.fillRect(0, 0, 100, 50);
michael@0 10977 ctx.fillStyle = '#0f0';
michael@0 10978 ctx.beginPath();
michael@0 10979 ctx.moveTo(50, 25);
michael@0 10980 ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true);
michael@0 10981 ctx.fill();
michael@0 10982 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 10983 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 10984 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 10985 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 10986
michael@0 10987
michael@0 10988 }
michael@0 10989 </script>
michael@0 10990
michael@0 10991 <!-- [[[ test_2d.path.arc.empty.html ]]] -->
michael@0 10992
michael@0 10993 <p>Canvas test: 2d.path.arc.empty</p>
michael@0 10994 <!-- Testing: arc() with an empty path does not draw a straight line to the start point -->
michael@0 10995 <canvas id="c338" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 10996 <script>
michael@0 10997
michael@0 10998
michael@0 10999 function test_2d_path_arc_empty() {
michael@0 11000
michael@0 11001 var canvas = document.getElementById('c338');
michael@0 11002 var ctx = canvas.getContext('2d');
michael@0 11003
michael@0 11004 ctx.fillStyle = '#0f0';
michael@0 11005 ctx.fillRect(0, 0, 100, 50);
michael@0 11006 ctx.lineWidth = 50;
michael@0 11007 ctx.strokeStyle = '#f00';
michael@0 11008 ctx.beginPath();
michael@0 11009 ctx.arc(200, 25, 5, 0, 2*Math.PI, true);
michael@0 11010 ctx.stroke();
michael@0 11011 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11012
michael@0 11013
michael@0 11014 }
michael@0 11015 </script>
michael@0 11016
michael@0 11017 <!-- [[[ test_2d.path.arc.end.html ]]] -->
michael@0 11018
michael@0 11019 <p>Canvas test: 2d.path.arc.end</p>
michael@0 11020 <!-- Testing: arc() adds the end point of the arc to the subpath -->
michael@0 11021 <canvas id="c339" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11022 <script>
michael@0 11023
michael@0 11024
michael@0 11025 function test_2d_path_arc_end() {
michael@0 11026
michael@0 11027 var canvas = document.getElementById('c339');
michael@0 11028 var ctx = canvas.getContext('2d');
michael@0 11029
michael@0 11030 ctx.fillStyle = '#f00';
michael@0 11031 ctx.fillRect(0, 0, 100, 50);
michael@0 11032 ctx.lineWidth = 50;
michael@0 11033 ctx.strokeStyle = '#0f0';
michael@0 11034 ctx.beginPath();
michael@0 11035 ctx.moveTo(-100, 0);
michael@0 11036 ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true);
michael@0 11037 ctx.lineTo(100, 25);
michael@0 11038 ctx.stroke();
michael@0 11039 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11040
michael@0 11041
michael@0 11042 }
michael@0 11043 </script>
michael@0 11044
michael@0 11045 <!-- [[[ test_2d.path.arc.negative.html ]]] -->
michael@0 11046
michael@0 11047 <p>Canvas test: 2d.path.arc.negative</p>
michael@0 11048 <!-- Testing: arc() with negative radius throws INDEX_SIZE_ERR -->
michael@0 11049 <canvas id="c340" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11050 <script>
michael@0 11051
michael@0 11052 function test_2d_path_arc_negative() {
michael@0 11053
michael@0 11054 var canvas = document.getElementById('c340');
michael@0 11055 var ctx = canvas.getContext('2d');
michael@0 11056
michael@0 11057 var _thrown = undefined; try {
michael@0 11058 ctx.arc(0, 0, -1, 0, 0, true);
michael@0 11059 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 11060
michael@0 11061
michael@0 11062 }
michael@0 11063 </script>
michael@0 11064
michael@0 11065 <!-- [[[ test_2d.path.arc.nonempty.html ]]] -->
michael@0 11066
michael@0 11067 <p>Canvas test: 2d.path.arc.nonempty</p>
michael@0 11068 <!-- Testing: arc() with a non-empty path does draw a straight line to the start point -->
michael@0 11069 <canvas id="c341" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11070 <script>
michael@0 11071
michael@0 11072
michael@0 11073 function test_2d_path_arc_nonempty() {
michael@0 11074
michael@0 11075 var canvas = document.getElementById('c341');
michael@0 11076 var ctx = canvas.getContext('2d');
michael@0 11077
michael@0 11078 ctx.fillStyle = '#f00';
michael@0 11079 ctx.fillRect(0, 0, 100, 50);
michael@0 11080 ctx.lineWidth = 50;
michael@0 11081 ctx.strokeStyle = '#0f0';
michael@0 11082 ctx.beginPath();
michael@0 11083 ctx.moveTo(0, 25);
michael@0 11084 ctx.arc(200, 25, 5, 0, 2*Math.PI, true);
michael@0 11085 ctx.stroke();
michael@0 11086 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11087
michael@0 11088
michael@0 11089 }
michael@0 11090 </script>
michael@0 11091
michael@0 11092 <!-- [[[ test_2d.path.arc.nonfinite.html ]]] -->
michael@0 11093
michael@0 11094 <p>Canvas test: 2d.path.arc.nonfinite</p>
michael@0 11095 <!-- Testing: arc() with Infinity/NaN is ignored -->
michael@0 11096 <canvas id="c342" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11097 <script>
michael@0 11098
michael@0 11099
michael@0 11100 function test_2d_path_arc_nonfinite() {
michael@0 11101
michael@0 11102 var canvas = document.getElementById('c342');
michael@0 11103 var ctx = canvas.getContext('2d');
michael@0 11104
michael@0 11105 var _thrown_outer = false;
michael@0 11106 try {
michael@0 11107
michael@0 11108 ctx.fillStyle = '#f00';
michael@0 11109 ctx.fillRect(0, 0, 100, 50);
michael@0 11110 ctx.moveTo(0, 0);
michael@0 11111 ctx.lineTo(100, 0);
michael@0 11112 ctx.arc(Infinity, 50, 0, 2*Math.PI, true);
michael@0 11113 ctx.arc(-Infinity, 50, 0, 2*Math.PI, true);
michael@0 11114 ctx.arc(NaN, 50, 0, 2*Math.PI, true);
michael@0 11115 ctx.arc(0, Infinity, 0, 2*Math.PI, true);
michael@0 11116 ctx.arc(0, -Infinity, 0, 2*Math.PI, true);
michael@0 11117 ctx.arc(0, NaN, 0, 2*Math.PI, true);
michael@0 11118 ctx.arc(0, 50, Infinity, 2*Math.PI, true);
michael@0 11119 ctx.arc(0, 50, -Infinity, 2*Math.PI, true);
michael@0 11120 ctx.arc(0, 50, NaN, 2*Math.PI, true);
michael@0 11121 ctx.arc(0, 50, 0, Infinity, true);
michael@0 11122 ctx.arc(0, 50, 0, -Infinity, true);
michael@0 11123 ctx.arc(0, 50, 0, NaN, true);
michael@0 11124 ctx.arc(Infinity, Infinity, 0, 2*Math.PI, true);
michael@0 11125 ctx.arc(Infinity, Infinity, Infinity, 2*Math.PI, true);
michael@0 11126 ctx.arc(Infinity, Infinity, Infinity, Infinity, true);
michael@0 11127 ctx.arc(Infinity, Infinity, 0, Infinity, true);
michael@0 11128 ctx.arc(Infinity, 50, Infinity, 2*Math.PI, true);
michael@0 11129 ctx.arc(Infinity, 50, Infinity, Infinity, true);
michael@0 11130 ctx.arc(Infinity, 50, 0, Infinity, true);
michael@0 11131 ctx.arc(0, Infinity, Infinity, 2*Math.PI, true);
michael@0 11132 ctx.arc(0, Infinity, Infinity, Infinity, true);
michael@0 11133 ctx.arc(0, Infinity, 0, Infinity, true);
michael@0 11134 ctx.arc(0, 50, Infinity, Infinity, true);
michael@0 11135 ctx.lineTo(100, 50);
michael@0 11136 ctx.lineTo(0, 50);
michael@0 11137 ctx.fillStyle = '#0f0';
michael@0 11138 ctx.fill();
michael@0 11139 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11140 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 11141
michael@0 11142 } catch (e) {
michael@0 11143 _thrown_outer = true;
michael@0 11144 }
michael@0 11145 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 11146
michael@0 11147
michael@0 11148 }
michael@0 11149 </script>
michael@0 11150
michael@0 11151 <!-- [[[ test_2d.path.arc.scale.1.html ]]] -->
michael@0 11152
michael@0 11153 <p>Canvas test: 2d.path.arc.scale.1</p>
michael@0 11154 <!-- Testing: Non-uniformly scaled arcs are the right shape -->
michael@0 11155 <canvas id="c343" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11156 <script>
michael@0 11157
michael@0 11158
michael@0 11159 function test_2d_path_arc_scale_1() {
michael@0 11160
michael@0 11161 var canvas = document.getElementById('c343');
michael@0 11162 var ctx = canvas.getContext('2d');
michael@0 11163
michael@0 11164 ctx.fillStyle = '#f00';
michael@0 11165 ctx.fillRect(0, 0, 100, 50);
michael@0 11166 ctx.scale(2, 0.5);
michael@0 11167 ctx.fillStyle = '#0f0';
michael@0 11168 ctx.beginPath();
michael@0 11169 var hypothenuse = Math.sqrt(50 * 50 + 25 * 25);
michael@0 11170 var tolerance = 0.5;
michael@0 11171 var radius = hypothenuse + tolerance;
michael@0 11172 ctx.arc(25, 50, radius, 0, 2*Math.PI, false);
michael@0 11173 ctx.fill();
michael@0 11174 ctx.fillStyle = '#f00';
michael@0 11175 ctx.beginPath();
michael@0 11176 ctx.moveTo(-25, 50);
michael@0 11177 ctx.arc(-25, 50, 24, 0, 2*Math.PI, false);
michael@0 11178 ctx.moveTo(75, 50);
michael@0 11179 ctx.arc(75, 50, 24, 0, 2*Math.PI, false);
michael@0 11180 ctx.moveTo(25, -25);
michael@0 11181 ctx.arc(25, -25, 24, 0, 2*Math.PI, false);
michael@0 11182 ctx.moveTo(25, 125);
michael@0 11183 ctx.arc(25, 125, 24, 0, 2*Math.PI, false);
michael@0 11184 ctx.fill();
michael@0 11185
michael@0 11186 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 11187 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 11188 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 11189 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 11190 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11191 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 11192 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 11193 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 11194 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 11195
michael@0 11196
michael@0 11197 }
michael@0 11198 </script>
michael@0 11199
michael@0 11200 <!-- [[[ test_2d.path.arc.scale.2.html ]]] -->
michael@0 11201
michael@0 11202 <p>Canvas test: 2d.path.arc.scale.2</p>
michael@0 11203 <!-- Testing: Highly scaled arcs are the right shape -->
michael@0 11204 <canvas id="c344" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11205 <script>
michael@0 11206
michael@0 11207
michael@0 11208 function test_2d_path_arc_scale_2() {
michael@0 11209
michael@0 11210 var canvas = document.getElementById('c344');
michael@0 11211 var ctx = canvas.getContext('2d');
michael@0 11212
michael@0 11213 ctx.fillStyle = '#f00';
michael@0 11214 ctx.fillRect(0, 0, 100, 50);
michael@0 11215 ctx.scale(100, 100);
michael@0 11216 ctx.strokeStyle = '#0f0';
michael@0 11217 ctx.lineWidth = 1.2;
michael@0 11218 ctx.beginPath();
michael@0 11219 ctx.arc(0, 0, 0.6, 0, Math.PI/2, false);
michael@0 11220 ctx.stroke();
michael@0 11221
michael@0 11222 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11223 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 11224 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11225 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 11226 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11227 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 11228 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11229 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 11230 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11231
michael@0 11232
michael@0 11233 }
michael@0 11234 </script>
michael@0 11235
michael@0 11236 <!-- [[[ test_2d.path.arc.selfintersect.1.html ]]] -->
michael@0 11237
michael@0 11238 <p>Canvas test: 2d.path.arc.selfintersect.1</p>
michael@0 11239 <!-- Testing: arc() with lineWidth > 2*radius is drawn sensibly -->
michael@0 11240 <canvas id="c345" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11241 <script>
michael@0 11242
michael@0 11243
michael@0 11244 function test_2d_path_arc_selfintersect_1() {
michael@0 11245
michael@0 11246 var canvas = document.getElementById('c345');
michael@0 11247 var ctx = canvas.getContext('2d');
michael@0 11248
michael@0 11249 ctx.fillStyle = '#0f0';
michael@0 11250 ctx.fillRect(0, 0, 100, 50);
michael@0 11251 ctx.lineWidth = 200;
michael@0 11252 ctx.strokeStyle = '#f00';
michael@0 11253 ctx.beginPath();
michael@0 11254 ctx.arc(100, 50, 25, 0, -Math.PI/2, true);
michael@0 11255 ctx.stroke();
michael@0 11256 ctx.beginPath();
michael@0 11257 ctx.arc(0, 0, 25, 0, -Math.PI/2, true);
michael@0 11258 ctx.stroke();
michael@0 11259 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11260
michael@0 11261
michael@0 11262 }
michael@0 11263 </script>
michael@0 11264
michael@0 11265 <!-- [[[ test_2d.path.arc.selfintersect.2.html ]]] -->
michael@0 11266
michael@0 11267 <p>Canvas test: 2d.path.arc.selfintersect.2</p>
michael@0 11268 <!-- Testing: arc() with lineWidth > 2*radius is drawn sensibly -->
michael@0 11269 <canvas id="c346" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11270 <script>
michael@0 11271
michael@0 11272
michael@0 11273 function test_2d_path_arc_selfintersect_2() {
michael@0 11274
michael@0 11275 var canvas = document.getElementById('c346');
michael@0 11276 var ctx = canvas.getContext('2d');
michael@0 11277
michael@0 11278 ctx.fillStyle = '#f00';
michael@0 11279 ctx.fillRect(0, 0, 100, 50);
michael@0 11280 ctx.lineWidth = 180;
michael@0 11281 ctx.strokeStyle = '#0f0';
michael@0 11282 ctx.beginPath();
michael@0 11283 ctx.arc(-50, 50, 25, 0, -Math.PI/2, true);
michael@0 11284 ctx.stroke();
michael@0 11285 ctx.beginPath();
michael@0 11286 ctx.arc(100, 0, 25, 0, -Math.PI/2, true);
michael@0 11287 ctx.stroke();
michael@0 11288 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11289 isPixel(ctx, 90,10, 0,255,0,255, 0);
michael@0 11290 isPixel(ctx, 97,1, 0,255,0,255, 0);
michael@0 11291 isPixel(ctx, 97,2, 0,255,0,255, 0);
michael@0 11292 isPixel(ctx, 97,3, 0,255,0,255, 0);
michael@0 11293 isPixel(ctx, 2,48, 0,255,0,255, 0);
michael@0 11294
michael@0 11295
michael@0 11296 }
michael@0 11297 </script>
michael@0 11298
michael@0 11299 <!-- [[[ test_2d.path.arc.shape.1.html ]]] -->
michael@0 11300
michael@0 11301 <p>Canvas test: 2d.path.arc.shape.1</p>
michael@0 11302 <!-- Testing: arc() from 0 to pi does not draw anything in the wrong half -->
michael@0 11303 <canvas id="c347" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11304 <script>
michael@0 11305
michael@0 11306
michael@0 11307 function test_2d_path_arc_shape_1() {
michael@0 11308
michael@0 11309 var canvas = document.getElementById('c347');
michael@0 11310 var ctx = canvas.getContext('2d');
michael@0 11311
michael@0 11312 ctx.fillStyle = '#0f0';
michael@0 11313 ctx.fillRect(0, 0, 100, 50);
michael@0 11314 ctx.lineWidth = 50;
michael@0 11315 ctx.strokeStyle = '#f00';
michael@0 11316 ctx.beginPath();
michael@0 11317 ctx.arc(50, 50, 50, 0, Math.PI, false);
michael@0 11318 ctx.stroke();
michael@0 11319 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11320 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11321 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11322 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11323 // Fails on Linux with Azure/Cairo only
michael@0 11324 // The arc is drawn badly due to Cairo limitations, the error only becomes
michael@0 11325 // apparent on Linux because of anti-aliasing, probably due to X.
michael@0 11326 // The limitation is that Cairo draws arcs by stroking perpendicular to the arc,
michael@0 11327 // and at very large stroke thicknesses, this becomes a fan. Where exactly the
michael@0 11328 // 'blades' of the fan appear seems to depend on exactly how the arc is defined
michael@0 11329 // and the platform. So if the blades of the fan are where pixels are tested it
michael@0 11330 // passes the test, if the testing pixels fall in between the blades, then we fail.
michael@0 11331 // With Thebes/Cairo, we were rendering wrong, but got lucky with the test, now
michael@0 11332 // we are not so lucky.
michael@0 11333 // Bug 764125
michael@0 11334 if (IsAzureCairo() && IsLinux()) {
michael@0 11335 todo_isPixel(ctx, 20,48, 0,255,0,255, 0);
michael@0 11336 } else {
michael@0 11337 isPixel(ctx, 20,48, 0,255,0,255, 0);
michael@0 11338 }
michael@0 11339 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11340
michael@0 11341 }
michael@0 11342 </script>
michael@0 11343
michael@0 11344 <!-- [[[ test_2d.path.arc.shape.2.html ]]] -->
michael@0 11345
michael@0 11346 <p>Canvas test: 2d.path.arc.shape.2</p>
michael@0 11347 <!-- Testing: arc() from 0 to pi draws stuff in the right half -->
michael@0 11348 <canvas id="c348" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11349 <script>
michael@0 11350
michael@0 11351
michael@0 11352 function test_2d_path_arc_shape_2() {
michael@0 11353
michael@0 11354 var canvas = document.getElementById('c348');
michael@0 11355 var ctx = canvas.getContext('2d');
michael@0 11356
michael@0 11357 ctx.fillStyle = '#f00';
michael@0 11358 ctx.fillRect(0, 0, 100, 50);
michael@0 11359 ctx.lineWidth = 100;
michael@0 11360 ctx.strokeStyle = '#0f0';
michael@0 11361 ctx.beginPath();
michael@0 11362 ctx.arc(50, 50, 50, 0, Math.PI, true);
michael@0 11363 ctx.stroke();
michael@0 11364 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11365 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11366 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11367 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11368 isPixel(ctx, 20,48, 0,255,0,255, 0);
michael@0 11369 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11370
michael@0 11371
michael@0 11372 }
michael@0 11373 </script>
michael@0 11374
michael@0 11375 <!-- [[[ test_2d.path.arc.shape.3.html ]]] -->
michael@0 11376
michael@0 11377 <p>Canvas test: 2d.path.arc.shape.3</p>
michael@0 11378 <!-- Testing: arc() from 0 to -pi/2 does not draw anything in the wrong quadrant -->
michael@0 11379 <canvas id="c349" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11380 <script>
michael@0 11381
michael@0 11382
michael@0 11383
michael@0 11384 function test_2d_path_arc_shape_3() {
michael@0 11385
michael@0 11386 var canvas = document.getElementById('c349');
michael@0 11387 var ctx = canvas.getContext('2d');
michael@0 11388
michael@0 11389 ctx.fillStyle = '#0f0';
michael@0 11390 ctx.fillRect(0, 0, 100, 50);
michael@0 11391 ctx.lineWidth = 100;
michael@0 11392 ctx.strokeStyle = '#f00';
michael@0 11393 ctx.beginPath();
michael@0 11394 ctx.arc(0, 50, 50, 0, -Math.PI/2, false);
michael@0 11395 ctx.stroke();
michael@0 11396 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11397 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11398 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11399 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11400 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11401
michael@0 11402
michael@0 11403 }
michael@0 11404 </script>
michael@0 11405
michael@0 11406 <!-- [[[ test_2d.path.arc.shape.4.html ]]] -->
michael@0 11407
michael@0 11408 <p>Canvas test: 2d.path.arc.shape.4</p>
michael@0 11409 <!-- Testing: arc() from 0 to -pi/2 draws stuff in the right quadrant -->
michael@0 11410 <canvas id="c350" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11411 <script>
michael@0 11412
michael@0 11413
michael@0 11414 function test_2d_path_arc_shape_4() {
michael@0 11415
michael@0 11416 var canvas = document.getElementById('c350');
michael@0 11417 var ctx = canvas.getContext('2d');
michael@0 11418
michael@0 11419 ctx.fillStyle = '#f00';
michael@0 11420 ctx.fillRect(0, 0, 100, 50);
michael@0 11421 ctx.lineWidth = 150;
michael@0 11422 ctx.strokeStyle = '#0f0';
michael@0 11423 ctx.beginPath();
michael@0 11424 ctx.arc(-50, 50, 100, 0, -Math.PI/2, true);
michael@0 11425 ctx.stroke();
michael@0 11426 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11427 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11428 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11429 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11430 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11431
michael@0 11432
michael@0 11433 }
michael@0 11434 </script>
michael@0 11435
michael@0 11436 <!-- [[[ test_2d.path.arc.shape.5.html ]]] -->
michael@0 11437
michael@0 11438 <p>Canvas test: 2d.path.arc.shape.5</p>
michael@0 11439 <!-- Testing: arc() from 0 to 5pi does not draw crazy things -->
michael@0 11440 <canvas id="c351" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11441 <script>
michael@0 11442
michael@0 11443
michael@0 11444 function test_2d_path_arc_shape_5() {
michael@0 11445
michael@0 11446 var canvas = document.getElementById('c351');
michael@0 11447 var ctx = canvas.getContext('2d');
michael@0 11448
michael@0 11449 ctx.fillStyle = '#0f0';
michael@0 11450 ctx.fillRect(0, 0, 100, 50);
michael@0 11451 ctx.lineWidth = 200;
michael@0 11452 ctx.strokeStyle = '#f00';
michael@0 11453 ctx.beginPath();
michael@0 11454 ctx.arc(300, 0, 100, 0, 5*Math.PI, false);
michael@0 11455 ctx.stroke();
michael@0 11456 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11457 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 11458 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 11459 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 11460 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 11461
michael@0 11462
michael@0 11463 }
michael@0 11464 </script>
michael@0 11465
michael@0 11466 <!-- [[[ test_2d.path.arc.twopie.1.html ]]] -->
michael@0 11467
michael@0 11468 <p>Canvas test: 2d.path.arc.twopie.1</p>
michael@0 11469 <!-- Testing: arc() draws nothing when end = start + 2pi-e and anticlockwise -->
michael@0 11470 <canvas id="c352" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11471 <script>
michael@0 11472
michael@0 11473
michael@0 11474 function test_2d_path_arc_twopie_1() {
michael@0 11475
michael@0 11476 var canvas = document.getElementById('c352');
michael@0 11477 var ctx = canvas.getContext('2d');
michael@0 11478
michael@0 11479 ctx.fillStyle = '#0f0';
michael@0 11480 ctx.fillRect(0, 0, 100, 50);
michael@0 11481 ctx.strokeStyle = '#f00';
michael@0 11482 ctx.lineWidth = 100;
michael@0 11483 ctx.beginPath();
michael@0 11484 ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true);
michael@0 11485 ctx.stroke();
michael@0 11486 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11487
michael@0 11488
michael@0 11489 }
michael@0 11490 </script>
michael@0 11491
michael@0 11492 <!-- [[[ test_2d.path.arc.twopie.2.html ]]] -->
michael@0 11493
michael@0 11494 <p>Canvas test: 2d.path.arc.twopie.2</p>
michael@0 11495 <!-- Testing: arc() draws a full circle when end = start + 2pi-e and clockwise -->
michael@0 11496 <canvas id="c353" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11497 <script>
michael@0 11498
michael@0 11499
michael@0 11500 function test_2d_path_arc_twopie_2() {
michael@0 11501
michael@0 11502 var canvas = document.getElementById('c353');
michael@0 11503 var ctx = canvas.getContext('2d');
michael@0 11504
michael@0 11505 ctx.fillStyle = '#f00';
michael@0 11506 ctx.fillRect(0, 0, 100, 50);
michael@0 11507 ctx.strokeStyle = '#0f0';
michael@0 11508 ctx.lineWidth = 100;
michael@0 11509 ctx.beginPath();
michael@0 11510 ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false);
michael@0 11511 ctx.stroke();
michael@0 11512 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11513
michael@0 11514
michael@0 11515 }
michael@0 11516 </script>
michael@0 11517
michael@0 11518 <!-- [[[ test_2d.path.arc.twopie.3.html ]]] -->
michael@0 11519
michael@0 11520 <p>Canvas test: 2d.path.arc.twopie.3</p>
michael@0 11521 <!-- Testing: arc() draws a full circle when end = start + 2pi+e and anticlockwise -->
michael@0 11522 <canvas id="c354" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11523 <script>
michael@0 11524
michael@0 11525
michael@0 11526 function test_2d_path_arc_twopie_3() {
michael@0 11527
michael@0 11528 var canvas = document.getElementById('c354');
michael@0 11529 var ctx = canvas.getContext('2d');
michael@0 11530
michael@0 11531 ctx.fillStyle = '#f00';
michael@0 11532 ctx.fillRect(0, 0, 100, 50);
michael@0 11533 ctx.strokeStyle = '#0f0';
michael@0 11534 ctx.lineWidth = 100;
michael@0 11535 ctx.beginPath();
michael@0 11536 ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true);
michael@0 11537 ctx.stroke();
michael@0 11538 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11539
michael@0 11540
michael@0 11541 }
michael@0 11542 </script>
michael@0 11543
michael@0 11544 <!-- [[[ test_2d.path.arc.twopie.4.html ]]] -->
michael@0 11545
michael@0 11546 <p>Canvas test: 2d.path.arc.twopie.4</p>
michael@0 11547 <!-- Testing: arc() draws nothing when end = start + 2pi+e and clockwise -->
michael@0 11548 <canvas id="c355" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11549 <script>
michael@0 11550
michael@0 11551
michael@0 11552 function test_2d_path_arc_twopie_4() {
michael@0 11553
michael@0 11554 var canvas = document.getElementById('c355');
michael@0 11555 var ctx = canvas.getContext('2d');
michael@0 11556
michael@0 11557 ctx.fillStyle = '#f00';
michael@0 11558 ctx.fillRect(0, 0, 100, 50);
michael@0 11559 ctx.strokeStyle = '#0f0';
michael@0 11560 ctx.lineWidth = 100;
michael@0 11561 ctx.beginPath();
michael@0 11562 ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false);
michael@0 11563 ctx.stroke();
michael@0 11564 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11565
michael@0 11566
michael@0 11567 }
michael@0 11568 </script>
michael@0 11569
michael@0 11570 <!-- [[[ test_2d.path.arc.zero.1.html ]]] -->
michael@0 11571
michael@0 11572 <p>Canvas test: 2d.path.arc.zero.1</p>
michael@0 11573 <!-- Testing: arc() draws nothing when startAngle = endAngle and anticlockwise -->
michael@0 11574 <canvas id="c356" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11575 <script>
michael@0 11576
michael@0 11577
michael@0 11578 function test_2d_path_arc_zero_1() {
michael@0 11579
michael@0 11580 var canvas = document.getElementById('c356');
michael@0 11581 var ctx = canvas.getContext('2d');
michael@0 11582
michael@0 11583 ctx.fillStyle = '#0f0';
michael@0 11584 ctx.fillRect(0, 0, 100, 50);
michael@0 11585 ctx.strokeStyle = '#f00';
michael@0 11586 ctx.lineWidth = 100;
michael@0 11587 ctx.beginPath();
michael@0 11588 ctx.arc(50, 25, 50, 0, 0, true);
michael@0 11589 ctx.stroke();
michael@0 11590 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11591
michael@0 11592
michael@0 11593 }
michael@0 11594 </script>
michael@0 11595
michael@0 11596 <!-- [[[ test_2d.path.arc.zero.2.html ]]] -->
michael@0 11597
michael@0 11598 <p>Canvas test: 2d.path.arc.zero.2</p>
michael@0 11599 <!-- Testing: arc() draws nothing when startAngle = endAngle and clockwise -->
michael@0 11600 <canvas id="c357" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11601 <script>
michael@0 11602
michael@0 11603
michael@0 11604 function test_2d_path_arc_zero_2() {
michael@0 11605
michael@0 11606 var canvas = document.getElementById('c357');
michael@0 11607 var ctx = canvas.getContext('2d');
michael@0 11608
michael@0 11609 ctx.fillStyle = '#0f0';
michael@0 11610 ctx.fillRect(0, 0, 100, 50);
michael@0 11611 ctx.strokeStyle = '#f00';
michael@0 11612 ctx.lineWidth = 100;
michael@0 11613 ctx.beginPath();
michael@0 11614 ctx.arc(50, 25, 50, 0, 0, false);
michael@0 11615 ctx.stroke();
michael@0 11616 isPixel(ctx, 50,20, 0,255,0,255, 0);
michael@0 11617
michael@0 11618
michael@0 11619 }
michael@0 11620 </script>
michael@0 11621
michael@0 11622 <!-- [[[ test_2d.path.arc.zeroradius.html ]]] -->
michael@0 11623
michael@0 11624 <p>Canvas test: 2d.path.arc.zeroradius</p>
michael@0 11625 <!-- Testing: arc() with zero radius draws a line to the start point -->
michael@0 11626 <canvas id="c358" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11627 <script>
michael@0 11628
michael@0 11629
michael@0 11630
michael@0 11631 function test_2d_path_arc_zeroradius() {
michael@0 11632
michael@0 11633 var canvas = document.getElementById('c358');
michael@0 11634 var ctx = canvas.getContext('2d');
michael@0 11635
michael@0 11636 ctx.fillStyle = '#f00'
michael@0 11637 ctx.fillRect(0, 0, 100, 50);
michael@0 11638 ctx.lineWidth = 50;
michael@0 11639 ctx.strokeStyle = '#0f0';
michael@0 11640 ctx.beginPath();
michael@0 11641 ctx.moveTo(0, 25);
michael@0 11642 ctx.arc(200, 25, 0, 0, Math.PI, true);
michael@0 11643 ctx.stroke();
michael@0 11644
michael@0 11645 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11646 }
michael@0 11647 </script>
michael@0 11648
michael@0 11649 <!-- [[[ test_2d.path.arcTo.coincide.1.html ]]] -->
michael@0 11650
michael@0 11651 <p>Canvas test: 2d.path.arcTo.coincide.1</p>
michael@0 11652 <!-- Testing: arcTo() has no effect if P0 = P1 -->
michael@0 11653 <canvas id="c359" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11654 <script>
michael@0 11655
michael@0 11656
michael@0 11657
michael@0 11658 function test_2d_path_arcTo_coincide_1() {
michael@0 11659
michael@0 11660 var canvas = document.getElementById('c359');
michael@0 11661 var ctx = canvas.getContext('2d');
michael@0 11662
michael@0 11663 ctx.fillStyle = '#f00';
michael@0 11664 ctx.fillRect(0, 0, 100, 50);
michael@0 11665 ctx.lineWidth = 50;
michael@0 11666
michael@0 11667 ctx.strokeStyle = '#0f0';
michael@0 11668 ctx.beginPath();
michael@0 11669 ctx.moveTo(0, 25);
michael@0 11670 ctx.arcTo(0, 25, 50, 1000, 1);
michael@0 11671 ctx.lineTo(100, 25);
michael@0 11672 ctx.stroke();
michael@0 11673
michael@0 11674 ctx.strokeStyle = '#f00';
michael@0 11675 ctx.beginPath();
michael@0 11676 ctx.moveTo(50, 25);
michael@0 11677 ctx.arcTo(50, 25, 100, 25, 1);
michael@0 11678 ctx.stroke();
michael@0 11679
michael@0 11680 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 11681 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11682 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 11683
michael@0 11684
michael@0 11685 }
michael@0 11686 </script>
michael@0 11687
michael@0 11688 <!-- [[[ test_2d.path.arcTo.coincide.2.html ]]] -->
michael@0 11689
michael@0 11690 <p>Canvas test: 2d.path.arcTo.coincide.2</p>
michael@0 11691 <!-- Testing: arcTo() draws a straight line to P1 if P1 = P2 -->
michael@0 11692 <canvas id="c360" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11693 <script>
michael@0 11694
michael@0 11695
michael@0 11696 function test_2d_path_arcTo_coincide_2() {
michael@0 11697
michael@0 11698 var canvas = document.getElementById('c360');
michael@0 11699 var ctx = canvas.getContext('2d');
michael@0 11700
michael@0 11701 ctx.fillStyle = '#f00';
michael@0 11702 ctx.fillRect(0, 0, 100, 50);
michael@0 11703 ctx.lineWidth = 50;
michael@0 11704 ctx.strokeStyle = '#0f0';
michael@0 11705 ctx.beginPath();
michael@0 11706 ctx.moveTo(0, 25);
michael@0 11707 ctx.arcTo(100, 25, 100, 25, 1);
michael@0 11708 ctx.stroke();
michael@0 11709
michael@0 11710 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11711
michael@0 11712
michael@0 11713 }
michael@0 11714 </script>
michael@0 11715
michael@0 11716 <!-- [[[ test_2d.path.arcTo.collinear.1.html ]]] -->
michael@0 11717
michael@0 11718 <p>Canvas test: 2d.path.arcTo.collinear.1</p>
michael@0 11719 <!-- Testing: arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1 -->
michael@0 11720 <canvas id="c361" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11721 <script>
michael@0 11722
michael@0 11723
michael@0 11724
michael@0 11725 function test_2d_path_arcTo_collinear_1() {
michael@0 11726
michael@0 11727 var canvas = document.getElementById('c361');
michael@0 11728 var ctx = canvas.getContext('2d');
michael@0 11729
michael@0 11730 ctx.fillStyle = '#f00';
michael@0 11731 ctx.fillRect(0, 0, 100, 50);
michael@0 11732 ctx.lineWidth = 50;
michael@0 11733
michael@0 11734 ctx.strokeStyle = '#0f0';
michael@0 11735 ctx.beginPath();
michael@0 11736 ctx.moveTo(0, 25);
michael@0 11737 ctx.arcTo(100, 25, 200, 25, 1);
michael@0 11738 ctx.stroke();
michael@0 11739
michael@0 11740 ctx.strokeStyle = '#f00';
michael@0 11741 ctx.beginPath();
michael@0 11742 ctx.moveTo(-100, 25);
michael@0 11743 ctx.arcTo(0, 25, 100, 25, 1);
michael@0 11744 ctx.stroke();
michael@0 11745
michael@0 11746 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11747
michael@0 11748
michael@0 11749 }
michael@0 11750 </script>
michael@0 11751
michael@0 11752 <!-- [[[ test_2d.path.arcTo.collinear.2.html ]]] -->
michael@0 11753
michael@0 11754 <p>Canvas test: 2d.path.arcTo.collinear.2</p>
michael@0 11755 <!-- Testing: arcTo() with all points on a line, and P2 between P0/P1, draws an infinite line along P1..P2 -->
michael@0 11756 <canvas id="c362" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11757 <script>
michael@0 11758
michael@0 11759
michael@0 11760
michael@0 11761 function test_2d_path_arcTo_collinear_2() {
michael@0 11762
michael@0 11763 var canvas = document.getElementById('c362');
michael@0 11764 var ctx = canvas.getContext('2d');
michael@0 11765
michael@0 11766 ctx.fillStyle = '#f00';
michael@0 11767 ctx.fillRect(0, 0, 100, 50);
michael@0 11768 ctx.lineWidth = 50;
michael@0 11769
michael@0 11770 ctx.strokeStyle = '#0f0';
michael@0 11771 ctx.beginPath();
michael@0 11772 ctx.moveTo(1000, 25);
michael@0 11773 ctx.arcTo(1100, 25, 1050, 25, 1);
michael@0 11774 ctx.stroke();
michael@0 11775
michael@0 11776 ctx.strokeStyle = '#f00';
michael@0 11777 ctx.beginPath();
michael@0 11778 ctx.moveTo(0, 25);
michael@0 11779 ctx.arcTo(100, 25, -50, 25, 1);
michael@0 11780 ctx.stroke();
michael@0 11781
michael@0 11782 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11783
michael@0 11784
michael@0 11785 }
michael@0 11786 </script>
michael@0 11787
michael@0 11788 <!-- [[[ test_2d.path.arcTo.collinear.3.html ]]] -->
michael@0 11789
michael@0 11790 <p>Canvas test: 2d.path.arcTo.collinear.3</p>
michael@0 11791 <!-- Testing: arcTo() with all points on a line, and P0 between P1/P2, draws an infinite line along P1..P2 -->
michael@0 11792 <canvas id="c363" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11793 <script>
michael@0 11794
michael@0 11795
michael@0 11796
michael@0 11797 function test_2d_path_arcTo_collinear_3() {
michael@0 11798
michael@0 11799 var canvas = document.getElementById('c363');
michael@0 11800 var ctx = canvas.getContext('2d');
michael@0 11801
michael@0 11802 ctx.fillStyle = '#f00';
michael@0 11803 ctx.fillRect(0, 0, 100, 50);
michael@0 11804 ctx.lineWidth = 50;
michael@0 11805
michael@0 11806 ctx.strokeStyle = '#0f0';
michael@0 11807 ctx.beginPath();
michael@0 11808 ctx.moveTo(150, 25);
michael@0 11809 ctx.arcTo(200, 25, 100, 25, 1);
michael@0 11810 ctx.stroke();
michael@0 11811
michael@0 11812 ctx.strokeStyle = '#f00';
michael@0 11813 ctx.beginPath();
michael@0 11814 ctx.moveTo(0, 25);
michael@0 11815 ctx.arcTo(100, 25, 50, 25, 1);
michael@0 11816 ctx.stroke();
michael@0 11817
michael@0 11818 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11819
michael@0 11820
michael@0 11821 }
michael@0 11822 </script>
michael@0 11823
michael@0 11824 <!-- [[[ test_2d.path.arcTo.emptysubpath.html ]]] -->
michael@0 11825
michael@0 11826 <p>Canvas test: 2d.path.arcTo.emptysubpath</p>
michael@0 11827 <!-- Testing: arcTo() does nothing if there are no subpaths -->
michael@0 11828 <canvas id="c364" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11829 <script>
michael@0 11830
michael@0 11831
michael@0 11832
michael@0 11833 function test_2d_path_arcTo_emptysubpath() {
michael@0 11834
michael@0 11835 var canvas = document.getElementById('c364');
michael@0 11836 var ctx = canvas.getContext('2d');
michael@0 11837
michael@0 11838 ctx.fillStyle = '#0f0';
michael@0 11839 ctx.fillRect(0, 0, 100, 50);
michael@0 11840 ctx.lineWidth = 50;
michael@0 11841 ctx.strokeStyle = '#f00';
michael@0 11842 ctx.beginPath();
michael@0 11843 ctx.arcTo(0, 25, 0, 25, 0.1);
michael@0 11844 ctx.arcTo(100, 25, 100, 25, 0.1);
michael@0 11845 ctx.stroke();
michael@0 11846 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11847
michael@0 11848
michael@0 11849 }
michael@0 11850 </script>
michael@0 11851
michael@0 11852 <!-- [[[ test_2d.path.arcTo.negative.html ]]] -->
michael@0 11853
michael@0 11854 <p>Canvas test: 2d.path.arcTo.negative</p>
michael@0 11855 <!-- Testing: arcTo() with negative radius throws an exception -->
michael@0 11856 <canvas id="c365" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11857 <script>
michael@0 11858
michael@0 11859 function test_2d_path_arcTo_negative() {
michael@0 11860
michael@0 11861 var canvas = document.getElementById('c365');
michael@0 11862 var ctx = canvas.getContext('2d');
michael@0 11863
michael@0 11864 var _thrown = undefined; try {
michael@0 11865 ctx.arcTo(0, 0, 0, 0, -1);
michael@0 11866 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
michael@0 11867
michael@0 11868
michael@0 11869 }
michael@0 11870 </script>
michael@0 11871
michael@0 11872 <!-- [[[ test_2d.path.arcTo.nonfinite.html ]]] -->
michael@0 11873
michael@0 11874 <p>Canvas test: 2d.path.arcTo.nonfinite</p>
michael@0 11875 <!-- Testing: arcTo() with Infinity/NaN is ignored -->
michael@0 11876 <canvas id="c366" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11877 <script>
michael@0 11878
michael@0 11879
michael@0 11880 function test_2d_path_arcTo_nonfinite() {
michael@0 11881
michael@0 11882 var canvas = document.getElementById('c366');
michael@0 11883 var ctx = canvas.getContext('2d');
michael@0 11884
michael@0 11885 var _thrown_outer = false;
michael@0 11886 try {
michael@0 11887
michael@0 11888 ctx.moveTo(0, 0);
michael@0 11889 ctx.lineTo(100, 0);
michael@0 11890 ctx.arcTo(Infinity, 50, 0, 50, 0);
michael@0 11891 ctx.arcTo(-Infinity, 50, 0, 50, 0);
michael@0 11892 ctx.arcTo(NaN, 50, 0, 50, 0);
michael@0 11893 ctx.arcTo(0, Infinity, 0, 50, 0);
michael@0 11894 ctx.arcTo(0, -Infinity, 0, 50, 0);
michael@0 11895 ctx.arcTo(0, NaN, 0, 50, 0);
michael@0 11896 ctx.arcTo(0, 50, Infinity, 50, 0);
michael@0 11897 ctx.arcTo(0, 50, -Infinity, 50, 0);
michael@0 11898 ctx.arcTo(0, 50, NaN, 50, 0);
michael@0 11899 ctx.arcTo(0, 50, 0, Infinity, 0);
michael@0 11900 ctx.arcTo(0, 50, 0, -Infinity, 0);
michael@0 11901 ctx.arcTo(0, 50, 0, NaN, 0);
michael@0 11902 ctx.arcTo(0, 50, 0, 50, Infinity);
michael@0 11903 ctx.arcTo(0, 50, 0, 50, -Infinity);
michael@0 11904 ctx.arcTo(0, 50, 0, 50, NaN);
michael@0 11905 ctx.arcTo(Infinity, Infinity, 0, 50, 0);
michael@0 11906 ctx.arcTo(Infinity, Infinity, Infinity, 50, 0);
michael@0 11907 ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0);
michael@0 11908 ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 11909 ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity);
michael@0 11910 ctx.arcTo(Infinity, Infinity, 0, Infinity, 0);
michael@0 11911 ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity);
michael@0 11912 ctx.arcTo(Infinity, Infinity, 0, 50, Infinity);
michael@0 11913 ctx.arcTo(Infinity, 50, Infinity, 50, 0);
michael@0 11914 ctx.arcTo(Infinity, 50, Infinity, Infinity, 0);
michael@0 11915 ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity);
michael@0 11916 ctx.arcTo(Infinity, 50, Infinity, 50, Infinity);
michael@0 11917 ctx.arcTo(Infinity, 50, 0, Infinity, 0);
michael@0 11918 ctx.arcTo(Infinity, 50, 0, Infinity, Infinity);
michael@0 11919 ctx.arcTo(Infinity, 50, 0, 50, Infinity);
michael@0 11920 ctx.arcTo(0, Infinity, Infinity, 50, 0);
michael@0 11921 ctx.arcTo(0, Infinity, Infinity, Infinity, 0);
michael@0 11922 ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity);
michael@0 11923 ctx.arcTo(0, Infinity, Infinity, 50, Infinity);
michael@0 11924 ctx.arcTo(0, Infinity, 0, Infinity, 0);
michael@0 11925 ctx.arcTo(0, Infinity, 0, Infinity, Infinity);
michael@0 11926 ctx.arcTo(0, Infinity, 0, 50, Infinity);
michael@0 11927 ctx.arcTo(0, 50, Infinity, Infinity, 0);
michael@0 11928 ctx.arcTo(0, 50, Infinity, Infinity, Infinity);
michael@0 11929 ctx.arcTo(0, 50, Infinity, 50, Infinity);
michael@0 11930 ctx.arcTo(0, 50, 0, Infinity, Infinity);
michael@0 11931 ctx.lineTo(100, 50);
michael@0 11932 ctx.lineTo(0, 50);
michael@0 11933 ctx.fillStyle = '#0f0';
michael@0 11934 ctx.fill();
michael@0 11935 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11936 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 11937
michael@0 11938 } catch (e) {
michael@0 11939 _thrown_outer = true;
michael@0 11940 }
michael@0 11941 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 11942
michael@0 11943
michael@0 11944 }
michael@0 11945 </script>
michael@0 11946
michael@0 11947 <!-- [[[ test_2d.path.arcTo.scale.html ]]] -->
michael@0 11948
michael@0 11949 <p>Canvas test: 2d.path.arcTo.scale</p>
michael@0 11950 <!-- Testing: arcTo scales the curve, not just the control points -->
michael@0 11951 <canvas id="c367" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11952 <script>
michael@0 11953
michael@0 11954
michael@0 11955 function test_2d_path_arcTo_scale() {
michael@0 11956
michael@0 11957 var canvas = document.getElementById('c367');
michael@0 11958 var ctx = canvas.getContext('2d');
michael@0 11959
michael@0 11960 ctx.fillStyle = '#f00';
michael@0 11961 ctx.fillRect(0, 0, 100, 50);
michael@0 11962
michael@0 11963 ctx.fillStyle = '#0f0';
michael@0 11964 ctx.beginPath();
michael@0 11965 ctx.moveTo(0, 50);
michael@0 11966 ctx.translate(100, 0);
michael@0 11967 ctx.scale(0.1, 1);
michael@0 11968 ctx.arcTo(50, 50, 50, 0, 50);
michael@0 11969 ctx.lineTo(-1000, 0);
michael@0 11970 ctx.fill();
michael@0 11971
michael@0 11972 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 11973 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 11974 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 11975 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 11976 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 11977 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 11978 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 11979 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 11980 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 11981
michael@0 11982
michael@0 11983 }
michael@0 11984 </script>
michael@0 11985
michael@0 11986 <!-- [[[ test_2d.path.arcTo.shape.curve1.html ]]] -->
michael@0 11987
michael@0 11988 <p>Canvas test: 2d.path.arcTo.shape.curve1</p>
michael@0 11989 <!-- Testing: arcTo() curves in the right kind of shape -->
michael@0 11990 <canvas id="c368" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 11991 <script>
michael@0 11992
michael@0 11993
michael@0 11994
michael@0 11995 function test_2d_path_arcTo_shape_curve1() {
michael@0 11996
michael@0 11997 var canvas = document.getElementById('c368');
michael@0 11998 var ctx = canvas.getContext('2d');
michael@0 11999
michael@0 12000 var tol = 1.5; // tolerance to avoid antialiasing artifacts
michael@0 12001
michael@0 12002 ctx.fillStyle = '#0f0';
michael@0 12003 ctx.fillRect(0, 0, 100, 50);
michael@0 12004
michael@0 12005 ctx.strokeStyle = '#f00';
michael@0 12006 ctx.lineWidth = 10;
michael@0 12007 ctx.beginPath();
michael@0 12008 ctx.moveTo(10, 25);
michael@0 12009 ctx.arcTo(75, 25, 75, 60, 20);
michael@0 12010 ctx.stroke();
michael@0 12011
michael@0 12012 ctx.fillStyle = '#0f0';
michael@0 12013 ctx.beginPath();
michael@0 12014 ctx.rect(10, 20, 45, 10);
michael@0 12015 ctx.moveTo(80, 45);
michael@0 12016 ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true);
michael@0 12017 ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false);
michael@0 12018 ctx.fill();
michael@0 12019
michael@0 12020 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12021 isPixel(ctx, 55,19, 0,255,0,255, 0);
michael@0 12022 isPixel(ctx, 55,20, 0,255,0,255, 0);
michael@0 12023 isPixel(ctx, 55,21, 0,255,0,255, 0);
michael@0 12024 isPixel(ctx, 64,22, 0,255,0,255, 0);
michael@0 12025 isPixel(ctx, 65,21, 0,255,0,255, 0);
michael@0 12026 isPixel(ctx, 72,28, 0,255,0,255, 0);
michael@0 12027 isPixel(ctx, 73,27, 0,255,0,255, 0);
michael@0 12028 isPixel(ctx, 78,36, 0,255,0,255, 0);
michael@0 12029 isPixel(ctx, 79,35, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 12030 isPixel(ctx, 80,44, 0,255,0,255, 0);
michael@0 12031 isPixel(ctx, 80,45, 0,255,0,255, 0);
michael@0 12032 isPixel(ctx, 80,46, 0,255,0,255, 0);
michael@0 12033
michael@0 12034
michael@0 12035 }
michael@0 12036 </script>
michael@0 12037
michael@0 12038 <!-- [[[ test_2d.path.arcTo.shape.curve2.html ]]] -->
michael@0 12039
michael@0 12040 <p>Canvas test: 2d.path.arcTo.shape.curve2</p>
michael@0 12041 <!-- Testing: arcTo() curves in the right kind of shape -->
michael@0 12042 <canvas id="c369" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12043 <script>
michael@0 12044
michael@0 12045
michael@0 12046
michael@0 12047 function test_2d_path_arcTo_shape_curve2() {
michael@0 12048
michael@0 12049 var canvas = document.getElementById('c369');
michael@0 12050 var ctx = canvas.getContext('2d');
michael@0 12051
michael@0 12052 var tol = 1.5; // tolerance to avoid antialiasing artifacts
michael@0 12053
michael@0 12054 ctx.fillStyle = '#0f0';
michael@0 12055 ctx.fillRect(0, 0, 100, 50);
michael@0 12056
michael@0 12057 ctx.fillStyle = '#f00';
michael@0 12058 ctx.beginPath();
michael@0 12059 ctx.rect(10, 20, 45, 10);
michael@0 12060 ctx.moveTo(80, 45);
michael@0 12061 ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true);
michael@0 12062 ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false);
michael@0 12063 ctx.fill();
michael@0 12064
michael@0 12065 ctx.strokeStyle = '#0f0';
michael@0 12066 ctx.lineWidth = 10;
michael@0 12067 ctx.beginPath();
michael@0 12068 ctx.moveTo(10, 25);
michael@0 12069 ctx.arcTo(75, 25, 75, 60, 20);
michael@0 12070 ctx.stroke();
michael@0 12071
michael@0 12072 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12073 isPixel(ctx, 55,19, 0,255,0,255, 0);
michael@0 12074 isPixel(ctx, 55,20, 0,255,0,255, 0);
michael@0 12075 isPixel(ctx, 55,21, 0,255,0,255, 0);
michael@0 12076 isPixel(ctx, 64,22, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 12077 isPixel(ctx, 65,21, 0,255,0,255, 0);
michael@0 12078 isPixel(ctx, 72,28, 0,255,0,255, 0);
michael@0 12079 isPixel(ctx, 73,27, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 12080 isPixel(ctx, 78,36, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 12081 isPixel(ctx, 79,35, 0,255,0,255, 0);
michael@0 12082 isPixel(ctx, 80,44, 0,255,0,255, 0);
michael@0 12083 isPixel(ctx, 80,45, 0,255,0,255, 0);
michael@0 12084 isPixel(ctx, 80,46, 0,255,0,255, 0);
michael@0 12085
michael@0 12086
michael@0 12087 }
michael@0 12088 </script>
michael@0 12089
michael@0 12090 <!-- [[[ test_2d.path.arcTo.shape.end.html ]]] -->
michael@0 12091
michael@0 12092 <p>Canvas test: 2d.path.arcTo.shape.end</p>
michael@0 12093 <!-- Testing: arcTo() does not draw anything from P1 to P2 -->
michael@0 12094 <canvas id="c370" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12095 <script>
michael@0 12096
michael@0 12097
michael@0 12098
michael@0 12099 function test_2d_path_arcTo_shape_end() {
michael@0 12100
michael@0 12101 var canvas = document.getElementById('c370');
michael@0 12102 var ctx = canvas.getContext('2d');
michael@0 12103
michael@0 12104 ctx.fillStyle = '#0f0';
michael@0 12105 ctx.fillRect(0, 0, 100, 50);
michael@0 12106 ctx.strokeStyle = '#f00';
michael@0 12107 ctx.lineWidth = 50;
michael@0 12108 ctx.beginPath();
michael@0 12109 ctx.moveTo(-100, -100);
michael@0 12110 ctx.arcTo(-100, 25, 200, 25, 10);
michael@0 12111 ctx.stroke();
michael@0 12112
michael@0 12113 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 12114 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 12115 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12116 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 12117 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 12118
michael@0 12119
michael@0 12120 }
michael@0 12121 </script>
michael@0 12122
michael@0 12123 <!-- [[[ test_2d.path.arcTo.shape.start.html ]]] -->
michael@0 12124
michael@0 12125 <p>Canvas test: 2d.path.arcTo.shape.start</p>
michael@0 12126 <!-- Testing: arcTo() draws a straight line from P0 to P1 -->
michael@0 12127 <canvas id="c371" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12128 <script>
michael@0 12129
michael@0 12130
michael@0 12131
michael@0 12132 function test_2d_path_arcTo_shape_start() {
michael@0 12133
michael@0 12134 var canvas = document.getElementById('c371');
michael@0 12135 var ctx = canvas.getContext('2d');
michael@0 12136
michael@0 12137 ctx.fillStyle = '#f00';
michael@0 12138 ctx.fillRect(0, 0, 100, 50);
michael@0 12139 ctx.strokeStyle = '#0f0';
michael@0 12140 ctx.lineWidth = 50;
michael@0 12141 ctx.beginPath();
michael@0 12142 ctx.moveTo(0, 25);
michael@0 12143 ctx.arcTo(200, 25, 200, 50, 10);
michael@0 12144 ctx.stroke();
michael@0 12145
michael@0 12146 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 12147 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 12148 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12149 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 12150 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 12151
michael@0 12152
michael@0 12153 }
michael@0 12154 </script>
michael@0 12155
michael@0 12156 <!-- [[[ test_2d.path.arcTo.transformation.html ]]] -->
michael@0 12157
michael@0 12158 <p>Canvas test: 2d.path.arcTo.transformation</p>
michael@0 12159 <!-- Testing: arcTo joins up to the last subpath point correctly -->
michael@0 12160 <canvas id="c372" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12161 <script>
michael@0 12162
michael@0 12163
michael@0 12164 function test_2d_path_arcTo_transformation() {
michael@0 12165
michael@0 12166 var canvas = document.getElementById('c372');
michael@0 12167 var ctx = canvas.getContext('2d');
michael@0 12168
michael@0 12169 ctx.fillStyle = '#f00';
michael@0 12170 ctx.fillRect(0, 0, 100, 50);
michael@0 12171
michael@0 12172 ctx.fillStyle = '#0f0';
michael@0 12173 ctx.beginPath();
michael@0 12174 ctx.moveTo(0, 50);
michael@0 12175 ctx.translate(100, 0);
michael@0 12176 ctx.arcTo(50, 50, 50, 0, 50);
michael@0 12177 ctx.lineTo(-100, 0);
michael@0 12178 ctx.fill();
michael@0 12179
michael@0 12180 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 12181 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 12182 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 12183 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 12184 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12185 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 12186 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 12187 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 12188 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 12189
michael@0 12190
michael@0 12191 }
michael@0 12192 </script>
michael@0 12193
michael@0 12194 <!-- [[[ test_2d.path.arcTo.zero.1.html ]]] -->
michael@0 12195
michael@0 12196 <p>Canvas test: 2d.path.arcTo.zero.1</p>
michael@0 12197 <!-- Testing: arcTo() with zero radius draws a straight line from P0 to P1 -->
michael@0 12198 <canvas id="c373" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12199 <script>
michael@0 12200
michael@0 12201
michael@0 12202 function test_2d_path_arcTo_zero_1() {
michael@0 12203
michael@0 12204 var canvas = document.getElementById('c373');
michael@0 12205 var ctx = canvas.getContext('2d');
michael@0 12206
michael@0 12207 var _thrown_outer = false;
michael@0 12208 try {
michael@0 12209
michael@0 12210 ctx.fillStyle = '#f00';
michael@0 12211 ctx.fillRect(0, 0, 100, 50);
michael@0 12212 ctx.lineWidth = 50;
michael@0 12213
michael@0 12214 ctx.strokeStyle = '#0f0';
michael@0 12215 ctx.beginPath();
michael@0 12216 ctx.moveTo(0, 25);
michael@0 12217 ctx.arcTo(100, 25, 100, 100, 0);
michael@0 12218 ctx.stroke();
michael@0 12219
michael@0 12220 ctx.strokeStyle = '#f00';
michael@0 12221 ctx.beginPath();
michael@0 12222 ctx.moveTo(0, -25);
michael@0 12223 ctx.arcTo(50, -25, 50, 50, 0);
michael@0 12224 ctx.stroke();
michael@0 12225
michael@0 12226 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12227
michael@0 12228 } catch (e) {
michael@0 12229 _thrown_outer = true;
michael@0 12230 }
michael@0 12231 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 12232
michael@0 12233
michael@0 12234 }
michael@0 12235 </script>
michael@0 12236
michael@0 12237 <!-- [[[ test_2d.path.arcTo.zero.2.html ]]] -->
michael@0 12238
michael@0 12239 <p>Canvas test: 2d.path.arcTo.zero.2</p>
michael@0 12240 <!-- Testing: arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear -->
michael@0 12241 <canvas id="c374" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12242 <script>
michael@0 12243
michael@0 12244
michael@0 12245 function test_2d_path_arcTo_zero_2() {
michael@0 12246
michael@0 12247 var canvas = document.getElementById('c374');
michael@0 12248 var ctx = canvas.getContext('2d');
michael@0 12249
michael@0 12250 var _thrown_outer = false;
michael@0 12251 try {
michael@0 12252
michael@0 12253 ctx.fillStyle = '#f00';
michael@0 12254 ctx.fillRect(0, 0, 100, 50);
michael@0 12255 ctx.lineWidth = 50;
michael@0 12256
michael@0 12257 ctx.strokeStyle = '#0f0';
michael@0 12258 ctx.beginPath();
michael@0 12259 ctx.moveTo(0, 25);
michael@0 12260 ctx.arcTo(100, 25, -100, 25, 0);
michael@0 12261 ctx.stroke();
michael@0 12262
michael@0 12263 ctx.strokeStyle = '#f00';
michael@0 12264 ctx.beginPath();
michael@0 12265 ctx.moveTo(100, 25);
michael@0 12266 ctx.arcTo(200, 25, 50, 25, 0);
michael@0 12267 ctx.stroke();
michael@0 12268
michael@0 12269 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12270
michael@0 12271 } catch (e) {
michael@0 12272 _thrown_outer = true;
michael@0 12273 }
michael@0 12274 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 12275
michael@0 12276
michael@0 12277 }
michael@0 12278 </script>
michael@0 12279
michael@0 12280 <!-- [[[ test_2d.path.beginPath.html ]]] -->
michael@0 12281
michael@0 12282 <p>Canvas test: 2d.path.beginPath</p>
michael@0 12283 <canvas id="c375" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12284 <script>
michael@0 12285
michael@0 12286
michael@0 12287 function test_2d_path_beginPath() {
michael@0 12288
michael@0 12289 var canvas = document.getElementById('c375');
michael@0 12290 var ctx = canvas.getContext('2d');
michael@0 12291
michael@0 12292 ctx.rect(0, 0, 100, 50);
michael@0 12293 ctx.beginPath();
michael@0 12294 ctx.fillStyle = '#f00';
michael@0 12295 ctx.fill();
michael@0 12296 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 12297
michael@0 12298
michael@0 12299 }
michael@0 12300 </script>
michael@0 12301
michael@0 12302 <!-- [[[ test_2d.path.bezierCurveTo.basic.html ]]] -->
michael@0 12303
michael@0 12304 <p>Canvas test: 2d.path.bezierCurveTo.basic</p>
michael@0 12305 <canvas id="c376" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12306 <script>
michael@0 12307
michael@0 12308
michael@0 12309 function test_2d_path_bezierCurveTo_basic() {
michael@0 12310
michael@0 12311 var canvas = document.getElementById('c376');
michael@0 12312 var ctx = canvas.getContext('2d');
michael@0 12313
michael@0 12314 ctx.strokeStyle = '#0f0';
michael@0 12315 ctx.lineWidth = 50;
michael@0 12316 ctx.beginPath();
michael@0 12317 ctx.moveTo(0, 25);
michael@0 12318 ctx.bezierCurveTo(100, 25, 100, 25, 100, 25);
michael@0 12319 ctx.stroke();
michael@0 12320 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12321
michael@0 12322
michael@0 12323 }
michael@0 12324 </script>
michael@0 12325
michael@0 12326 <!-- [[[ test_2d.path.bezierCurveTo.emptysubpath.html ]]] -->
michael@0 12327
michael@0 12328 <p>Canvas test: 2d.path.bezierCurveTo.emptysubpath</p>
michael@0 12329 <canvas id="c377" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12330 <script>
michael@0 12331
michael@0 12332
michael@0 12333
michael@0 12334 function test_2d_path_bezierCurveTo_emptysubpath() {
michael@0 12335
michael@0 12336 var canvas = document.getElementById('c377');
michael@0 12337 var ctx = canvas.getContext('2d');
michael@0 12338
michael@0 12339 ctx.strokeStyle = '#f00';
michael@0 12340 ctx.lineWidth = 50;
michael@0 12341 ctx.beginPath();
michael@0 12342 ctx.bezierCurveTo(0, 25, 0, 25, 0, 25);
michael@0 12343 ctx.bezierCurveTo(100, 25, 100, 25, 100, 25);
michael@0 12344 ctx.stroke();
michael@0 12345 todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 12346
michael@0 12347
michael@0 12348 }
michael@0 12349 </script>
michael@0 12350
michael@0 12351 <!-- [[[ test_2d.path.bezierCurveTo.nonfinite.html ]]] -->
michael@0 12352
michael@0 12353 <p>Canvas test: 2d.path.bezierCurveTo.nonfinite</p>
michael@0 12354 <!-- Testing: bezierCurveTo() with Infinity/NaN is ignored -->
michael@0 12355 <canvas id="c378" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12356 <script>
michael@0 12357
michael@0 12358
michael@0 12359 function test_2d_path_bezierCurveTo_nonfinite() {
michael@0 12360
michael@0 12361 var canvas = document.getElementById('c378');
michael@0 12362 var ctx = canvas.getContext('2d');
michael@0 12363
michael@0 12364 var _thrown_outer = false;
michael@0 12365 try {
michael@0 12366
michael@0 12367 ctx.moveTo(0, 0);
michael@0 12368 ctx.lineTo(100, 0);
michael@0 12369 ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50);
michael@0 12370 ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50);
michael@0 12371 ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50);
michael@0 12372 ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50);
michael@0 12373 ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50);
michael@0 12374 ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50);
michael@0 12375 ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50);
michael@0 12376 ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50);
michael@0 12377 ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50);
michael@0 12378 ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50);
michael@0 12379 ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50);
michael@0 12380 ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50);
michael@0 12381 ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50);
michael@0 12382 ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50);
michael@0 12383 ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50);
michael@0 12384 ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity);
michael@0 12385 ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity);
michael@0 12386 ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN);
michael@0 12387 ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50);
michael@0 12388 ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50);
michael@0 12389 ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50);
michael@0 12390 ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 12391 ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 12392 ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 12393 ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50);
michael@0 12394 ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity);
michael@0 12395 ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity);
michael@0 12396 ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50);
michael@0 12397 ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50);
michael@0 12398 ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 12399 ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity);
michael@0 12400 ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50);
michael@0 12401 ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity);
michael@0 12402 ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity);
michael@0 12403 ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50);
michael@0 12404 ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50);
michael@0 12405 ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50);
michael@0 12406 ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 12407 ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity);
michael@0 12408 ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50);
michael@0 12409 ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity);
michael@0 12410 ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity);
michael@0 12411 ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50);
michael@0 12412 ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50);
michael@0 12413 ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity);
michael@0 12414 ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity);
michael@0 12415 ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50);
michael@0 12416 ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity);
michael@0 12417 ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity);
michael@0 12418 ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50);
michael@0 12419 ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50);
michael@0 12420 ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50);
michael@0 12421 ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 12422 ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 12423 ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50);
michael@0 12424 ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity);
michael@0 12425 ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity);
michael@0 12426 ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50);
michael@0 12427 ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50);
michael@0 12428 ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 12429 ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity);
michael@0 12430 ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50);
michael@0 12431 ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity);
michael@0 12432 ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity);
michael@0 12433 ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50);
michael@0 12434 ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50);
michael@0 12435 ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity);
michael@0 12436 ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity);
michael@0 12437 ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50);
michael@0 12438 ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity);
michael@0 12439 ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity);
michael@0 12440 ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50);
michael@0 12441 ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity);
michael@0 12442 ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity);
michael@0 12443 ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity);
michael@0 12444 ctx.lineTo(100, 50);
michael@0 12445 ctx.lineTo(0, 50);
michael@0 12446 ctx.fillStyle = '#0f0';
michael@0 12447 ctx.fill();
michael@0 12448 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12449 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 12450
michael@0 12451 } catch (e) {
michael@0 12452 _thrown_outer = true;
michael@0 12453 }
michael@0 12454 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 12455
michael@0 12456
michael@0 12457 }
michael@0 12458 </script>
michael@0 12459
michael@0 12460 <!-- [[[ test_2d.path.bezierCurveTo.scaled.html ]]] -->
michael@0 12461
michael@0 12462 <p>Canvas test: 2d.path.bezierCurveTo.scaled</p>
michael@0 12463 <canvas id="c379" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12464 <script>
michael@0 12465
michael@0 12466
michael@0 12467 function test_2d_path_bezierCurveTo_scaled() {
michael@0 12468
michael@0 12469 var canvas = document.getElementById('c379');
michael@0 12470 var ctx = canvas.getContext('2d');
michael@0 12471
michael@0 12472 ctx.scale(1000, 1000);
michael@0 12473 ctx.strokeStyle = '#0f0';
michael@0 12474 ctx.lineWidth = 0.055;
michael@0 12475 ctx.beginPath();
michael@0 12476 ctx.moveTo(-2, 3.1);
michael@0 12477 ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1);
michael@0 12478 ctx.stroke();
michael@0 12479 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12480 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 12481 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 12482 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 12483 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 12484
michael@0 12485
michael@0 12486 }
michael@0 12487 </script>
michael@0 12488
michael@0 12489 <!-- [[[ test_2d.path.bezierCurveTo.shape.html ]]] -->
michael@0 12490
michael@0 12491 <p>Canvas test: 2d.path.bezierCurveTo.shape</p>
michael@0 12492 <canvas id="c380" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12493 <script>
michael@0 12494
michael@0 12495
michael@0 12496 function test_2d_path_bezierCurveTo_shape() {
michael@0 12497
michael@0 12498 var canvas = document.getElementById('c380');
michael@0 12499 var ctx = canvas.getContext('2d');
michael@0 12500
michael@0 12501 ctx.strokeStyle = '#0f0';
michael@0 12502 ctx.lineWidth = 55;
michael@0 12503 ctx.beginPath();
michael@0 12504 ctx.moveTo(-2000, 3100);
michael@0 12505 ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100);
michael@0 12506 ctx.stroke();
michael@0 12507 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12508 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 12509 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 12510 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 12511 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 12512
michael@0 12513
michael@0 12514 }
michael@0 12515 </script>
michael@0 12516
michael@0 12517 <!-- [[[ test_2d.path.clip.basic.1.html ]]] -->
michael@0 12518
michael@0 12519 <p>Canvas test: 2d.path.clip.basic.1</p>
michael@0 12520 <canvas id="c381" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12521 <script>
michael@0 12522
michael@0 12523
michael@0 12524 function test_2d_path_clip_basic_1() {
michael@0 12525
michael@0 12526 var canvas = document.getElementById('c381');
michael@0 12527 var ctx = canvas.getContext('2d');
michael@0 12528
michael@0 12529 ctx.fillStyle = '#f00';
michael@0 12530 ctx.fillRect(0, 0, 100, 50);
michael@0 12531
michael@0 12532 ctx.beginPath();
michael@0 12533 ctx.rect(0, 0, 100, 50);
michael@0 12534 ctx.clip();
michael@0 12535
michael@0 12536 ctx.fillStyle = '#0f0';
michael@0 12537 ctx.fillRect(0, 0, 100, 50);
michael@0 12538
michael@0 12539 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12540
michael@0 12541
michael@0 12542 }
michael@0 12543 </script>
michael@0 12544
michael@0 12545 <!-- [[[ test_2d.path.clip.basic.2.html ]]] -->
michael@0 12546
michael@0 12547 <p>Canvas test: 2d.path.clip.basic.2</p>
michael@0 12548 <canvas id="c382" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12549 <script>
michael@0 12550
michael@0 12551
michael@0 12552 function test_2d_path_clip_basic_2() {
michael@0 12553
michael@0 12554 var canvas = document.getElementById('c382');
michael@0 12555 var ctx = canvas.getContext('2d');
michael@0 12556
michael@0 12557 ctx.fillStyle = '#0f0';
michael@0 12558 ctx.fillRect(0, 0, 100, 50);
michael@0 12559
michael@0 12560 ctx.beginPath();
michael@0 12561 ctx.rect(-100, 0, 100, 50);
michael@0 12562 ctx.clip();
michael@0 12563
michael@0 12564 ctx.fillStyle = '#f00';
michael@0 12565 ctx.fillRect(0, 0, 100, 50);
michael@0 12566
michael@0 12567 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12568
michael@0 12569
michael@0 12570 }
michael@0 12571 </script>
michael@0 12572
michael@0 12573 <!-- [[[ test_2d.path.clip.empty.html ]]] -->
michael@0 12574
michael@0 12575 <p>Canvas test: 2d.path.clip.empty</p>
michael@0 12576 <canvas id="c383" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12577 <script>
michael@0 12578
michael@0 12579
michael@0 12580 function test_2d_path_clip_empty() {
michael@0 12581
michael@0 12582 var canvas = document.getElementById('c383');
michael@0 12583 var ctx = canvas.getContext('2d');
michael@0 12584
michael@0 12585 ctx.fillStyle = '#0f0';
michael@0 12586 ctx.fillRect(0, 0, 100, 50);
michael@0 12587
michael@0 12588 ctx.beginPath();
michael@0 12589 ctx.clip();
michael@0 12590
michael@0 12591 ctx.fillStyle = '#f00';
michael@0 12592 ctx.fillRect(0, 0, 100, 50);
michael@0 12593
michael@0 12594 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12595
michael@0 12596
michael@0 12597 }
michael@0 12598 </script>
michael@0 12599
michael@0 12600 <!-- [[[ test_2d.path.clip.intersect.html ]]] -->
michael@0 12601
michael@0 12602 <p>Canvas test: 2d.path.clip.intersect</p>
michael@0 12603 <canvas id="c384" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12604 <script>
michael@0 12605
michael@0 12606
michael@0 12607 function test_2d_path_clip_intersect() {
michael@0 12608
michael@0 12609 var canvas = document.getElementById('c384');
michael@0 12610 var ctx = canvas.getContext('2d');
michael@0 12611
michael@0 12612 ctx.fillStyle = '#0f0';
michael@0 12613 ctx.fillRect(0, 0, 100, 50);
michael@0 12614
michael@0 12615 ctx.beginPath();
michael@0 12616 ctx.rect(0, 0, 50, 50);
michael@0 12617 ctx.clip();
michael@0 12618 ctx.beginPath();
michael@0 12619 ctx.rect(50, 0, 50, 50)
michael@0 12620 ctx.clip();
michael@0 12621
michael@0 12622 ctx.fillStyle = '#f00';
michael@0 12623 ctx.fillRect(0, 0, 100, 50);
michael@0 12624
michael@0 12625 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12626
michael@0 12627
michael@0 12628 }
michael@0 12629 </script>
michael@0 12630
michael@0 12631 <!-- [[[ test_2d.path.clip.unaffected.html ]]] -->
michael@0 12632
michael@0 12633 <p>Canvas test: 2d.path.clip.unaffected</p>
michael@0 12634 <canvas id="c385" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12635 <script>
michael@0 12636
michael@0 12637
michael@0 12638 function test_2d_path_clip_unaffected() {
michael@0 12639
michael@0 12640 var canvas = document.getElementById('c385');
michael@0 12641 var ctx = canvas.getContext('2d');
michael@0 12642
michael@0 12643 ctx.fillStyle = '#f00';
michael@0 12644 ctx.fillRect(0, 0, 100, 50);
michael@0 12645
michael@0 12646 ctx.fillStyle = '#0f0';
michael@0 12647
michael@0 12648 ctx.beginPath();
michael@0 12649 ctx.lineTo(0, 0);
michael@0 12650 ctx.lineTo(0, 50);
michael@0 12651 ctx.lineTo(100, 50);
michael@0 12652 ctx.lineTo(100, 0);
michael@0 12653 ctx.clip();
michael@0 12654
michael@0 12655 ctx.lineTo(0, 0);
michael@0 12656 ctx.fill();
michael@0 12657
michael@0 12658 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12659
michael@0 12660
michael@0 12661 }
michael@0 12662 </script>
michael@0 12663
michael@0 12664 <!-- [[[ test_2d.path.clip.winding.1.html ]]] -->
michael@0 12665
michael@0 12666 <p>Canvas test: 2d.path.clip.winding.1</p>
michael@0 12667 <canvas id="c386" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12668 <script>
michael@0 12669
michael@0 12670
michael@0 12671 function test_2d_path_clip_winding_1() {
michael@0 12672
michael@0 12673 var canvas = document.getElementById('c386');
michael@0 12674 var ctx = canvas.getContext('2d');
michael@0 12675
michael@0 12676 ctx.fillStyle = '#0f0';
michael@0 12677 ctx.fillRect(0, 0, 100, 50);
michael@0 12678
michael@0 12679 ctx.beginPath();
michael@0 12680 ctx.moveTo(-10, -10);
michael@0 12681 ctx.lineTo(110, -10);
michael@0 12682 ctx.lineTo(110, 60);
michael@0 12683 ctx.lineTo(-10, 60);
michael@0 12684 ctx.lineTo(-10, -10);
michael@0 12685 ctx.lineTo(0, 0);
michael@0 12686 ctx.lineTo(0, 50);
michael@0 12687 ctx.lineTo(100, 50);
michael@0 12688 ctx.lineTo(100, 0);
michael@0 12689 ctx.clip();
michael@0 12690
michael@0 12691 ctx.fillStyle = '#f00';
michael@0 12692 ctx.fillRect(0, 0, 100, 50);
michael@0 12693
michael@0 12694 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12695
michael@0 12696
michael@0 12697 }
michael@0 12698 </script>
michael@0 12699
michael@0 12700 <!-- [[[ test_2d.path.clip.winding.2.html ]]] -->
michael@0 12701
michael@0 12702 <p>Canvas test: 2d.path.clip.winding.2</p>
michael@0 12703 <canvas id="c387" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12704 <script>
michael@0 12705
michael@0 12706
michael@0 12707 function test_2d_path_clip_winding_2() {
michael@0 12708
michael@0 12709 var canvas = document.getElementById('c387');
michael@0 12710 var ctx = canvas.getContext('2d');
michael@0 12711
michael@0 12712 ctx.fillStyle = '#f00';
michael@0 12713 ctx.fillRect(0, 0, 100, 50);
michael@0 12714
michael@0 12715 ctx.beginPath();
michael@0 12716 ctx.moveTo(-10, -10);
michael@0 12717 ctx.lineTo(110, -10);
michael@0 12718 ctx.lineTo(110, 60);
michael@0 12719 ctx.lineTo(-10, 60);
michael@0 12720 ctx.lineTo(-10, -10);
michael@0 12721 ctx.clip();
michael@0 12722
michael@0 12723 ctx.beginPath();
michael@0 12724 ctx.lineTo(0, 0);
michael@0 12725 ctx.lineTo(0, 50);
michael@0 12726 ctx.lineTo(100, 50);
michael@0 12727 ctx.lineTo(100, 0);
michael@0 12728 ctx.lineTo(0, 0);
michael@0 12729 ctx.clip();
michael@0 12730
michael@0 12731 ctx.fillStyle = '#0f0';
michael@0 12732 ctx.fillRect(0, 0, 100, 50);
michael@0 12733
michael@0 12734 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12735
michael@0 12736
michael@0 12737 }
michael@0 12738 </script>
michael@0 12739
michael@0 12740 <!-- [[[ test_2d.path.closePath.empty.html ]]] -->
michael@0 12741
michael@0 12742 <p>Canvas test: 2d.path.closePath.empty</p>
michael@0 12743 <canvas id="c388" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12744 <script>
michael@0 12745
michael@0 12746
michael@0 12747 function test_2d_path_closePath_empty() {
michael@0 12748
michael@0 12749 var canvas = document.getElementById('c388');
michael@0 12750 var ctx = canvas.getContext('2d');
michael@0 12751
michael@0 12752 ctx.closePath();
michael@0 12753 ctx.fillStyle = '#f00';
michael@0 12754 ctx.fill();
michael@0 12755 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 12756
michael@0 12757
michael@0 12758 }
michael@0 12759 </script>
michael@0 12760
michael@0 12761 <!-- [[[ test_2d.path.closePath.newline.html ]]] -->
michael@0 12762
michael@0 12763 <p>Canvas test: 2d.path.closePath.newline</p>
michael@0 12764 <canvas id="c389" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12765 <script>
michael@0 12766
michael@0 12767
michael@0 12768 function test_2d_path_closePath_newline() {
michael@0 12769
michael@0 12770 var canvas = document.getElementById('c389');
michael@0 12771 var ctx = canvas.getContext('2d');
michael@0 12772
michael@0 12773 ctx.strokeStyle = '#0f0';
michael@0 12774 ctx.lineWidth = 50;
michael@0 12775 ctx.moveTo(-100, 25);
michael@0 12776 ctx.lineTo(-100, -100);
michael@0 12777 ctx.lineTo(200, -100);
michael@0 12778 ctx.lineTo(200, 25);
michael@0 12779 ctx.closePath();
michael@0 12780 ctx.stroke();
michael@0 12781 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12782
michael@0 12783
michael@0 12784 }
michael@0 12785 </script>
michael@0 12786
michael@0 12787 <!-- [[[ test_2d.path.closePath.nextpoint.html ]]] -->
michael@0 12788
michael@0 12789 <p>Canvas test: 2d.path.closePath.nextpoint</p>
michael@0 12790 <canvas id="c390" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12791 <script>
michael@0 12792
michael@0 12793
michael@0 12794 function test_2d_path_closePath_nextpoint() {
michael@0 12795
michael@0 12796 var canvas = document.getElementById('c390');
michael@0 12797 var ctx = canvas.getContext('2d');
michael@0 12798
michael@0 12799 ctx.strokeStyle = '#0f0';
michael@0 12800 ctx.lineWidth = 50;
michael@0 12801 ctx.moveTo(-100, 25);
michael@0 12802 ctx.lineTo(-100, -1000);
michael@0 12803 ctx.closePath();
michael@0 12804 ctx.lineTo(1000, 25);
michael@0 12805 ctx.stroke();
michael@0 12806 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12807
michael@0 12808
michael@0 12809 }
michael@0 12810 </script>
michael@0 12811
michael@0 12812 <!-- [[[ test_2d.path.fill.closed.basic.html ]]] -->
michael@0 12813
michael@0 12814 <p>Canvas test: 2d.path.fill.closed.basic</p>
michael@0 12815 <canvas id="c391" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12816 <script>
michael@0 12817
michael@0 12818
michael@0 12819 function test_2d_path_fill_closed_basic() {
michael@0 12820
michael@0 12821 var canvas = document.getElementById('c391');
michael@0 12822 var ctx = canvas.getContext('2d');
michael@0 12823
michael@0 12824 ctx.fillStyle = '#f00';
michael@0 12825 ctx.fillRect(0, 0, 100, 50);
michael@0 12826
michael@0 12827 ctx.fillStyle = '#0f0';
michael@0 12828 ctx.moveTo(0, 0);
michael@0 12829 ctx.lineTo(100, 0);
michael@0 12830 ctx.lineTo(100, 50);
michael@0 12831 ctx.lineTo(0, 50);
michael@0 12832 ctx.fill();
michael@0 12833
michael@0 12834 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12835
michael@0 12836
michael@0 12837 }
michael@0 12838 </script>
michael@0 12839
michael@0 12840 <!-- [[[ test_2d.path.fill.closed.unaffected.html ]]] -->
michael@0 12841
michael@0 12842 <p>Canvas test: 2d.path.fill.closed.unaffected</p>
michael@0 12843 <canvas id="c392" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12844 <script>
michael@0 12845
michael@0 12846
michael@0 12847 function test_2d_path_fill_closed_unaffected() {
michael@0 12848
michael@0 12849 var canvas = document.getElementById('c392');
michael@0 12850 var ctx = canvas.getContext('2d');
michael@0 12851
michael@0 12852 ctx.fillStyle = '#00f';
michael@0 12853 ctx.fillRect(0, 0, 100, 50);
michael@0 12854
michael@0 12855 ctx.moveTo(0, 0);
michael@0 12856 ctx.lineTo(100, 0);
michael@0 12857 ctx.lineTo(100, 50);
michael@0 12858 ctx.fillStyle = '#f00';
michael@0 12859 ctx.fill();
michael@0 12860 ctx.lineTo(0, 50);
michael@0 12861 ctx.fillStyle = '#0f0';
michael@0 12862 ctx.fill();
michael@0 12863
michael@0 12864 isPixel(ctx, 90,10, 0,255,0,255, 0);
michael@0 12865 isPixel(ctx, 10,40, 0,255,0,255, 0);
michael@0 12866
michael@0 12867
michael@0 12868 }
michael@0 12869 </script>
michael@0 12870
michael@0 12871 <!-- [[[ test_2d.path.fill.overlap.html ]]] -->
michael@0 12872
michael@0 12873 <p>Canvas test: 2d.path.fill.overlap</p>
michael@0 12874 <canvas id="c393" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12875 <script>
michael@0 12876
michael@0 12877
michael@0 12878 function test_2d_path_fill_overlap() {
michael@0 12879
michael@0 12880 var canvas = document.getElementById('c393');
michael@0 12881 var ctx = canvas.getContext('2d');
michael@0 12882
michael@0 12883 ctx.fillStyle = '#000';
michael@0 12884 ctx.fillRect(0, 0, 100, 50);
michael@0 12885
michael@0 12886 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 12887 ctx.rect(0, 0, 100, 50);
michael@0 12888 ctx.closePath();
michael@0 12889 ctx.rect(10, 10, 80, 30);
michael@0 12890 ctx.fill();
michael@0 12891
michael@0 12892 isPixel(ctx, 50,25, 0,127,0,255, 1);
michael@0 12893
michael@0 12894
michael@0 12895 }
michael@0 12896 </script>
michael@0 12897
michael@0 12898 <!-- [[[ test_2d.path.fill.winding.add.html ]]] -->
michael@0 12899
michael@0 12900 <p>Canvas test: 2d.path.fill.winding.add</p>
michael@0 12901 <canvas id="c394" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12902 <script>
michael@0 12903
michael@0 12904
michael@0 12905 function test_2d_path_fill_winding_add() {
michael@0 12906
michael@0 12907 var canvas = document.getElementById('c394');
michael@0 12908 var ctx = canvas.getContext('2d');
michael@0 12909
michael@0 12910 ctx.fillStyle = '#f00';
michael@0 12911 ctx.fillRect(0, 0, 100, 50);
michael@0 12912
michael@0 12913 ctx.fillStyle = '#0f0';
michael@0 12914 ctx.moveTo(-10, -10);
michael@0 12915 ctx.lineTo(110, -10);
michael@0 12916 ctx.lineTo(110, 60);
michael@0 12917 ctx.lineTo(-10, 60);
michael@0 12918 ctx.lineTo(-10, -10);
michael@0 12919 ctx.lineTo(0, 0);
michael@0 12920 ctx.lineTo(100, 0);
michael@0 12921 ctx.lineTo(100, 50);
michael@0 12922 ctx.lineTo(0, 50);
michael@0 12923 ctx.fill();
michael@0 12924
michael@0 12925 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12926
michael@0 12927
michael@0 12928 }
michael@0 12929 </script>
michael@0 12930
michael@0 12931 <!-- [[[ test_2d.path.fill.winding.subtract.1.html ]]] -->
michael@0 12932
michael@0 12933 <p>Canvas test: 2d.path.fill.winding.subtract.1</p>
michael@0 12934 <canvas id="c395" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12935 <script>
michael@0 12936
michael@0 12937
michael@0 12938 function test_2d_path_fill_winding_subtract_1() {
michael@0 12939
michael@0 12940 var canvas = document.getElementById('c395');
michael@0 12941 var ctx = canvas.getContext('2d');
michael@0 12942
michael@0 12943 ctx.fillStyle = '#0f0';
michael@0 12944 ctx.fillRect(0, 0, 100, 50);
michael@0 12945
michael@0 12946 ctx.fillStyle = '#f00';
michael@0 12947 ctx.moveTo(-10, -10);
michael@0 12948 ctx.lineTo(110, -10);
michael@0 12949 ctx.lineTo(110, 60);
michael@0 12950 ctx.lineTo(-10, 60);
michael@0 12951 ctx.lineTo(-10, -10);
michael@0 12952 ctx.lineTo(0, 0);
michael@0 12953 ctx.lineTo(0, 50);
michael@0 12954 ctx.lineTo(100, 50);
michael@0 12955 ctx.lineTo(100, 0);
michael@0 12956 ctx.fill();
michael@0 12957
michael@0 12958 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12959
michael@0 12960
michael@0 12961 }
michael@0 12962 </script>
michael@0 12963
michael@0 12964 <!-- [[[ test_2d.path.fill.winding.subtract.2.html ]]] -->
michael@0 12965
michael@0 12966 <p>Canvas test: 2d.path.fill.winding.subtract.2</p>
michael@0 12967 <canvas id="c396" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 12968 <script>
michael@0 12969
michael@0 12970
michael@0 12971 function test_2d_path_fill_winding_subtract_2() {
michael@0 12972
michael@0 12973 var canvas = document.getElementById('c396');
michael@0 12974 var ctx = canvas.getContext('2d');
michael@0 12975
michael@0 12976 ctx.fillStyle = '#0f0';
michael@0 12977 ctx.fillRect(0, 0, 100, 50);
michael@0 12978
michael@0 12979 ctx.fillStyle = '#f00';
michael@0 12980 ctx.moveTo(-10, -10);
michael@0 12981 ctx.lineTo(110, -10);
michael@0 12982 ctx.lineTo(110, 60);
michael@0 12983 ctx.lineTo(-10, 60);
michael@0 12984 ctx.moveTo(0, 0);
michael@0 12985 ctx.lineTo(0, 50);
michael@0 12986 ctx.lineTo(100, 50);
michael@0 12987 ctx.lineTo(100, 0);
michael@0 12988 ctx.fill();
michael@0 12989
michael@0 12990 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 12991
michael@0 12992
michael@0 12993 }
michael@0 12994 </script>
michael@0 12995
michael@0 12996 <!-- [[[ test_2d.path.fill.winding.subtract.3.html ]]] -->
michael@0 12997
michael@0 12998 <p>Canvas test: 2d.path.fill.winding.subtract.3</p>
michael@0 12999 <canvas id="c397" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13000 <script>
michael@0 13001
michael@0 13002
michael@0 13003 function test_2d_path_fill_winding_subtract_3() {
michael@0 13004
michael@0 13005 var canvas = document.getElementById('c397');
michael@0 13006 var ctx = canvas.getContext('2d');
michael@0 13007
michael@0 13008 ctx.fillStyle = '#f00';
michael@0 13009 ctx.fillRect(0, 0, 100, 50);
michael@0 13010
michael@0 13011 ctx.fillStyle = '#0f0';
michael@0 13012 ctx.moveTo(-10, -10);
michael@0 13013 ctx.lineTo(110, -10);
michael@0 13014 ctx.lineTo(110, 60);
michael@0 13015 ctx.lineTo(-10, 60);
michael@0 13016 ctx.lineTo(-10, -10);
michael@0 13017 ctx.lineTo(-20, -20);
michael@0 13018 ctx.lineTo(120, -20);
michael@0 13019 ctx.lineTo(120, 70);
michael@0 13020 ctx.lineTo(-20, 70);
michael@0 13021 ctx.lineTo(-20, -20);
michael@0 13022 ctx.lineTo(0, 0);
michael@0 13023 ctx.lineTo(0, 50);
michael@0 13024 ctx.lineTo(100, 50);
michael@0 13025 ctx.lineTo(100, 0);
michael@0 13026 ctx.fill();
michael@0 13027
michael@0 13028 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13029
michael@0 13030
michael@0 13031 }
michael@0 13032 </script>
michael@0 13033
michael@0 13034 <!-- [[[ test_2d.path.initial.html ]]] -->
michael@0 13035
michael@0 13036 <p>Canvas test: 2d.path.initial</p>
michael@0 13037 <canvas id="c398" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13038 <script>
michael@0 13039
michael@0 13040
michael@0 13041
michael@0 13042 function test_2d_path_initial() {
michael@0 13043
michael@0 13044 var canvas = document.getElementById('c398');
michael@0 13045 var ctx = canvas.getContext('2d');
michael@0 13046
michael@0 13047 ctx.lineTo(0, 0);
michael@0 13048 ctx.lineTo(100, 0);
michael@0 13049 ctx.lineTo(100, 50);
michael@0 13050 ctx.lineTo(0, 50);
michael@0 13051 ctx.closePath();
michael@0 13052 ctx.fillStyle = '#f00';
michael@0 13053 ctx.fill();
michael@0 13054 todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 13055
michael@0 13056
michael@0 13057 }
michael@0 13058 </script>
michael@0 13059
michael@0 13060 <!-- [[[ test_2d.path.isPointInPath.arc.html ]]] -->
michael@0 13061
michael@0 13062 <p>Canvas test: 2d.path.isPointInPath.arc</p>
michael@0 13063 <!-- Testing: isPointInPath() works on arcs -->
michael@0 13064 <canvas id="c399" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13065 <script>
michael@0 13066
michael@0 13067 function test_2d_path_isPointInPath_arc() {
michael@0 13068
michael@0 13069 var canvas = document.getElementById('c399');
michael@0 13070 var ctx = canvas.getContext('2d');
michael@0 13071
michael@0 13072 ctx.arc(50, 25, 10, 0, Math.PI, false);
michael@0 13073 ok(ctx.isPointInPath(50, 10) === false, "ctx.isPointInPath(50, 10) === false");
michael@0 13074 ok(ctx.isPointInPath(50, 20) === false, "ctx.isPointInPath(50, 20) === false");
michael@0 13075 ok(ctx.isPointInPath(50, 30) === true, "ctx.isPointInPath(50, 30) === true");
michael@0 13076 ok(ctx.isPointInPath(50, 40) === false, "ctx.isPointInPath(50, 40) === false");
michael@0 13077 ok(ctx.isPointInPath(30, 20) === false, "ctx.isPointInPath(30, 20) === false");
michael@0 13078 ok(ctx.isPointInPath(70, 20) === false, "ctx.isPointInPath(70, 20) === false");
michael@0 13079 ok(ctx.isPointInPath(30, 30) === false, "ctx.isPointInPath(30, 30) === false");
michael@0 13080 ok(ctx.isPointInPath(70, 30) === false, "ctx.isPointInPath(70, 30) === false");
michael@0 13081
michael@0 13082
michael@0 13083 }
michael@0 13084 </script>
michael@0 13085
michael@0 13086 <!-- [[[ test_2d.path.isPointInPath.basic.1.html ]]] -->
michael@0 13087
michael@0 13088 <p>Canvas test: 2d.path.isPointInPath.basic.1</p>
michael@0 13089 <!-- Testing: isPointInPath() detects whether the point is inside the path -->
michael@0 13090 <canvas id="c400" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13091 <script>
michael@0 13092
michael@0 13093 function test_2d_path_isPointInPath_basic_1() {
michael@0 13094
michael@0 13095 var canvas = document.getElementById('c400');
michael@0 13096 var ctx = canvas.getContext('2d');
michael@0 13097
michael@0 13098 ctx.rect(0, 0, 20, 20);
michael@0 13099 ok(ctx.isPointInPath(10, 10) === true, "ctx.isPointInPath(10, 10) === true");
michael@0 13100 ok(ctx.isPointInPath(30, 10) === false, "ctx.isPointInPath(30, 10) === false");
michael@0 13101
michael@0 13102
michael@0 13103 }
michael@0 13104 </script>
michael@0 13105
michael@0 13106 <!-- [[[ test_2d.path.isPointInPath.basic.2.html ]]] -->
michael@0 13107
michael@0 13108 <p>Canvas test: 2d.path.isPointInPath.basic.2</p>
michael@0 13109 <!-- Testing: isPointInPath() detects whether the point is inside the path -->
michael@0 13110 <canvas id="c401" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13111 <script>
michael@0 13112
michael@0 13113 function test_2d_path_isPointInPath_basic_2() {
michael@0 13114
michael@0 13115 var canvas = document.getElementById('c401');
michael@0 13116 var ctx = canvas.getContext('2d');
michael@0 13117
michael@0 13118 ctx.rect(20, 0, 20, 20);
michael@0 13119 ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
michael@0 13120 ok(ctx.isPointInPath(30, 10) === true, "ctx.isPointInPath(30, 10) === true");
michael@0 13121
michael@0 13122
michael@0 13123 }
michael@0 13124 </script>
michael@0 13125
michael@0 13126 <!-- [[[ test_2d.path.isPointInPath.bezier.html ]]] -->
michael@0 13127
michael@0 13128 <p>Canvas test: 2d.path.isPointInPath.bezier</p>
michael@0 13129 <!-- Testing: isPointInPath() works on Bezier curves -->
michael@0 13130 <canvas id="c402" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13131 <script>
michael@0 13132
michael@0 13133 function test_2d_path_isPointInPath_bezier() {
michael@0 13134
michael@0 13135 var canvas = document.getElementById('c402');
michael@0 13136 var ctx = canvas.getContext('2d');
michael@0 13137
michael@0 13138 ctx.moveTo(25, 25);
michael@0 13139 ctx.bezierCurveTo(50, -50, 50, 100, 75, 25);
michael@0 13140 ok(ctx.isPointInPath(25, 20) == false, "ctx.isPointInPath(25, 20) == false");
michael@0 13141 ok(ctx.isPointInPath(25, 30) == false, "ctx.isPointInPath(25, 30) == false");
michael@0 13142 ok(ctx.isPointInPath(30, 20) == true, "ctx.isPointInPath(30, 20) == true");
michael@0 13143 ok(ctx.isPointInPath(30, 30) == false, "ctx.isPointInPath(30, 30) == false");
michael@0 13144 ok(ctx.isPointInPath(40, 2) == false, "ctx.isPointInPath(40, 2) == false");
michael@0 13145 ok(ctx.isPointInPath(40, 20) == true, "ctx.isPointInPath(40, 20) == true");
michael@0 13146 ok(ctx.isPointInPath(40, 30) == false, "ctx.isPointInPath(40, 30) == false");
michael@0 13147 ok(ctx.isPointInPath(40, 47) == false, "ctx.isPointInPath(40, 47) == false");
michael@0 13148 ok(ctx.isPointInPath(45, 20) == true, "ctx.isPointInPath(45, 20) == true");
michael@0 13149 ok(ctx.isPointInPath(45, 30) == false, "ctx.isPointInPath(45, 30) == false");
michael@0 13150 ok(ctx.isPointInPath(55, 20) == false, "ctx.isPointInPath(55, 20) == false");
michael@0 13151 ok(ctx.isPointInPath(55, 30) == true, "ctx.isPointInPath(55, 30) == true");
michael@0 13152 ok(ctx.isPointInPath(60, 2) == false, "ctx.isPointInPath(60, 2) == false");
michael@0 13153 ok(ctx.isPointInPath(60, 20) == false, "ctx.isPointInPath(60, 20) == false");
michael@0 13154 ok(ctx.isPointInPath(60, 30) == true, "ctx.isPointInPath(60, 30) == true");
michael@0 13155 ok(ctx.isPointInPath(60, 47) == false, "ctx.isPointInPath(60, 47) == false");
michael@0 13156 ok(ctx.isPointInPath(70, 20) == false, "ctx.isPointInPath(70, 20) == false");
michael@0 13157 ok(ctx.isPointInPath(70, 30) == true, "ctx.isPointInPath(70, 30) == true");
michael@0 13158 ok(ctx.isPointInPath(75, 20) == false, "ctx.isPointInPath(75, 20) == false");
michael@0 13159 ok(ctx.isPointInPath(75, 30) == false, "ctx.isPointInPath(75, 30) == false");
michael@0 13160
michael@0 13161
michael@0 13162 }
michael@0 13163 </script>
michael@0 13164
michael@0 13165 <!-- [[[ test_2d.path.isPointInPath.bigarc.html ]]] -->
michael@0 13166
michael@0 13167 <p>Canvas test: 2d.path.isPointInPath.bigarc</p>
michael@0 13168 <!-- Testing: isPointInPath() works on unclosed arcs larger than 2pi -->
michael@0 13169 <canvas id="c403" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13170 <script>
michael@0 13171
michael@0 13172 function test_2d_path_isPointInPath_bigarc() {
michael@0 13173
michael@0 13174 var canvas = document.getElementById('c403');
michael@0 13175 var ctx = canvas.getContext('2d');
michael@0 13176
michael@0 13177 ctx.arc(50, 25, 10, 0, 7, false);
michael@0 13178 ok(ctx.isPointInPath(50, 10) === false, "ctx.isPointInPath(50, 10) === false");
michael@0 13179 ok(ctx.isPointInPath(50, 20) === true, "ctx.isPointInPath(50, 20) === true");
michael@0 13180 ok(ctx.isPointInPath(50, 30) === true, "ctx.isPointInPath(50, 30) === true");
michael@0 13181 ok(ctx.isPointInPath(50, 40) === false, "ctx.isPointInPath(50, 40) === false");
michael@0 13182 ok(ctx.isPointInPath(30, 20) === false, "ctx.isPointInPath(30, 20) === false");
michael@0 13183 ok(ctx.isPointInPath(70, 20) === false, "ctx.isPointInPath(70, 20) === false");
michael@0 13184 ok(ctx.isPointInPath(30, 30) === false, "ctx.isPointInPath(30, 30) === false");
michael@0 13185 ok(ctx.isPointInPath(70, 30) === false, "ctx.isPointInPath(70, 30) === false");
michael@0 13186
michael@0 13187
michael@0 13188 }
michael@0 13189 </script>
michael@0 13190
michael@0 13191 <!-- [[[ test_2d.path.isPointInPath.edge.html ]]] -->
michael@0 13192
michael@0 13193 <p>Canvas test: 2d.path.isPointInPath.edge</p>
michael@0 13194 <!-- Testing: isPointInPath() counts points on the path as being inside -->
michael@0 13195 <canvas id="c404" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13196 <script>
michael@0 13197
michael@0 13198 function test_2d_path_isPointInPath_edge() {
michael@0 13199
michael@0 13200 var canvas = document.getElementById('c404');
michael@0 13201 var ctx = canvas.getContext('2d');
michael@0 13202
michael@0 13203 ctx.rect(0, 0, 20, 20);
michael@0 13204
michael@0 13205 ok(ctx.isPointInPath(0, 0) === true, "ctx.isPointInPath(0, 0) === true");
michael@0 13206 ok(ctx.isPointInPath(10, 0) === true, "ctx.isPointInPath(10, 0) === true");
michael@0 13207 ok(ctx.isPointInPath(20, 0) === true, "ctx.isPointInPath(20, 0) === true");
michael@0 13208 ok(ctx.isPointInPath(20, 10) === true, "ctx.isPointInPath(20, 10) === true");
michael@0 13209 ok(ctx.isPointInPath(20, 20) === true, "ctx.isPointInPath(20, 20) === true");
michael@0 13210 ok(ctx.isPointInPath(10, 20) === true, "ctx.isPointInPath(10, 20) === true");
michael@0 13211 ok(ctx.isPointInPath(0, 20) === true, "ctx.isPointInPath(0, 20) === true");
michael@0 13212 ok(ctx.isPointInPath(0, 10) === true, "ctx.isPointInPath(0, 10) === true");
michael@0 13213 ok(ctx.isPointInPath(10, -0.01) === false, "ctx.isPointInPath(10, -0.01) === false");
michael@0 13214 ok(ctx.isPointInPath(10, 20.01) === false, "ctx.isPointInPath(10, 20.01) === false");
michael@0 13215 ok(ctx.isPointInPath(-0.01, 10) === false, "ctx.isPointInPath(-0.01, 10) === false");
michael@0 13216 ok(ctx.isPointInPath(20.01, 10) === false, "ctx.isPointInPath(20.01, 10) === false");
michael@0 13217
michael@0 13218 }
michael@0 13219 </script>
michael@0 13220
michael@0 13221 <!-- [[[ test_2d.path.isPointInPath.empty.html ]]] -->
michael@0 13222
michael@0 13223 <p>Canvas test: 2d.path.isPointInPath.empty</p>
michael@0 13224 <!-- Testing: isPointInPath() works when there is no path -->
michael@0 13225 <canvas id="c405" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13226 <script>
michael@0 13227
michael@0 13228 function test_2d_path_isPointInPath_empty() {
michael@0 13229
michael@0 13230 var canvas = document.getElementById('c405');
michael@0 13231 var ctx = canvas.getContext('2d');
michael@0 13232
michael@0 13233 ok(ctx.isPointInPath(0, 0) === false, "ctx.isPointInPath(0, 0) === false");
michael@0 13234
michael@0 13235
michael@0 13236 }
michael@0 13237 </script>
michael@0 13238
michael@0 13239 <!-- [[[ test_2d.path.isPointInPath.nonfinite.html ]]] -->
michael@0 13240
michael@0 13241 <p>Canvas test: 2d.path.isPointInPath.nonfinite</p>
michael@0 13242 <!-- Testing: isPointInPath() returns false for non-finite arguments -->
michael@0 13243 <canvas id="c406" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13244 <script>
michael@0 13245
michael@0 13246 function test_2d_path_isPointInPath_nonfinite() {
michael@0 13247
michael@0 13248 var canvas = document.getElementById('c406');
michael@0 13249 var ctx = canvas.getContext('2d');
michael@0 13250
michael@0 13251 var _thrown_outer = false;
michael@0 13252 try {
michael@0 13253
michael@0 13254 ctx.rect(-100, -50, 200, 100);
michael@0 13255 ok(ctx.isPointInPath(Infinity, 0) === false, "ctx.isPointInPath(Infinity, 0) === false");
michael@0 13256 ok(ctx.isPointInPath(-Infinity, 0) === false, "ctx.isPointInPath(-Infinity, 0) === false");
michael@0 13257 ok(ctx.isPointInPath(NaN, 0) === false, "ctx.isPointInPath(NaN, 0) === false");
michael@0 13258 ok(ctx.isPointInPath(0, Infinity) === false, "ctx.isPointInPath(0, Infinity) === false");
michael@0 13259 ok(ctx.isPointInPath(0, -Infinity) === false, "ctx.isPointInPath(0, -Infinity) === false");
michael@0 13260 ok(ctx.isPointInPath(0, NaN) === false, "ctx.isPointInPath(0, NaN) === false");
michael@0 13261 ok(ctx.isPointInPath(NaN, NaN) === false, "ctx.isPointInPath(NaN, NaN) === false");
michael@0 13262
michael@0 13263 } catch (e) {
michael@0 13264 _thrown_outer = true;
michael@0 13265 }
michael@0 13266 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 13267
michael@0 13268
michael@0 13269 }
michael@0 13270 </script>
michael@0 13271
michael@0 13272 <!-- [[[ test_2d.path.isPointInPath.outside.html ]]] -->
michael@0 13273
michael@0 13274 <p>Canvas test: 2d.path.isPointInPath.outside</p>
michael@0 13275 <!-- Testing: isPointInPath() works on paths outside the canvas -->
michael@0 13276 <canvas id="c407" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13277 <script>
michael@0 13278
michael@0 13279 function test_2d_path_isPointInPath_outside() {
michael@0 13280
michael@0 13281 var canvas = document.getElementById('c407');
michael@0 13282 var ctx = canvas.getContext('2d');
michael@0 13283
michael@0 13284 ctx.rect(0, -100, 20, 20);
michael@0 13285 ctx.rect(20, -10, 20, 20);
michael@0 13286 ok(ctx.isPointInPath(10, -110) === false, "ctx.isPointInPath(10, -110) === false");
michael@0 13287 ok(ctx.isPointInPath(10, -90) === true, "ctx.isPointInPath(10, -90) === true");
michael@0 13288 ok(ctx.isPointInPath(10, -70) === false, "ctx.isPointInPath(10, -70) === false");
michael@0 13289 ok(ctx.isPointInPath(30, -20) === false, "ctx.isPointInPath(30, -20) === false");
michael@0 13290 ok(ctx.isPointInPath(30, 0) === true, "ctx.isPointInPath(30, 0) === true");
michael@0 13291 ok(ctx.isPointInPath(30, 20) === false, "ctx.isPointInPath(30, 20) === false");
michael@0 13292
michael@0 13293
michael@0 13294 }
michael@0 13295 </script>
michael@0 13296
michael@0 13297 <!-- [[[ test_2d.path.isPointInPath.subpath.html ]]] -->
michael@0 13298
michael@0 13299 <p>Canvas test: 2d.path.isPointInPath.subpath</p>
michael@0 13300 <!-- Testing: isPointInPath() uses the current path, not just the subpath -->
michael@0 13301 <canvas id="c408" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13302 <script>
michael@0 13303
michael@0 13304 function test_2d_path_isPointInPath_subpath() {
michael@0 13305
michael@0 13306 var canvas = document.getElementById('c408');
michael@0 13307 var ctx = canvas.getContext('2d');
michael@0 13308
michael@0 13309 ctx.rect(0, 0, 20, 20);
michael@0 13310 ctx.beginPath();
michael@0 13311 ctx.rect(20, 0, 20, 20);
michael@0 13312 ctx.closePath();
michael@0 13313 ctx.rect(40, 0, 20, 20);
michael@0 13314 ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
michael@0 13315 ok(ctx.isPointInPath(30, 10) === true, "ctx.isPointInPath(30, 10) === true");
michael@0 13316 ok(ctx.isPointInPath(50, 10) === true, "ctx.isPointInPath(50, 10) === true");
michael@0 13317
michael@0 13318
michael@0 13319 }
michael@0 13320 </script>
michael@0 13321
michael@0 13322 <!-- [[[ test_2d.path.isPointInPath.transform.1.html ]]] -->
michael@0 13323
michael@0 13324 <p>Canvas test: 2d.path.isPointInPath.transform.1 - bug 405300</p>
michael@0 13325 <!-- Testing: isPointInPath() handles transformations correctly -->
michael@0 13326 <canvas id="c409" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13327 <script>
michael@0 13328
michael@0 13329 function test_2d_path_isPointInPath_transform_1() {
michael@0 13330
michael@0 13331 var canvas = document.getElementById('c409');
michael@0 13332 var ctx = canvas.getContext('2d');
michael@0 13333
michael@0 13334 ctx.translate(50, 0);
michael@0 13335 ctx.rect(0, 0, 20, 20);
michael@0 13336 ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
michael@0 13337 ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
michael@0 13338 ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
michael@0 13339 ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
michael@0 13340 ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
michael@0 13341 ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");
michael@0 13342
michael@0 13343
michael@0 13344 }
michael@0 13345 </script>
michael@0 13346
michael@0 13347 <!-- [[[ test_2d.path.isPointInPath.transform.2.html ]]] -->
michael@0 13348
michael@0 13349 <p>Canvas test: 2d.path.isPointInPath.transform.2 - bug 405300</p>
michael@0 13350 <!-- Testing: isPointInPath() handles transformations correctly -->
michael@0 13351 <canvas id="c410" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13352 <script>
michael@0 13353
michael@0 13354 function test_2d_path_isPointInPath_transform_2() {
michael@0 13355
michael@0 13356 var canvas = document.getElementById('c410');
michael@0 13357 var ctx = canvas.getContext('2d');
michael@0 13358
michael@0 13359 ctx.rect(50, 0, 20, 20);
michael@0 13360 ctx.translate(50, 0);
michael@0 13361 ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
michael@0 13362 ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
michael@0 13363 ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
michael@0 13364 ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
michael@0 13365 ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
michael@0 13366 ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");
michael@0 13367
michael@0 13368
michael@0 13369 }
michael@0 13370 </script>
michael@0 13371
michael@0 13372 <!-- [[[ test_2d.path.isPointInPath.transform.3.html ]]] -->
michael@0 13373
michael@0 13374 <p>Canvas test: 2d.path.isPointInPath.transform.3 - bug 405300</p>
michael@0 13375 <!-- Testing: isPointInPath() handles transformations correctly -->
michael@0 13376 <canvas id="c411" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13377 <script>
michael@0 13378
michael@0 13379 function test_2d_path_isPointInPath_transform_3() {
michael@0 13380
michael@0 13381 var canvas = document.getElementById('c411');
michael@0 13382 var ctx = canvas.getContext('2d');
michael@0 13383
michael@0 13384 ctx.scale(-1, 1);
michael@0 13385 ctx.rect(-70, 0, 20, 20);
michael@0 13386 ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
michael@0 13387 ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
michael@0 13388 ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
michael@0 13389 ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
michael@0 13390 ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
michael@0 13391 ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");
michael@0 13392
michael@0 13393
michael@0 13394 }
michael@0 13395 </script>
michael@0 13396
michael@0 13397 <!-- [[[ test_2d.path.isPointInPath.unclosed.html ]]] -->
michael@0 13398
michael@0 13399 <p>Canvas test: 2d.path.isPointInPath.unclosed</p>
michael@0 13400 <!-- Testing: isPointInPath() works on unclosed subpaths -->
michael@0 13401 <canvas id="c412" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13402 <script>
michael@0 13403
michael@0 13404 function test_2d_path_isPointInPath_unclosed() {
michael@0 13405
michael@0 13406 var canvas = document.getElementById('c412');
michael@0 13407 var ctx = canvas.getContext('2d');
michael@0 13408
michael@0 13409 ctx.moveTo(0, 0);
michael@0 13410 ctx.lineTo(20, 0);
michael@0 13411 ctx.lineTo(20, 20);
michael@0 13412 ctx.lineTo(0, 20);
michael@0 13413 ok(ctx.isPointInPath(10, 10) === true, "ctx.isPointInPath(10, 10) === true");
michael@0 13414 ok(ctx.isPointInPath(30, 10) === false, "ctx.isPointInPath(30, 10) === false");
michael@0 13415
michael@0 13416
michael@0 13417 }
michael@0 13418 </script>
michael@0 13419
michael@0 13420 <!-- [[[ test_2d.path.isPointInPath.winding.html ]]] -->
michael@0 13421
michael@0 13422 <p>Canvas test: 2d.path.isPointInPath.winding</p>
michael@0 13423 <!-- Testing: isPointInPath() uses the non-zero winding number rule -->
michael@0 13424 <canvas id="c413" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13425 <script>
michael@0 13426
michael@0 13427 function test_2d_path_isPointInPath_winding() {
michael@0 13428
michael@0 13429 var canvas = document.getElementById('c413');
michael@0 13430 var ctx = canvas.getContext('2d');
michael@0 13431
michael@0 13432 // Create a square ring, using opposite windings to make a hole in the centre
michael@0 13433 ctx.moveTo(0, 0);
michael@0 13434 ctx.lineTo(50, 0);
michael@0 13435 ctx.lineTo(50, 50);
michael@0 13436 ctx.lineTo(0, 50);
michael@0 13437 ctx.lineTo(0, 0);
michael@0 13438 ctx.lineTo(10, 10);
michael@0 13439 ctx.lineTo(10, 40);
michael@0 13440 ctx.lineTo(40, 40);
michael@0 13441 ctx.lineTo(40, 10);
michael@0 13442 ctx.lineTo(10, 10);
michael@0 13443
michael@0 13444 ok(ctx.isPointInPath(5, 5) === true, "ctx.isPointInPath(5, 5) === true");
michael@0 13445 ok(ctx.isPointInPath(25, 5) === true, "ctx.isPointInPath(25, 5) === true");
michael@0 13446 ok(ctx.isPointInPath(45, 5) === true, "ctx.isPointInPath(45, 5) === true");
michael@0 13447 ok(ctx.isPointInPath(5, 25) === true, "ctx.isPointInPath(5, 25) === true");
michael@0 13448 ok(ctx.isPointInPath(25, 25) === false, "ctx.isPointInPath(25, 25) === false");
michael@0 13449 ok(ctx.isPointInPath(45, 25) === true, "ctx.isPointInPath(45, 25) === true");
michael@0 13450 ok(ctx.isPointInPath(5, 45) === true, "ctx.isPointInPath(5, 45) === true");
michael@0 13451 ok(ctx.isPointInPath(25, 45) === true, "ctx.isPointInPath(25, 45) === true");
michael@0 13452 ok(ctx.isPointInPath(45, 45) === true, "ctx.isPointInPath(45, 45) === true");
michael@0 13453
michael@0 13454
michael@0 13455 }
michael@0 13456 </script>
michael@0 13457
michael@0 13458 <!-- [[[ test_2d.path.lineTo.basic.html ]]] -->
michael@0 13459
michael@0 13460 <p>Canvas test: 2d.path.lineTo.basic</p>
michael@0 13461 <canvas id="c414" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13462 <script>
michael@0 13463
michael@0 13464
michael@0 13465 function test_2d_path_lineTo_basic() {
michael@0 13466
michael@0 13467 var canvas = document.getElementById('c414');
michael@0 13468 var ctx = canvas.getContext('2d');
michael@0 13469
michael@0 13470 ctx.strokeStyle = '#0f0';
michael@0 13471 ctx.lineWidth = 50;
michael@0 13472 ctx.beginPath();
michael@0 13473 ctx.moveTo(0, 25);
michael@0 13474 ctx.lineTo(100, 25);
michael@0 13475 ctx.stroke();
michael@0 13476 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13477
michael@0 13478
michael@0 13479 }
michael@0 13480 </script>
michael@0 13481
michael@0 13482 <!-- [[[ test_2d.path.lineTo.emptysubpath.html ]]] -->
michael@0 13483
michael@0 13484 <p>Canvas test: 2d.path.lineTo.emptysubpath</p>
michael@0 13485 <canvas id="c415" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13486 <script>
michael@0 13487
michael@0 13488
michael@0 13489
michael@0 13490 function test_2d_path_lineTo_emptysubpath() {
michael@0 13491
michael@0 13492 var canvas = document.getElementById('c415');
michael@0 13493 var ctx = canvas.getContext('2d');
michael@0 13494
michael@0 13495 ctx.strokeStyle = '#f00';
michael@0 13496 ctx.lineWidth = 50;
michael@0 13497 ctx.beginPath();
michael@0 13498 ctx.lineTo(0, 25);
michael@0 13499 ctx.lineTo(100, 25);
michael@0 13500 ctx.stroke();
michael@0 13501 todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 13502
michael@0 13503
michael@0 13504 }
michael@0 13505 </script>
michael@0 13506
michael@0 13507 <!-- [[[ test_2d.path.lineTo.nextpoint.html ]]] -->
michael@0 13508
michael@0 13509 <p>Canvas test: 2d.path.lineTo.nextpoint</p>
michael@0 13510 <canvas id="c416" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13511 <script>
michael@0 13512
michael@0 13513
michael@0 13514 function test_2d_path_lineTo_nextpoint() {
michael@0 13515
michael@0 13516 var canvas = document.getElementById('c416');
michael@0 13517 var ctx = canvas.getContext('2d');
michael@0 13518
michael@0 13519 ctx.strokeStyle = '#0f0';
michael@0 13520 ctx.lineWidth = 50;
michael@0 13521 ctx.beginPath();
michael@0 13522 ctx.moveTo(-100, -100);
michael@0 13523 ctx.lineTo(0, 25);
michael@0 13524 ctx.lineTo(100, 25);
michael@0 13525 ctx.stroke();
michael@0 13526 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13527
michael@0 13528
michael@0 13529 }
michael@0 13530 </script>
michael@0 13531
michael@0 13532 <!-- [[[ test_2d.path.lineTo.nonfinite.html ]]] -->
michael@0 13533
michael@0 13534 <p>Canvas test: 2d.path.lineTo.nonfinite</p>
michael@0 13535 <!-- Testing: lineTo() with Infinity/NaN is ignored -->
michael@0 13536 <canvas id="c417" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13537 <script>
michael@0 13538
michael@0 13539
michael@0 13540 function test_2d_path_lineTo_nonfinite() {
michael@0 13541
michael@0 13542 var canvas = document.getElementById('c417');
michael@0 13543 var ctx = canvas.getContext('2d');
michael@0 13544
michael@0 13545 var _thrown_outer = false;
michael@0 13546 try {
michael@0 13547
michael@0 13548 ctx.moveTo(0, 0);
michael@0 13549 ctx.lineTo(100, 0);
michael@0 13550 ctx.lineTo(Infinity, 50);
michael@0 13551 ctx.lineTo(-Infinity, 50);
michael@0 13552 ctx.lineTo(NaN, 50);
michael@0 13553 ctx.lineTo(0, Infinity);
michael@0 13554 ctx.lineTo(0, -Infinity);
michael@0 13555 ctx.lineTo(0, NaN);
michael@0 13556 ctx.lineTo(Infinity, Infinity);
michael@0 13557 ctx.lineTo(100, 50);
michael@0 13558 ctx.lineTo(0, 50);
michael@0 13559 ctx.fillStyle = '#0f0';
michael@0 13560 ctx.fill();
michael@0 13561 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13562 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 13563
michael@0 13564 } catch (e) {
michael@0 13565 _thrown_outer = true;
michael@0 13566 }
michael@0 13567 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 13568
michael@0 13569
michael@0 13570 }
michael@0 13571 </script>
michael@0 13572
michael@0 13573 <!-- [[[ test_2d.path.moveTo.basic.html ]]] -->
michael@0 13574
michael@0 13575 <p>Canvas test: 2d.path.moveTo.basic</p>
michael@0 13576 <canvas id="c418" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13577 <script>
michael@0 13578
michael@0 13579
michael@0 13580 function test_2d_path_moveTo_basic() {
michael@0 13581
michael@0 13582 var canvas = document.getElementById('c418');
michael@0 13583 var ctx = canvas.getContext('2d');
michael@0 13584
michael@0 13585 ctx.rect(0, 0, 10, 50);
michael@0 13586 ctx.moveTo(100, 0);
michael@0 13587 ctx.lineTo(10, 0);
michael@0 13588 ctx.lineTo(10, 50);
michael@0 13589 ctx.lineTo(100, 50);
michael@0 13590 ctx.fillStyle = '#0f0';
michael@0 13591 ctx.fill();
michael@0 13592 isPixel(ctx, 90,25, 0,255,0,255, 0);
michael@0 13593
michael@0 13594
michael@0 13595 }
michael@0 13596 </script>
michael@0 13597
michael@0 13598 <!-- [[[ test_2d.path.moveTo.multiple.html ]]] -->
michael@0 13599
michael@0 13600 <p>Canvas test: 2d.path.moveTo.multiple</p>
michael@0 13601 <canvas id="c419" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13602 <script>
michael@0 13603
michael@0 13604
michael@0 13605 function test_2d_path_moveTo_multiple() {
michael@0 13606
michael@0 13607 var canvas = document.getElementById('c419');
michael@0 13608 var ctx = canvas.getContext('2d');
michael@0 13609
michael@0 13610 ctx.moveTo(0, 25);
michael@0 13611 ctx.moveTo(100, 25);
michael@0 13612 ctx.moveTo(0, 25);
michael@0 13613 ctx.lineTo(100, 25);
michael@0 13614 ctx.strokeStyle = '#0f0';
michael@0 13615 ctx.lineWidth = 50;
michael@0 13616 ctx.stroke();
michael@0 13617 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13618
michael@0 13619
michael@0 13620 }
michael@0 13621 </script>
michael@0 13622
michael@0 13623 <!-- [[[ test_2d.path.moveTo.newsubpath.html ]]] -->
michael@0 13624
michael@0 13625 <p>Canvas test: 2d.path.moveTo.newsubpath</p>
michael@0 13626 <canvas id="c420" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13627 <script>
michael@0 13628
michael@0 13629
michael@0 13630 function test_2d_path_moveTo_newsubpath() {
michael@0 13631
michael@0 13632 var canvas = document.getElementById('c420');
michael@0 13633 var ctx = canvas.getContext('2d');
michael@0 13634
michael@0 13635 ctx.beginPath();
michael@0 13636 ctx.moveTo(0, 0);
michael@0 13637 ctx.moveTo(100, 0);
michael@0 13638 ctx.moveTo(100, 50);
michael@0 13639 ctx.moveTo(0, 50);
michael@0 13640 ctx.fillStyle = '#f00';
michael@0 13641 ctx.fill();
michael@0 13642 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 13643
michael@0 13644
michael@0 13645 }
michael@0 13646 </script>
michael@0 13647
michael@0 13648 <!-- [[[ test_2d.path.moveTo.nonfinite.html ]]] -->
michael@0 13649
michael@0 13650 <p>Canvas test: 2d.path.moveTo.nonfinite</p>
michael@0 13651 <!-- Testing: moveTo() with Infinity/NaN is ignored -->
michael@0 13652 <canvas id="c421" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13653 <script>
michael@0 13654
michael@0 13655
michael@0 13656 function test_2d_path_moveTo_nonfinite() {
michael@0 13657
michael@0 13658 var canvas = document.getElementById('c421');
michael@0 13659 var ctx = canvas.getContext('2d');
michael@0 13660
michael@0 13661 var _thrown_outer = false;
michael@0 13662 try {
michael@0 13663
michael@0 13664 ctx.moveTo(0, 0);
michael@0 13665 ctx.lineTo(100, 0);
michael@0 13666 ctx.moveTo(Infinity, 50);
michael@0 13667 ctx.moveTo(-Infinity, 50);
michael@0 13668 ctx.moveTo(NaN, 50);
michael@0 13669 ctx.moveTo(0, Infinity);
michael@0 13670 ctx.moveTo(0, -Infinity);
michael@0 13671 ctx.moveTo(0, NaN);
michael@0 13672 ctx.moveTo(Infinity, Infinity);
michael@0 13673 ctx.lineTo(100, 50);
michael@0 13674 ctx.lineTo(0, 50);
michael@0 13675 ctx.fillStyle = '#0f0';
michael@0 13676 ctx.fill();
michael@0 13677 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13678
michael@0 13679 } catch (e) {
michael@0 13680 _thrown_outer = true;
michael@0 13681 }
michael@0 13682 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 13683
michael@0 13684
michael@0 13685 }
michael@0 13686 </script>
michael@0 13687
michael@0 13688 <!-- [[[ test_2d.path.quadraticCurveTo.basic.html ]]] -->
michael@0 13689
michael@0 13690 <p>Canvas test: 2d.path.quadraticCurveTo.basic</p>
michael@0 13691 <canvas id="c422" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13692 <script>
michael@0 13693
michael@0 13694
michael@0 13695 function test_2d_path_quadraticCurveTo_basic() {
michael@0 13696
michael@0 13697 var canvas = document.getElementById('c422');
michael@0 13698 var ctx = canvas.getContext('2d');
michael@0 13699
michael@0 13700 ctx.strokeStyle = '#0f0';
michael@0 13701 ctx.lineWidth = 50;
michael@0 13702 ctx.beginPath();
michael@0 13703 ctx.moveTo(0, 25);
michael@0 13704 ctx.quadraticCurveTo(100, 25, 100, 25);
michael@0 13705 ctx.stroke();
michael@0 13706 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13707
michael@0 13708
michael@0 13709 }
michael@0 13710 </script>
michael@0 13711
michael@0 13712 <!-- [[[ test_2d.path.quadraticCurveTo.emptysubpath.html ]]] -->
michael@0 13713
michael@0 13714 <p>Canvas test: 2d.path.quadraticCurveTo.emptysubpath</p>
michael@0 13715 <canvas id="c423" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13716 <script>
michael@0 13717
michael@0 13718
michael@0 13719
michael@0 13720 function test_2d_path_quadraticCurveTo_emptysubpath() {
michael@0 13721
michael@0 13722 var canvas = document.getElementById('c423');
michael@0 13723 var ctx = canvas.getContext('2d');
michael@0 13724
michael@0 13725 ctx.strokeStyle = '#f00';
michael@0 13726 ctx.lineWidth = 50;
michael@0 13727 ctx.beginPath();
michael@0 13728 ctx.quadraticCurveTo(0, 25, 0, 25);
michael@0 13729 ctx.quadraticCurveTo(100, 25, 100, 25);
michael@0 13730 ctx.stroke();
michael@0 13731 todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 13732
michael@0 13733
michael@0 13734 }
michael@0 13735 </script>
michael@0 13736
michael@0 13737 <!-- [[[ test_2d.path.quadraticCurveTo.nonfinite.html ]]] -->
michael@0 13738
michael@0 13739 <p>Canvas test: 2d.path.quadraticCurveTo.nonfinite</p>
michael@0 13740 <!-- Testing: quadraticCurveTo() with Infinity/NaN is ignored -->
michael@0 13741 <canvas id="c424" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13742 <script>
michael@0 13743
michael@0 13744
michael@0 13745 function test_2d_path_quadraticCurveTo_nonfinite() {
michael@0 13746
michael@0 13747 var canvas = document.getElementById('c424');
michael@0 13748 var ctx = canvas.getContext('2d');
michael@0 13749
michael@0 13750 var _thrown_outer = false;
michael@0 13751 try {
michael@0 13752
michael@0 13753 ctx.moveTo(0, 0);
michael@0 13754 ctx.lineTo(100, 0);
michael@0 13755 ctx.quadraticCurveTo(Infinity, 50, 0, 50);
michael@0 13756 ctx.quadraticCurveTo(-Infinity, 50, 0, 50);
michael@0 13757 ctx.quadraticCurveTo(NaN, 50, 0, 50);
michael@0 13758 ctx.quadraticCurveTo(0, Infinity, 0, 50);
michael@0 13759 ctx.quadraticCurveTo(0, -Infinity, 0, 50);
michael@0 13760 ctx.quadraticCurveTo(0, NaN, 0, 50);
michael@0 13761 ctx.quadraticCurveTo(0, 50, Infinity, 50);
michael@0 13762 ctx.quadraticCurveTo(0, 50, -Infinity, 50);
michael@0 13763 ctx.quadraticCurveTo(0, 50, NaN, 50);
michael@0 13764 ctx.quadraticCurveTo(0, 50, 0, Infinity);
michael@0 13765 ctx.quadraticCurveTo(0, 50, 0, -Infinity);
michael@0 13766 ctx.quadraticCurveTo(0, 50, 0, NaN);
michael@0 13767 ctx.quadraticCurveTo(Infinity, Infinity, 0, 50);
michael@0 13768 ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50);
michael@0 13769 ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity);
michael@0 13770 ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity);
michael@0 13771 ctx.quadraticCurveTo(Infinity, 50, Infinity, 50);
michael@0 13772 ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity);
michael@0 13773 ctx.quadraticCurveTo(Infinity, 50, 0, Infinity);
michael@0 13774 ctx.quadraticCurveTo(0, Infinity, Infinity, 50);
michael@0 13775 ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity);
michael@0 13776 ctx.quadraticCurveTo(0, Infinity, 0, Infinity);
michael@0 13777 ctx.quadraticCurveTo(0, 50, Infinity, Infinity);
michael@0 13778 ctx.lineTo(100, 50);
michael@0 13779 ctx.lineTo(0, 50);
michael@0 13780 ctx.fillStyle = '#0f0';
michael@0 13781 ctx.fill();
michael@0 13782 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13783 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 13784
michael@0 13785 } catch (e) {
michael@0 13786 _thrown_outer = true;
michael@0 13787 }
michael@0 13788 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 13789
michael@0 13790
michael@0 13791 }
michael@0 13792 </script>
michael@0 13793
michael@0 13794 <!-- [[[ test_2d.path.quadraticCurveTo.scaled.html ]]] -->
michael@0 13795
michael@0 13796 <p>Canvas test: 2d.path.quadraticCurveTo.scaled</p>
michael@0 13797 <canvas id="c425" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13798 <script>
michael@0 13799
michael@0 13800
michael@0 13801 function test_2d_path_quadraticCurveTo_scaled() {
michael@0 13802
michael@0 13803 var canvas = document.getElementById('c425');
michael@0 13804 var ctx = canvas.getContext('2d');
michael@0 13805
michael@0 13806 ctx.scale(1000, 1000);
michael@0 13807 ctx.strokeStyle = '#0f0';
michael@0 13808 ctx.lineWidth = 0.055;
michael@0 13809 ctx.beginPath();
michael@0 13810 ctx.moveTo(-1, 1.05);
michael@0 13811 ctx.quadraticCurveTo(0, -1, 1.2, 1.05);
michael@0 13812 ctx.stroke();
michael@0 13813 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13814 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 13815 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 13816 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 13817 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 13818
michael@0 13819
michael@0 13820 }
michael@0 13821 </script>
michael@0 13822
michael@0 13823 <!-- [[[ test_2d.path.quadraticCurveTo.shape.html ]]] -->
michael@0 13824
michael@0 13825 <p>Canvas test: 2d.path.quadraticCurveTo.shape</p>
michael@0 13826 <canvas id="c426" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13827 <script>
michael@0 13828
michael@0 13829
michael@0 13830 function test_2d_path_quadraticCurveTo_shape() {
michael@0 13831
michael@0 13832 var canvas = document.getElementById('c426');
michael@0 13833 var ctx = canvas.getContext('2d');
michael@0 13834
michael@0 13835 ctx.strokeStyle = '#0f0';
michael@0 13836 ctx.lineWidth = 55;
michael@0 13837 ctx.beginPath();
michael@0 13838 ctx.moveTo(-1000, 1050);
michael@0 13839 ctx.quadraticCurveTo(0, -1000, 1200, 1050);
michael@0 13840 ctx.stroke();
michael@0 13841 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13842 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 13843 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 13844 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 13845 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 13846
michael@0 13847
michael@0 13848 }
michael@0 13849 </script>
michael@0 13850
michael@0 13851 <!-- [[[ test_2d.path.rect.basic.html ]]] -->
michael@0 13852
michael@0 13853 <p>Canvas test: 2d.path.rect.basic</p>
michael@0 13854 <canvas id="c427" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13855 <script>
michael@0 13856
michael@0 13857
michael@0 13858 function test_2d_path_rect_basic() {
michael@0 13859
michael@0 13860 var canvas = document.getElementById('c427');
michael@0 13861 var ctx = canvas.getContext('2d');
michael@0 13862
michael@0 13863 ctx.fillStyle = '#0f0';
michael@0 13864 ctx.rect(0, 0, 100, 50);
michael@0 13865 ctx.fill();
michael@0 13866 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13867
michael@0 13868
michael@0 13869 }
michael@0 13870 </script>
michael@0 13871
michael@0 13872 <!-- [[[ test_2d.path.rect.closed.html ]]] -->
michael@0 13873
michael@0 13874 <p>Canvas test: 2d.path.rect.closed</p>
michael@0 13875 <canvas id="c428" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13876 <script>
michael@0 13877
michael@0 13878
michael@0 13879 function test_2d_path_rect_closed() {
michael@0 13880
michael@0 13881 var canvas = document.getElementById('c428');
michael@0 13882 var ctx = canvas.getContext('2d');
michael@0 13883
michael@0 13884 ctx.strokeStyle = '#0f0';
michael@0 13885 ctx.lineWidth = 200;
michael@0 13886 ctx.lineJoin = 'miter';
michael@0 13887 ctx.rect(100, 50, 100, 100);
michael@0 13888 ctx.stroke();
michael@0 13889 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13890
michael@0 13891
michael@0 13892 }
michael@0 13893 </script>
michael@0 13894
michael@0 13895 <!-- [[[ test_2d.path.rect.end.1.html ]]] -->
michael@0 13896
michael@0 13897 <p>Canvas test: 2d.path.rect.end.1</p>
michael@0 13898 <canvas id="c429" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13899 <script>
michael@0 13900
michael@0 13901
michael@0 13902 function test_2d_path_rect_end_1() {
michael@0 13903
michael@0 13904 var canvas = document.getElementById('c429');
michael@0 13905 var ctx = canvas.getContext('2d');
michael@0 13906
michael@0 13907 ctx.strokeStyle = '#0f0';
michael@0 13908 ctx.lineWidth = 100;
michael@0 13909 ctx.rect(200, 100, 400, 1000);
michael@0 13910 ctx.lineTo(-2000, -1000);
michael@0 13911 ctx.stroke();
michael@0 13912 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 13913
michael@0 13914
michael@0 13915 }
michael@0 13916 </script>
michael@0 13917
michael@0 13918 <!-- [[[ test_2d.path.rect.end.2.html ]]] -->
michael@0 13919
michael@0 13920 <p>Canvas test: 2d.path.rect.end.2</p>
michael@0 13921 <canvas id="c430" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13922 <script>
michael@0 13923
michael@0 13924
michael@0 13925 function test_2d_path_rect_end_2() {
michael@0 13926
michael@0 13927 var canvas = document.getElementById('c430');
michael@0 13928 var ctx = canvas.getContext('2d');
michael@0 13929
michael@0 13930 ctx.strokeStyle = '#0f0';
michael@0 13931 ctx.lineWidth = 450;
michael@0 13932 ctx.lineCap = 'round';
michael@0 13933 ctx.lineJoin = 'bevel';
michael@0 13934 ctx.rect(150, 150, 2000, 2000);
michael@0 13935 ctx.lineTo(160, 160);
michael@0 13936 ctx.stroke();
michael@0 13937 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 13938 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 13939 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 13940 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 13941
michael@0 13942
michael@0 13943 }
michael@0 13944 </script>
michael@0 13945
michael@0 13946 <!-- [[[ test_2d.path.rect.negative.html ]]] -->
michael@0 13947
michael@0 13948 <p>Canvas test: 2d.path.rect.negative</p>
michael@0 13949 <canvas id="c431" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13950 <script>
michael@0 13951
michael@0 13952
michael@0 13953 function test_2d_path_rect_negative() {
michael@0 13954
michael@0 13955 var canvas = document.getElementById('c431');
michael@0 13956 var ctx = canvas.getContext('2d');
michael@0 13957
michael@0 13958 ctx.fillStyle = '#f00';
michael@0 13959 ctx.fillRect(0, 0, 100, 50);
michael@0 13960 ctx.beginPath();
michael@0 13961 ctx.fillStyle = '#0f0';
michael@0 13962 ctx.rect(0, 0, 50, 25);
michael@0 13963 ctx.rect(100, 0, -50, 25);
michael@0 13964 ctx.rect(0, 50, 50, -25);
michael@0 13965 ctx.rect(100, 50, -50, -25);
michael@0 13966 ctx.fill();
michael@0 13967 isPixel(ctx, 25,12, 0,255,0,255, 0);
michael@0 13968 isPixel(ctx, 75,12, 0,255,0,255, 0);
michael@0 13969 isPixel(ctx, 25,37, 0,255,0,255, 0);
michael@0 13970 isPixel(ctx, 75,37, 0,255,0,255, 0);
michael@0 13971
michael@0 13972
michael@0 13973 }
michael@0 13974 </script>
michael@0 13975
michael@0 13976 <!-- [[[ test_2d.path.rect.newsubpath.html ]]] -->
michael@0 13977
michael@0 13978 <p>Canvas test: 2d.path.rect.newsubpath</p>
michael@0 13979 <canvas id="c432" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 13980 <script>
michael@0 13981
michael@0 13982
michael@0 13983 function test_2d_path_rect_newsubpath() {
michael@0 13984
michael@0 13985 var canvas = document.getElementById('c432');
michael@0 13986 var ctx = canvas.getContext('2d');
michael@0 13987
michael@0 13988 ctx.beginPath();
michael@0 13989 ctx.strokeStyle = '#f00';
michael@0 13990 ctx.lineWidth = 50;
michael@0 13991 ctx.moveTo(-100, 25);
michael@0 13992 ctx.lineTo(-50, 25);
michael@0 13993 ctx.rect(200, 25, 1, 1);
michael@0 13994 ctx.stroke();
michael@0 13995 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 13996
michael@0 13997
michael@0 13998 }
michael@0 13999 </script>
michael@0 14000
michael@0 14001 <!-- [[[ test_2d.path.rect.nonfinite.html ]]] -->
michael@0 14002
michael@0 14003 <p>Canvas test: 2d.path.rect.nonfinite</p>
michael@0 14004 <!-- Testing: rect() with Infinity/NaN is ignored -->
michael@0 14005 <canvas id="c433" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14006 <script>
michael@0 14007
michael@0 14008
michael@0 14009 function test_2d_path_rect_nonfinite() {
michael@0 14010
michael@0 14011 var canvas = document.getElementById('c433');
michael@0 14012 var ctx = canvas.getContext('2d');
michael@0 14013
michael@0 14014 var _thrown_outer = false;
michael@0 14015 try {
michael@0 14016
michael@0 14017 ctx.moveTo(0, 0);
michael@0 14018 ctx.lineTo(100, 0);
michael@0 14019 ctx.rect(Infinity, 50, 1, 1);
michael@0 14020 ctx.rect(-Infinity, 50, 1, 1);
michael@0 14021 ctx.rect(NaN, 50, 1, 1);
michael@0 14022 ctx.rect(0, Infinity, 1, 1);
michael@0 14023 ctx.rect(0, -Infinity, 1, 1);
michael@0 14024 ctx.rect(0, NaN, 1, 1);
michael@0 14025 ctx.rect(0, 50, Infinity, 1);
michael@0 14026 ctx.rect(0, 50, -Infinity, 1);
michael@0 14027 ctx.rect(0, 50, NaN, 1);
michael@0 14028 ctx.rect(0, 50, 1, Infinity);
michael@0 14029 ctx.rect(0, 50, 1, -Infinity);
michael@0 14030 ctx.rect(0, 50, 1, NaN);
michael@0 14031 ctx.rect(Infinity, Infinity, 1, 1);
michael@0 14032 ctx.rect(Infinity, Infinity, Infinity, 1);
michael@0 14033 ctx.rect(Infinity, Infinity, Infinity, Infinity);
michael@0 14034 ctx.rect(Infinity, Infinity, 1, Infinity);
michael@0 14035 ctx.rect(Infinity, 50, Infinity, 1);
michael@0 14036 ctx.rect(Infinity, 50, Infinity, Infinity);
michael@0 14037 ctx.rect(Infinity, 50, 1, Infinity);
michael@0 14038 ctx.rect(0, Infinity, Infinity, 1);
michael@0 14039 ctx.rect(0, Infinity, Infinity, Infinity);
michael@0 14040 ctx.rect(0, Infinity, 1, Infinity);
michael@0 14041 ctx.rect(0, 50, Infinity, Infinity);
michael@0 14042 ctx.lineTo(100, 50);
michael@0 14043 ctx.lineTo(0, 50);
michael@0 14044 ctx.fillStyle = '#0f0';
michael@0 14045 ctx.fill();
michael@0 14046 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14047 isPixel(ctx, 90,45, 0,255,0,255, 0);
michael@0 14048
michael@0 14049 } catch (e) {
michael@0 14050 _thrown_outer = true;
michael@0 14051 }
michael@0 14052 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 14053
michael@0 14054
michael@0 14055 }
michael@0 14056 </script>
michael@0 14057
michael@0 14058 <!-- [[[ test_2d.path.rect.selfintersect.html ]]] -->
michael@0 14059
michael@0 14060 <p>Canvas test: 2d.path.rect.selfintersect</p>
michael@0 14061 <canvas id="c434" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14062 <script>
michael@0 14063
michael@0 14064
michael@0 14065
michael@0 14066 function test_2d_path_rect_selfintersect() {
michael@0 14067
michael@0 14068 var canvas = document.getElementById('c434');
michael@0 14069 var ctx = canvas.getContext('2d');
michael@0 14070
michael@0 14071 ctx.strokeStyle = '#0f0';
michael@0 14072 ctx.lineWidth = 90;
michael@0 14073 ctx.beginPath();
michael@0 14074 ctx.rect(45, 20, 10, 10);
michael@0 14075 ctx.stroke();
michael@0 14076 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14077
michael@0 14078
michael@0 14079 }
michael@0 14080 </script>
michael@0 14081
michael@0 14082 <!-- [[[ test_2d.path.rect.winding.html ]]] -->
michael@0 14083
michael@0 14084 <p>Canvas test: 2d.path.rect.winding</p>
michael@0 14085 <canvas id="c435" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14086 <script>
michael@0 14087
michael@0 14088
michael@0 14089 function test_2d_path_rect_winding() {
michael@0 14090
michael@0 14091 var canvas = document.getElementById('c435');
michael@0 14092 var ctx = canvas.getContext('2d');
michael@0 14093
michael@0 14094 ctx.fillStyle = '#0f0';
michael@0 14095 ctx.fillRect(0, 0, 100, 50);
michael@0 14096 ctx.beginPath();
michael@0 14097 ctx.fillStyle = '#f00';
michael@0 14098 ctx.rect(0, 0, 50, 50);
michael@0 14099 ctx.rect(100, 50, -50, -50);
michael@0 14100 ctx.rect(0, 25, 100, -25);
michael@0 14101 ctx.rect(100, 25, -100, 25);
michael@0 14102 ctx.fill();
michael@0 14103 isPixel(ctx, 25,12, 0,255,0,255, 0);
michael@0 14104 isPixel(ctx, 75,12, 0,255,0,255, 0);
michael@0 14105 isPixel(ctx, 25,37, 0,255,0,255, 0);
michael@0 14106 isPixel(ctx, 75,37, 0,255,0,255, 0);
michael@0 14107
michael@0 14108
michael@0 14109 }
michael@0 14110 </script>
michael@0 14111
michael@0 14112 <!-- [[[ test_2d.path.rect.zero.1.html ]]] -->
michael@0 14113
michael@0 14114 <p>Canvas test: 2d.path.rect.zero.1</p>
michael@0 14115 <canvas id="c436" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14116 <script>
michael@0 14117
michael@0 14118
michael@0 14119 function test_2d_path_rect_zero_1() {
michael@0 14120
michael@0 14121 var canvas = document.getElementById('c436');
michael@0 14122 var ctx = canvas.getContext('2d');
michael@0 14123
michael@0 14124 ctx.strokeStyle = '#0f0';
michael@0 14125 ctx.lineWidth = 100;
michael@0 14126 ctx.beginPath();
michael@0 14127 ctx.rect(0, 50, 100, 0);
michael@0 14128 ctx.stroke();
michael@0 14129 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14130
michael@0 14131
michael@0 14132 }
michael@0 14133 </script>
michael@0 14134
michael@0 14135 <!-- [[[ test_2d.path.rect.zero.2.html ]]] -->
michael@0 14136
michael@0 14137 <p>Canvas test: 2d.path.rect.zero.2</p>
michael@0 14138 <canvas id="c437" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14139 <script>
michael@0 14140
michael@0 14141
michael@0 14142 function test_2d_path_rect_zero_2() {
michael@0 14143
michael@0 14144 var canvas = document.getElementById('c437');
michael@0 14145 var ctx = canvas.getContext('2d');
michael@0 14146
michael@0 14147 ctx.strokeStyle = '#0f0';
michael@0 14148 ctx.lineWidth = 100;
michael@0 14149 ctx.beginPath();
michael@0 14150 ctx.rect(50, -100, 0, 250);
michael@0 14151 ctx.stroke();
michael@0 14152 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14153
michael@0 14154
michael@0 14155 }
michael@0 14156 </script>
michael@0 14157
michael@0 14158 <!-- [[[ test_2d.path.rect.zero.3.html ]]] -->
michael@0 14159
michael@0 14160 <p>Canvas test: 2d.path.rect.zero.3</p>
michael@0 14161 <canvas id="c438" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14162 <script>
michael@0 14163
michael@0 14164
michael@0 14165 function test_2d_path_rect_zero_3() {
michael@0 14166
michael@0 14167 var canvas = document.getElementById('c438');
michael@0 14168 var ctx = canvas.getContext('2d');
michael@0 14169
michael@0 14170 if (!IsD2DEnabled()) {
michael@0 14171 // Disabled for D2D until we can figure out Bug 587554.
michael@0 14172 ctx.strokeStyle = '#f00';
michael@0 14173 ctx.lineWidth = 100;
michael@0 14174 ctx.beginPath();
michael@0 14175 ctx.rect(50, 25, 0, 0);
michael@0 14176 ctx.stroke();
michael@0 14177 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 14178 }
michael@0 14179
michael@0 14180 }
michael@0 14181 </script>
michael@0 14182
michael@0 14183 <!-- [[[ test_2d.path.rect.zero.4.html ]]] -->
michael@0 14184
michael@0 14185 <p>Canvas test: 2d.path.rect.zero.4</p>
michael@0 14186 <canvas id="c439" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14187 <script>
michael@0 14188
michael@0 14189
michael@0 14190 function test_2d_path_rect_zero_4() {
michael@0 14191
michael@0 14192 var canvas = document.getElementById('c439');
michael@0 14193 var ctx = canvas.getContext('2d');
michael@0 14194
michael@0 14195 ctx.strokeStyle = '#0f0';
michael@0 14196 ctx.lineWidth = 50;
michael@0 14197 ctx.rect(100, 25, 0, 0);
michael@0 14198 ctx.lineTo(0, 25);
michael@0 14199 ctx.stroke();
michael@0 14200 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14201
michael@0 14202
michael@0 14203 }
michael@0 14204 </script>
michael@0 14205
michael@0 14206 <!-- [[[ test_2d.path.rect.zero.5.html ]]] -->
michael@0 14207
michael@0 14208 <p>Canvas test: 2d.path.rect.zero.5</p>
michael@0 14209 <canvas id="c440" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14210 <script>
michael@0 14211
michael@0 14212
michael@0 14213 function test_2d_path_rect_zero_5() {
michael@0 14214
michael@0 14215 var canvas = document.getElementById('c440');
michael@0 14216 var ctx = canvas.getContext('2d');
michael@0 14217
michael@0 14218 ctx.strokeStyle = '#f00';
michael@0 14219 ctx.lineWidth = 50;
michael@0 14220 ctx.moveTo(0, 0);
michael@0 14221 ctx.rect(100, 25, 0, 0);
michael@0 14222 ctx.stroke();
michael@0 14223 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 14224
michael@0 14225
michael@0 14226 }
michael@0 14227 </script>
michael@0 14228
michael@0 14229 <!-- [[[ test_2d.path.rect.zero.6.html ]]] -->
michael@0 14230
michael@0 14231 <p>Canvas test: 2d.path.rect.zero.6</p>
michael@0 14232 <canvas id="c441" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14233 <script>
michael@0 14234
michael@0 14235
michael@0 14236
michael@0 14237 function test_2d_path_rect_zero_6() {
michael@0 14238
michael@0 14239 var canvas = document.getElementById('c441');
michael@0 14240 var ctx = canvas.getContext('2d');
michael@0 14241
michael@0 14242 ctx.strokeStyle = '#f00';
michael@0 14243 ctx.lineJoin = 'miter';
michael@0 14244 ctx.miterLimit = 1.5;
michael@0 14245 ctx.lineWidth = 200;
michael@0 14246 ctx.beginPath();
michael@0 14247 ctx.rect(100, 25, 1000, 0);
michael@0 14248 ctx.stroke();
michael@0 14249 todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 14250
michael@0 14251
michael@0 14252 }
michael@0 14253 </script>
michael@0 14254
michael@0 14255 <!-- [[[ test_2d.path.stroke.empty.html ]]] -->
michael@0 14256
michael@0 14257 <p>Canvas test: 2d.path.stroke.empty</p>
michael@0 14258 <!-- Testing: Empty subpaths are not stroked -->
michael@0 14259 <canvas id="c442" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14260 <script>
michael@0 14261
michael@0 14262
michael@0 14263 function test_2d_path_stroke_empty() {
michael@0 14264
michael@0 14265 var canvas = document.getElementById('c442');
michael@0 14266 var ctx = canvas.getContext('2d');
michael@0 14267
michael@0 14268 ctx.fillStyle = '#0f0';
michael@0 14269 ctx.fillRect(0, 0, 100, 50);
michael@0 14270
michael@0 14271 ctx.strokeStyle = '#f00';
michael@0 14272 ctx.lineWidth = 100;
michael@0 14273 ctx.lineCap = 'round';
michael@0 14274 ctx.lineJoin = 'round';
michael@0 14275
michael@0 14276 ctx.beginPath();
michael@0 14277 ctx.moveTo(40, 25);
michael@0 14278 ctx.moveTo(60, 25);
michael@0 14279 ctx.stroke();
michael@0 14280
michael@0 14281 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14282
michael@0 14283
michael@0 14284 }
michael@0 14285 </script>
michael@0 14286
michael@0 14287 <!-- [[[ test_2d.path.stroke.overlap.html ]]] -->
michael@0 14288
michael@0 14289 <p>Canvas test: 2d.path.stroke.overlap</p>
michael@0 14290 <!-- Testing: Stroked subpaths are combined before being drawn -->
michael@0 14291 <canvas id="c443" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14292 <script>
michael@0 14293
michael@0 14294
michael@0 14295 function test_2d_path_stroke_overlap() {
michael@0 14296
michael@0 14297 var canvas = document.getElementById('c443');
michael@0 14298 var ctx = canvas.getContext('2d');
michael@0 14299
michael@0 14300 ctx.fillStyle = '#000';
michael@0 14301 ctx.fillRect(0, 0, 100, 50);
michael@0 14302
michael@0 14303 ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';
michael@0 14304 ctx.lineWidth = 50;
michael@0 14305 ctx.moveTo(0, 20);
michael@0 14306 ctx.lineTo(100, 20);
michael@0 14307 ctx.moveTo(0, 30);
michael@0 14308 ctx.lineTo(100, 30);
michael@0 14309 ctx.stroke();
michael@0 14310
michael@0 14311 isPixel(ctx, 50,25, 0,127,0,255, 1);
michael@0 14312
michael@0 14313
michael@0 14314 }
michael@0 14315 </script>
michael@0 14316
michael@0 14317 <!-- [[[ test_2d.path.stroke.prune.arc.html ]]] -->
michael@0 14318
michael@0 14319 <p>Canvas test: 2d.path.stroke.prune.arc</p>
michael@0 14320 <!-- Testing: Zero-length line segments from arcTo and arc are removed before stroking -->
michael@0 14321 <canvas id="c444" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14322 <script>
michael@0 14323
michael@0 14324
michael@0 14325
michael@0 14326 function test_2d_path_stroke_prune_arc() {
michael@0 14327
michael@0 14328 var canvas = document.getElementById('c444');
michael@0 14329 var ctx = canvas.getContext('2d');
michael@0 14330
michael@0 14331 ctx.fillStyle = '#0f0';
michael@0 14332 ctx.fillRect(0, 0, 100, 50);
michael@0 14333
michael@0 14334 ctx.strokeStyle = '#f00';
michael@0 14335 ctx.lineWidth = 100;
michael@0 14336 ctx.lineCap = 'round';
michael@0 14337 ctx.lineJoin = 'round';
michael@0 14338
michael@0 14339 ctx.beginPath();
michael@0 14340 ctx.moveTo(50, 25);
michael@0 14341 ctx.arcTo(50, 25, 150, 25, 10);
michael@0 14342 ctx.stroke();
michael@0 14343
michael@0 14344 ctx.beginPath();
michael@0 14345 ctx.moveTo(50, 25);
michael@0 14346 ctx.arc(50, 25, 10, 0, 0, false);
michael@0 14347 ctx.stroke();
michael@0 14348
michael@0 14349 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14350
michael@0 14351
michael@0 14352 }
michael@0 14353 </script>
michael@0 14354
michael@0 14355 <!-- [[[ test_2d.path.stroke.prune.closed.html ]]] -->
michael@0 14356
michael@0 14357 <p>Canvas test: 2d.path.stroke.prune.closed</p>
michael@0 14358 <!-- Testing: Zero-length line segments from closed paths are removed before stroking -->
michael@0 14359 <canvas id="c445" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14360 <script>
michael@0 14361
michael@0 14362
michael@0 14363
michael@0 14364 function test_2d_path_stroke_prune_closed() {
michael@0 14365
michael@0 14366 var canvas = document.getElementById('c445');
michael@0 14367 var ctx = canvas.getContext('2d');
michael@0 14368
michael@0 14369 ctx.fillStyle = '#0f0';
michael@0 14370 ctx.fillRect(0, 0, 100, 50);
michael@0 14371
michael@0 14372 ctx.strokeStyle = '#f00';
michael@0 14373 ctx.lineWidth = 100;
michael@0 14374 ctx.lineCap = 'round';
michael@0 14375 ctx.lineJoin = 'round';
michael@0 14376
michael@0 14377 ctx.beginPath();
michael@0 14378 ctx.moveTo(50, 25);
michael@0 14379 ctx.lineTo(50, 25);
michael@0 14380 ctx.closePath();
michael@0 14381 ctx.stroke();
michael@0 14382
michael@0 14383 if (IsAzureSkia()) {
michael@0 14384 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14385 } else {
michael@0 14386 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14387 }
michael@0 14388
michael@0 14389 }
michael@0 14390 </script>
michael@0 14391
michael@0 14392 <!-- [[[ test_2d.path.stroke.prune.corner.html ]]] -->
michael@0 14393
michael@0 14394 <p>Canvas test: 2d.path.stroke.prune.corner</p>
michael@0 14395 <!-- Testing: Zero-length line segments are removed before stroking with miters -->
michael@0 14396 <canvas id="c446" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14397 <script>
michael@0 14398
michael@0 14399
michael@0 14400 function test_2d_path_stroke_prune_corner() {
michael@0 14401
michael@0 14402 var canvas = document.getElementById('c446');
michael@0 14403 var ctx = canvas.getContext('2d');
michael@0 14404
michael@0 14405 ctx.fillStyle = '#0f0';
michael@0 14406 ctx.fillRect(0, 0, 100, 50);
michael@0 14407
michael@0 14408 ctx.strokeStyle = '#f00';
michael@0 14409 ctx.lineWidth = 400;
michael@0 14410 ctx.lineJoin = 'miter';
michael@0 14411 ctx.miterLimit = 1.4;
michael@0 14412
michael@0 14413 ctx.beginPath();
michael@0 14414 ctx.moveTo(-1000, 200, 0, 0);
michael@0 14415 ctx.lineTo(-100, 200);
michael@0 14416 ctx.lineTo(-100, 200);
michael@0 14417 ctx.lineTo(-100, 200);
michael@0 14418 ctx.lineTo(-100, 1000);
michael@0 14419 ctx.stroke();
michael@0 14420
michael@0 14421 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14422
michael@0 14423
michael@0 14424 }
michael@0 14425 </script>
michael@0 14426
michael@0 14427 <!-- [[[ test_2d.path.stroke.prune.curve.html ]]] -->
michael@0 14428
michael@0 14429 <p>Canvas test: 2d.path.stroke.prune.curve</p>
michael@0 14430 <!-- Testing: Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking -->
michael@0 14431 <canvas id="c447" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14432 <script>
michael@0 14433
michael@0 14434
michael@0 14435
michael@0 14436 function test_2d_path_stroke_prune_curve() {
michael@0 14437
michael@0 14438 var canvas = document.getElementById('c447');
michael@0 14439 var ctx = canvas.getContext('2d');
michael@0 14440
michael@0 14441 ctx.fillStyle = '#0f0';
michael@0 14442 ctx.fillRect(0, 0, 100, 50);
michael@0 14443
michael@0 14444 ctx.strokeStyle = '#f00';
michael@0 14445 ctx.lineWidth = 100;
michael@0 14446 ctx.lineCap = 'round';
michael@0 14447 ctx.lineJoin = 'round';
michael@0 14448
michael@0 14449 ctx.beginPath();
michael@0 14450 ctx.moveTo(50, 25);
michael@0 14451 ctx.quadraticCurveTo(50, 25, 50, 25);
michael@0 14452 ctx.stroke();
michael@0 14453
michael@0 14454 ctx.beginPath();
michael@0 14455 ctx.moveTo(50, 25);
michael@0 14456 ctx.bezierCurveTo(50, 25, 50, 25, 50, 25);
michael@0 14457 ctx.stroke();
michael@0 14458
michael@0 14459 if (IsAzureSkia()) {
michael@0 14460 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14461 } else {
michael@0 14462 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14463 }
michael@0 14464
michael@0 14465
michael@0 14466 }
michael@0 14467 </script>
michael@0 14468
michael@0 14469 <!-- [[[ test_2d.path.stroke.prune.line.html ]]] -->
michael@0 14470
michael@0 14471 <p>Canvas test: 2d.path.stroke.prune.line</p>
michael@0 14472 <!-- Testing: Zero-length line segments from lineTo are removed before stroking -->
michael@0 14473 <canvas id="c448" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14474 <script>
michael@0 14475
michael@0 14476
michael@0 14477
michael@0 14478 function test_2d_path_stroke_prune_line() {
michael@0 14479
michael@0 14480 var canvas = document.getElementById('c448');
michael@0 14481 var ctx = canvas.getContext('2d');
michael@0 14482
michael@0 14483 ctx.fillStyle = '#0f0';
michael@0 14484 ctx.fillRect(0, 0, 100, 50);
michael@0 14485
michael@0 14486 ctx.strokeStyle = '#f00';
michael@0 14487 ctx.lineWidth = 100;
michael@0 14488 ctx.lineCap = 'round';
michael@0 14489 ctx.lineJoin = 'round';
michael@0 14490
michael@0 14491 ctx.beginPath();
michael@0 14492 ctx.moveTo(50, 25);
michael@0 14493 ctx.lineTo(50, 25);
michael@0 14494 ctx.stroke();
michael@0 14495
michael@0 14496 if (IsAzureSkia()) {
michael@0 14497 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14498 } else {
michael@0 14499 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14500 }
michael@0 14501
michael@0 14502 }
michael@0 14503 </script>
michael@0 14504
michael@0 14505 <!-- [[[ test_2d.path.stroke.prune.rect.html ]]] -->
michael@0 14506
michael@0 14507 <p>Canvas test: 2d.path.stroke.prune.rect</p>
michael@0 14508 <!-- Testing: Zero-length line segments from rect and strokeRect are removed before stroking -->
michael@0 14509 <canvas id="c449" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14510 <script>
michael@0 14511
michael@0 14512
michael@0 14513
michael@0 14514 function test_2d_path_stroke_prune_rect() {
michael@0 14515
michael@0 14516 var canvas = document.getElementById('c449');
michael@0 14517 var ctx = canvas.getContext('2d');
michael@0 14518
michael@0 14519 ctx.fillStyle = '#0f0';
michael@0 14520 ctx.fillRect(0, 0, 100, 50);
michael@0 14521
michael@0 14522 ctx.strokeStyle = '#f00';
michael@0 14523 ctx.lineWidth = 100;
michael@0 14524 ctx.lineCap = 'round';
michael@0 14525 ctx.lineJoin = 'round';
michael@0 14526
michael@0 14527 ctx.beginPath();
michael@0 14528 ctx.rect(50, 25, 0, 0);
michael@0 14529 ctx.stroke();
michael@0 14530
michael@0 14531 ctx.strokeRect(50, 25, 0, 0);
michael@0 14532
michael@0 14533 if (IsAzureSkia()) {
michael@0 14534 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14535 } else {
michael@0 14536 todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14537 }
michael@0 14538
michael@0 14539 }
michael@0 14540 </script>
michael@0 14541
michael@0 14542 <!-- [[[ test_2d.path.stroke.scale1.html ]]] -->
michael@0 14543
michael@0 14544 <p>Canvas test: 2d.path.stroke.scale1</p>
michael@0 14545 <!-- Testing: Stroke line widths are scaled by the current transformation matrix -->
michael@0 14546 <canvas id="c450" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14547 <script>
michael@0 14548
michael@0 14549
michael@0 14550 function test_2d_path_stroke_scale1() {
michael@0 14551
michael@0 14552 var canvas = document.getElementById('c450');
michael@0 14553 var ctx = canvas.getContext('2d');
michael@0 14554
michael@0 14555 ctx.fillStyle = '#f00';
michael@0 14556 ctx.fillRect(0, 0, 100, 50);
michael@0 14557
michael@0 14558 ctx.beginPath();
michael@0 14559 ctx.rect(25, 12.5, 50, 25);
michael@0 14560 ctx.save();
michael@0 14561 ctx.scale(50, 25);
michael@0 14562 ctx.strokeStyle = '#0f0';
michael@0 14563 ctx.stroke();
michael@0 14564 ctx.restore();
michael@0 14565
michael@0 14566 ctx.beginPath();
michael@0 14567 ctx.rect(-25, -12.5, 150, 75);
michael@0 14568 ctx.save();
michael@0 14569 ctx.scale(50, 25);
michael@0 14570 ctx.strokeStyle = '#f00';
michael@0 14571 ctx.stroke();
michael@0 14572 ctx.restore();
michael@0 14573
michael@0 14574 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 14575 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 14576 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 14577 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 14578 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14579 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 14580 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 14581 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 14582 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 14583
michael@0 14584
michael@0 14585 }
michael@0 14586 </script>
michael@0 14587
michael@0 14588 <!-- [[[ test_2d.path.stroke.scale2.html ]]] -->
michael@0 14589
michael@0 14590 <p>Canvas test: 2d.path.stroke.scale2</p>
michael@0 14591 <!-- Testing: Stroke line widths are scaled by the current transformation matrix -->
michael@0 14592 <canvas id="c451" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14593 <script>
michael@0 14594
michael@0 14595
michael@0 14596 function test_2d_path_stroke_scale2() {
michael@0 14597
michael@0 14598 var canvas = document.getElementById('c451');
michael@0 14599 var ctx = canvas.getContext('2d');
michael@0 14600
michael@0 14601 if (!IsD2DEnabled()) {
michael@0 14602 // On D2D a rasterization bug causes a small discrepancy here. See bug 587316
michael@0 14603 ctx.fillStyle = '#f00';
michael@0 14604 ctx.fillRect(0, 0, 100, 50);
michael@0 14605
michael@0 14606 ctx.beginPath();
michael@0 14607 ctx.rect(25, 12.5, 50, 25);
michael@0 14608 ctx.save();
michael@0 14609 ctx.rotate(Math.PI/2);
michael@0 14610 ctx.scale(25, 50);
michael@0 14611 ctx.strokeStyle = '#0f0';
michael@0 14612 ctx.stroke();
michael@0 14613 ctx.restore();
michael@0 14614
michael@0 14615 ctx.beginPath();
michael@0 14616 ctx.rect(-25, -12.5, 150, 75);
michael@0 14617 ctx.save();
michael@0 14618 ctx.rotate(Math.PI/2);
michael@0 14619 ctx.scale(25, 50);
michael@0 14620 ctx.strokeStyle = '#f00';
michael@0 14621 ctx.stroke();
michael@0 14622 ctx.restore();
michael@0 14623
michael@0 14624 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 14625 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 14626 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 14627 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 14628 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14629 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 14630 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 14631 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 14632 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 14633 }
michael@0 14634
michael@0 14635 }
michael@0 14636 </script>
michael@0 14637
michael@0 14638 <!-- [[[ test_2d.path.stroke.skew.html ]]] -->
michael@0 14639
michael@0 14640 <p>Canvas test: 2d.path.stroke.skew</p>
michael@0 14641 <!-- Testing: Strokes lines are skewed by the current transformation matrix -->
michael@0 14642 <canvas id="c452" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14643 <script>
michael@0 14644
michael@0 14645
michael@0 14646 function test_2d_path_stroke_skew() {
michael@0 14647
michael@0 14648 var canvas = document.getElementById('c452');
michael@0 14649 var ctx = canvas.getContext('2d');
michael@0 14650
michael@0 14651 ctx.fillStyle = '#f00';
michael@0 14652 ctx.fillRect(0, 0, 100, 50);
michael@0 14653
michael@0 14654 ctx.save();
michael@0 14655 ctx.beginPath();
michael@0 14656 ctx.moveTo(49, -50);
michael@0 14657 ctx.lineTo(201, -50);
michael@0 14658 ctx.rotate(Math.PI/4);
michael@0 14659 ctx.scale(1, 283);
michael@0 14660 ctx.strokeStyle = '#0f0';
michael@0 14661 ctx.stroke();
michael@0 14662 ctx.restore();
michael@0 14663
michael@0 14664 ctx.save();
michael@0 14665 ctx.beginPath();
michael@0 14666 ctx.translate(-150, 0);
michael@0 14667 ctx.moveTo(49, -50);
michael@0 14668 ctx.lineTo(199, -50);
michael@0 14669 ctx.rotate(Math.PI/4);
michael@0 14670 ctx.scale(1, 142);
michael@0 14671 ctx.strokeStyle = '#f00';
michael@0 14672 ctx.stroke();
michael@0 14673 ctx.restore();
michael@0 14674
michael@0 14675 ctx.save();
michael@0 14676 ctx.beginPath();
michael@0 14677 ctx.translate(-150, 0);
michael@0 14678 ctx.moveTo(49, -50);
michael@0 14679 ctx.lineTo(199, -50);
michael@0 14680 ctx.rotate(Math.PI/4);
michael@0 14681 ctx.scale(1, 142);
michael@0 14682 ctx.strokeStyle = '#f00';
michael@0 14683 ctx.stroke();
michael@0 14684 ctx.restore();
michael@0 14685
michael@0 14686 isPixel(ctx, 0,0, 0,255,0,255, 0);
michael@0 14687 isPixel(ctx, 50,0, 0,255,0,255, 0);
michael@0 14688 isPixel(ctx, 99,0, 0,255,0,255, 0);
michael@0 14689 isPixel(ctx, 0,25, 0,255,0,255, 0);
michael@0 14690 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14691 isPixel(ctx, 99,25, 0,255,0,255, 0);
michael@0 14692 isPixel(ctx, 0,49, 0,255,0,255, 0);
michael@0 14693 isPixel(ctx, 50,49, 0,255,0,255, 0);
michael@0 14694 isPixel(ctx, 99,49, 0,255,0,255, 0);
michael@0 14695
michael@0 14696 }
michael@0 14697 </script>
michael@0 14698
michael@0 14699 <!-- [[[ test_2d.path.stroke.unaffected.html ]]] -->
michael@0 14700
michael@0 14701 <p>Canvas test: 2d.path.stroke.unaffected</p>
michael@0 14702 <!-- Testing: Stroking does not start a new path or subpath -->
michael@0 14703 <canvas id="c453" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14704 <script>
michael@0 14705
michael@0 14706
michael@0 14707 function test_2d_path_stroke_unaffected() {
michael@0 14708
michael@0 14709 var canvas = document.getElementById('c453');
michael@0 14710 var ctx = canvas.getContext('2d');
michael@0 14711
michael@0 14712 ctx.fillStyle = '#f00';
michael@0 14713 ctx.fillRect(0, 0, 100, 50);
michael@0 14714
michael@0 14715 ctx.lineWidth = 50;
michael@0 14716 ctx.moveTo(-100, 25);
michael@0 14717 ctx.lineTo(-100, -100);
michael@0 14718 ctx.lineTo(200, -100);
michael@0 14719 ctx.lineTo(200, 25);
michael@0 14720 ctx.strokeStyle = '#f00';
michael@0 14721 ctx.stroke();
michael@0 14722
michael@0 14723 ctx.closePath();
michael@0 14724 ctx.strokeStyle = '#0f0';
michael@0 14725 ctx.stroke();
michael@0 14726
michael@0 14727 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14728
michael@0 14729
michael@0 14730 }
michael@0 14731 </script>
michael@0 14732
michael@0 14733 <!-- [[[ test_2d.path.stroke.union.html ]]] -->
michael@0 14734
michael@0 14735 <p>Canvas test: 2d.path.stroke.union</p>
michael@0 14736 <!-- Testing: Strokes in opposite directions are unioned, not subtracted -->
michael@0 14737 <canvas id="c454" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14738 <script>
michael@0 14739
michael@0 14740
michael@0 14741 function test_2d_path_stroke_union() {
michael@0 14742
michael@0 14743 var canvas = document.getElementById('c454');
michael@0 14744 var ctx = canvas.getContext('2d');
michael@0 14745
michael@0 14746 ctx.fillStyle = '#f00';
michael@0 14747 ctx.fillRect(0, 0, 100, 50);
michael@0 14748
michael@0 14749 ctx.strokeStyle = '#0f0';
michael@0 14750 ctx.lineWidth = 40;
michael@0 14751 ctx.moveTo(0, 10);
michael@0 14752 ctx.lineTo(100, 10);
michael@0 14753 ctx.moveTo(100, 40);
michael@0 14754 ctx.lineTo(0, 40);
michael@0 14755 ctx.stroke();
michael@0 14756
michael@0 14757 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14758
michael@0 14759
michael@0 14760 }
michael@0 14761 </script>
michael@0 14762
michael@0 14763 <!-- [[[ test_2d.path.transformation.basic.html ]]] -->
michael@0 14764
michael@0 14765 <p>Canvas test: 2d.path.transformation.basic</p>
michael@0 14766 <canvas id="c455" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14767 <script>
michael@0 14768
michael@0 14769
michael@0 14770 function test_2d_path_transformation_basic() {
michael@0 14771
michael@0 14772 var canvas = document.getElementById('c455');
michael@0 14773 var ctx = canvas.getContext('2d');
michael@0 14774
michael@0 14775 ctx.fillStyle = '#f00';
michael@0 14776 ctx.fillRect(0, 0, 100, 50);
michael@0 14777
michael@0 14778 ctx.translate(-100, 0);
michael@0 14779 ctx.rect(100, 0, 100, 50);
michael@0 14780 ctx.translate(0, -100);
michael@0 14781 ctx.fillStyle = '#0f0';
michael@0 14782 ctx.fill();
michael@0 14783
michael@0 14784 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14785
michael@0 14786
michael@0 14787 }
michael@0 14788 </script>
michael@0 14789
michael@0 14790 <!-- [[[ test_2d.path.transformation.changing.html ]]] -->
michael@0 14791
michael@0 14792 <p>Canvas test: 2d.path.transformation.changing</p>
michael@0 14793 <!-- Testing: Transformations are applied while building paths, not when drawing -->
michael@0 14794 <canvas id="c456" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14795 <script>
michael@0 14796
michael@0 14797
michael@0 14798 function test_2d_path_transformation_changing() {
michael@0 14799
michael@0 14800 var canvas = document.getElementById('c456');
michael@0 14801 var ctx = canvas.getContext('2d');
michael@0 14802
michael@0 14803 ctx.fillStyle = '#f00';
michael@0 14804 ctx.fillRect(0, 0, 100, 50);
michael@0 14805 ctx.fillStyle = '#0f0';
michael@0 14806 ctx.moveTo(0, 0);
michael@0 14807 ctx.translate(100, 0);
michael@0 14808 ctx.lineTo(0, 0);
michael@0 14809 ctx.translate(0, 50);
michael@0 14810 ctx.lineTo(0, 0);
michael@0 14811 ctx.translate(-100, 0);
michael@0 14812 ctx.lineTo(0, 0);
michael@0 14813 ctx.translate(1000, 1000);
michael@0 14814 ctx.rotate(Math.PI/2);
michael@0 14815 ctx.scale(0.1, 0.1);
michael@0 14816 ctx.fill();
michael@0 14817
michael@0 14818 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14819
michael@0 14820
michael@0 14821 }
michael@0 14822 </script>
michael@0 14823
michael@0 14824 <!-- [[[ test_2d.path.transformation.multiple.html ]]] -->
michael@0 14825
michael@0 14826 <p>Canvas test: 2d.path.transformation.multiple</p>
michael@0 14827 <canvas id="c457" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14828 <script>
michael@0 14829
michael@0 14830
michael@0 14831 function test_2d_path_transformation_multiple() {
michael@0 14832
michael@0 14833 var canvas = document.getElementById('c457');
michael@0 14834 var ctx = canvas.getContext('2d');
michael@0 14835
michael@0 14836 ctx.fillStyle = '#f00';
michael@0 14837 ctx.fillRect(0, 0, 100, 50);
michael@0 14838
michael@0 14839 ctx.rect(0, 0, 100, 50);
michael@0 14840 ctx.fill();
michael@0 14841 ctx.translate(-100, 0);
michael@0 14842 ctx.fillStyle = '#0f0';
michael@0 14843 ctx.fill();
michael@0 14844
michael@0 14845 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14846
michael@0 14847
michael@0 14848 }
michael@0 14849 </script>
michael@0 14850
michael@0 14851 <!-- [[[ test_2d.pattern.animated.gif.html ]]] -->
michael@0 14852
michael@0 14853 <p>Canvas test: 2d.pattern.animated.gif</p>
michael@0 14854 <!-- Testing: createPattern() of an animated GIF draws the first frame -->
michael@0 14855 <canvas id="c458" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14856 <script>
michael@0 14857
michael@0 14858 var canvas458 = document.getElementById('c458');
michael@0 14859 var ctx458 = canvas458.getContext('2d');
michael@0 14860 var isDone_test_2d_pattern_animated_gif = false;
michael@0 14861
michael@0 14862 function test_2d_pattern_animated_gif() {
michael@0 14863
michael@0 14864 deferTest();
michael@0 14865 setTimeout(function () {
michael@0 14866 var pattern = ctx458.createPattern(document.getElementById('anim-gr_2.gif'), 'repeat');
michael@0 14867 ctx458.fillStyle = pattern;
michael@0 14868 ctx458.fillRect(0, 0, 50, 50);
michael@0 14869 setTimeout(wrapFunction(function () {
michael@0 14870 ctx458.fillRect(50, 0, 50, 50);
michael@0 14871 isPixel(ctx458, 25,25, 0,255,0,255, 2);
michael@0 14872 isPixel(ctx458, 75,25, 0,255,0,255, 2);
michael@0 14873 isDone_test_2d_pattern_animated_gif = true;
michael@0 14874 }), 2500);
michael@0 14875 }, 2500);
michael@0 14876
michael@0 14877
michael@0 14878 }
michael@0 14879 </script>
michael@0 14880 <img src="image_anim-gr.gif" id="anim-gr_2.gif" class="resource">
michael@0 14881
michael@0 14882 <!-- [[[ test_2d.pattern.basic.canvas.html ]]] -->
michael@0 14883
michael@0 14884 <p>Canvas test: 2d.pattern.basic.canvas</p>
michael@0 14885 <canvas id="c459" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14886 <script>
michael@0 14887
michael@0 14888
michael@0 14889 function test_2d_pattern_basic_canvas() {
michael@0 14890
michael@0 14891 var canvas = document.getElementById('c459');
michael@0 14892 var ctx = canvas.getContext('2d');
michael@0 14893
michael@0 14894 ctx.fillStyle = '#f00';
michael@0 14895 ctx.fillRect(0, 0, 100, 50);
michael@0 14896
michael@0 14897 var canvas2 = document.createElement('canvas');
michael@0 14898 canvas2.width = 100;
michael@0 14899 canvas2.height = 50;
michael@0 14900 var ctx2 = canvas2.getContext('2d');
michael@0 14901 ctx2.fillStyle = '#0f0';
michael@0 14902 ctx2.fillRect(0, 0, 100, 50);
michael@0 14903
michael@0 14904 var pattern = ctx.createPattern(canvas2, 'no-repeat');
michael@0 14905 ctx.fillStyle = pattern;
michael@0 14906 ctx.fillRect(0, 0, 100, 50);
michael@0 14907
michael@0 14908 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 14909 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 14910 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 14911 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 14912 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 14913 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 14914 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 14915 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 14916 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 14917
michael@0 14918
michael@0 14919 }
michael@0 14920 </script>
michael@0 14921
michael@0 14922 <!-- [[[ test_2d.pattern.basic.image.html ]]] -->
michael@0 14923
michael@0 14924 <p>Canvas test: 2d.pattern.basic.image</p>
michael@0 14925 <canvas id="c460" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14926 <script>
michael@0 14927
michael@0 14928
michael@0 14929 function test_2d_pattern_basic_image() {
michael@0 14930
michael@0 14931 var canvas = document.getElementById('c460');
michael@0 14932 var ctx = canvas.getContext('2d');
michael@0 14933
michael@0 14934 ctx.fillStyle = '#f00';
michael@0 14935 ctx.fillRect(0, 0, 100, 50);
michael@0 14936 var img = document.getElementById('green_8.png');
michael@0 14937 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 14938 ctx.fillStyle = pattern;
michael@0 14939 ctx.fillRect(0, 0, 100, 50);
michael@0 14940
michael@0 14941 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 14942 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 14943 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 14944 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 14945
michael@0 14946
michael@0 14947 }
michael@0 14948 </script>
michael@0 14949 <img src="image_green.png" id="green_8.png" class="resource">
michael@0 14950
michael@0 14951 <!-- [[[ test_2d.pattern.basic.nocontext.html ]]] -->
michael@0 14952
michael@0 14953 <p>Canvas test: 2d.pattern.basic.nocontext</p>
michael@0 14954 <canvas id="c461" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14955 <script>
michael@0 14956
michael@0 14957
michael@0 14958 function test_2d_pattern_basic_nocontext() {
michael@0 14959
michael@0 14960 var canvas = document.getElementById('c461');
michael@0 14961 var ctx = canvas.getContext('2d');
michael@0 14962
michael@0 14963 var canvas2 = document.createElement('canvas');
michael@0 14964 canvas2.width = 100;
michael@0 14965 canvas2.height = 50;
michael@0 14966 var pattern = ctx.createPattern(canvas2, 'no-repeat');
michael@0 14967
michael@0 14968 ctx.fillStyle = '#0f0';
michael@0 14969 ctx.fillRect(0, 0, 100, 50);
michael@0 14970 ctx.fillStyle = pattern;
michael@0 14971 ctx.fillRect(0, 0, 100, 50);
michael@0 14972
michael@0 14973 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 14974 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 14975 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 14976 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 14977
michael@0 14978
michael@0 14979 }
michael@0 14980 </script>
michael@0 14981
michael@0 14982 <!-- [[[ test_2d.pattern.basic.type.html ]]] -->
michael@0 14983
michael@0 14984 <p>Canvas test: 2d.pattern.basic.type</p>
michael@0 14985 <canvas id="c462" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 14986 <script>
michael@0 14987
michael@0 14988 function test_2d_pattern_basic_type() {
michael@0 14989
michael@0 14990 var canvas = document.getElementById('c462');
michael@0 14991 var ctx = canvas.getContext('2d');
michael@0 14992
michael@0 14993 ok(window.CanvasPattern !== undefined, "window.CanvasPattern !== undefined");
michael@0 14994
michael@0 14995 window.CanvasPattern.prototype.thisImplementsCanvasPattern = true;
michael@0 14996
michael@0 14997 var img = document.getElementById('green_9.png');
michael@0 14998 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 14999 ok(pattern.thisImplementsCanvasPattern, "pattern.thisImplementsCanvasPattern");
michael@0 15000
michael@0 15001
michael@0 15002 }
michael@0 15003 </script>
michael@0 15004 <img src="image_green.png" id="green_9.png" class="resource">
michael@0 15005
michael@0 15006 <!-- [[[ test_2d.pattern.basic.zerocanvas.html ]]] -->
michael@0 15007
michael@0 15008 <p>Canvas test: 2d.pattern.basic.zerocanvas</p>
michael@0 15009 <canvas id="c463" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15010 <script>
michael@0 15011
michael@0 15012
michael@0 15013
michael@0 15014 function test_2d_pattern_basic_zerocanvas() {
michael@0 15015
michael@0 15016 var canvas = document.getElementById('c463');
michael@0 15017 var ctx = canvas.getContext('2d');
michael@0 15018
michael@0 15019 canvas.width = 0;
michael@0 15020 canvas.height = 10;
michael@0 15021 ok(canvas.width === 0, "canvas.width === 0");
michael@0 15022 ok(canvas.height === 10, "canvas.height === 10");
michael@0 15023 var _thrown = undefined; try {
michael@0 15024 ctx.createPattern(canvas, 'repeat');
michael@0 15025 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 15026
michael@0 15027 canvas.width = 10;
michael@0 15028 canvas.height = 0;
michael@0 15029 ok(canvas.width === 10, "canvas.width === 10");
michael@0 15030 ok(canvas.height === 0, "canvas.height === 0");
michael@0 15031 var _thrown = undefined; try {
michael@0 15032 ctx.createPattern(canvas, 'repeat');
michael@0 15033 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 15034
michael@0 15035 canvas.width = 0;
michael@0 15036 canvas.height = 0;
michael@0 15037 ok(canvas.width === 0, "canvas.width === 0");
michael@0 15038 ok(canvas.height === 0, "canvas.height === 0");
michael@0 15039 var _thrown = undefined; try {
michael@0 15040 ctx.createPattern(canvas, 'repeat');
michael@0 15041 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 15042
michael@0 15043
michael@0 15044 }
michael@0 15045 </script>
michael@0 15046
michael@0 15047 <!-- [[[ test_2d.pattern.crosscanvas.html ]]] -->
michael@0 15048
michael@0 15049 <p>Canvas test: 2d.pattern.crosscanvas</p>
michael@0 15050 <canvas id="c464" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15051 <script>
michael@0 15052
michael@0 15053
michael@0 15054 function test_2d_pattern_crosscanvas() {
michael@0 15055
michael@0 15056 var canvas = document.getElementById('c464');
michael@0 15057 var ctx = canvas.getContext('2d');
michael@0 15058
michael@0 15059 var img = document.getElementById('green_10.png');
michael@0 15060
michael@0 15061 var pattern = document.createElement('canvas').getContext('2d').createPattern(img, 'no-repeat');
michael@0 15062 ctx.fillStyle = '#f00';
michael@0 15063 ctx.fillRect(0, 0, 100, 50);
michael@0 15064 ctx.fillStyle = pattern;
michael@0 15065 ctx.fillRect(0, 0, 100, 50);
michael@0 15066
michael@0 15067 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 15068
michael@0 15069
michael@0 15070 }
michael@0 15071 </script>
michael@0 15072 <img src="image_green.png" id="green_10.png" class="resource">
michael@0 15073
michael@0 15074 <!-- [[[ test_2d.pattern.image.broken.html ]]] -->
michael@0 15075
michael@0 15076 <p>Canvas test: 2d.pattern.image.broken</p>
michael@0 15077 <canvas id="c465" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15078 <script>
michael@0 15079
michael@0 15080 function test_2d_pattern_image_broken() {
michael@0 15081
michael@0 15082 var canvas = document.getElementById('c465');
michael@0 15083 var ctx = canvas.getContext('2d');
michael@0 15084
michael@0 15085 var img = document.getElementById('broken_2.png');
michael@0 15086 todo(img.complete === false, "img.complete === false");
michael@0 15087 var _thrown = undefined; try {
michael@0 15088 ctx.createPattern(img, 'repeat');
michael@0 15089 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 15090
michael@0 15091
michael@0 15092 }
michael@0 15093 </script>
michael@0 15094 <img src="image_broken.png" id="broken_2.png" class="resource">
michael@0 15095
michael@0 15096 <!-- [[[ test_2d.pattern.image.incomplete.html ]]] -->
michael@0 15097
michael@0 15098 <p>Canvas test: 2d.pattern.image.incomplete</p>
michael@0 15099 <canvas id="c466" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15100 <script>
michael@0 15101
michael@0 15102 function test_2d_pattern_image_incomplete() {
michael@0 15103
michael@0 15104 var canvas = document.getElementById('c466');
michael@0 15105 var ctx = canvas.getContext('2d');
michael@0 15106
michael@0 15107 var img = new Image();
michael@0 15108 todo(img.complete === false, "img.complete === false");
michael@0 15109 var _thrown = undefined; try {
michael@0 15110 ctx.createPattern(img, 'repeat');
michael@0 15111 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "InvalidStateError" && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw InvalidStateError");
michael@0 15112
michael@0 15113
michael@0 15114 }
michael@0 15115 </script>
michael@0 15116
michael@0 15117 <!-- [[[ test_2d.pattern.image.null.html ]]] -->
michael@0 15118
michael@0 15119 <p>Canvas test: 2d.pattern.image.null</p>
michael@0 15120 <canvas id="c467" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15121 <script>
michael@0 15122
michael@0 15123 function test_2d_pattern_image_null() {
michael@0 15124
michael@0 15125 var canvas = document.getElementById('c467');
michael@0 15126 var ctx = canvas.getContext('2d');
michael@0 15127
michael@0 15128 var _thrown = undefined; try {
michael@0 15129 ctx.createPattern(null, 'repeat');
michael@0 15130 } catch (e) { _thrown = e };
michael@0 15131 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 15132 }
michael@0 15133 </script>
michael@0 15134
michael@0 15135 <!-- [[[ test_2d.pattern.image.string.html ]]] -->
michael@0 15136
michael@0 15137 <p>Canvas test: 2d.pattern.image.string</p>
michael@0 15138 <canvas id="c468" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15139 <script>
michael@0 15140
michael@0 15141 function test_2d_pattern_image_string() {
michael@0 15142
michael@0 15143 var canvas = document.getElementById('c468');
michael@0 15144 var ctx = canvas.getContext('2d');
michael@0 15145
michael@0 15146 var _thrown = undefined; try {
michael@0 15147 ctx.createPattern('image_red.png', 'repeat');
michael@0 15148 } catch (e) { _thrown = e };
michael@0 15149 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 15150 }
michael@0 15151 </script>
michael@0 15152
michael@0 15153 <!-- [[[ test_2d.pattern.image.undefined.html ]]] -->
michael@0 15154
michael@0 15155 <p>Canvas test: 2d.pattern.image.undefined</p>
michael@0 15156 <canvas id="c469" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15157 <script>
michael@0 15158
michael@0 15159 function test_2d_pattern_image_undefined() {
michael@0 15160
michael@0 15161 var canvas = document.getElementById('c469');
michael@0 15162 var ctx = canvas.getContext('2d');
michael@0 15163
michael@0 15164 var _thrown = undefined; try {
michael@0 15165 ctx.createPattern(undefined, 'repeat');
michael@0 15166 } catch (e) { _thrown = e };
michael@0 15167 ok(_thrown && _thrown.name == "TypeError", "should throw TypeError");
michael@0 15168 }
michael@0 15169 </script>
michael@0 15170
michael@0 15171 <!-- [[[ test_2d.pattern.modify.canvas1.html ]]] -->
michael@0 15172
michael@0 15173 <p>Canvas test: 2d.pattern.modify.canvas1</p>
michael@0 15174 <canvas id="c470" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15175 <script>
michael@0 15176
michael@0 15177
michael@0 15178 function test_2d_pattern_modify_canvas1() {
michael@0 15179
michael@0 15180 var canvas = document.getElementById('c470');
michael@0 15181 var ctx = canvas.getContext('2d');
michael@0 15182
michael@0 15183 var canvas2 = document.createElement('canvas');
michael@0 15184 canvas2.width = 100;
michael@0 15185 canvas2.height = 50;
michael@0 15186 var ctx2 = canvas2.getContext('2d');
michael@0 15187 ctx2.fillStyle = '#0f0';
michael@0 15188 ctx2.fillRect(0, 0, 100, 50);
michael@0 15189
michael@0 15190 var pattern = ctx.createPattern(canvas2, 'no-repeat');
michael@0 15191
michael@0 15192 ctx2.fillStyle = '#f00';
michael@0 15193 ctx2.fillRect(0, 0, 100, 50);
michael@0 15194
michael@0 15195 ctx.fillStyle = pattern;
michael@0 15196 ctx.fillRect(0, 0, 100, 50);
michael@0 15197
michael@0 15198 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15199 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15200 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15201 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15202
michael@0 15203
michael@0 15204 }
michael@0 15205 </script>
michael@0 15206
michael@0 15207 <!-- [[[ test_2d.pattern.modify.canvas2.html ]]] -->
michael@0 15208
michael@0 15209 <p>Canvas test: 2d.pattern.modify.canvas2</p>
michael@0 15210 <canvas id="c471" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15211 <script>
michael@0 15212
michael@0 15213
michael@0 15214 function test_2d_pattern_modify_canvas2() {
michael@0 15215
michael@0 15216 var canvas = document.getElementById('c471');
michael@0 15217 var ctx = canvas.getContext('2d');
michael@0 15218
michael@0 15219 var canvas2 = document.createElement('canvas');
michael@0 15220 canvas2.width = 100;
michael@0 15221 canvas2.height = 50;
michael@0 15222 var ctx2 = canvas2.getContext('2d');
michael@0 15223 ctx2.fillStyle = '#0f0';
michael@0 15224 ctx2.fillRect(0, 0, 100, 50);
michael@0 15225
michael@0 15226 var pattern = ctx.createPattern(canvas2, 'no-repeat');
michael@0 15227 ctx.fillStyle = pattern;
michael@0 15228 ctx.fillRect(0, 0, 100, 50);
michael@0 15229 ctx.fillStyle = '#f00';
michael@0 15230 ctx.fillRect(0, 0, 100, 50);
michael@0 15231
michael@0 15232 ctx2.fillStyle = '#f00';
michael@0 15233 ctx2.fillRect(0, 0, 100, 50);
michael@0 15234
michael@0 15235 ctx.fillStyle = pattern;
michael@0 15236 ctx.fillRect(0, 0, 100, 50);
michael@0 15237
michael@0 15238 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15239 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15240 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15241 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15242
michael@0 15243
michael@0 15244 }
michael@0 15245 </script>
michael@0 15246
michael@0 15247 <!-- [[[ test_2d.pattern.modify.image1.html ]]] -->
michael@0 15248
michael@0 15249 <p>Canvas test: 2d.pattern.modify.image1</p>
michael@0 15250 <canvas id="c472" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15251 <script>
michael@0 15252
michael@0 15253 var canvas472 = document.getElementById('c472');
michael@0 15254 var ctx472 = canvas472.getContext('2d');
michael@0 15255
michael@0 15256 function test_2d_pattern_modify_image1() {
michael@0 15257
michael@0 15258 var img = document.getElementById('green_11.png');
michael@0 15259 var pattern = ctx472.createPattern(img, 'no-repeat');
michael@0 15260 deferTest();
michael@0 15261 img.onload = wrapFunction(function ()
michael@0 15262 {
michael@0 15263 ctx472.fillStyle = pattern;
michael@0 15264 ctx472.fillRect(0, 0, 100, 50);
michael@0 15265
michael@0 15266 isPixel(ctx472, 1,1, 0,255,0,255, 0);
michael@0 15267 isPixel(ctx472, 98,1, 0,255,0,255, 0);
michael@0 15268 isPixel(ctx472, 1,48, 0,255,0,255, 0);
michael@0 15269 isPixel(ctx472, 98,48, 0,255,0,255, 0);
michael@0 15270 });
michael@0 15271 img.src = 'image_red.png';
michael@0 15272
michael@0 15273
michael@0 15274 }
michael@0 15275 </script>
michael@0 15276 <img src="image_green.png" id="green_11.png" class="resource">
michael@0 15277
michael@0 15278 <!-- [[[ test_2d.pattern.modify.image2.html ]]] -->
michael@0 15279
michael@0 15280 <p>Canvas test: 2d.pattern.modify.image2</p>
michael@0 15281 <canvas id="c473" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15282 <script>
michael@0 15283
michael@0 15284
michael@0 15285 var canvas473 = document.getElementById('c473');
michael@0 15286 var ctx473 = canvas473.getContext('2d');
michael@0 15287
michael@0 15288 function test_2d_pattern_modify_image2() {
michael@0 15289
michael@0 15290 var img = document.getElementById('green_12.png');
michael@0 15291 var pattern = ctx473.createPattern(img, 'no-repeat');
michael@0 15292 ctx473.fillStyle = pattern;
michael@0 15293 ctx473.fillRect(0, 0, 100, 50);
michael@0 15294 ctx473.fillStyle = '#00f';
michael@0 15295 ctx473.fillRect(0, 0, 100, 50);
michael@0 15296 deferTest();
michael@0 15297 img.onload = wrapFunction(function ()
michael@0 15298 {
michael@0 15299 ctx473.fillStyle = pattern;
michael@0 15300 ctx473.fillRect(0, 0, 100, 50);
michael@0 15301
michael@0 15302 isPixel(ctx473, 1,1, 0,255,0,255, 0);
michael@0 15303 isPixel(ctx473, 98,1, 0,255,0,255, 0);
michael@0 15304 isPixel(ctx473, 1,48, 0,255,0,255, 0);
michael@0 15305 isPixel(ctx473, 98,48, 0,255,0,255, 0);
michael@0 15306 });
michael@0 15307 img.src = 'image_red.png';
michael@0 15308
michael@0 15309
michael@0 15310 }
michael@0 15311 </script>
michael@0 15312 <img src="image_green.png" id="green_12.png" class="resource">
michael@0 15313
michael@0 15314 <!-- [[[ test_2d.pattern.paint.norepeat.basic.html ]]] -->
michael@0 15315
michael@0 15316 <p>Canvas test: 2d.pattern.paint.norepeat.basic</p>
michael@0 15317 <canvas id="c474" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15318 <script>
michael@0 15319
michael@0 15320
michael@0 15321 function test_2d_pattern_paint_norepeat_basic() {
michael@0 15322
michael@0 15323 var canvas = document.getElementById('c474');
michael@0 15324 var ctx = canvas.getContext('2d');
michael@0 15325
michael@0 15326 ctx.fillStyle = '#f00';
michael@0 15327 ctx.fillRect(0, 0, 100, 50);
michael@0 15328
michael@0 15329 var img = document.getElementById('green_13.png');
michael@0 15330 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15331 ctx.fillStyle = pattern;
michael@0 15332 ctx.fillRect(0, 0, 100, 50);
michael@0 15333
michael@0 15334 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15335 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15336 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15337 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15338
michael@0 15339
michael@0 15340 }
michael@0 15341 </script>
michael@0 15342 <img src="image_green.png" id="green_13.png" class="resource">
michael@0 15343
michael@0 15344 <!-- [[[ test_2d.pattern.paint.norepeat.coord1.html ]]] -->
michael@0 15345
michael@0 15346 <p>Canvas test: 2d.pattern.paint.norepeat.coord1</p>
michael@0 15347 <canvas id="c475" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15348 <script>
michael@0 15349
michael@0 15350
michael@0 15351 function test_2d_pattern_paint_norepeat_coord1() {
michael@0 15352
michael@0 15353 var canvas = document.getElementById('c475');
michael@0 15354 var ctx = canvas.getContext('2d');
michael@0 15355
michael@0 15356 ctx.fillStyle = '#0f0';
michael@0 15357 ctx.fillRect(0, 0, 50, 50);
michael@0 15358 ctx.fillStyle = '#f00';
michael@0 15359 ctx.fillRect(50, 0, 50, 50);
michael@0 15360
michael@0 15361 var img = document.getElementById('green_14.png');
michael@0 15362 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15363 ctx.fillStyle = pattern;
michael@0 15364 ctx.translate(50, 0);
michael@0 15365 ctx.fillRect(-50, 0, 100, 50);
michael@0 15366
michael@0 15367 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15368 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15369 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15370 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15371
michael@0 15372
michael@0 15373 }
michael@0 15374 </script>
michael@0 15375 <img src="image_green.png" id="green_14.png" class="resource">
michael@0 15376
michael@0 15377 <!-- [[[ test_2d.pattern.paint.norepeat.coord2.html ]]] -->
michael@0 15378
michael@0 15379 <p>Canvas test: 2d.pattern.paint.norepeat.coord2</p>
michael@0 15380 <canvas id="c476" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15381 <script>
michael@0 15382
michael@0 15383
michael@0 15384 function test_2d_pattern_paint_norepeat_coord2() {
michael@0 15385
michael@0 15386 var canvas = document.getElementById('c476');
michael@0 15387 var ctx = canvas.getContext('2d');
michael@0 15388
michael@0 15389 var img = document.getElementById('green_15.png');
michael@0 15390 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15391 ctx.fillStyle = pattern;
michael@0 15392 ctx.fillRect(0, 0, 50, 50);
michael@0 15393
michael@0 15394 ctx.fillStyle = '#f00';
michael@0 15395 ctx.fillRect(50, 0, 50, 50);
michael@0 15396
michael@0 15397 ctx.fillStyle = pattern;
michael@0 15398 ctx.translate(50, 0);
michael@0 15399 ctx.fillRect(-50, 0, 100, 50);
michael@0 15400
michael@0 15401 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15402 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15403 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15404 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15405
michael@0 15406
michael@0 15407 }
michael@0 15408 </script>
michael@0 15409 <img src="image_green.png" id="green_15.png" class="resource">
michael@0 15410
michael@0 15411 <!-- [[[ test_2d.pattern.paint.norepeat.coord3.html ]]] -->
michael@0 15412
michael@0 15413 <p>Canvas test: 2d.pattern.paint.norepeat.coord3</p>
michael@0 15414 <canvas id="c477" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15415 <script>
michael@0 15416
michael@0 15417
michael@0 15418 function test_2d_pattern_paint_norepeat_coord3() {
michael@0 15419
michael@0 15420 var canvas = document.getElementById('c477');
michael@0 15421 var ctx = canvas.getContext('2d');
michael@0 15422
michael@0 15423 ctx.fillStyle = '#0f0';
michael@0 15424 ctx.fillRect(0, 0, 100, 50);
michael@0 15425
michael@0 15426 var img = document.getElementById('red_15.png');
michael@0 15427 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15428 ctx.fillStyle = pattern;
michael@0 15429 ctx.translate(50, 25);
michael@0 15430 ctx.fillRect(-50, -25, 100, 50);
michael@0 15431
michael@0 15432 ctx.fillStyle = '#0f0';
michael@0 15433 ctx.fillRect(0, 0, 50, 25);
michael@0 15434
michael@0 15435 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15436 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15437 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15438 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15439
michael@0 15440
michael@0 15441 }
michael@0 15442 </script>
michael@0 15443 <img src="image_red.png" id="red_15.png" class="resource">
michael@0 15444
michael@0 15445 <!-- [[[ test_2d.pattern.paint.norepeat.outside.html ]]] -->
michael@0 15446
michael@0 15447 <p>Canvas test: 2d.pattern.paint.norepeat.outside</p>
michael@0 15448 <canvas id="c478" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15449 <script>
michael@0 15450
michael@0 15451
michael@0 15452 function test_2d_pattern_paint_norepeat_outside() {
michael@0 15453
michael@0 15454 var canvas = document.getElementById('c478');
michael@0 15455 var ctx = canvas.getContext('2d');
michael@0 15456
michael@0 15457 ctx.fillStyle = '#f00';
michael@0 15458 ctx.fillRect(0, 0, 100, 50);
michael@0 15459
michael@0 15460 var img = document.getElementById('red_16.png');
michael@0 15461 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15462 ctx.fillStyle = '#0f0';
michael@0 15463 ctx.fillRect(0, 0, 100, 50);
michael@0 15464
michael@0 15465 ctx.fillStyle = pattern;
michael@0 15466 ctx.fillRect(0, -50, 100, 50);
michael@0 15467 ctx.fillRect(-100, 0, 100, 50);
michael@0 15468 ctx.fillRect(0, 50, 100, 50);
michael@0 15469 ctx.fillRect(100, 0, 100, 50);
michael@0 15470
michael@0 15471 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15472 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15473 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15474 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15475
michael@0 15476
michael@0 15477 }
michael@0 15478 </script>
michael@0 15479 <img src="image_red.png" id="red_16.png" class="resource">
michael@0 15480
michael@0 15481 <!-- [[[ test_2d.pattern.paint.orientation.canvas.html ]]] -->
michael@0 15482
michael@0 15483 <p>Canvas test: 2d.pattern.paint.orientation.canvas</p>
michael@0 15484 <!-- Testing: Canvas patterns do not get flipped when painted -->
michael@0 15485 <canvas id="c479" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15486 <script>
michael@0 15487
michael@0 15488
michael@0 15489 function test_2d_pattern_paint_orientation_canvas() {
michael@0 15490
michael@0 15491 var canvas = document.getElementById('c479');
michael@0 15492 var ctx = canvas.getContext('2d');
michael@0 15493
michael@0 15494 ctx.fillStyle = '#f00';
michael@0 15495 ctx.fillRect(0, 0, 100, 50);
michael@0 15496
michael@0 15497 var canvas2 = document.createElement('canvas');
michael@0 15498 canvas2.width = 100;
michael@0 15499 canvas2.height = 50;
michael@0 15500 var ctx2 = canvas2.getContext('2d');
michael@0 15501 ctx2.fillStyle = '#f00';
michael@0 15502 ctx2.fillRect(0, 0, 100, 25);
michael@0 15503 ctx2.fillStyle = '#0f0';
michael@0 15504 ctx2.fillRect(0, 25, 100, 25);
michael@0 15505
michael@0 15506 var pattern = ctx.createPattern(canvas2, 'no-repeat');
michael@0 15507 ctx.fillStyle = pattern;
michael@0 15508 ctx.fillRect(0, 0, 100, 50);
michael@0 15509 ctx.fillStyle = '#0f0';
michael@0 15510 ctx.fillRect(0, 0, 100, 25);
michael@0 15511
michael@0 15512 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15513 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15514 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15515 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15516
michael@0 15517
michael@0 15518 }
michael@0 15519 </script>
michael@0 15520
michael@0 15521 <!-- [[[ test_2d.pattern.paint.orientation.image.html ]]] -->
michael@0 15522
michael@0 15523 <p>Canvas test: 2d.pattern.paint.orientation.image</p>
michael@0 15524 <!-- Testing: Image patterns do not get flipped when painted -->
michael@0 15525 <canvas id="c480" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15526 <script>
michael@0 15527
michael@0 15528
michael@0 15529 function test_2d_pattern_paint_orientation_image() {
michael@0 15530
michael@0 15531 var canvas = document.getElementById('c480');
michael@0 15532 var ctx = canvas.getContext('2d');
michael@0 15533
michael@0 15534 ctx.fillStyle = '#f00';
michael@0 15535 ctx.fillRect(0, 0, 100, 50);
michael@0 15536
michael@0 15537 var img = document.getElementById('rrgg-256x256_1.png');
michael@0 15538 var pattern = ctx.createPattern(img, 'no-repeat');
michael@0 15539 ctx.fillStyle = pattern;
michael@0 15540 ctx.save();
michael@0 15541 ctx.translate(0, -103);
michael@0 15542 ctx.fillRect(0, 103, 100, 50);
michael@0 15543 ctx.restore();
michael@0 15544
michael@0 15545 ctx.fillStyle = '#0f0';
michael@0 15546 ctx.fillRect(0, 0, 100, 25);
michael@0 15547
michael@0 15548 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15549 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15550 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15551 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15552
michael@0 15553
michael@0 15554 }
michael@0 15555 </script>
michael@0 15556 <img src="image_rrgg-256x256.png" id="rrgg-256x256_1.png" class="resource">
michael@0 15557
michael@0 15558 <!-- [[[ test_2d.pattern.paint.repeat.basic.html ]]] -->
michael@0 15559
michael@0 15560 <p>Canvas test: 2d.pattern.paint.repeat.basic</p>
michael@0 15561 <canvas id="c481" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15562 <script>
michael@0 15563
michael@0 15564
michael@0 15565 function test_2d_pattern_paint_repeat_basic() {
michael@0 15566
michael@0 15567 var canvas = document.getElementById('c481');
michael@0 15568 var ctx = canvas.getContext('2d');
michael@0 15569
michael@0 15570 ctx.fillStyle = '#f00';
michael@0 15571 ctx.fillRect(0, 0, 100, 50);
michael@0 15572
michael@0 15573 var img = document.getElementById('green-16x16_1.png');
michael@0 15574 var pattern = ctx.createPattern(img, 'repeat');
michael@0 15575 ctx.fillStyle = pattern;
michael@0 15576 ctx.fillRect(0, 0, 100, 50);
michael@0 15577
michael@0 15578 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15579 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15580 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15581 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15582
michael@0 15583
michael@0 15584 }
michael@0 15585 </script>
michael@0 15586 <img src="image_green-16x16.png" id="green-16x16_1.png" class="resource">
michael@0 15587
michael@0 15588 <!-- [[[ test_2d.pattern.paint.repeat.coord1.html ]]] -->
michael@0 15589
michael@0 15590 <p>Canvas test: 2d.pattern.paint.repeat.coord1</p>
michael@0 15591 <canvas id="c482" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15592 <script>
michael@0 15593
michael@0 15594
michael@0 15595 function test_2d_pattern_paint_repeat_coord1() {
michael@0 15596
michael@0 15597 var canvas = document.getElementById('c482');
michael@0 15598 var ctx = canvas.getContext('2d');
michael@0 15599
michael@0 15600 ctx.fillStyle = '#f00';
michael@0 15601 ctx.fillRect(0, 0, 100, 50);
michael@0 15602
michael@0 15603 var img = document.getElementById('rgrg-256x256_3.png');
michael@0 15604 var pattern = ctx.createPattern(img, 'repeat');
michael@0 15605 ctx.fillStyle = pattern;
michael@0 15606 ctx.translate(-128, -78);
michael@0 15607 ctx.fillRect(128, 78, 100, 50);
michael@0 15608
michael@0 15609 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15610 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15611 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15612 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15613
michael@0 15614
michael@0 15615 }
michael@0 15616 </script>
michael@0 15617 <img src="image_rgrg-256x256.png" id="rgrg-256x256_3.png" class="resource">
michael@0 15618
michael@0 15619 <!-- [[[ test_2d.pattern.paint.repeat.coord2.html ]]] -->
michael@0 15620
michael@0 15621 <p>Canvas test: 2d.pattern.paint.repeat.coord2</p>
michael@0 15622 <canvas id="c483" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15623 <script>
michael@0 15624
michael@0 15625
michael@0 15626 function test_2d_pattern_paint_repeat_coord2() {
michael@0 15627
michael@0 15628 var canvas = document.getElementById('c483');
michael@0 15629 var ctx = canvas.getContext('2d');
michael@0 15630
michael@0 15631 var img = document.getElementById('ggrr-256x256_3.png');
michael@0 15632 var pattern = ctx.createPattern(img, 'repeat');
michael@0 15633 ctx.fillStyle = pattern;
michael@0 15634 ctx.fillRect(0, 0, 100, 50);
michael@0 15635
michael@0 15636 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15637 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15638 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15639 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15640
michael@0 15641
michael@0 15642 }
michael@0 15643 </script>
michael@0 15644 <img src="image_ggrr-256x256.png" id="ggrr-256x256_3.png" class="resource">
michael@0 15645
michael@0 15646 <!-- [[[ test_2d.pattern.paint.repeat.coord3.html ]]] -->
michael@0 15647
michael@0 15648 <p>Canvas test: 2d.pattern.paint.repeat.coord3</p>
michael@0 15649 <canvas id="c484" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15650 <script>
michael@0 15651
michael@0 15652
michael@0 15653
michael@0 15654 function test_2d_pattern_paint_repeat_coord3() {
michael@0 15655
michael@0 15656 var canvas = document.getElementById('c484');
michael@0 15657 var ctx = canvas.getContext('2d');
michael@0 15658
michael@0 15659 var img = document.getElementById('rgrg-256x256_4.png');
michael@0 15660 var pattern = ctx.createPattern(img, 'repeat');
michael@0 15661 ctx.fillStyle = pattern;
michael@0 15662 ctx.fillRect(0, 0, 100, 50);
michael@0 15663
michael@0 15664 ctx.translate(-128, -78);
michael@0 15665 ctx.fillRect(128, 78, 100, 50);
michael@0 15666
michael@0 15667 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15668 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15669 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15670 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15671 }
michael@0 15672 </script>
michael@0 15673 <img src="image_rgrg-256x256.png" id="rgrg-256x256_4.png" class="resource">
michael@0 15674
michael@0 15675 <!-- [[[ test_2d.pattern.paint.repeat.outside.html ]]] -->
michael@0 15676
michael@0 15677 <p>Canvas test: 2d.pattern.paint.repeat.outside</p>
michael@0 15678 <canvas id="c485" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15679 <script>
michael@0 15680
michael@0 15681
michael@0 15682 function test_2d_pattern_paint_repeat_outside() {
michael@0 15683
michael@0 15684 var canvas = document.getElementById('c485');
michael@0 15685 var ctx = canvas.getContext('2d');
michael@0 15686
michael@0 15687 ctx.fillStyle = '#f00';
michael@0 15688 ctx.fillRect(0, 0, 100, 50);
michael@0 15689
michael@0 15690 var img = document.getElementById('green-16x16_2.png');
michael@0 15691 var pattern = ctx.createPattern(img, 'repeat');
michael@0 15692 ctx.fillStyle = pattern;
michael@0 15693 ctx.translate(50, 25);
michael@0 15694 ctx.fillRect(-50, -25, 100, 50);
michael@0 15695
michael@0 15696 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15697 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15698 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15699 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15700
michael@0 15701
michael@0 15702 }
michael@0 15703 </script>
michael@0 15704 <img src="image_green-16x16.png" id="green-16x16_2.png" class="resource">
michael@0 15705
michael@0 15706 <!-- [[[ test_2d.pattern.paint.repeatx.basic.html ]]] -->
michael@0 15707
michael@0 15708 <p>Canvas test: 2d.pattern.paint.repeatx.basic</p>
michael@0 15709 <canvas id="c486" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15710 <script>
michael@0 15711
michael@0 15712
michael@0 15713 function test_2d_pattern_paint_repeatx_basic() {
michael@0 15714
michael@0 15715 var canvas = document.getElementById('c486');
michael@0 15716 var ctx = canvas.getContext('2d');
michael@0 15717
michael@0 15718 ctx.fillStyle = '#0f0';
michael@0 15719 ctx.fillRect(0, 0, 100, 50);
michael@0 15720 ctx.fillStyle = '#f00';
michael@0 15721 ctx.fillRect(0, 0, 100, 16);
michael@0 15722
michael@0 15723 var img = document.getElementById('green-16x16_3.png');
michael@0 15724 var pattern = ctx.createPattern(img, 'repeat-x');
michael@0 15725 ctx.fillStyle = pattern;
michael@0 15726 ctx.fillRect(0, 0, 100, 50);
michael@0 15727
michael@0 15728 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15729 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15730 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15731 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15732
michael@0 15733
michael@0 15734 }
michael@0 15735 </script>
michael@0 15736 <img src="image_green-16x16.png" id="green-16x16_3.png" class="resource">
michael@0 15737
michael@0 15738 <!-- [[[ test_2d.pattern.paint.repeatx.coord1.html ]]] -->
michael@0 15739
michael@0 15740 <p>Canvas test: 2d.pattern.paint.repeatx.coord1</p>
michael@0 15741 <canvas id="c487" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15742 <script>
michael@0 15743
michael@0 15744
michael@0 15745
michael@0 15746 function test_2d_pattern_paint_repeatx_coord1() {
michael@0 15747
michael@0 15748 var canvas = document.getElementById('c487');
michael@0 15749 var ctx = canvas.getContext('2d');
michael@0 15750
michael@0 15751 ctx.fillStyle = '#0f0';
michael@0 15752 ctx.fillRect(0, 0, 100, 50);
michael@0 15753
michael@0 15754 var img = document.getElementById('red-16x16_1.png');
michael@0 15755 var pattern = ctx.createPattern(img, 'repeat-x');
michael@0 15756 ctx.fillStyle = pattern;
michael@0 15757 ctx.translate(0, 16);
michael@0 15758 ctx.fillRect(0, -16, 100, 50);
michael@0 15759
michael@0 15760 ctx.fillStyle = '#0f0';
michael@0 15761 ctx.fillRect(0, 0, 100, 16);
michael@0 15762
michael@0 15763 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15764 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15765 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15766 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15767 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 15768 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 15769 }
michael@0 15770 </script>
michael@0 15771 <img src="image_red-16x16.png" id="red-16x16_1.png" class="resource">
michael@0 15772
michael@0 15773 <!-- [[[ test_2d.pattern.paint.repeatx.outside.html ]]] -->
michael@0 15774
michael@0 15775 <p>Canvas test: 2d.pattern.paint.repeatx.outside</p>
michael@0 15776 <canvas id="c488" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15777 <script>
michael@0 15778
michael@0 15779
michael@0 15780
michael@0 15781 function test_2d_pattern_paint_repeatx_outside() {
michael@0 15782
michael@0 15783 var canvas = document.getElementById('c488');
michael@0 15784 var ctx = canvas.getContext('2d');
michael@0 15785
michael@0 15786 ctx.fillStyle = '#0f0';
michael@0 15787 ctx.fillRect(0, 0, 100, 50);
michael@0 15788
michael@0 15789 var img = document.getElementById('red-16x16_2.png');
michael@0 15790 var pattern = ctx.createPattern(img, 'repeat-x');
michael@0 15791 ctx.fillStyle = pattern;
michael@0 15792 ctx.fillRect(0, 0, 100, 50);
michael@0 15793
michael@0 15794 ctx.fillStyle = '#0f0';
michael@0 15795 ctx.fillRect(0, 0, 100, 16);
michael@0 15796
michael@0 15797 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15798 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15799 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15800 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15801 }
michael@0 15802 </script>
michael@0 15803 <img src="image_red-16x16.png" id="red-16x16_2.png" class="resource">
michael@0 15804
michael@0 15805 <!-- [[[ test_2d.pattern.paint.repeaty.basic.html ]]] -->
michael@0 15806
michael@0 15807 <p>Canvas test: 2d.pattern.paint.repeaty.basic</p>
michael@0 15808 <canvas id="c489" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15809 <script>
michael@0 15810
michael@0 15811
michael@0 15812 function test_2d_pattern_paint_repeaty_basic() {
michael@0 15813
michael@0 15814 var canvas = document.getElementById('c489');
michael@0 15815 var ctx = canvas.getContext('2d');
michael@0 15816
michael@0 15817 ctx.fillStyle = '#0f0';
michael@0 15818 ctx.fillRect(0, 0, 100, 50);
michael@0 15819 ctx.fillStyle = '#f00';
michael@0 15820 ctx.fillRect(0, 0, 16, 50);
michael@0 15821
michael@0 15822 var img = document.getElementById('green-16x16_4.png');
michael@0 15823 var pattern = ctx.createPattern(img, 'repeat-y');
michael@0 15824 ctx.fillStyle = pattern;
michael@0 15825 ctx.fillRect(0, 0, 100, 50);
michael@0 15826
michael@0 15827 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15828 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15829 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15830 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15831
michael@0 15832
michael@0 15833 }
michael@0 15834 </script>
michael@0 15835 <img src="image_green-16x16.png" id="green-16x16_4.png" class="resource">
michael@0 15836
michael@0 15837 <!-- [[[ test_2d.pattern.paint.repeaty.coord1.html ]]] -->
michael@0 15838
michael@0 15839 <p>Canvas test: 2d.pattern.paint.repeaty.coord1</p>
michael@0 15840 <canvas id="c490" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15841 <script>
michael@0 15842
michael@0 15843
michael@0 15844
michael@0 15845 function test_2d_pattern_paint_repeaty_coord1() {
michael@0 15846
michael@0 15847 var canvas = document.getElementById('c490');
michael@0 15848 var ctx = canvas.getContext('2d');
michael@0 15849
michael@0 15850 ctx.fillStyle = '#0f0';
michael@0 15851 ctx.fillRect(0, 0, 100, 50);
michael@0 15852
michael@0 15853 var img = document.getElementById('red-16x16_3.png');
michael@0 15854 var pattern = ctx.createPattern(img, 'repeat-y');
michael@0 15855 ctx.fillStyle = pattern;
michael@0 15856 ctx.translate(48, 0);
michael@0 15857 ctx.fillRect(-48, 0, 100, 50);
michael@0 15858
michael@0 15859 ctx.fillStyle = '#0f0';
michael@0 15860 ctx.fillRect(0, 0, 16, 50);
michael@0 15861
michael@0 15862 isPixel(ctx, 50,1, 0,255,0,255, 0);
michael@0 15863 isPixel(ctx, 50,48, 0,255,0,255, 0);
michael@0 15864
michael@0 15865 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15866 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15867 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15868 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15869 }
michael@0 15870 </script>
michael@0 15871 <img src="image_red-16x16.png" id="red-16x16_3.png" class="resource">
michael@0 15872
michael@0 15873 <!-- [[[ test_2d.pattern.paint.repeaty.outside.html ]]] -->
michael@0 15874
michael@0 15875 <p>Canvas test: 2d.pattern.paint.repeaty.outside</p>
michael@0 15876 <canvas id="c491" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15877 <script>
michael@0 15878
michael@0 15879
michael@0 15880
michael@0 15881 function test_2d_pattern_paint_repeaty_outside() {
michael@0 15882
michael@0 15883 var canvas = document.getElementById('c491');
michael@0 15884 var ctx = canvas.getContext('2d');
michael@0 15885
michael@0 15886 ctx.fillStyle = '#0f0';
michael@0 15887 ctx.fillRect(0, 0, 100, 50);
michael@0 15888
michael@0 15889 var img = document.getElementById('red-16x16_4.png');
michael@0 15890 var pattern = ctx.createPattern(img, 'repeat-y');
michael@0 15891 ctx.fillStyle = pattern;
michael@0 15892 ctx.fillRect(0, 0, 100, 50);
michael@0 15893
michael@0 15894 ctx.fillStyle = '#0f0';
michael@0 15895 ctx.fillRect(0, 0, 16, 50);
michael@0 15896
michael@0 15897 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15898 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15899 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15900 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15901 }
michael@0 15902 </script>
michael@0 15903 <img src="image_red-16x16.png" id="red-16x16_4.png" class="resource">
michael@0 15904
michael@0 15905 <!-- [[[ test_2d.pattern.repeat.case.html ]]] -->
michael@0 15906
michael@0 15907 <p>Canvas test: 2d.pattern.repeat.case</p>
michael@0 15908 <canvas id="c492" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15909 <script>
michael@0 15910
michael@0 15911 function test_2d_pattern_repeat_case() {
michael@0 15912
michael@0 15913 var canvas = document.getElementById('c492');
michael@0 15914 var ctx = canvas.getContext('2d');
michael@0 15915
michael@0 15916 var _thrown = undefined; try {
michael@0 15917 ctx.createPattern(canvas, "Repeat");
michael@0 15918 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 15919
michael@0 15920
michael@0 15921 }
michael@0 15922 </script>
michael@0 15923
michael@0 15924 <!-- [[[ test_2d.pattern.repeat.empty.html ]]] -->
michael@0 15925
michael@0 15926 <p>Canvas test: 2d.pattern.repeat.empty</p>
michael@0 15927 <canvas id="c493" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15928 <script>
michael@0 15929
michael@0 15930
michael@0 15931 function test_2d_pattern_repeat_empty() {
michael@0 15932
michael@0 15933 var canvas = document.getElementById('c493');
michael@0 15934 var ctx = canvas.getContext('2d');
michael@0 15935
michael@0 15936 ctx.fillStyle = '#f00';
michael@0 15937 ctx.fillRect(0, 0, 100, 50);
michael@0 15938 var img = document.getElementById('green-1x1_1.png');
michael@0 15939 var pattern = ctx.createPattern(img, "");
michael@0 15940 ctx.fillStyle = pattern;
michael@0 15941 ctx.fillRect(0, 0, 200, 50);
michael@0 15942
michael@0 15943 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15944 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15945 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15946 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15947
michael@0 15948
michael@0 15949 }
michael@0 15950 </script>
michael@0 15951 <img src="image_green-1x1.png" id="green-1x1_1.png" class="resource">
michael@0 15952
michael@0 15953 <!-- [[[ test_2d.pattern.repeat.null.html ]]] -->
michael@0 15954
michael@0 15955 <p>Canvas test: 2d.pattern.repeat.null</p>
michael@0 15956 <canvas id="c494" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15957 <script>
michael@0 15958
michael@0 15959
michael@0 15960 function test_2d_pattern_repeat_null() {
michael@0 15961
michael@0 15962 var canvas = document.getElementById('c494');
michael@0 15963 var ctx = canvas.getContext('2d');
michael@0 15964
michael@0 15965 ctx.fillStyle = '#f00';
michael@0 15966 ctx.fillRect(0, 0, 100, 50);
michael@0 15967 var img = document.getElementById('green-1x1_2.png');
michael@0 15968 var pattern = ctx.createPattern(img, null);
michael@0 15969 ctx.fillStyle = pattern;
michael@0 15970 ctx.fillRect(0, 0, 100, 50);
michael@0 15971
michael@0 15972 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 15973 isPixel(ctx, 98,1, 0,255,0,255, 0);
michael@0 15974 isPixel(ctx, 1,48, 0,255,0,255, 0);
michael@0 15975 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 15976
michael@0 15977
michael@0 15978 }
michael@0 15979 </script>
michael@0 15980 <img src="image_green-1x1.png" id="green-1x1_2.png" class="resource">
michael@0 15981
michael@0 15982 <!-- [[[ test_2d.pattern.repeat.nullsuffix.html ]]] -->
michael@0 15983
michael@0 15984 <p>Canvas test: 2d.pattern.repeat.nullsuffix</p>
michael@0 15985 <canvas id="c495" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 15986 <script>
michael@0 15987
michael@0 15988 function test_2d_pattern_repeat_nullsuffix() {
michael@0 15989
michael@0 15990 var canvas = document.getElementById('c495');
michael@0 15991 var ctx = canvas.getContext('2d');
michael@0 15992
michael@0 15993 var _thrown = undefined; try {
michael@0 15994 ctx.createPattern(canvas, "repeat\0");
michael@0 15995 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 15996
michael@0 15997
michael@0 15998 }
michael@0 15999 </script>
michael@0 16000
michael@0 16001 <!-- [[[ test_2d.pattern.repeat.undefined.html ]]] -->
michael@0 16002
michael@0 16003 <p>Canvas test: 2d.pattern.repeat.undefined</p>
michael@0 16004 <canvas id="c496" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16005 <script>
michael@0 16006
michael@0 16007 function test_2d_pattern_repeat_undefined() {
michael@0 16008
michael@0 16009 var canvas = document.getElementById('c496');
michael@0 16010 var ctx = canvas.getContext('2d');
michael@0 16011
michael@0 16012 var _thrown = undefined; try {
michael@0 16013 ctx.createPattern(canvas, undefined);
michael@0 16014 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 16015
michael@0 16016
michael@0 16017 }
michael@0 16018 </script>
michael@0 16019
michael@0 16020 <!-- [[[ test_2d.pattern.repeat.unrecognised.html ]]] -->
michael@0 16021
michael@0 16022 <p>Canvas test: 2d.pattern.repeat.unrecognised</p>
michael@0 16023 <canvas id="c497" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16024 <script>
michael@0 16025
michael@0 16026 function test_2d_pattern_repeat_unrecognised() {
michael@0 16027
michael@0 16028 var canvas = document.getElementById('c497');
michael@0 16029 var ctx = canvas.getContext('2d');
michael@0 16030
michael@0 16031 var _thrown = undefined; try {
michael@0 16032 ctx.createPattern(canvas, "invalid");
michael@0 16033 } catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
michael@0 16034
michael@0 16035
michael@0 16036 }
michael@0 16037 </script>
michael@0 16038
michael@0 16039 <!-- [[[ test_2d.scaled.html ]]] -->
michael@0 16040
michael@0 16041 <p>Canvas test: 2d.scaled</p>
michael@0 16042 <!-- Testing: CSS-scaled canvases get drawn correctly -->
michael@0 16043 <canvas id="c498" width="50" height="25" style="width: 100px; height: 50px"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16044 <script>
michael@0 16045
michael@0 16046 function test_2d_scaled() {
michael@0 16047
michael@0 16048 var canvas = document.getElementById('c498');
michael@0 16049 var ctx = canvas.getContext('2d');
michael@0 16050
michael@0 16051 ctx.fillStyle = '#00f';
michael@0 16052 ctx.fillRect(0, 0, 50, 25);
michael@0 16053 ctx.fillStyle = '#0ff';
michael@0 16054 ctx.fillRect(0, 0, 25, 10);
michael@0 16055
michael@0 16056 todo(false, "test completed successfully"); // (Bug 483989)
michael@0 16057
michael@0 16058 }
michael@0 16059
michael@0 16060 </script>
michael@0 16061 <!-- [[[ test_2d.shadow.alpha.1.html ]]] -->
michael@0 16062
michael@0 16063 <p>Canvas test: 2d.shadow.alpha.1</p>
michael@0 16064 <canvas id="c499" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16065 <script>
michael@0 16066
michael@0 16067
michael@0 16068 function test_2d_shadow_alpha_1() {
michael@0 16069
michael@0 16070 var canvas = document.getElementById('c499');
michael@0 16071 var ctx = canvas.getContext('2d');
michael@0 16072
michael@0 16073 ctx.fillStyle = '#0f0';
michael@0 16074 ctx.fillRect(0, 0, 100, 50);
michael@0 16075 ctx.shadowColor = 'rgba(255, 0, 0, 0.01)';
michael@0 16076 ctx.shadowOffsetY = 50;
michael@0 16077 ctx.fillRect(0, -50, 100, 50);
michael@0 16078
michael@0 16079 isPixel(ctx, 50,25, 0,255,0,255, 4);
michael@0 16080
michael@0 16081
michael@0 16082 }
michael@0 16083 </script>
michael@0 16084
michael@0 16085 <!-- [[[ test_2d.shadow.alpha.2.html ]]] -->
michael@0 16086
michael@0 16087 <p>Canvas test: 2d.shadow.alpha.2</p>
michael@0 16088 <canvas id="c500" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16089 <script>
michael@0 16090
michael@0 16091
michael@0 16092
michael@0 16093 function test_2d_shadow_alpha_2() {
michael@0 16094
michael@0 16095 var canvas = document.getElementById('c500');
michael@0 16096 var ctx = canvas.getContext('2d');
michael@0 16097
michael@0 16098 ctx.fillStyle = '#f00';
michael@0 16099 ctx.fillRect(0, 0, 100, 50);
michael@0 16100 ctx.shadowColor = 'rgba(0, 0, 255, 0.5)';
michael@0 16101 ctx.shadowOffsetY = 50;
michael@0 16102 ctx.fillRect(0, -50, 100, 50);
michael@0 16103
michael@0 16104 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16105
michael@0 16106
michael@0 16107 }
michael@0 16108 </script>
michael@0 16109
michael@0 16110 <!-- [[[ test_2d.shadow.alpha.3.html ]]] -->
michael@0 16111
michael@0 16112 <p>Canvas test: 2d.shadow.alpha.3</p>
michael@0 16113 <canvas id="c501" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16114 <script>
michael@0 16115
michael@0 16116
michael@0 16117
michael@0 16118 function test_2d_shadow_alpha_3() {
michael@0 16119
michael@0 16120 var canvas = document.getElementById('c501');
michael@0 16121 var ctx = canvas.getContext('2d');
michael@0 16122
michael@0 16123 ctx.fillStyle = '#f00';
michael@0 16124 ctx.fillRect(0, 0, 100, 50);
michael@0 16125 ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching)
michael@0 16126 ctx.shadowColor = '#00f';
michael@0 16127 ctx.shadowOffsetY = 50;
michael@0 16128 ctx.globalAlpha = 0.5;
michael@0 16129 ctx.fillRect(0, -50, 100, 50);
michael@0 16130
michael@0 16131 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16132
michael@0 16133
michael@0 16134 }
michael@0 16135 </script>
michael@0 16136
michael@0 16137 <!-- [[[ test_2d.shadow.alpha.4.html ]]] -->
michael@0 16138
michael@0 16139 <p>Canvas test: 2d.shadow.alpha.4</p>
michael@0 16140 <canvas id="c502" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16141 <script>
michael@0 16142
michael@0 16143
michael@0 16144
michael@0 16145 function test_2d_shadow_alpha_4() {
michael@0 16146
michael@0 16147 var canvas = document.getElementById('c502');
michael@0 16148 var ctx = canvas.getContext('2d');
michael@0 16149
michael@0 16150 ctx.fillStyle = '#f00';
michael@0 16151 ctx.fillRect(0, 0, 100, 50);
michael@0 16152 ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching)
michael@0 16153 ctx.shadowColor = 'rgba(0, 0, 255, 0.707)';
michael@0 16154 ctx.shadowOffsetY = 50;
michael@0 16155 ctx.globalAlpha = 0.707;
michael@0 16156 ctx.fillRect(0, -50, 100, 50);
michael@0 16157
michael@0 16158 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16159
michael@0 16160
michael@0 16161 }
michael@0 16162 </script>
michael@0 16163
michael@0 16164 <!-- [[[ test_2d.shadow.alpha.5.html ]]] -->
michael@0 16165
michael@0 16166 <p>Canvas test: 2d.shadow.alpha.5</p>
michael@0 16167 <canvas id="c503" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16168 <script>
michael@0 16169
michael@0 16170
michael@0 16171
michael@0 16172 function test_2d_shadow_alpha_5() {
michael@0 16173
michael@0 16174 var canvas = document.getElementById('c503');
michael@0 16175 var ctx = canvas.getContext('2d');
michael@0 16176
michael@0 16177 ctx.fillStyle = '#f00';
michael@0 16178 ctx.fillRect(0, 0, 100, 50);
michael@0 16179 ctx.fillStyle = 'rgba(64, 0, 0, 0.5)';
michael@0 16180 ctx.shadowColor = '#00f';
michael@0 16181 ctx.shadowOffsetY = 50;
michael@0 16182 ctx.fillRect(0, -50, 100, 50);
michael@0 16183
michael@0 16184 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16185
michael@0 16186
michael@0 16187 }
michael@0 16188 </script>
michael@0 16189
michael@0 16190 <!-- [[[ test_2d.shadow.attributes.shadowBlur.1.html ]]] -->
michael@0 16191
michael@0 16192 <p>Canvas test: 2d.shadow.attributes.shadowBlur.1</p>
michael@0 16193 <canvas id="c504" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16194 <script>
michael@0 16195
michael@0 16196 function test_2d_shadow_attributes_shadowBlur_1() {
michael@0 16197
michael@0 16198 var canvas = document.getElementById('c504');
michael@0 16199 var ctx = canvas.getContext('2d');
michael@0 16200
michael@0 16201 ctx.shadowBlur = 1;
michael@0 16202 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16203 ctx.shadowBlur = 0.5;
michael@0 16204 ok(ctx.shadowBlur === 0.5, "ctx.shadowBlur === 0.5");
michael@0 16205 ctx.shadowBlur = 1e6;
michael@0 16206 ok(ctx.shadowBlur === 1e6, "ctx.shadowBlur === 1e6");
michael@0 16207 ctx.shadowBlur = 1;
michael@0 16208 ctx.shadowBlur = -2;
michael@0 16209 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16210 ctx.shadowBlur = 0;
michael@0 16211 ok(ctx.shadowBlur === 0, "ctx.shadowBlur === 0");
michael@0 16212
michael@0 16213
michael@0 16214 }
michael@0 16215 </script>
michael@0 16216
michael@0 16217 <!-- [[[ test_2d.shadow.attributes.shadowBlur.2.html ]]] -->
michael@0 16218
michael@0 16219 <p>Canvas test: 2d.shadow.attributes.shadowBlur.2</p>
michael@0 16220 <canvas id="c505" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16221 <script>
michael@0 16222
michael@0 16223 function test_2d_shadow_attributes_shadowBlur_2() {
michael@0 16224
michael@0 16225 var canvas = document.getElementById('c505');
michael@0 16226 var ctx = canvas.getContext('2d');
michael@0 16227
michael@0 16228 ctx.shadowBlur = 1;
michael@0 16229 ctx.shadowBlur = -2;
michael@0 16230 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16231
michael@0 16232 ctx.shadowBlur = 1;
michael@0 16233 ctx.shadowBlur = Infinity;
michael@0 16234 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16235
michael@0 16236 ctx.shadowBlur = 1;
michael@0 16237 ctx.shadowBlur = -Infinity;
michael@0 16238 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16239
michael@0 16240 ctx.shadowBlur = 1;
michael@0 16241 ctx.shadowBlur = NaN;
michael@0 16242 ok(ctx.shadowBlur === 1, "ctx.shadowBlur === 1");
michael@0 16243
michael@0 16244 }
michael@0 16245 </script>
michael@0 16246
michael@0 16247 <!-- [[[ test_2d.shadow.attributes.shadowColor.1.html ]]] -->
michael@0 16248
michael@0 16249 <p>Canvas test: 2d.shadow.attributes.shadowColor.1</p>
michael@0 16250 <canvas id="c506" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16251 <script>
michael@0 16252
michael@0 16253 function test_2d_shadow_attributes_shadowColor_1() {
michael@0 16254
michael@0 16255 var canvas = document.getElementById('c506');
michael@0 16256 var ctx = canvas.getContext('2d');
michael@0 16257
michael@0 16258 ctx.shadowColor = 'lime';
michael@0 16259 ok(ctx.shadowColor === '#00ff00', "ctx.shadowColor === '#00ff00'");
michael@0 16260 ctx.shadowColor = 'RGBA(0,255, 0,0)';
michael@0 16261 is(ctx.shadowColor, 'rgba(0, 255, 0, 0)', "ctx.shadowColor should be what we set it to");
michael@0 16262
michael@0 16263
michael@0 16264 }
michael@0 16265 </script>
michael@0 16266
michael@0 16267 <!-- [[[ test_2d.shadow.attributes.shadowColor.2.html ]]] -->
michael@0 16268
michael@0 16269 <p>Canvas test: 2d.shadow.attributes.shadowColor.2</p>
michael@0 16270 <canvas id="c507" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16271 <script>
michael@0 16272
michael@0 16273 function test_2d_shadow_attributes_shadowColor_2() {
michael@0 16274
michael@0 16275 var canvas = document.getElementById('c507');
michael@0 16276 var ctx = canvas.getContext('2d');
michael@0 16277
michael@0 16278 ctx.shadowColor = '#00ff00';
michael@0 16279 ctx.shadowColor = 'bogus';
michael@0 16280 ok(ctx.shadowColor === '#00ff00', "ctx.shadowColor === '#00ff00'");
michael@0 16281 ctx.shadowColor = ctx;
michael@0 16282 ok(ctx.shadowColor === '#00ff00', "ctx.shadowColor === '#00ff00'");
michael@0 16283 ctx.shadowColor = undefined;
michael@0 16284 ok(ctx.shadowColor === '#00ff00', "ctx.shadowColor === '#00ff00'");
michael@0 16285
michael@0 16286
michael@0 16287 }
michael@0 16288 </script>
michael@0 16289
michael@0 16290 <!-- [[[ test_2d.shadow.attributes.shadowOffset.1.html ]]] -->
michael@0 16291
michael@0 16292 <p>Canvas test: 2d.shadow.attributes.shadowOffset.1</p>
michael@0 16293 <canvas id="c508" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16294 <script>
michael@0 16295
michael@0 16296 function test_2d_shadow_attributes_shadowOffset_1() {
michael@0 16297
michael@0 16298 var canvas = document.getElementById('c508');
michael@0 16299 var ctx = canvas.getContext('2d');
michael@0 16300
michael@0 16301 ctx.shadowOffsetX = 1;
michael@0 16302 ctx.shadowOffsetY = 2;
michael@0 16303 ok(ctx.shadowOffsetX === 1, "ctx.shadowOffsetX === 1");
michael@0 16304 ok(ctx.shadowOffsetY === 2, "ctx.shadowOffsetY === 2");
michael@0 16305 ctx.shadowOffsetX = 0.5;
michael@0 16306 ctx.shadowOffsetY = 0.25;
michael@0 16307 ok(ctx.shadowOffsetX === 0.5, "ctx.shadowOffsetX === 0.5");
michael@0 16308 ok(ctx.shadowOffsetY === 0.25, "ctx.shadowOffsetY === 0.25");
michael@0 16309 ctx.shadowOffsetX = -0.5;
michael@0 16310 ctx.shadowOffsetY = -0.25;
michael@0 16311 ok(ctx.shadowOffsetX === -0.5, "ctx.shadowOffsetX === -0.5");
michael@0 16312 ok(ctx.shadowOffsetY === -0.25, "ctx.shadowOffsetY === -0.25");
michael@0 16313 ctx.shadowOffsetX = 1e6;
michael@0 16314 ctx.shadowOffsetY = 1e6;
michael@0 16315 ok(ctx.shadowOffsetX === 1e6, "ctx.shadowOffsetX === 1e6");
michael@0 16316 ok(ctx.shadowOffsetY === 1e6, "ctx.shadowOffsetY === 1e6");
michael@0 16317
michael@0 16318
michael@0 16319 }
michael@0 16320 </script>
michael@0 16321
michael@0 16322 <!-- [[[ test_2d.shadow.attributes.shadowOffset.2.html ]]] -->
michael@0 16323
michael@0 16324 <p>Canvas test: 2d.shadow.attributes.shadowOffset.2</p>
michael@0 16325 <canvas id="c509" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16326 <script>
michael@0 16327
michael@0 16328 function test_2d_shadow_attributes_shadowOffset_2() {
michael@0 16329
michael@0 16330 var canvas = document.getElementById('c509');
michael@0 16331 var ctx = canvas.getContext('2d');
michael@0 16332
michael@0 16333 ctx.shadowOffsetX = 1;
michael@0 16334 ctx.shadowOffsetY = 2;
michael@0 16335 ctx.shadowOffsetX = Infinity;
michael@0 16336 ctx.shadowOffsetY = Infinity;
michael@0 16337 ok(ctx.shadowOffsetX === 1, "ctx.shadowOffsetX === 1");
michael@0 16338 ok(ctx.shadowOffsetY === 2, "ctx.shadowOffsetY === 2");
michael@0 16339
michael@0 16340 ctx.shadowOffsetX = 1;
michael@0 16341 ctx.shadowOffsetY = 2;
michael@0 16342 ctx.shadowOffsetX = -Infinity;
michael@0 16343 ctx.shadowOffsetY = -Infinity;
michael@0 16344 ok(ctx.shadowOffsetX === 1, "ctx.shadowOffsetX === 1");
michael@0 16345 ok(ctx.shadowOffsetY === 2, "ctx.shadowOffsetY === 2");
michael@0 16346
michael@0 16347 ctx.shadowOffsetX = 1;
michael@0 16348 ctx.shadowOffsetY = 2;
michael@0 16349 ctx.shadowOffsetX = NaN;
michael@0 16350 ctx.shadowOffsetY = NaN;
michael@0 16351 ok(ctx.shadowOffsetX === 1, "ctx.shadowOffsetX === 1");
michael@0 16352 ok(ctx.shadowOffsetY === 2, "ctx.shadowOffsetY === 2");
michael@0 16353
michael@0 16354 }
michael@0 16355 </script>
michael@0 16356
michael@0 16357 <!-- [[[ test_2d.shadow.basic.1.html ]]] -->
michael@0 16358
michael@0 16359 <p>Canvas test: 2d.shadow.basic.1</p>
michael@0 16360 <canvas id="c510" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16361 <script>
michael@0 16362
michael@0 16363
michael@0 16364 function test_2d_shadow_basic_1() {
michael@0 16365
michael@0 16366 var canvas = document.getElementById('c510');
michael@0 16367 var ctx = canvas.getContext('2d');
michael@0 16368
michael@0 16369 ctx.shadowColor = '#f00';
michael@0 16370 ctx.fillStyle = '#0f0';
michael@0 16371 ctx.fillRect(0, 0, 100, 50);
michael@0 16372 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16373
michael@0 16374
michael@0 16375 }
michael@0 16376 </script>
michael@0 16377
michael@0 16378 <!-- [[[ test_2d.shadow.basic.2.html ]]] -->
michael@0 16379
michael@0 16380 <p>Canvas test: 2d.shadow.basic.2</p>
michael@0 16381 <canvas id="c511" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16382 <script>
michael@0 16383
michael@0 16384
michael@0 16385 function test_2d_shadow_basic_2() {
michael@0 16386
michael@0 16387 var canvas = document.getElementById('c511');
michael@0 16388 var ctx = canvas.getContext('2d');
michael@0 16389
michael@0 16390 ctx.fillStyle = '#0f0';
michael@0 16391 ctx.fillRect(0, 0, 100, 50);
michael@0 16392 ctx.fillStyle = '#f00';
michael@0 16393 ctx.shadowColor = '#f00';
michael@0 16394 ctx.fillRect(0, -50, 100, 50);
michael@0 16395 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16396
michael@0 16397
michael@0 16398 }
michael@0 16399 </script>
michael@0 16400
michael@0 16401 <!-- [[[ test_2d.shadow.blur.high.html ]]] -->
michael@0 16402
michael@0 16403 <p>Canvas test: 2d.shadow.blur.high</p>
michael@0 16404 <canvas id="c512" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16405 <script>
michael@0 16406
michael@0 16407 function test_2d_shadow_blur_high() {
michael@0 16408
michael@0 16409 var canvas = document.getElementById('c512');
michael@0 16410 var ctx = canvas.getContext('2d');
michael@0 16411
michael@0 16412 ctx.fillStyle = '#ff0';
michael@0 16413 ctx.fillRect(0, 0, 100, 50);
michael@0 16414 ctx.shadowColor = '#00f';
michael@0 16415 ctx.shadowOffsetY = 0;
michael@0 16416 ctx.shadowBlur = 555.6;
michael@0 16417 ctx.fillRect(-200, -200, 200, 400);
michael@0 16418
michael@0 16419 todo(false, "test completed successfully"); // (Bug 483989)
michael@0 16420
michael@0 16421 }
michael@0 16422
michael@0 16423 </script>
michael@0 16424 <!-- [[[ test_2d.shadow.blur.low.html ]]] -->
michael@0 16425
michael@0 16426 <p>Canvas test: 2d.shadow.blur.low</p>
michael@0 16427 <canvas id="c513" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16428 <script>
michael@0 16429
michael@0 16430 function test_2d_shadow_blur_low() {
michael@0 16431
michael@0 16432 var canvas = document.getElementById('c513');
michael@0 16433 var ctx = canvas.getContext('2d');
michael@0 16434
michael@0 16435 ctx.fillStyle = '#ff0';
michael@0 16436 ctx.fillRect(0, 0, 100, 50);
michael@0 16437 ctx.shadowColor = '#00f';
michael@0 16438 ctx.shadowOffsetY = 25;
michael@0 16439 for (var x = 0; x < 100; ++x) {
michael@0 16440 ctx.save();
michael@0 16441 ctx.beginPath();
michael@0 16442 ctx.rect(x, 0, 1, 50);
michael@0 16443 ctx.clip();
michael@0 16444 ctx.shadowBlur = x;
michael@0 16445 ctx.fillRect(-200, -200, 500, 200);
michael@0 16446 ctx.restore();
michael@0 16447 }
michael@0 16448
michael@0 16449 todo(false, "test completed successfully"); // (Bug 483989)
michael@0 16450
michael@0 16451 }
michael@0 16452 </script>
michael@0 16453 <!-- [[[ test_2d.shadow.canvas.alpha.html ]]] -->
michael@0 16454
michael@0 16455 <p>Canvas test: 2d.shadow.canvas.alpha</p>
michael@0 16456 <canvas id="c514" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16457 <script>
michael@0 16458
michael@0 16459
michael@0 16460
michael@0 16461 function test_2d_shadow_canvas_alpha() {
michael@0 16462
michael@0 16463 var canvas = document.getElementById('c514');
michael@0 16464 var ctx = canvas.getContext('2d');
michael@0 16465
michael@0 16466 var canvas2 = document.createElement('canvas');
michael@0 16467 canvas2.width = 100;
michael@0 16468 canvas2.height = 50;
michael@0 16469 var ctx2 = canvas2.getContext('2d');
michael@0 16470 ctx2.fillStyle = 'rgba(255, 0, 0, 0.5)';
michael@0 16471 ctx2.fillRect(0, 0, 100, 50);
michael@0 16472
michael@0 16473 ctx.fillStyle = '#f00';
michael@0 16474 ctx.fillRect(0, 0, 100, 50);
michael@0 16475 ctx.shadowOffsetY = 50;
michael@0 16476 ctx.shadowColor = '#00f';
michael@0 16477 ctx.drawImage(canvas2, 0, -50);
michael@0 16478
michael@0 16479 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16480
michael@0 16481
michael@0 16482 }
michael@0 16483 </script>
michael@0 16484 <img src="image_transparent50.png" id="transparent50_1.png" class="resource">
michael@0 16485
michael@0 16486 <!-- [[[ test_2d.shadow.canvas.basic.html ]]] -->
michael@0 16487
michael@0 16488 <p>Canvas test: 2d.shadow.canvas.basic</p>
michael@0 16489 <canvas id="c515" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16490 <script>
michael@0 16491
michael@0 16492
michael@0 16493
michael@0 16494 function test_2d_shadow_canvas_basic() {
michael@0 16495
michael@0 16496 var canvas = document.getElementById('c515');
michael@0 16497 var ctx = canvas.getContext('2d');
michael@0 16498
michael@0 16499 var canvas2 = document.createElement('canvas');
michael@0 16500 canvas2.width = 100;
michael@0 16501 canvas2.height = 50;
michael@0 16502 var ctx2 = canvas2.getContext('2d');
michael@0 16503 ctx2.fillStyle = '#f00';
michael@0 16504 ctx2.fillRect(0, 0, 100, 50);
michael@0 16505
michael@0 16506 ctx.fillStyle = '#f00';
michael@0 16507 ctx.fillRect(0, 0, 100, 50);
michael@0 16508 ctx.shadowColor = '#0f0';
michael@0 16509 ctx.shadowOffsetY = 50;
michael@0 16510 ctx.drawImage(canvas2, 0, -50);
michael@0 16511
michael@0 16512 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16513
michael@0 16514
michael@0 16515 }
michael@0 16516 </script>
michael@0 16517
michael@0 16518 <!-- [[[ test_2d.shadow.canvas.transparent.1.html ]]] -->
michael@0 16519
michael@0 16520 <p>Canvas test: 2d.shadow.canvas.transparent.1</p>
michael@0 16521 <canvas id="c516" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16522 <script>
michael@0 16523
michael@0 16524
michael@0 16525 function test_2d_shadow_canvas_transparent_1() {
michael@0 16526
michael@0 16527 var canvas = document.getElementById('c516');
michael@0 16528 var ctx = canvas.getContext('2d');
michael@0 16529
michael@0 16530 var canvas2 = document.createElement('canvas');
michael@0 16531 canvas2.width = 100;
michael@0 16532 canvas2.height = 50;
michael@0 16533 var ctx2 = canvas2.getContext('2d');
michael@0 16534
michael@0 16535 ctx.fillStyle = '#0f0';
michael@0 16536 ctx.fillRect(0, 0, 100, 50);
michael@0 16537 ctx.shadowColor = '#f00';
michael@0 16538 ctx.shadowOffsetY = 50;
michael@0 16539 ctx.drawImage(canvas2, 0, -50);
michael@0 16540
michael@0 16541 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16542
michael@0 16543
michael@0 16544 }
michael@0 16545 </script>
michael@0 16546
michael@0 16547 <!-- [[[ test_2d.shadow.canvas.transparent.2.html ]]] -->
michael@0 16548
michael@0 16549 <p>Canvas test: 2d.shadow.canvas.transparent.2</p>
michael@0 16550 <canvas id="c517" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16551 <script>
michael@0 16552
michael@0 16553
michael@0 16554
michael@0 16555 function test_2d_shadow_canvas_transparent_2() {
michael@0 16556
michael@0 16557 var canvas = document.getElementById('c517');
michael@0 16558 var ctx = canvas.getContext('2d');
michael@0 16559
michael@0 16560 var canvas2 = document.createElement('canvas');
michael@0 16561 canvas2.width = 100;
michael@0 16562 canvas2.height = 50;
michael@0 16563 var ctx2 = canvas2.getContext('2d');
michael@0 16564 ctx2.fillStyle = '#f00';
michael@0 16565 ctx2.fillRect(0, 0, 50, 50);
michael@0 16566
michael@0 16567 ctx.fillStyle = '#0f0';
michael@0 16568 ctx.fillRect(0, 0, 50, 50);
michael@0 16569 ctx.fillStyle = '#f00';
michael@0 16570 ctx.fillRect(50, 0, 50, 50);
michael@0 16571 ctx.shadowOffsetY = 50;
michael@0 16572 ctx.shadowColor = '#0f0';
michael@0 16573 ctx.drawImage(canvas2, 50, -50);
michael@0 16574 ctx.shadowColor = '#f00';
michael@0 16575 ctx.drawImage(canvas2, -50, -50);
michael@0 16576
michael@0 16577 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 16578 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16579 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 16580
michael@0 16581
michael@0 16582 }
michael@0 16583 </script>
michael@0 16584
michael@0 16585 <!-- [[[ test_2d.shadow.clip.1.html ]]] -->
michael@0 16586
michael@0 16587 <p>Canvas test: 2d.shadow.clip.1</p>
michael@0 16588 <canvas id="c518" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16589 <script>
michael@0 16590
michael@0 16591
michael@0 16592
michael@0 16593 function test_2d_shadow_clip_1() {
michael@0 16594
michael@0 16595 var canvas = document.getElementById('c518');
michael@0 16596 var ctx = canvas.getContext('2d');
michael@0 16597
michael@0 16598 ctx.fillStyle = '#0f0';
michael@0 16599 ctx.fillRect(0, 0, 50, 50);
michael@0 16600 ctx.fillStyle = '#f00';
michael@0 16601 ctx.fillRect(50, 0, 50, 50);
michael@0 16602
michael@0 16603 ctx.save();
michael@0 16604 ctx.beginPath();
michael@0 16605 ctx.rect(50, 0, 50, 50);
michael@0 16606 ctx.clip();
michael@0 16607 ctx.shadowColor = '#0f0';
michael@0 16608 ctx.shadowOffsetX = 50;
michael@0 16609 ctx.fillRect(0, 0, 50, 50);
michael@0 16610 ctx.restore();
michael@0 16611
michael@0 16612 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 16613 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 16614
michael@0 16615
michael@0 16616 }
michael@0 16617 </script>
michael@0 16618
michael@0 16619 <!-- [[[ test_2d.shadow.clip.2.html ]]] -->
michael@0 16620
michael@0 16621 <p>Canvas test: 2d.shadow.clip.2</p>
michael@0 16622 <canvas id="c519" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16623 <script>
michael@0 16624
michael@0 16625
michael@0 16626 function test_2d_shadow_clip_2() {
michael@0 16627
michael@0 16628 var canvas = document.getElementById('c519');
michael@0 16629 var ctx = canvas.getContext('2d');
michael@0 16630
michael@0 16631 ctx.fillStyle = '#f00';
michael@0 16632 ctx.fillRect(0, 0, 50, 50);
michael@0 16633 ctx.fillStyle = '#0f0';
michael@0 16634 ctx.fillRect(50, 0, 50, 50);
michael@0 16635
michael@0 16636 ctx.save();
michael@0 16637 ctx.beginPath();
michael@0 16638 ctx.rect(0, 0, 50, 50);
michael@0 16639 ctx.clip();
michael@0 16640 ctx.shadowColor = '#f00';
michael@0 16641 ctx.shadowOffsetX = 50;
michael@0 16642 ctx.fillRect(0, 0, 50, 50);
michael@0 16643 ctx.restore();
michael@0 16644
michael@0 16645 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 16646 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 16647
michael@0 16648
michael@0 16649 }
michael@0 16650 </script>
michael@0 16651
michael@0 16652 <!-- [[[ test_2d.shadow.clip.3.html ]]] -->
michael@0 16653
michael@0 16654 <p>Canvas test: 2d.shadow.clip.3</p>
michael@0 16655 <canvas id="c520" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16656 <script>
michael@0 16657
michael@0 16658
michael@0 16659
michael@0 16660 function test_2d_shadow_clip_3() {
michael@0 16661
michael@0 16662 var canvas = document.getElementById('c520');
michael@0 16663 var ctx = canvas.getContext('2d');
michael@0 16664
michael@0 16665 ctx.fillStyle = '#f00';
michael@0 16666 ctx.fillRect(0, 0, 50, 50);
michael@0 16667 ctx.fillStyle = '#0f0';
michael@0 16668 ctx.fillRect(50, 0, 50, 50);
michael@0 16669
michael@0 16670 ctx.save();
michael@0 16671 ctx.beginPath();
michael@0 16672 ctx.rect(0, 0, 50, 50);
michael@0 16673 ctx.clip();
michael@0 16674 ctx.fillStyle = '#f00';
michael@0 16675 ctx.shadowColor = '#0f0';
michael@0 16676 ctx.shadowOffsetX = 50;
michael@0 16677 ctx.fillRect(-50, 0, 50, 50);
michael@0 16678 ctx.restore();
michael@0 16679
michael@0 16680 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 16681 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 16682
michael@0 16683
michael@0 16684 }
michael@0 16685 </script>
michael@0 16686
michael@0 16687 <!-- [[[ test_2d.shadow.composite.1.html ]]] -->
michael@0 16688
michael@0 16689 <p>Canvas test: 2d.shadow.composite.1</p>
michael@0 16690 <canvas id="c521" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16691 <script>
michael@0 16692
michael@0 16693
michael@0 16694
michael@0 16695 function test_2d_shadow_composite_1() {
michael@0 16696
michael@0 16697 var canvas = document.getElementById('c521');
michael@0 16698 var ctx = canvas.getContext('2d');
michael@0 16699
michael@0 16700 ctx.fillStyle = '#f00';
michael@0 16701 ctx.fillRect(0, 0, 100, 50);
michael@0 16702 ctx.globalCompositeOperation = 'xor';
michael@0 16703 ctx.shadowColor = '#f00';
michael@0 16704 ctx.shadowOffsetX = 100;
michael@0 16705 ctx.fillStyle = '#0f0';
michael@0 16706 ctx.fillRect(-100, 0, 200, 50);
michael@0 16707
michael@0 16708 isPixel(ctx, 50, 25, 0, 255, 0, 255, 2);
michael@0 16709
michael@0 16710 }
michael@0 16711 </script>
michael@0 16712
michael@0 16713 <!-- [[[ test_2d.shadow.composite.2.html ]]] -->
michael@0 16714
michael@0 16715 <p>Canvas test: 2d.shadow.composite.2</p>
michael@0 16716 <canvas id="c522" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16717 <script>
michael@0 16718
michael@0 16719
michael@0 16720
michael@0 16721 function test_2d_shadow_composite_2() {
michael@0 16722
michael@0 16723 var canvas = document.getElementById('c522');
michael@0 16724 var ctx = canvas.getContext('2d');
michael@0 16725
michael@0 16726 ctx.fillStyle = '#f00';
michael@0 16727 ctx.fillRect(0, 0, 100, 50);
michael@0 16728 ctx.globalCompositeOperation = 'xor';
michael@0 16729 ctx.shadowColor = '#f00';
michael@0 16730 ctx.shadowBlur = 1;
michael@0 16731 ctx.fillStyle = '#0f0';
michael@0 16732 ctx.fillRect(-10, -10, 120, 70);
michael@0 16733
michael@0 16734 isPixel(ctx, 50, 25, 0, 255, 0, 255, 2);
michael@0 16735
michael@0 16736 }
michael@0 16737 </script>
michael@0 16738
michael@0 16739 <!-- [[[ test_2d.shadow.composite.3.html ]]] -->
michael@0 16740
michael@0 16741 <p>Canvas test: 2d.shadow.composite.3</p>
michael@0 16742 <canvas id="c523" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16743 <script>
michael@0 16744
michael@0 16745
michael@0 16746
michael@0 16747 function test_2d_shadow_composite_3() {
michael@0 16748
michael@0 16749 var canvas = document.getElementById('c523');
michael@0 16750 var ctx = canvas.getContext('2d');
michael@0 16751
michael@0 16752 ctx.fillStyle = '#f00';
michael@0 16753 ctx.fillRect(0, 0, 100, 50);
michael@0 16754 ctx.globalCompositeOperation = 'xor';
michael@0 16755 ctx.shadowColor = '#f00';
michael@0 16756 ctx.fillStyle = '#0f0';
michael@0 16757 ctx.fillRect(0, 0, 100, 50);
michael@0 16758
michael@0 16759 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 16760
michael@0 16761
michael@0 16762 }
michael@0 16763 </script>
michael@0 16764
michael@0 16765 <!-- [[[ test_2d.shadow.composite.4.html ]]] -->
michael@0 16766
michael@0 16767 <p>Canvas test: 2d.shadow.composite.4</p>
michael@0 16768 <canvas id="c524" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16769 <script>
michael@0 16770
michael@0 16771
michael@0 16772
michael@0 16773 function test_2d_shadow_composite_4() {
michael@0 16774
michael@0 16775 var canvas = document.getElementById('c524');
michael@0 16776 var ctx = canvas.getContext('2d');
michael@0 16777
michael@0 16778 ctx.globalCompositeOperation = 'destination-over';
michael@0 16779 ctx.shadowColor = '#0f0';
michael@0 16780 ctx.fillStyle = '#f00';
michael@0 16781 ctx.fillRect(0, 0, 100, 50);
michael@0 16782
michael@0 16783 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 16784
michael@0 16785
michael@0 16786 }
michael@0 16787 </script>
michael@0 16788
michael@0 16789 <!-- [[[ test_2d.shadow.gradient.alpha.html ]]] -->
michael@0 16790
michael@0 16791 <p>Canvas test: 2d.shadow.gradient.alpha</p>
michael@0 16792 <canvas id="c525" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16793 <script>
michael@0 16794
michael@0 16795
michael@0 16796
michael@0 16797 function test_2d_shadow_gradient_alpha() {
michael@0 16798
michael@0 16799 var canvas = document.getElementById('c525');
michael@0 16800 var ctx = canvas.getContext('2d');
michael@0 16801
michael@0 16802 var gradient = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 16803 gradient.addColorStop(0, 'rgba(255,0,0,0.5)');
michael@0 16804 gradient.addColorStop(1, 'rgba(255,0,0,0.5)');
michael@0 16805 ctx.fillStyle = '#f00';
michael@0 16806 ctx.fillRect(0, 0, 100, 50);
michael@0 16807 ctx.shadowOffsetY = 50;
michael@0 16808 ctx.shadowColor = '#00f';
michael@0 16809 ctx.fillStyle = gradient;
michael@0 16810 ctx.fillRect(0, -50, 100, 50);
michael@0 16811
michael@0 16812 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16813
michael@0 16814
michael@0 16815 }
michael@0 16816 </script>
michael@0 16817
michael@0 16818 <!-- [[[ test_2d.shadow.gradient.basic.html ]]] -->
michael@0 16819
michael@0 16820 <p>Canvas test: 2d.shadow.gradient.basic</p>
michael@0 16821 <canvas id="c526" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16822 <script>
michael@0 16823
michael@0 16824
michael@0 16825
michael@0 16826 function test_2d_shadow_gradient_basic() {
michael@0 16827
michael@0 16828 var canvas = document.getElementById('c526');
michael@0 16829 var ctx = canvas.getContext('2d');
michael@0 16830
michael@0 16831 var gradient = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 16832 gradient.addColorStop(0, '#f00');
michael@0 16833 gradient.addColorStop(1, '#f00');
michael@0 16834 ctx.fillStyle = '#f00';
michael@0 16835 ctx.fillRect(0, 0, 100, 50);
michael@0 16836 ctx.shadowColor = '#0f0';
michael@0 16837 ctx.shadowOffsetY = 50;
michael@0 16838 ctx.fillStyle = gradient;
michael@0 16839 ctx.fillRect(0, -50, 100, 50);
michael@0 16840
michael@0 16841 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16842
michael@0 16843
michael@0 16844 }
michael@0 16845 </script>
michael@0 16846
michael@0 16847 <!-- [[[ test_2d.shadow.gradient.transparent.1.html ]]] -->
michael@0 16848
michael@0 16849 <p>Canvas test: 2d.shadow.gradient.transparent.1</p>
michael@0 16850 <canvas id="c527" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16851 <script>
michael@0 16852
michael@0 16853
michael@0 16854 function test_2d_shadow_gradient_transparent_1() {
michael@0 16855
michael@0 16856 var canvas = document.getElementById('c527');
michael@0 16857 var ctx = canvas.getContext('2d');
michael@0 16858
michael@0 16859 var gradient = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 16860 gradient.addColorStop(0, 'rgba(0,0,0,0)');
michael@0 16861 gradient.addColorStop(1, 'rgba(0,0,0,0)');
michael@0 16862 ctx.fillStyle = '#0f0';
michael@0 16863 ctx.fillRect(0, 0, 100, 50);
michael@0 16864 ctx.shadowColor = '#f00';
michael@0 16865 ctx.shadowOffsetY = 50;
michael@0 16866 ctx.fillStyle = gradient;
michael@0 16867 ctx.fillRect(0, -50, 100, 50);
michael@0 16868
michael@0 16869 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16870
michael@0 16871
michael@0 16872 }
michael@0 16873 </script>
michael@0 16874
michael@0 16875 <!-- [[[ test_2d.shadow.gradient.transparent.2.html ]]] -->
michael@0 16876
michael@0 16877 <p>Canvas test: 2d.shadow.gradient.transparent.2</p>
michael@0 16878 <canvas id="c528" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16879 <script>
michael@0 16880
michael@0 16881
michael@0 16882
michael@0 16883 function test_2d_shadow_gradient_transparent_2() {
michael@0 16884
michael@0 16885 var canvas = document.getElementById('c528');
michael@0 16886 var ctx = canvas.getContext('2d');
michael@0 16887
michael@0 16888 var gradient = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 16889 gradient.addColorStop(0, '#f00');
michael@0 16890 gradient.addColorStop(0.499, '#f00');
michael@0 16891 gradient.addColorStop(0.5, 'rgba(0,0,0,0)');
michael@0 16892 gradient.addColorStop(1, 'rgba(0,0,0,0)');
michael@0 16893 ctx.fillStyle = '#f00';
michael@0 16894 ctx.fillRect(0, 0, 50, 50);
michael@0 16895 ctx.fillStyle = '#0f0';
michael@0 16896 ctx.fillRect(50, 0, 50, 50);
michael@0 16897 ctx.shadowOffsetY = 50;
michael@0 16898 ctx.shadowColor = '#0f0';
michael@0 16899 ctx.fillStyle = gradient;
michael@0 16900 ctx.fillRect(0, -50, 100, 50);
michael@0 16901
michael@0 16902 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 16903 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16904 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 16905
michael@0 16906
michael@0 16907 }
michael@0 16908 </script>
michael@0 16909
michael@0 16910 <!-- [[[ test_2d.shadow.image.alpha.html ]]] -->
michael@0 16911
michael@0 16912 <p>Canvas test: 2d.shadow.image.alpha</p>
michael@0 16913 <canvas id="c529" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16914 <script>
michael@0 16915
michael@0 16916
michael@0 16917
michael@0 16918 function test_2d_shadow_image_alpha() {
michael@0 16919
michael@0 16920 var canvas = document.getElementById('c529');
michael@0 16921 var ctx = canvas.getContext('2d');
michael@0 16922
michael@0 16923 ctx.fillStyle = '#f00';
michael@0 16924 ctx.fillRect(0, 0, 100, 50);
michael@0 16925 ctx.shadowOffsetY = 50;
michael@0 16926 ctx.shadowColor = '#00f';
michael@0 16927 ctx.drawImage(document.getElementById('transparent50_2.png'), 0, -50);
michael@0 16928
michael@0 16929 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 16930
michael@0 16931
michael@0 16932 }
michael@0 16933 </script>
michael@0 16934 <img src="image_transparent50.png" id="transparent50_2.png" class="resource">
michael@0 16935
michael@0 16936 <!-- [[[ test_2d.shadow.image.basic.html ]]] -->
michael@0 16937
michael@0 16938 <p>Canvas test: 2d.shadow.image.basic</p>
michael@0 16939 <canvas id="c530" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16940 <script>
michael@0 16941
michael@0 16942
michael@0 16943
michael@0 16944 function test_2d_shadow_image_basic() {
michael@0 16945
michael@0 16946 var canvas = document.getElementById('c530');
michael@0 16947 var ctx = canvas.getContext('2d');
michael@0 16948
michael@0 16949 ctx.fillStyle = '#f00';
michael@0 16950 ctx.fillRect(0, 0, 100, 50);
michael@0 16951 ctx.shadowColor = '#0f0';
michael@0 16952 ctx.shadowOffsetY = 50;
michael@0 16953 ctx.drawImage(document.getElementById('red_17.png'), 0, -50);
michael@0 16954
michael@0 16955 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 16956
michael@0 16957
michael@0 16958 }
michael@0 16959 </script>
michael@0 16960 <img src="image_red.png" id="red_17.png" class="resource">
michael@0 16961
michael@0 16962 <!-- [[[ test_2d.shadow.image.scale.html ]]] -->
michael@0 16963
michael@0 16964 <p>Canvas test: 2d.shadow.image.scale</p>
michael@0 16965 <canvas id="c531" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16966 <script>
michael@0 16967
michael@0 16968
michael@0 16969
michael@0 16970 function test_2d_shadow_image_scale() {
michael@0 16971
michael@0 16972 var canvas = document.getElementById('c531');
michael@0 16973 var ctx = canvas.getContext('2d');
michael@0 16974
michael@0 16975 ctx.fillStyle = '#f00';
michael@0 16976 ctx.fillRect(0, 0, 100, 50);
michael@0 16977 ctx.shadowOffsetY = 50;
michael@0 16978 ctx.shadowColor = '#0f0';
michael@0 16979 ctx.drawImage(document.getElementById('redtransparent_2.png'), 0, 0, 100, 50, -10, -50, 240, 50);
michael@0 16980
michael@0 16981 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 16982 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 16983 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 16984
michael@0 16985
michael@0 16986 }
michael@0 16987 </script>
michael@0 16988 <img src="image_redtransparent.png" id="redtransparent_2.png" class="resource">
michael@0 16989
michael@0 16990 <!-- [[[ test_2d.shadow.image.section.html ]]] -->
michael@0 16991
michael@0 16992 <p>Canvas test: 2d.shadow.image.section</p>
michael@0 16993 <canvas id="c532" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 16994 <script>
michael@0 16995
michael@0 16996
michael@0 16997 function test_2d_shadow_image_section() {
michael@0 16998
michael@0 16999 var canvas = document.getElementById('c532');
michael@0 17000 var ctx = canvas.getContext('2d');
michael@0 17001
michael@0 17002 ctx.fillStyle = '#0f0';
michael@0 17003 ctx.fillRect(0, 0, 100, 50);
michael@0 17004 ctx.shadowOffsetY = 50;
michael@0 17005 ctx.shadowColor = '#f00';
michael@0 17006 ctx.drawImage(document.getElementById('redtransparent_3.png'), 50, 0, 50, 50, 0, -50, 50, 50);
michael@0 17007
michael@0 17008 isPixel(ctx, 25,25, 0,255,0,255, 2);
michael@0 17009 isPixel(ctx, 50,25, 0,255,0,255, 2);
michael@0 17010 isPixel(ctx, 75,25, 0,255,0,255, 2);
michael@0 17011
michael@0 17012
michael@0 17013 }
michael@0 17014 </script>
michael@0 17015 <img src="image_redtransparent.png" id="redtransparent_3.png" class="resource">
michael@0 17016
michael@0 17017 <!-- [[[ test_2d.shadow.image.transparent.1.html ]]] -->
michael@0 17018
michael@0 17019 <p>Canvas test: 2d.shadow.image.transparent.1</p>
michael@0 17020 <canvas id="c533" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17021 <script>
michael@0 17022
michael@0 17023
michael@0 17024 function test_2d_shadow_image_transparent_1() {
michael@0 17025
michael@0 17026 var canvas = document.getElementById('c533');
michael@0 17027 var ctx = canvas.getContext('2d');
michael@0 17028
michael@0 17029 ctx.fillStyle = '#0f0';
michael@0 17030 ctx.fillRect(0, 0, 100, 50);
michael@0 17031 ctx.shadowColor = '#f00';
michael@0 17032 ctx.shadowOffsetY = 50;
michael@0 17033 ctx.drawImage(document.getElementById('transparent_1.png'), 0, -50);
michael@0 17034
michael@0 17035 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17036
michael@0 17037
michael@0 17038 }
michael@0 17039 </script>
michael@0 17040 <img src="image_transparent.png" id="transparent_1.png" class="resource">
michael@0 17041
michael@0 17042 <!-- [[[ test_2d.shadow.image.transparent.2.html ]]] -->
michael@0 17043
michael@0 17044 <p>Canvas test: 2d.shadow.image.transparent.2</p>
michael@0 17045 <canvas id="c534" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17046 <script>
michael@0 17047
michael@0 17048
michael@0 17049
michael@0 17050 function test_2d_shadow_image_transparent_2() {
michael@0 17051
michael@0 17052 var canvas = document.getElementById('c534');
michael@0 17053 var ctx = canvas.getContext('2d');
michael@0 17054
michael@0 17055 ctx.fillStyle = '#0f0';
michael@0 17056 ctx.fillRect(0, 0, 50, 50);
michael@0 17057 ctx.fillStyle = '#f00';
michael@0 17058 ctx.fillRect(50, 0, 50, 50);
michael@0 17059 ctx.shadowOffsetY = 50;
michael@0 17060 ctx.shadowColor = '#0f0';
michael@0 17061 ctx.drawImage(document.getElementById('redtransparent_4.png'), 50, -50);
michael@0 17062 ctx.shadowColor = '#f00';
michael@0 17063 ctx.drawImage(document.getElementById('redtransparent_4.png'), -50, -50);
michael@0 17064
michael@0 17065 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 17066 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17067 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 17068
michael@0 17069
michael@0 17070 }
michael@0 17071 </script>
michael@0 17072 <img src="image_redtransparent.png" id="redtransparent_4.png" class="resource">
michael@0 17073
michael@0 17074 <!-- [[[ test_2d.shadow.offset.negativeX.html ]]] -->
michael@0 17075
michael@0 17076 <p>Canvas test: 2d.shadow.offset.negativeX</p>
michael@0 17077 <canvas id="c535" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17078 <script>
michael@0 17079
michael@0 17080
michael@0 17081
michael@0 17082 function test_2d_shadow_offset_negativeX() {
michael@0 17083
michael@0 17084 var canvas = document.getElementById('c535');
michael@0 17085 var ctx = canvas.getContext('2d');
michael@0 17086
michael@0 17087 ctx.fillStyle = '#f00';
michael@0 17088 ctx.fillRect(0, 0, 100, 50);
michael@0 17089 ctx.fillStyle = '#0f0';
michael@0 17090 ctx.shadowColor = '#0f0';
michael@0 17091 ctx.shadowOffsetX = -50;
michael@0 17092 ctx.fillRect(50, 0, 50, 50);
michael@0 17093 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 17094 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 17095
michael@0 17096
michael@0 17097 }
michael@0 17098 </script>
michael@0 17099
michael@0 17100 <!-- [[[ test_2d.shadow.offset.negativeY.html ]]] -->
michael@0 17101
michael@0 17102 <p>Canvas test: 2d.shadow.offset.negativeY</p>
michael@0 17103 <canvas id="c536" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17104 <script>
michael@0 17105
michael@0 17106
michael@0 17107
michael@0 17108 function test_2d_shadow_offset_negativeY() {
michael@0 17109
michael@0 17110 var canvas = document.getElementById('c536');
michael@0 17111 var ctx = canvas.getContext('2d');
michael@0 17112
michael@0 17113 ctx.fillStyle = '#f00';
michael@0 17114 ctx.fillRect(0, 0, 100, 50);
michael@0 17115 ctx.fillStyle = '#0f0';
michael@0 17116 ctx.shadowColor = '#0f0';
michael@0 17117 ctx.shadowOffsetY = -25;
michael@0 17118 ctx.fillRect(0, 25, 100, 25);
michael@0 17119 isPixel(ctx, 50,12, 0,255,0,255, 0);
michael@0 17120 isPixel(ctx, 50,37, 0,255,0,255, 0);
michael@0 17121
michael@0 17122
michael@0 17123 }
michael@0 17124 </script>
michael@0 17125
michael@0 17126 <!-- [[[ test_2d.shadow.offset.positiveX.html ]]] -->
michael@0 17127
michael@0 17128 <p>Canvas test: 2d.shadow.offset.positiveX</p>
michael@0 17129 <canvas id="c537" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17130 <script>
michael@0 17131
michael@0 17132
michael@0 17133
michael@0 17134 function test_2d_shadow_offset_positiveX() {
michael@0 17135
michael@0 17136 var canvas = document.getElementById('c537');
michael@0 17137 var ctx = canvas.getContext('2d');
michael@0 17138
michael@0 17139 ctx.fillStyle = '#f00';
michael@0 17140 ctx.fillRect(0, 0, 100, 50);
michael@0 17141 ctx.fillStyle = '#0f0';
michael@0 17142 ctx.shadowColor = '#0f0';
michael@0 17143 ctx.shadowOffsetX = 50;
michael@0 17144 ctx.fillRect(0, 0, 50, 50);
michael@0 17145 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 17146 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 17147
michael@0 17148
michael@0 17149 }
michael@0 17150 </script>
michael@0 17151
michael@0 17152 <!-- [[[ test_2d.shadow.offset.positiveY.html ]]] -->
michael@0 17153
michael@0 17154 <p>Canvas test: 2d.shadow.offset.positiveY</p>
michael@0 17155 <canvas id="c538" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17156 <script>
michael@0 17157
michael@0 17158
michael@0 17159
michael@0 17160 function test_2d_shadow_offset_positiveY() {
michael@0 17161
michael@0 17162 var canvas = document.getElementById('c538');
michael@0 17163 var ctx = canvas.getContext('2d');
michael@0 17164
michael@0 17165 ctx.fillStyle = '#f00';
michael@0 17166 ctx.fillRect(0, 0, 100, 50);
michael@0 17167 ctx.fillStyle = '#0f0';
michael@0 17168 ctx.shadowColor = '#0f0';
michael@0 17169 ctx.shadowOffsetY = 25;
michael@0 17170 ctx.fillRect(0, 0, 100, 25);
michael@0 17171 isPixel(ctx, 50,12, 0,255,0,255, 0);
michael@0 17172 isPixel(ctx, 50,37, 0,255,0,255, 0);
michael@0 17173
michael@0 17174
michael@0 17175 }
michael@0 17176 </script>
michael@0 17177
michael@0 17178 <!-- [[[ test_2d.shadow.outside.html ]]] -->
michael@0 17179
michael@0 17180 <p>Canvas test: 2d.shadow.outside</p>
michael@0 17181 <canvas id="c539" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17182 <script>
michael@0 17183
michael@0 17184
michael@0 17185
michael@0 17186 function test_2d_shadow_outside() {
michael@0 17187
michael@0 17188 var canvas = document.getElementById('c539');
michael@0 17189 var ctx = canvas.getContext('2d');
michael@0 17190
michael@0 17191 ctx.fillStyle = '#f00';
michael@0 17192 ctx.fillRect(0, 0, 100, 50);
michael@0 17193 ctx.shadowColor = '#0f0';
michael@0 17194 ctx.shadowOffsetX = 100;
michael@0 17195 ctx.fillRect(-100, 0, 25, 50);
michael@0 17196 ctx.shadowOffsetX = -100;
michael@0 17197 ctx.fillRect(175, 0, 25, 50);
michael@0 17198 ctx.shadowOffsetX = 0;
michael@0 17199 ctx.shadowOffsetY = 100;
michael@0 17200 ctx.fillRect(25, -100, 50, 25);
michael@0 17201 ctx.shadowOffsetY = -100;
michael@0 17202 ctx.fillRect(25, 125, 50, 25);
michael@0 17203 isPixel(ctx, 12,25, 0,255,0,255, 0);
michael@0 17204 isPixel(ctx, 87,25, 0,255,0,255, 0);
michael@0 17205 isPixel(ctx, 50,12, 0,255,0,255, 0);
michael@0 17206 isPixel(ctx, 50,37, 0,255,0,255, 0);
michael@0 17207
michael@0 17208
michael@0 17209 }
michael@0 17210 </script>
michael@0 17211
michael@0 17212 <!-- [[[ test_2d.shadow.pattern.alpha.html ]]] -->
michael@0 17213
michael@0 17214 <p>Canvas test: 2d.shadow.pattern.alpha</p>
michael@0 17215 <canvas id="c540" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17216 <script>
michael@0 17217
michael@0 17218
michael@0 17219
michael@0 17220 function test_2d_shadow_pattern_alpha() {
michael@0 17221
michael@0 17222 var canvas = document.getElementById('c540');
michael@0 17223 var ctx = canvas.getContext('2d');
michael@0 17224
michael@0 17225 var pattern = ctx.createPattern(document.getElementById('transparent50_3.png'), 'repeat');
michael@0 17226 ctx.fillStyle = '#f00';
michael@0 17227 ctx.fillRect(0, 0, 100, 50);
michael@0 17228 ctx.shadowOffsetY = 50;
michael@0 17229 ctx.shadowColor = '#00f';
michael@0 17230 ctx.fillStyle = pattern;
michael@0 17231 ctx.fillRect(0, -50, 100, 50);
michael@0 17232
michael@0 17233 isPixel(ctx, 50,25, 127,0,127,255, 2);
michael@0 17234
michael@0 17235
michael@0 17236 }
michael@0 17237 </script>
michael@0 17238 <img src="image_transparent50.png" id="transparent50_3.png" class="resource">
michael@0 17239
michael@0 17240 <!-- [[[ test_2d.shadow.pattern.basic.html ]]] -->
michael@0 17241
michael@0 17242 <p>Canvas test: 2d.shadow.pattern.basic</p>
michael@0 17243 <canvas id="c541" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17244 <script>
michael@0 17245
michael@0 17246
michael@0 17247
michael@0 17248 function test_2d_shadow_pattern_basic() {
michael@0 17249
michael@0 17250 var canvas = document.getElementById('c541');
michael@0 17251 var ctx = canvas.getContext('2d');
michael@0 17252
michael@0 17253 var pattern = ctx.createPattern(document.getElementById('red_18.png'), 'repeat');
michael@0 17254 ctx.fillStyle = '#f00';
michael@0 17255 ctx.fillRect(0, 0, 100, 50);
michael@0 17256 ctx.shadowColor = '#0f0';
michael@0 17257 ctx.shadowOffsetY = 50;
michael@0 17258 ctx.fillStyle = pattern;
michael@0 17259 ctx.fillRect(0, -50, 100, 50);
michael@0 17260
michael@0 17261 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17262
michael@0 17263
michael@0 17264 }
michael@0 17265 </script>
michael@0 17266 <img src="image_red.png" id="red_18.png" class="resource">
michael@0 17267
michael@0 17268 <!-- [[[ test_2d.shadow.pattern.transparent.1.html ]]] -->
michael@0 17269
michael@0 17270 <p>Canvas test: 2d.shadow.pattern.transparent.1</p>
michael@0 17271 <canvas id="c542" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17272 <script>
michael@0 17273
michael@0 17274
michael@0 17275 function test_2d_shadow_pattern_transparent_1() {
michael@0 17276
michael@0 17277 var canvas = document.getElementById('c542');
michael@0 17278 var ctx = canvas.getContext('2d');
michael@0 17279
michael@0 17280 var pattern = ctx.createPattern(document.getElementById('transparent_2.png'), 'repeat');
michael@0 17281 ctx.fillStyle = '#0f0';
michael@0 17282 ctx.fillRect(0, 0, 100, 50);
michael@0 17283 ctx.shadowColor = '#f00';
michael@0 17284 ctx.shadowOffsetY = 50;
michael@0 17285 ctx.fillStyle = pattern;
michael@0 17286 ctx.fillRect(0, -50, 100, 50);
michael@0 17287
michael@0 17288 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17289
michael@0 17290
michael@0 17291 }
michael@0 17292 </script>
michael@0 17293 <img src="image_transparent.png" id="transparent_2.png" class="resource">
michael@0 17294
michael@0 17295 <!-- [[[ test_2d.shadow.pattern.transparent.2.html ]]] -->
michael@0 17296
michael@0 17297 <p>Canvas test: 2d.shadow.pattern.transparent.2</p>
michael@0 17298 <canvas id="c543" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17299 <script>
michael@0 17300
michael@0 17301
michael@0 17302
michael@0 17303 function test_2d_shadow_pattern_transparent_2() {
michael@0 17304
michael@0 17305 var canvas = document.getElementById('c543');
michael@0 17306 var ctx = canvas.getContext('2d');
michael@0 17307
michael@0 17308 var pattern = ctx.createPattern(document.getElementById('redtransparent_5.png'), 'repeat');
michael@0 17309 ctx.fillStyle = '#f00';
michael@0 17310 ctx.fillRect(0, 0, 50, 50);
michael@0 17311 ctx.fillStyle = '#0f0';
michael@0 17312 ctx.fillRect(50, 0, 50, 50);
michael@0 17313 ctx.shadowOffsetY = 50;
michael@0 17314 ctx.shadowColor = '#0f0';
michael@0 17315 ctx.fillStyle = pattern;
michael@0 17316 ctx.fillRect(0, -50, 100, 50);
michael@0 17317
michael@0 17318 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 17319 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17320 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 17321
michael@0 17322
michael@0 17323 }
michael@0 17324 </script>
michael@0 17325 <img src="image_redtransparent.png" id="redtransparent_5.png" class="resource">
michael@0 17326
michael@0 17327 <!-- [[[ test_2d.shadow.stroke.basic.html ]]] -->
michael@0 17328
michael@0 17329 <p>Canvas test: 2d.shadow.stroke.basic</p>
michael@0 17330 <canvas id="c544" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17331 <script>
michael@0 17332
michael@0 17333
michael@0 17334
michael@0 17335 function test_2d_shadow_stroke_basic() {
michael@0 17336
michael@0 17337 var canvas = document.getElementById('c544');
michael@0 17338 var ctx = canvas.getContext('2d');
michael@0 17339
michael@0 17340 ctx.fillStyle = '#f00';
michael@0 17341 ctx.fillRect(0, 0, 100, 50);
michael@0 17342 ctx.strokeStyle = '#f00';
michael@0 17343 ctx.shadowColor = '#0f0';
michael@0 17344 ctx.shadowOffsetY = 50;
michael@0 17345 ctx.beginPath();
michael@0 17346 ctx.lineWidth = 50;
michael@0 17347 ctx.moveTo(0, -25);
michael@0 17348 ctx.lineTo(100, -25);
michael@0 17349 ctx.stroke();
michael@0 17350
michael@0 17351 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 17352 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17353 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 17354
michael@0 17355
michael@0 17356 }
michael@0 17357 </script>
michael@0 17358
michael@0 17359 <!-- [[[ test_2d.shadow.stroke.cap.1.html ]]] -->
michael@0 17360
michael@0 17361 <p>Canvas test: 2d.shadow.stroke.cap.1</p>
michael@0 17362 <canvas id="c545" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17363 <script>
michael@0 17364
michael@0 17365
michael@0 17366 function test_2d_shadow_stroke_cap_1() {
michael@0 17367
michael@0 17368 var canvas = document.getElementById('c545');
michael@0 17369 var ctx = canvas.getContext('2d');
michael@0 17370
michael@0 17371 ctx.fillStyle = '#0f0';
michael@0 17372 ctx.fillRect(0, 0, 100, 50);
michael@0 17373 ctx.strokeStyle = '#f00';
michael@0 17374 ctx.shadowColor = '#f00';
michael@0 17375 ctx.shadowOffsetY = 50;
michael@0 17376 ctx.beginPath();
michael@0 17377 ctx.lineWidth = 50;
michael@0 17378 ctx.lineCap = 'butt';
michael@0 17379 ctx.moveTo(-50, -25);
michael@0 17380 ctx.lineTo(0, -25);
michael@0 17381 ctx.moveTo(100, -25);
michael@0 17382 ctx.lineTo(150, -25);
michael@0 17383 ctx.stroke();
michael@0 17384
michael@0 17385 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 17386 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17387 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 17388
michael@0 17389
michael@0 17390 }
michael@0 17391 </script>
michael@0 17392
michael@0 17393 <!-- [[[ test_2d.shadow.stroke.cap.2.html ]]] -->
michael@0 17394
michael@0 17395 <p>Canvas test: 2d.shadow.stroke.cap.2</p>
michael@0 17396 <canvas id="c546" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17397 <script>
michael@0 17398
michael@0 17399
michael@0 17400
michael@0 17401 function test_2d_shadow_stroke_cap_2() {
michael@0 17402
michael@0 17403 var canvas = document.getElementById('c546');
michael@0 17404 var ctx = canvas.getContext('2d');
michael@0 17405
michael@0 17406 ctx.fillStyle = '#f00';
michael@0 17407 ctx.fillRect(0, 0, 100, 50);
michael@0 17408 ctx.strokeStyle = '#f00';
michael@0 17409 ctx.shadowColor = '#0f0';
michael@0 17410 ctx.shadowOffsetY = 50;
michael@0 17411 ctx.beginPath();
michael@0 17412 ctx.lineWidth = 50;
michael@0 17413 ctx.lineCap = 'square';
michael@0 17414 ctx.moveTo(25, -25);
michael@0 17415 ctx.lineTo(75, -25);
michael@0 17416 ctx.stroke();
michael@0 17417
michael@0 17418 isPixel(ctx, 1,25, 0,255,0,255, 0);
michael@0 17419 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17420 isPixel(ctx, 98,25, 0,255,0,255, 0);
michael@0 17421
michael@0 17422
michael@0 17423 }
michael@0 17424 </script>
michael@0 17425
michael@0 17426 <!-- [[[ test_2d.shadow.stroke.join.1.html ]]] -->
michael@0 17427
michael@0 17428 <p>Canvas test: 2d.shadow.stroke.join.1</p>
michael@0 17429 <canvas id="c547" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17430 <script>
michael@0 17431
michael@0 17432
michael@0 17433 function test_2d_shadow_stroke_join_1() {
michael@0 17434
michael@0 17435 var canvas = document.getElementById('c547');
michael@0 17436 var ctx = canvas.getContext('2d');
michael@0 17437
michael@0 17438 ctx.fillStyle = '#0f0';
michael@0 17439 ctx.fillRect(0, 0, 100, 50);
michael@0 17440 ctx.strokeStyle = '#f00';
michael@0 17441 ctx.shadowColor = '#f00';
michael@0 17442 ctx.shadowOffsetX = 100;
michael@0 17443 ctx.lineWidth = 200;
michael@0 17444 ctx.lineJoin = 'bevel';
michael@0 17445 ctx.beginPath();
michael@0 17446 ctx.moveTo(-200, -50);
michael@0 17447 ctx.lineTo(-150, -50);
michael@0 17448 ctx.lineTo(-151, -100);
michael@0 17449 ctx.stroke();
michael@0 17450
michael@0 17451 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 17452 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 17453 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17454 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 17455
michael@0 17456
michael@0 17457 }
michael@0 17458 </script>
michael@0 17459
michael@0 17460 <!-- [[[ test_2d.shadow.stroke.join.2.html ]]] -->
michael@0 17461
michael@0 17462 <p>Canvas test: 2d.shadow.stroke.join.2</p>
michael@0 17463 <canvas id="c548" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17464 <script>
michael@0 17465
michael@0 17466
michael@0 17467
michael@0 17468 function test_2d_shadow_stroke_join_2() {
michael@0 17469
michael@0 17470 var canvas = document.getElementById('c548');
michael@0 17471 var ctx = canvas.getContext('2d');
michael@0 17472
michael@0 17473 ctx.fillStyle = '#f00';
michael@0 17474 ctx.fillRect(0, 0, 50, 50);
michael@0 17475 ctx.fillStyle = '#0f0';
michael@0 17476 ctx.fillRect(50, 0, 50, 50);
michael@0 17477 ctx.strokeStyle = '#f00';
michael@0 17478 ctx.shadowColor = '#0f0';
michael@0 17479 ctx.shadowOffsetX = 100;
michael@0 17480 ctx.lineWidth = 200;
michael@0 17481 ctx.lineJoin = 'miter';
michael@0 17482 ctx.beginPath();
michael@0 17483 ctx.moveTo(-200, -50);
michael@0 17484 ctx.lineTo(-150, -50);
michael@0 17485 ctx.lineTo(-151, -100);
michael@0 17486 ctx.stroke();
michael@0 17487
michael@0 17488 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 17489 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 17490 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17491 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 17492
michael@0 17493
michael@0 17494 }
michael@0 17495 </script>
michael@0 17496
michael@0 17497 <!-- [[[ test_2d.shadow.stroke.join.3.html ]]] -->
michael@0 17498
michael@0 17499 <p>Canvas test: 2d.shadow.stroke.join.3</p>
michael@0 17500 <canvas id="c549" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17501 <script>
michael@0 17502
michael@0 17503
michael@0 17504 function test_2d_shadow_stroke_join_3() {
michael@0 17505
michael@0 17506 var canvas = document.getElementById('c549');
michael@0 17507 var ctx = canvas.getContext('2d');
michael@0 17508
michael@0 17509 ctx.fillStyle = '#0f0';
michael@0 17510 ctx.fillRect(0, 0, 100, 50);
michael@0 17511 ctx.strokeStyle = '#f00';
michael@0 17512 ctx.shadowColor = '#f00';
michael@0 17513 ctx.shadowOffsetX = 100;
michael@0 17514 ctx.lineWidth = 200;
michael@0 17515 ctx.lineJoin = 'miter';
michael@0 17516 ctx.miterLimit = 0.1;
michael@0 17517 ctx.beginPath();
michael@0 17518 ctx.moveTo(-200, -50);
michael@0 17519 ctx.lineTo(-150, -50);
michael@0 17520 ctx.lineTo(-151, -100); // (not an exact right angle, to avoid some other bug in Firefox 3)
michael@0 17521 ctx.stroke();
michael@0 17522
michael@0 17523 isPixel(ctx, 1,1, 0,255,0,255, 0);
michael@0 17524 isPixel(ctx, 48,48, 0,255,0,255, 0);
michael@0 17525 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17526 isPixel(ctx, 98,48, 0,255,0,255, 0);
michael@0 17527
michael@0 17528
michael@0 17529 }
michael@0 17530 </script>
michael@0 17531
michael@0 17532 <!-- [[[ test_2d.shadow.transform.1.html ]]] -->
michael@0 17533
michael@0 17534 <p>Canvas test: 2d.shadow.transform.1</p>
michael@0 17535 <canvas id="c550" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17536 <script>
michael@0 17537
michael@0 17538
michael@0 17539
michael@0 17540 function test_2d_shadow_transform_1() {
michael@0 17541
michael@0 17542 var canvas = document.getElementById('c550');
michael@0 17543 var ctx = canvas.getContext('2d');
michael@0 17544
michael@0 17545 ctx.fillStyle = '#f00';
michael@0 17546 ctx.fillRect(0, 0, 100, 50);
michael@0 17547 ctx.shadowOffsetY = 50;
michael@0 17548 ctx.shadowColor = '#0f0';
michael@0 17549 ctx.translate(100, 100);
michael@0 17550 ctx.fillRect(-100, -150, 100, 50);
michael@0 17551
michael@0 17552 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17553
michael@0 17554
michael@0 17555 }
michael@0 17556 </script>
michael@0 17557
michael@0 17558 <!-- [[[ test_2d.shadow.transform.2.html ]]] -->
michael@0 17559
michael@0 17560 <p>Canvas test: 2d.shadow.transform.2</p>
michael@0 17561 <canvas id="c551" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17562 <script>
michael@0 17563
michael@0 17564
michael@0 17565
michael@0 17566 function test_2d_shadow_transform_2() {
michael@0 17567
michael@0 17568 var canvas = document.getElementById('c551');
michael@0 17569 var ctx = canvas.getContext('2d');
michael@0 17570
michael@0 17571 ctx.fillStyle = '#f00';
michael@0 17572 ctx.fillRect(0, 0, 100, 50);
michael@0 17573 ctx.shadowOffsetY = 50;
michael@0 17574 ctx.shadowColor = '#0f0';
michael@0 17575 ctx.rotate(Math.PI)
michael@0 17576 ctx.fillRect(-100, 0, 100, 50);
michael@0 17577
michael@0 17578 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17579
michael@0 17580
michael@0 17581 }
michael@0 17582 </script>
michael@0 17583
michael@0 17584 <!-- [[[ test_2d.state.saverestore.bitmap.html ]]] -->
michael@0 17585
michael@0 17586 <p>Canvas test: 2d.state.saverestore.bitmap</p>
michael@0 17587 <!-- Testing: save()/restore() does not affect the current bitmap -->
michael@0 17588 <canvas id="c552" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17589 <script>
michael@0 17590
michael@0 17591
michael@0 17592 function test_2d_state_saverestore_bitmap() {
michael@0 17593
michael@0 17594 var canvas = document.getElementById('c552');
michael@0 17595 var ctx = canvas.getContext('2d');
michael@0 17596
michael@0 17597 ctx.fillStyle = '#f00';
michael@0 17598 ctx.fillRect(0, 0, 100, 50);
michael@0 17599 ctx.save();
michael@0 17600 ctx.fillStyle = '#0f0';
michael@0 17601 ctx.fillRect(0, 0, 100, 50);
michael@0 17602 ctx.restore();
michael@0 17603 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17604
michael@0 17605
michael@0 17606 }
michael@0 17607 </script>
michael@0 17608
michael@0 17609 <!-- [[[ test_2d.state.saverestore.clip.html ]]] -->
michael@0 17610
michael@0 17611 <p>Canvas test: 2d.state.saverestore.clip</p>
michael@0 17612 <!-- Testing: save()/restore() affects the clipping path -->
michael@0 17613 <canvas id="c553" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17614 <script>
michael@0 17615
michael@0 17616
michael@0 17617 function test_2d_state_saverestore_clip() {
michael@0 17618
michael@0 17619 var canvas = document.getElementById('c553');
michael@0 17620 var ctx = canvas.getContext('2d');
michael@0 17621
michael@0 17622 ctx.fillStyle = '#f00';
michael@0 17623 ctx.fillRect(0, 0, 100, 50);
michael@0 17624 ctx.save();
michael@0 17625 ctx.rect(0, 0, 1, 1);
michael@0 17626 ctx.clip();
michael@0 17627 ctx.restore();
michael@0 17628 ctx.fillStyle = '#0f0';
michael@0 17629 ctx.fillRect(0, 0, 100, 50);
michael@0 17630 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17631
michael@0 17632
michael@0 17633 }
michael@0 17634 </script>
michael@0 17635
michael@0 17636 <!-- [[[ test_2d.state.saverestore.fillStyle.html ]]] -->
michael@0 17637
michael@0 17638 <p>Canvas test: 2d.state.saverestore.fillStyle</p>
michael@0 17639 <!-- Testing: save()/restore() works for fillStyle -->
michael@0 17640 <canvas id="c554" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17641 <script>
michael@0 17642
michael@0 17643 function test_2d_state_saverestore_fillStyle() {
michael@0 17644
michael@0 17645 var canvas = document.getElementById('c554');
michael@0 17646 var ctx = canvas.getContext('2d');
michael@0 17647
michael@0 17648 // Test that restore() undoes any modifications
michael@0 17649 var old = ctx.fillStyle;
michael@0 17650 ctx.save();
michael@0 17651 ctx.fillStyle = "#ff0000";
michael@0 17652 ctx.restore();
michael@0 17653 ok(ctx.fillStyle === old, "ctx.fillStyle === old");
michael@0 17654
michael@0 17655 // Also test that save() doesn't modify the values
michael@0 17656 ctx.fillStyle = "#ff0000";
michael@0 17657 old = ctx.fillStyle;
michael@0 17658 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17659 // from rounding), so compare against d instead of against "#ff0000"
michael@0 17660 ctx.save();
michael@0 17661 ok(ctx.fillStyle === old, "ctx.fillStyle === old");
michael@0 17662 ctx.restore();
michael@0 17663
michael@0 17664
michael@0 17665 }
michael@0 17666 </script>
michael@0 17667
michael@0 17668 <!-- [[[ test_2d.state.saverestore.globalAlpha.html ]]] -->
michael@0 17669
michael@0 17670 <p>Canvas test: 2d.state.saverestore.globalAlpha</p>
michael@0 17671 <!-- Testing: save()/restore() works for globalAlpha -->
michael@0 17672 <canvas id="c555" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17673 <script>
michael@0 17674
michael@0 17675 function test_2d_state_saverestore_globalAlpha() {
michael@0 17676
michael@0 17677 var canvas = document.getElementById('c555');
michael@0 17678 var ctx = canvas.getContext('2d');
michael@0 17679
michael@0 17680 // Test that restore() undoes any modifications
michael@0 17681 var old = ctx.globalAlpha;
michael@0 17682 ctx.save();
michael@0 17683 ctx.globalAlpha = 0.5;
michael@0 17684 ctx.restore();
michael@0 17685 ok(ctx.globalAlpha === old, "ctx.globalAlpha === old");
michael@0 17686
michael@0 17687 // Also test that save() doesn't modify the values
michael@0 17688 ctx.globalAlpha = 0.5;
michael@0 17689 old = ctx.globalAlpha;
michael@0 17690 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17691 // from rounding), so compare against d instead of against 0.5
michael@0 17692 ctx.save();
michael@0 17693 ok(ctx.globalAlpha === old, "ctx.globalAlpha === old");
michael@0 17694 ctx.restore();
michael@0 17695
michael@0 17696
michael@0 17697 }
michael@0 17698 </script>
michael@0 17699
michael@0 17700 <!-- [[[ test_2d.state.saverestore.globalCompositeOperation.html ]]] -->
michael@0 17701
michael@0 17702 <p>Canvas test: 2d.state.saverestore.globalCompositeOperation</p>
michael@0 17703 <!-- Testing: save()/restore() works for globalCompositeOperation -->
michael@0 17704 <canvas id="c556" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17705 <script>
michael@0 17706
michael@0 17707 function test_2d_state_saverestore_globalCompositeOperation() {
michael@0 17708
michael@0 17709 var canvas = document.getElementById('c556');
michael@0 17710 var ctx = canvas.getContext('2d');
michael@0 17711
michael@0 17712 // Test that restore() undoes any modifications
michael@0 17713 var old = ctx.globalCompositeOperation;
michael@0 17714 ctx.save();
michael@0 17715 ctx.globalCompositeOperation = "copy";
michael@0 17716 ctx.restore();
michael@0 17717 ok(ctx.globalCompositeOperation === old, "ctx.globalCompositeOperation === old");
michael@0 17718
michael@0 17719 // Also test that save() doesn't modify the values
michael@0 17720 ctx.globalCompositeOperation = "copy";
michael@0 17721 old = ctx.globalCompositeOperation;
michael@0 17722 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17723 // from rounding), so compare against d instead of against "copy"
michael@0 17724 ctx.save();
michael@0 17725 ok(ctx.globalCompositeOperation === old, "ctx.globalCompositeOperation === old");
michael@0 17726 ctx.restore();
michael@0 17727
michael@0 17728
michael@0 17729 }
michael@0 17730 </script>
michael@0 17731
michael@0 17732 <!-- [[[ test_2d.state.saverestore.lineCap.html ]]] -->
michael@0 17733
michael@0 17734 <p>Canvas test: 2d.state.saverestore.lineCap</p>
michael@0 17735 <!-- Testing: save()/restore() works for lineCap -->
michael@0 17736 <canvas id="c557" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17737 <script>
michael@0 17738
michael@0 17739 function test_2d_state_saverestore_lineCap() {
michael@0 17740
michael@0 17741 var canvas = document.getElementById('c557');
michael@0 17742 var ctx = canvas.getContext('2d');
michael@0 17743
michael@0 17744 // Test that restore() undoes any modifications
michael@0 17745 var old = ctx.lineCap;
michael@0 17746 ctx.save();
michael@0 17747 ctx.lineCap = "round";
michael@0 17748 ctx.restore();
michael@0 17749 ok(ctx.lineCap === old, "ctx.lineCap === old");
michael@0 17750
michael@0 17751 // Also test that save() doesn't modify the values
michael@0 17752 ctx.lineCap = "round";
michael@0 17753 old = ctx.lineCap;
michael@0 17754 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17755 // from rounding), so compare against d instead of against "round"
michael@0 17756 ctx.save();
michael@0 17757 ok(ctx.lineCap === old, "ctx.lineCap === old");
michael@0 17758 ctx.restore();
michael@0 17759
michael@0 17760
michael@0 17761 }
michael@0 17762 </script>
michael@0 17763
michael@0 17764 <!-- [[[ test_2d.state.saverestore.lineJoin.html ]]] -->
michael@0 17765
michael@0 17766 <p>Canvas test: 2d.state.saverestore.lineJoin</p>
michael@0 17767 <!-- Testing: save()/restore() works for lineJoin -->
michael@0 17768 <canvas id="c558" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17769 <script>
michael@0 17770
michael@0 17771 function test_2d_state_saverestore_lineJoin() {
michael@0 17772
michael@0 17773 var canvas = document.getElementById('c558');
michael@0 17774 var ctx = canvas.getContext('2d');
michael@0 17775
michael@0 17776 // Test that restore() undoes any modifications
michael@0 17777 var old = ctx.lineJoin;
michael@0 17778 ctx.save();
michael@0 17779 ctx.lineJoin = "round";
michael@0 17780 ctx.restore();
michael@0 17781 ok(ctx.lineJoin === old, "ctx.lineJoin === old");
michael@0 17782
michael@0 17783 // Also test that save() doesn't modify the values
michael@0 17784 ctx.lineJoin = "round";
michael@0 17785 old = ctx.lineJoin;
michael@0 17786 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17787 // from rounding), so compare against d instead of against "round"
michael@0 17788 ctx.save();
michael@0 17789 ok(ctx.lineJoin === old, "ctx.lineJoin === old");
michael@0 17790 ctx.restore();
michael@0 17791
michael@0 17792
michael@0 17793 }
michael@0 17794 </script>
michael@0 17795
michael@0 17796 <!-- [[[ test_2d.state.saverestore.lineWidth.html ]]] -->
michael@0 17797
michael@0 17798 <p>Canvas test: 2d.state.saverestore.lineWidth</p>
michael@0 17799 <!-- Testing: save()/restore() works for lineWidth -->
michael@0 17800 <canvas id="c559" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17801 <script>
michael@0 17802
michael@0 17803 function test_2d_state_saverestore_lineWidth() {
michael@0 17804
michael@0 17805 var canvas = document.getElementById('c559');
michael@0 17806 var ctx = canvas.getContext('2d');
michael@0 17807
michael@0 17808 // Test that restore() undoes any modifications
michael@0 17809 var old = ctx.lineWidth;
michael@0 17810 ctx.save();
michael@0 17811 ctx.lineWidth = 0.5;
michael@0 17812 ctx.restore();
michael@0 17813 ok(ctx.lineWidth === old, "ctx.lineWidth === old");
michael@0 17814
michael@0 17815 // Also test that save() doesn't modify the values
michael@0 17816 ctx.lineWidth = 0.5;
michael@0 17817 old = ctx.lineWidth;
michael@0 17818 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17819 // from rounding), so compare against d instead of against 0.5
michael@0 17820 ctx.save();
michael@0 17821 ok(ctx.lineWidth === old, "ctx.lineWidth === old");
michael@0 17822 ctx.restore();
michael@0 17823
michael@0 17824
michael@0 17825 }
michael@0 17826 </script>
michael@0 17827
michael@0 17828 <!-- [[[ test_2d.state.saverestore.miterLimit.html ]]] -->
michael@0 17829
michael@0 17830 <p>Canvas test: 2d.state.saverestore.miterLimit</p>
michael@0 17831 <!-- Testing: save()/restore() works for miterLimit -->
michael@0 17832 <canvas id="c560" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17833 <script>
michael@0 17834
michael@0 17835 function test_2d_state_saverestore_miterLimit() {
michael@0 17836
michael@0 17837 var canvas = document.getElementById('c560');
michael@0 17838 var ctx = canvas.getContext('2d');
michael@0 17839
michael@0 17840 // Test that restore() undoes any modifications
michael@0 17841 var old = ctx.miterLimit;
michael@0 17842 ctx.save();
michael@0 17843 ctx.miterLimit = 0.5;
michael@0 17844 ctx.restore();
michael@0 17845 ok(ctx.miterLimit === old, "ctx.miterLimit === old");
michael@0 17846
michael@0 17847 // Also test that save() doesn't modify the values
michael@0 17848 ctx.miterLimit = 0.5;
michael@0 17849 old = ctx.miterLimit;
michael@0 17850 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17851 // from rounding), so compare against d instead of against 0.5
michael@0 17852 ctx.save();
michael@0 17853 ok(ctx.miterLimit === old, "ctx.miterLimit === old");
michael@0 17854 ctx.restore();
michael@0 17855
michael@0 17856
michael@0 17857 }
michael@0 17858 </script>
michael@0 17859
michael@0 17860 <!-- [[[ test_2d.state.saverestore.path.html ]]] -->
michael@0 17861
michael@0 17862 <p>Canvas test: 2d.state.saverestore.path</p>
michael@0 17863 <!-- Testing: save()/restore() does not affect the current path -->
michael@0 17864 <canvas id="c561" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17865 <script>
michael@0 17866
michael@0 17867
michael@0 17868 function test_2d_state_saverestore_path() {
michael@0 17869
michael@0 17870 var canvas = document.getElementById('c561');
michael@0 17871 var ctx = canvas.getContext('2d');
michael@0 17872
michael@0 17873 ctx.fillStyle = '#f00';
michael@0 17874 ctx.fillRect(0, 0, 100, 50);
michael@0 17875 ctx.save();
michael@0 17876 ctx.rect(0, 0, 100, 50);
michael@0 17877 ctx.restore();
michael@0 17878 ctx.fillStyle = '#0f0';
michael@0 17879 ctx.fill();
michael@0 17880 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 17881
michael@0 17882
michael@0 17883 }
michael@0 17884 </script>
michael@0 17885
michael@0 17886 <!-- [[[ test_2d.state.saverestore.shadowBlur.html ]]] -->
michael@0 17887
michael@0 17888 <p>Canvas test: 2d.state.saverestore.shadowBlur</p>
michael@0 17889 <!-- Testing: save()/restore() works for shadowBlur -->
michael@0 17890 <canvas id="c562" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17891 <script>
michael@0 17892
michael@0 17893 function test_2d_state_saverestore_shadowBlur() {
michael@0 17894
michael@0 17895 var canvas = document.getElementById('c562');
michael@0 17896 var ctx = canvas.getContext('2d');
michael@0 17897
michael@0 17898 // Test that restore() undoes any modifications
michael@0 17899 var old = ctx.shadowBlur;
michael@0 17900 ctx.save();
michael@0 17901 ctx.shadowBlur = 5;
michael@0 17902 ctx.restore();
michael@0 17903 ok(ctx.shadowBlur === old, "ctx.shadowBlur === old");
michael@0 17904
michael@0 17905 // Also test that save() doesn't modify the values
michael@0 17906 ctx.shadowBlur = 5;
michael@0 17907 old = ctx.shadowBlur;
michael@0 17908 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17909 // from rounding), so compare against d instead of against 5
michael@0 17910 ctx.save();
michael@0 17911 ok(ctx.shadowBlur === old, "ctx.shadowBlur === old");
michael@0 17912 ctx.restore();
michael@0 17913
michael@0 17914
michael@0 17915 }
michael@0 17916 </script>
michael@0 17917
michael@0 17918 <!-- [[[ test_2d.state.saverestore.shadowColor.html ]]] -->
michael@0 17919
michael@0 17920 <p>Canvas test: 2d.state.saverestore.shadowColor</p>
michael@0 17921 <!-- Testing: save()/restore() works for shadowColor -->
michael@0 17922 <canvas id="c563" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17923 <script>
michael@0 17924
michael@0 17925 function test_2d_state_saverestore_shadowColor() {
michael@0 17926
michael@0 17927 var canvas = document.getElementById('c563');
michael@0 17928 var ctx = canvas.getContext('2d');
michael@0 17929
michael@0 17930 // Test that restore() undoes any modifications
michael@0 17931 var old = ctx.shadowColor;
michael@0 17932 ctx.save();
michael@0 17933 ctx.shadowColor = "#ff0000";
michael@0 17934 ctx.restore();
michael@0 17935 ok(ctx.shadowColor === old, "ctx.shadowColor === old");
michael@0 17936
michael@0 17937 // Also test that save() doesn't modify the values
michael@0 17938 ctx.shadowColor = "#ff0000";
michael@0 17939 old = ctx.shadowColor;
michael@0 17940 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17941 // from rounding), so compare against d instead of against "#ff0000"
michael@0 17942 ctx.save();
michael@0 17943 ok(ctx.shadowColor === old, "ctx.shadowColor === old");
michael@0 17944 ctx.restore();
michael@0 17945
michael@0 17946
michael@0 17947 }
michael@0 17948 </script>
michael@0 17949
michael@0 17950 <!-- [[[ test_2d.state.saverestore.shadowOffsetX.html ]]] -->
michael@0 17951
michael@0 17952 <p>Canvas test: 2d.state.saverestore.shadowOffsetX</p>
michael@0 17953 <!-- Testing: save()/restore() works for shadowOffsetX -->
michael@0 17954 <canvas id="c564" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17955 <script>
michael@0 17956
michael@0 17957 function test_2d_state_saverestore_shadowOffsetX() {
michael@0 17958
michael@0 17959 var canvas = document.getElementById('c564');
michael@0 17960 var ctx = canvas.getContext('2d');
michael@0 17961
michael@0 17962 // Test that restore() undoes any modifications
michael@0 17963 var old = ctx.shadowOffsetX;
michael@0 17964 ctx.save();
michael@0 17965 ctx.shadowOffsetX = 5;
michael@0 17966 ctx.restore();
michael@0 17967 ok(ctx.shadowOffsetX === old, "ctx.shadowOffsetX === old");
michael@0 17968
michael@0 17969 // Also test that save() doesn't modify the values
michael@0 17970 ctx.shadowOffsetX = 5;
michael@0 17971 old = ctx.shadowOffsetX;
michael@0 17972 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 17973 // from rounding), so compare against d instead of against 5
michael@0 17974 ctx.save();
michael@0 17975 ok(ctx.shadowOffsetX === old, "ctx.shadowOffsetX === old");
michael@0 17976 ctx.restore();
michael@0 17977
michael@0 17978
michael@0 17979 }
michael@0 17980 </script>
michael@0 17981
michael@0 17982 <!-- [[[ test_2d.state.saverestore.shadowOffsetY.html ]]] -->
michael@0 17983
michael@0 17984 <p>Canvas test: 2d.state.saverestore.shadowOffsetY</p>
michael@0 17985 <!-- Testing: save()/restore() works for shadowOffsetY -->
michael@0 17986 <canvas id="c565" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 17987 <script>
michael@0 17988
michael@0 17989 function test_2d_state_saverestore_shadowOffsetY() {
michael@0 17990
michael@0 17991 var canvas = document.getElementById('c565');
michael@0 17992 var ctx = canvas.getContext('2d');
michael@0 17993
michael@0 17994 // Test that restore() undoes any modifications
michael@0 17995 var old = ctx.shadowOffsetY;
michael@0 17996 ctx.save();
michael@0 17997 ctx.shadowOffsetY = 5;
michael@0 17998 ctx.restore();
michael@0 17999 ok(ctx.shadowOffsetY === old, "ctx.shadowOffsetY === old");
michael@0 18000
michael@0 18001 // Also test that save() doesn't modify the values
michael@0 18002 ctx.shadowOffsetY = 5;
michael@0 18003 old = ctx.shadowOffsetY;
michael@0 18004 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 18005 // from rounding), so compare against d instead of against 5
michael@0 18006 ctx.save();
michael@0 18007 ok(ctx.shadowOffsetY === old, "ctx.shadowOffsetY === old");
michael@0 18008 ctx.restore();
michael@0 18009
michael@0 18010
michael@0 18011 }
michael@0 18012 </script>
michael@0 18013
michael@0 18014 <!-- [[[ test_2d.state.saverestore.stack.html ]]] -->
michael@0 18015
michael@0 18016 <p>Canvas test: 2d.state.saverestore.stack</p>
michael@0 18017 <!-- Testing: save()/restore() can be nested as a stack -->
michael@0 18018 <canvas id="c566" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18019 <script>
michael@0 18020
michael@0 18021 function test_2d_state_saverestore_stack() {
michael@0 18022
michael@0 18023 var canvas = document.getElementById('c566');
michael@0 18024 var ctx = canvas.getContext('2d');
michael@0 18025
michael@0 18026 ctx.lineWidth = 1;
michael@0 18027 ctx.save();
michael@0 18028 ctx.lineWidth = 2;
michael@0 18029 ctx.save();
michael@0 18030 ctx.lineWidth = 3;
michael@0 18031 ok(ctx.lineWidth == 3, "ctx.lineWidth == 3");
michael@0 18032 ctx.restore();
michael@0 18033 ok(ctx.lineWidth == 2, "ctx.lineWidth == 2");
michael@0 18034 ctx.restore();
michael@0 18035 ok(ctx.lineWidth == 1, "ctx.lineWidth == 1");
michael@0 18036
michael@0 18037
michael@0 18038 }
michael@0 18039 </script>
michael@0 18040
michael@0 18041 <!-- [[[ test_2d.state.saverestore.stackdepth.html ]]] -->
michael@0 18042
michael@0 18043 <p>Canvas test: 2d.state.saverestore.stackdepth</p>
michael@0 18044 <!-- Testing: save()/restore() stack depth is not unreasonably limited -->
michael@0 18045 <canvas id="c567" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18046 <script>
michael@0 18047
michael@0 18048 function test_2d_state_saverestore_stackdepth() {
michael@0 18049
michael@0 18050 var canvas = document.getElementById('c567');
michael@0 18051 var ctx = canvas.getContext('2d');
michael@0 18052
michael@0 18053 var limit = 512;
michael@0 18054 for (var i = 1; i < limit; ++i)
michael@0 18055 {
michael@0 18056 ctx.save();
michael@0 18057 ctx.lineWidth = i;
michael@0 18058 }
michael@0 18059 for (var i = limit-1; i > 0; --i)
michael@0 18060 {
michael@0 18061 ok(ctx.lineWidth == i, "ctx.lineWidth == i");
michael@0 18062 ctx.restore();
michael@0 18063 }
michael@0 18064
michael@0 18065
michael@0 18066 }
michael@0 18067 </script>
michael@0 18068
michael@0 18069 <!-- [[[ test_2d.state.saverestore.strokeStyle.html ]]] -->
michael@0 18070
michael@0 18071 <p>Canvas test: 2d.state.saverestore.strokeStyle</p>
michael@0 18072 <!-- Testing: save()/restore() works for strokeStyle -->
michael@0 18073 <canvas id="c568" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18074 <script>
michael@0 18075
michael@0 18076 function test_2d_state_saverestore_strokeStyle() {
michael@0 18077
michael@0 18078 var canvas = document.getElementById('c568');
michael@0 18079 var ctx = canvas.getContext('2d');
michael@0 18080
michael@0 18081 // Test that restore() undoes any modifications
michael@0 18082 var old = ctx.strokeStyle;
michael@0 18083 ctx.save();
michael@0 18084 ctx.strokeStyle = "#ff0000";
michael@0 18085 ctx.restore();
michael@0 18086 ok(ctx.strokeStyle === old, "ctx.strokeStyle === old");
michael@0 18087
michael@0 18088 // Also test that save() doesn't modify the values
michael@0 18089 ctx.strokeStyle = "#ff0000";
michael@0 18090 old = ctx.strokeStyle;
michael@0 18091 // we're not interested in failures caused by get(set(x)) != x (e.g.
michael@0 18092 // from rounding), so compare against d instead of against "#ff0000"
michael@0 18093 ctx.save();
michael@0 18094 ok(ctx.strokeStyle === old, "ctx.strokeStyle === old");
michael@0 18095 ctx.restore();
michael@0 18096
michael@0 18097
michael@0 18098 }
michael@0 18099 </script>
michael@0 18100
michael@0 18101 <!-- [[[ test_2d.state.saverestore.transformation.html ]]] -->
michael@0 18102
michael@0 18103 <p>Canvas test: 2d.state.saverestore.transformation</p>
michael@0 18104 <!-- Testing: save()/restore() affects the current transformation matrix -->
michael@0 18105 <canvas id="c569" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18106 <script>
michael@0 18107
michael@0 18108
michael@0 18109 function test_2d_state_saverestore_transformation() {
michael@0 18110
michael@0 18111 var canvas = document.getElementById('c569');
michael@0 18112 var ctx = canvas.getContext('2d');
michael@0 18113
michael@0 18114 ctx.fillStyle = '#0f0';
michael@0 18115 ctx.fillRect(0, 0, 100, 50);
michael@0 18116 ctx.save();
michael@0 18117 ctx.translate(200, 0);
michael@0 18118 ctx.restore();
michael@0 18119 ctx.fillStyle = '#f00';
michael@0 18120 ctx.fillRect(-200, 0, 100, 50);
michael@0 18121 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18122
michael@0 18123
michael@0 18124 }
michael@0 18125 </script>
michael@0 18126
michael@0 18127 <!-- [[[ test_2d.state.saverestore.underflow.html ]]] -->
michael@0 18128
michael@0 18129 <p>Canvas test: 2d.state.saverestore.underflow - bug 296821</p>
michael@0 18130 <!-- Testing: restore() with an empty stack has no effect -->
michael@0 18131 <canvas id="c570" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18132 <script>
michael@0 18133
michael@0 18134 function test_2d_state_saverestore_underflow() {
michael@0 18135
michael@0 18136 var canvas = document.getElementById('c570');
michael@0 18137 var ctx = canvas.getContext('2d');
michael@0 18138
michael@0 18139 for (var i = 0; i < 16; ++i)
michael@0 18140 ctx.restore();
michael@0 18141 ctx.lineWidth = 0.5;
michael@0 18142 ctx.restore();
michael@0 18143 ok(ctx.lineWidth == 0.5, "ctx.lineWidth == 0.5");
michael@0 18144
michael@0 18145
michael@0 18146 }
michael@0 18147 </script>
michael@0 18148
michael@0 18149 <!-- [[[ test_2d.strokeRect.basic.html ]]] -->
michael@0 18150
michael@0 18151 <p>Canvas test: 2d.strokeRect.basic</p>
michael@0 18152 <canvas id="c571" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18153 <script>
michael@0 18154
michael@0 18155
michael@0 18156 function test_2d_strokeRect_basic() {
michael@0 18157
michael@0 18158 var canvas = document.getElementById('c571');
michael@0 18159 var ctx = canvas.getContext('2d');
michael@0 18160
michael@0 18161 ctx.strokeStyle = '#0f0';
michael@0 18162 ctx.lineWidth = 50;
michael@0 18163 ctx.strokeRect(25, 24, 50, 2);
michael@0 18164 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18165
michael@0 18166
michael@0 18167 }
michael@0 18168 </script>
michael@0 18169
michael@0 18170 <!-- [[[ test_2d.strokeRect.clip.html ]]] -->
michael@0 18171
michael@0 18172 <p>Canvas test: 2d.strokeRect.clip</p>
michael@0 18173 <canvas id="c572" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18174 <script>
michael@0 18175
michael@0 18176
michael@0 18177 function test_2d_strokeRect_clip() {
michael@0 18178
michael@0 18179 var canvas = document.getElementById('c572');
michael@0 18180 var ctx = canvas.getContext('2d');
michael@0 18181
michael@0 18182 ctx.fillStyle = '#0f0';
michael@0 18183 ctx.fillRect(0, 0, 100, 50);
michael@0 18184
michael@0 18185 ctx.beginPath();
michael@0 18186 ctx.rect(0, 0, 16, 16);
michael@0 18187 ctx.clip();
michael@0 18188
michael@0 18189 ctx.strokeStyle = '#f00';
michael@0 18190 ctx.lineWidth = 50;
michael@0 18191 ctx.strokeRect(0, 0, 100, 50);
michael@0 18192
michael@0 18193 ctx.fillStyle = '#0f0';
michael@0 18194 ctx.fillRect(0, 0, 16, 16);
michael@0 18195
michael@0 18196 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18197
michael@0 18198
michael@0 18199 }
michael@0 18200 </script>
michael@0 18201
michael@0 18202 <!-- [[[ test_2d.strokeRect.globalalpha.html ]]] -->
michael@0 18203
michael@0 18204 <p>Canvas test: 2d.strokeRect.globalalpha</p>
michael@0 18205 <canvas id="c573" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18206 <script>
michael@0 18207
michael@0 18208
michael@0 18209 function test_2d_strokeRect_globalalpha() {
michael@0 18210
michael@0 18211 var canvas = document.getElementById('c573');
michael@0 18212 var ctx = canvas.getContext('2d');
michael@0 18213
michael@0 18214 ctx.globalAlpha = 0;
michael@0 18215 ctx.strokeStyle = '#f00';
michael@0 18216 ctx.lineWidth = 50;
michael@0 18217 ctx.strokeRect(25, 24, 50, 2);
michael@0 18218 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 18219
michael@0 18220
michael@0 18221 }
michael@0 18222 </script>
michael@0 18223
michael@0 18224 <!-- [[[ test_2d.strokeRect.globalcomposite.html ]]] -->
michael@0 18225
michael@0 18226 <p>Canvas test: 2d.strokeRect.globalcomposite</p>
michael@0 18227 <canvas id="c574" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18228 <script>
michael@0 18229
michael@0 18230
michael@0 18231 function test_2d_strokeRect_globalcomposite() {
michael@0 18232
michael@0 18233 var canvas = document.getElementById('c574');
michael@0 18234 var ctx = canvas.getContext('2d');
michael@0 18235
michael@0 18236 ctx.globalCompositeOperation = 'source-in';
michael@0 18237 ctx.strokeStyle = '#f00';
michael@0 18238 ctx.lineWidth = 50;
michael@0 18239 ctx.strokeRect(25, 24, 50, 2);
michael@0 18240 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 18241
michael@0 18242
michael@0 18243 }
michael@0 18244 </script>
michael@0 18245
michael@0 18246 <!-- [[[ test_2d.strokeRect.negative.html ]]] -->
michael@0 18247
michael@0 18248 <p>Canvas test: 2d.strokeRect.negative</p>
michael@0 18249 <canvas id="c575" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18250 <script>
michael@0 18251
michael@0 18252
michael@0 18253 function test_2d_strokeRect_negative() {
michael@0 18254
michael@0 18255 var canvas = document.getElementById('c575');
michael@0 18256 var ctx = canvas.getContext('2d');
michael@0 18257
michael@0 18258 ctx.fillStyle = '#f00';
michael@0 18259 ctx.fillRect(0, 0, 100, 50);
michael@0 18260 ctx.strokeStyle = '#0f0';
michael@0 18261 ctx.lineWidth = 25;
michael@0 18262 ctx.strokeRect(12, 12, 26, 1);
michael@0 18263 ctx.strokeRect(88, 12, -26, 1);
michael@0 18264 ctx.strokeRect(12, 38, 26, -1);
michael@0 18265 ctx.strokeRect(88, 38, -26, -1);
michael@0 18266 isPixel(ctx, 25,12, 0,255,0,255, 0);
michael@0 18267 isPixel(ctx, 75,12, 0,255,0,255, 0);
michael@0 18268 isPixel(ctx, 25,37, 0,255,0,255, 0);
michael@0 18269 isPixel(ctx, 75,37, 0,255,0,255, 0);
michael@0 18270
michael@0 18271
michael@0 18272 }
michael@0 18273 </script>
michael@0 18274
michael@0 18275 <!-- [[[ test_2d.strokeRect.nonfinite.html ]]] -->
michael@0 18276
michael@0 18277 <p>Canvas test: 2d.strokeRect.nonfinite</p>
michael@0 18278 <!-- Testing: strokeRect() with Infinity/NaN is ignored -->
michael@0 18279 <canvas id="c576" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18280 <script>
michael@0 18281
michael@0 18282
michael@0 18283 function test_2d_strokeRect_nonfinite() {
michael@0 18284
michael@0 18285 var canvas = document.getElementById('c576');
michael@0 18286 var ctx = canvas.getContext('2d');
michael@0 18287
michael@0 18288 var _thrown_outer = false;
michael@0 18289 try {
michael@0 18290
michael@0 18291 ctx.fillStyle = '#0f0';
michael@0 18292 ctx.fillRect(0, 0, 100, 50);
michael@0 18293
michael@0 18294 ctx.strokeStyle = '#f00';
michael@0 18295 ctx.lineWidth = 150;
michael@0 18296 ctx.strokeRect(Infinity, 0, 100, 50);
michael@0 18297 ctx.strokeRect(-Infinity, 0, 100, 50);
michael@0 18298 ctx.strokeRect(NaN, 0, 100, 50);
michael@0 18299 ctx.strokeRect(0, Infinity, 100, 50);
michael@0 18300 ctx.strokeRect(0, -Infinity, 100, 50);
michael@0 18301 ctx.strokeRect(0, NaN, 100, 50);
michael@0 18302 ctx.strokeRect(0, 0, Infinity, 50);
michael@0 18303 ctx.strokeRect(0, 0, -Infinity, 50);
michael@0 18304 ctx.strokeRect(0, 0, NaN, 50);
michael@0 18305 ctx.strokeRect(0, 0, 100, Infinity);
michael@0 18306 ctx.strokeRect(0, 0, 100, -Infinity);
michael@0 18307 ctx.strokeRect(0, 0, 100, NaN);
michael@0 18308 ctx.strokeRect(Infinity, Infinity, 100, 50);
michael@0 18309 ctx.strokeRect(Infinity, Infinity, Infinity, 50);
michael@0 18310 ctx.strokeRect(Infinity, Infinity, Infinity, Infinity);
michael@0 18311 ctx.strokeRect(Infinity, Infinity, 100, Infinity);
michael@0 18312 ctx.strokeRect(Infinity, 0, Infinity, 50);
michael@0 18313 ctx.strokeRect(Infinity, 0, Infinity, Infinity);
michael@0 18314 ctx.strokeRect(Infinity, 0, 100, Infinity);
michael@0 18315 ctx.strokeRect(0, Infinity, Infinity, 50);
michael@0 18316 ctx.strokeRect(0, Infinity, Infinity, Infinity);
michael@0 18317 ctx.strokeRect(0, Infinity, 100, Infinity);
michael@0 18318 ctx.strokeRect(0, 0, Infinity, Infinity);
michael@0 18319
michael@0 18320 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18321
michael@0 18322 } catch (e) {
michael@0 18323 _thrown_outer = true;
michael@0 18324 }
michael@0 18325 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 18326
michael@0 18327
michael@0 18328 }
michael@0 18329 </script>
michael@0 18330
michael@0 18331 <!-- [[[ test_2d.strokeRect.path.html ]]] -->
michael@0 18332
michael@0 18333 <p>Canvas test: 2d.strokeRect.path</p>
michael@0 18334 <canvas id="c577" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18335 <script>
michael@0 18336
michael@0 18337
michael@0 18338 function test_2d_strokeRect_path() {
michael@0 18339
michael@0 18340 var canvas = document.getElementById('c577');
michael@0 18341 var ctx = canvas.getContext('2d');
michael@0 18342
michael@0 18343 ctx.beginPath();
michael@0 18344 ctx.rect(0, 0, 100, 50);
michael@0 18345 ctx.strokeStyle = '#f00';
michael@0 18346 ctx.lineWidth = 5;
michael@0 18347 ctx.strokeRect(0, 0, 16, 16);
michael@0 18348 ctx.fillStyle = '#0f0';
michael@0 18349 ctx.fill();
michael@0 18350 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18351
michael@0 18352
michael@0 18353 }
michael@0 18354 </script>
michael@0 18355
michael@0 18356 <!-- [[[ test_2d.strokeRect.shadow.html ]]] -->
michael@0 18357
michael@0 18358 <p>Canvas test: 2d.strokeRect.shadow</p>
michael@0 18359 <canvas id="c578" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18360 <script>
michael@0 18361
michael@0 18362
michael@0 18363 function test_2d_strokeRect_shadow() {
michael@0 18364
michael@0 18365 var canvas = document.getElementById('c578');
michael@0 18366 var ctx = canvas.getContext('2d');
michael@0 18367
michael@0 18368 ctx.fillStyle = '#0f0';
michael@0 18369 ctx.fillRect(0, 0, 100, 50);
michael@0 18370
michael@0 18371 ctx.fillStyle = '#f00';
michael@0 18372 ctx.shadowBlur = 0;
michael@0 18373 ctx.shadowOffsetX = 0;
michael@0 18374 ctx.shadowOffsetY = 50;
michael@0 18375
michael@0 18376 // Shadows are optional, so just test that if they apply to fill() then they apply to strokeRect() too
michael@0 18377 ctx.beginPath();
michael@0 18378 ctx.rect(0, -50, 100, 50);
michael@0 18379 ctx.shadowColor = '#f00';
michael@0 18380 ctx.fill();
michael@0 18381
michael@0 18382 ctx.shadowColor = '#0f0';
michael@0 18383 ctx.strokeStyle = '#f00';
michael@0 18384 ctx.lineWidth = 50;
michael@0 18385 ctx.strokeRect(0, -75, 100, 50);
michael@0 18386
michael@0 18387 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18388
michael@0 18389
michael@0 18390 }
michael@0 18391 </script>
michael@0 18392
michael@0 18393 <!-- [[[ test_2d.strokeRect.transform.html ]]] -->
michael@0 18394
michael@0 18395 <p>Canvas test: 2d.strokeRect.transform</p>
michael@0 18396 <canvas id="c579" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18397 <script>
michael@0 18398
michael@0 18399
michael@0 18400 function test_2d_strokeRect_transform() {
michael@0 18401
michael@0 18402 var canvas = document.getElementById('c579');
michael@0 18403 var ctx = canvas.getContext('2d');
michael@0 18404
michael@0 18405 ctx.scale(10, 10);
michael@0 18406 ctx.translate(0, 5);
michael@0 18407 ctx.strokeStyle = '#0f0';
michael@0 18408 ctx.lineWidth = 5;
michael@0 18409 ctx.strokeRect(2.5, -2.6, 5, 0.2);
michael@0 18410 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18411
michael@0 18412
michael@0 18413 }
michael@0 18414 </script>
michael@0 18415
michael@0 18416 <!-- [[[ test_2d.strokeRect.zero.1.html ]]] -->
michael@0 18417
michael@0 18418 <p>Canvas test: 2d.strokeRect.zero.1</p>
michael@0 18419 <canvas id="c580" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18420 <script>
michael@0 18421
michael@0 18422
michael@0 18423 function test_2d_strokeRect_zero_1() {
michael@0 18424
michael@0 18425 var canvas = document.getElementById('c580');
michael@0 18426 var ctx = canvas.getContext('2d');
michael@0 18427
michael@0 18428 if (!IsD2DEnabled()) {
michael@0 18429 // Disabled for D2D until we can figure out Bug 587554.
michael@0 18430 ctx.strokeStyle = '#f00';
michael@0 18431 ctx.lineWidth = 250;
michael@0 18432 ctx.strokeRect(50, 25, 0, 0);
michael@0 18433 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 18434 }
michael@0 18435
michael@0 18436 }
michael@0 18437 </script>
michael@0 18438
michael@0 18439 <!-- [[[ test_2d.strokeRect.zero.2.html ]]] -->
michael@0 18440
michael@0 18441 <p>Canvas test: 2d.strokeRect.zero.2</p>
michael@0 18442 <canvas id="c581" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18443 <script>
michael@0 18444
michael@0 18445
michael@0 18446
michael@0 18447 function test_2d_strokeRect_zero_2() {
michael@0 18448
michael@0 18449 var canvas = document.getElementById('c581');
michael@0 18450 var ctx = canvas.getContext('2d');
michael@0 18451
michael@0 18452 ctx.strokeStyle = '#f00';
michael@0 18453 ctx.lineWidth = 250;
michael@0 18454 ctx.lineCap = 'round';
michael@0 18455 ctx.lineJoin = 'round';
michael@0 18456 ctx.strokeRect(50, 25, 0, 0);
michael@0 18457 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 18458
michael@0 18459
michael@0 18460 }
michael@0 18461 </script>
michael@0 18462
michael@0 18463 <!-- [[[ test_2d.strokeRect.zero.3.html ]]] -->
michael@0 18464
michael@0 18465 <p>Canvas test: 2d.strokeRect.zero.3</p>
michael@0 18466 <canvas id="c582" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18467 <script>
michael@0 18468
michael@0 18469
michael@0 18470 function test_2d_strokeRect_zero_3() {
michael@0 18471
michael@0 18472 var canvas = document.getElementById('c582');
michael@0 18473 var ctx = canvas.getContext('2d');
michael@0 18474
michael@0 18475 ctx.strokeStyle = '#0f0';
michael@0 18476 ctx.lineWidth = 50;
michael@0 18477 ctx.strokeRect(0, 25, 100, 0);
michael@0 18478 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18479
michael@0 18480
michael@0 18481 }
michael@0 18482 </script>
michael@0 18483
michael@0 18484 <!-- [[[ test_2d.strokeRect.zero.4.html ]]] -->
michael@0 18485
michael@0 18486 <p>Canvas test: 2d.strokeRect.zero.4</p>
michael@0 18487 <canvas id="c583" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18488 <script>
michael@0 18489
michael@0 18490
michael@0 18491 function test_2d_strokeRect_zero_4() {
michael@0 18492
michael@0 18493 var canvas = document.getElementById('c583');
michael@0 18494 var ctx = canvas.getContext('2d');
michael@0 18495
michael@0 18496 ctx.strokeStyle = '#f00';
michael@0 18497 ctx.lineWidth = 250;
michael@0 18498 ctx.lineCap = 'round';
michael@0 18499 ctx.strokeRect(100, 25, 100, 0);
michael@0 18500 isPixel(ctx, 50,25, 0,0,0,0, 0);
michael@0 18501
michael@0 18502
michael@0 18503 }
michael@0 18504 </script>
michael@0 18505
michael@0 18506 <!-- [[[ test_2d.strokeRect.zero.5.html ]]] -->
michael@0 18507
michael@0 18508 <p>Canvas test: 2d.strokeRect.zero.5</p>
michael@0 18509 <canvas id="c584" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18510 <script>
michael@0 18511
michael@0 18512
michael@0 18513 function test_2d_strokeRect_zero_5() {
michael@0 18514
michael@0 18515 var canvas = document.getElementById('c584');
michael@0 18516 var ctx = canvas.getContext('2d');
michael@0 18517
michael@0 18518 ctx.strokeStyle = '#0f0';
michael@0 18519 ctx.lineWidth = 250;
michael@0 18520 ctx.lineJoin = 'round';
michael@0 18521 ctx.strokeRect(100, 25, 100, 0);
michael@0 18522 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18523
michael@0 18524
michael@0 18525 }
michael@0 18526 </script>
michael@0 18527
michael@0 18528 <!-- [[[ test_2d.strokeStyle.default.html ]]] -->
michael@0 18529
michael@0 18530 <p>Canvas test: 2d.strokeStyle.default</p>
michael@0 18531 <canvas id="c585" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18532 <script>
michael@0 18533
michael@0 18534 function test_2d_strokeStyle_default() {
michael@0 18535
michael@0 18536 var canvas = document.getElementById('c585');
michael@0 18537 var ctx = canvas.getContext('2d');
michael@0 18538
michael@0 18539 ok(ctx.strokeStyle == '#000000', "ctx.strokeStyle == '#000000'");
michael@0 18540
michael@0 18541
michael@0 18542 }
michael@0 18543 </script>
michael@0 18544
michael@0 18545 <!-- [[[ test_2d.text.align.default.html ]]] -->
michael@0 18546
michael@0 18547 <p>Canvas test: 2d.text.align.default</p>
michael@0 18548 <canvas height="50" id="c569a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18549 <script>
michael@0 18550
michael@0 18551 function test_2d_text_align_default() {
michael@0 18552
michael@0 18553 var canvas = document.getElementById('c569a');
michael@0 18554 var ctx = canvas.getContext('2d');
michael@0 18555
michael@0 18556 ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
michael@0 18557
michael@0 18558
michael@0 18559 }
michael@0 18560 </script>
michael@0 18561
michael@0 18562 <!-- [[[ test_2d.text.align.invalid.html ]]] -->
michael@0 18563
michael@0 18564 <p>Canvas test: 2d.text.align.invalid</p>
michael@0 18565 <canvas height="50" id="c570a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18566 <script>
michael@0 18567
michael@0 18568 function test_2d_text_align_invalid() {
michael@0 18569
michael@0 18570 var canvas = document.getElementById('c570a');
michael@0 18571 var ctx = canvas.getContext('2d');
michael@0 18572
michael@0 18573 ctx.textAlign = 'start';
michael@0 18574 ctx.textAlign = 'bogus';
michael@0 18575 ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
michael@0 18576
michael@0 18577 ctx.textAlign = 'start';
michael@0 18578 ctx.textAlign = 'END';
michael@0 18579 ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
michael@0 18580
michael@0 18581 ctx.textAlign = 'start';
michael@0 18582 ctx.textAlign = 'end ';
michael@0 18583 ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
michael@0 18584
michael@0 18585 ctx.textAlign = 'start';
michael@0 18586 ctx.textAlign = 'end\0';
michael@0 18587 ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
michael@0 18588
michael@0 18589
michael@0 18590 }
michael@0 18591 </script>
michael@0 18592
michael@0 18593 <!-- [[[ test_2d.text.baseline.default.html ]]] -->
michael@0 18594
michael@0 18595 <p>Canvas test: 2d.text.baseline.default</p>
michael@0 18596 <canvas height="50" id="c572a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18597 <script>
michael@0 18598
michael@0 18599 function test_2d_text_baseline_default() {
michael@0 18600
michael@0 18601 var canvas = document.getElementById('c572a');
michael@0 18602 var ctx = canvas.getContext('2d');
michael@0 18603
michael@0 18604 ok(ctx.textBaseline === 'alphabetic', "ctx.textBaseline === 'alphabetic'");
michael@0 18605
michael@0 18606
michael@0 18607 }
michael@0 18608 </script>
michael@0 18609
michael@0 18610 <!-- [[[ test_2d.text.baseline.invalid.html ]]] -->
michael@0 18611
michael@0 18612 <p>Canvas test: 2d.text.baseline.invalid</p>
michael@0 18613 <canvas height="50" id="c573a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18614 <script>
michael@0 18615
michael@0 18616 function test_2d_text_baseline_invalid() {
michael@0 18617
michael@0 18618 var canvas = document.getElementById('c573a');
michael@0 18619 var ctx = canvas.getContext('2d');
michael@0 18620
michael@0 18621 ctx.textBaseline = 'top';
michael@0 18622 ctx.textBaseline = 'bogus';
michael@0 18623 ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
michael@0 18624
michael@0 18625 ctx.textBaseline = 'top';
michael@0 18626 ctx.textBaseline = 'MIDDLE';
michael@0 18627 ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
michael@0 18628
michael@0 18629 ctx.textBaseline = 'top';
michael@0 18630 ctx.textBaseline = 'middle ';
michael@0 18631 ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
michael@0 18632
michael@0 18633 ctx.textBaseline = 'top';
michael@0 18634 ctx.textBaseline = 'middle\0';
michael@0 18635 ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
michael@0 18636
michael@0 18637
michael@0 18638 }
michael@0 18639 </script>
michael@0 18640
michael@0 18641 <!-- [[[ test_2d.transformation.order.html ]]] -->
michael@0 18642
michael@0 18643 <p>Canvas test: 2d.transformation.order</p>
michael@0 18644 <!-- Testing: Transformations are applied in the right order -->
michael@0 18645 <canvas id="c586" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18646 <script>
michael@0 18647
michael@0 18648
michael@0 18649 function test_2d_transformation_order() {
michael@0 18650
michael@0 18651 var canvas = document.getElementById('c586');
michael@0 18652 var ctx = canvas.getContext('2d');
michael@0 18653
michael@0 18654 ctx.fillStyle = '#f00';
michael@0 18655 ctx.fillRect(0, 0, 100, 50);
michael@0 18656
michael@0 18657 ctx.scale(2, 1);
michael@0 18658 ctx.rotate(Math.PI / 2);
michael@0 18659 ctx.fillStyle = '#0f0';
michael@0 18660 ctx.fillRect(0, -50, 50, 50);
michael@0 18661 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 18662
michael@0 18663
michael@0 18664 }
michael@0 18665 </script>
michael@0 18666
michael@0 18667 <!-- [[[ test_2d.transformation.rotate.direction.html ]]] -->
michael@0 18668
michael@0 18669 <p>Canvas test: 2d.transformation.rotate.direction</p>
michael@0 18670 <!-- Testing: rotate() is clockwise -->
michael@0 18671 <canvas id="c587" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18672 <script>
michael@0 18673
michael@0 18674
michael@0 18675 function test_2d_transformation_rotate_direction() {
michael@0 18676
michael@0 18677 var canvas = document.getElementById('c587');
michael@0 18678 var ctx = canvas.getContext('2d');
michael@0 18679
michael@0 18680 ctx.fillStyle = '#f00';
michael@0 18681 ctx.fillRect(0, 0, 100, 50);
michael@0 18682
michael@0 18683 ctx.rotate(Math.PI / 2);
michael@0 18684 ctx.fillStyle = '#0f0';
michael@0 18685 ctx.fillRect(0, -100, 50, 100);
michael@0 18686 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18687
michael@0 18688
michael@0 18689 }
michael@0 18690 </script>
michael@0 18691
michael@0 18692 <!-- [[[ test_2d.transformation.rotate.nonfinite.html ]]] -->
michael@0 18693
michael@0 18694 <p>Canvas test: 2d.transformation.rotate.nonfinite</p>
michael@0 18695 <!-- Testing: rotate() with Infinity/NaN is ignored -->
michael@0 18696 <canvas id="c588" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18697 <script>
michael@0 18698
michael@0 18699
michael@0 18700 function test_2d_transformation_rotate_nonfinite() {
michael@0 18701
michael@0 18702 var canvas = document.getElementById('c588');
michael@0 18703 var ctx = canvas.getContext('2d');
michael@0 18704
michael@0 18705 var _thrown_outer = false;
michael@0 18706 try {
michael@0 18707
michael@0 18708 ctx.fillStyle = '#f00';
michael@0 18709 ctx.fillRect(0, 0, 100, 50);
michael@0 18710
michael@0 18711 ctx.translate(100, 10);
michael@0 18712 ctx.rotate(Infinity);
michael@0 18713 ctx.rotate(-Infinity);
michael@0 18714 ctx.rotate(NaN);
michael@0 18715
michael@0 18716 ctx.fillStyle = '#0f0';
michael@0 18717 ctx.fillRect(-100, -10, 100, 50);
michael@0 18718
michael@0 18719 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18720
michael@0 18721 } catch (e) {
michael@0 18722 _thrown_outer = true;
michael@0 18723 }
michael@0 18724 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 18725
michael@0 18726
michael@0 18727 }
michael@0 18728 </script>
michael@0 18729
michael@0 18730 <!-- [[[ test_2d.transformation.rotate.radians.html ]]] -->
michael@0 18731
michael@0 18732 <p>Canvas test: 2d.transformation.rotate.radians</p>
michael@0 18733 <!-- Testing: rotate() uses radians -->
michael@0 18734 <canvas id="c589" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18735 <script>
michael@0 18736
michael@0 18737
michael@0 18738 function test_2d_transformation_rotate_radians() {
michael@0 18739
michael@0 18740 var canvas = document.getElementById('c589');
michael@0 18741 var ctx = canvas.getContext('2d');
michael@0 18742
michael@0 18743 ctx.fillStyle = '#f00';
michael@0 18744 ctx.fillRect(0, 0, 100, 50);
michael@0 18745
michael@0 18746 ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees
michael@0 18747 ctx.fillStyle = '#0f0';
michael@0 18748 ctx.fillRect(-100, -50, 100, 50);
michael@0 18749 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18750
michael@0 18751
michael@0 18752 }
michael@0 18753 </script>
michael@0 18754
michael@0 18755 <!-- [[[ test_2d.transformation.rotate.wrap.html ]]] -->
michael@0 18756
michael@0 18757 <p>Canvas test: 2d.transformation.rotate.wrap</p>
michael@0 18758 <!-- Testing: rotate() wraps large positive values correctly -->
michael@0 18759 <canvas id="c590" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18760 <script>
michael@0 18761
michael@0 18762
michael@0 18763 function test_2d_transformation_rotate_wrap() {
michael@0 18764
michael@0 18765 var canvas = document.getElementById('c590');
michael@0 18766 var ctx = canvas.getContext('2d');
michael@0 18767
michael@0 18768 ctx.fillStyle = '#f00';
michael@0 18769 ctx.fillRect(0, 0, 100, 50);
michael@0 18770
michael@0 18771 ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi)
michael@0 18772 // We need about pi +/- 0.001 in order to get correct-looking results
michael@0 18773 // 32-bit floats can store pi*4097 with precision 2^-10, so that should
michael@0 18774 // be safe enough on reasonable implementations
michael@0 18775 ctx.fillStyle = '#0f0';
michael@0 18776 ctx.fillRect(-100, -50, 100, 50);
michael@0 18777 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18778 isPixel(ctx, 98,2, 0,255,0,255, 0);
michael@0 18779 isPixel(ctx, 98,47, 0,255,0,255, 0);
michael@0 18780
michael@0 18781
michael@0 18782 }
michael@0 18783 </script>
michael@0 18784
michael@0 18785 <!-- [[[ test_2d.transformation.rotate.wrapnegative.html ]]] -->
michael@0 18786
michael@0 18787 <p>Canvas test: 2d.transformation.rotate.wrapnegative</p>
michael@0 18788 <!-- Testing: rotate() wraps large negative values correctly -->
michael@0 18789 <canvas id="c591" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18790 <script>
michael@0 18791
michael@0 18792
michael@0 18793 function test_2d_transformation_rotate_wrapnegative() {
michael@0 18794
michael@0 18795 var canvas = document.getElementById('c591');
michael@0 18796 var ctx = canvas.getContext('2d');
michael@0 18797
michael@0 18798 ctx.fillStyle = '#f00';
michael@0 18799 ctx.fillRect(0, 0, 100, 50);
michael@0 18800
michael@0 18801 ctx.rotate(-Math.PI * (1 + 4096));
michael@0 18802 ctx.fillStyle = '#0f0';
michael@0 18803 ctx.fillRect(-100, -50, 100, 50);
michael@0 18804 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18805 isPixel(ctx, 98,2, 0,255,0,255, 0);
michael@0 18806 isPixel(ctx, 98,47, 0,255,0,255, 0);
michael@0 18807
michael@0 18808
michael@0 18809 }
michael@0 18810 </script>
michael@0 18811
michael@0 18812 <!-- [[[ test_2d.transformation.rotate.zero.html ]]] -->
michael@0 18813
michael@0 18814 <p>Canvas test: 2d.transformation.rotate.zero</p>
michael@0 18815 <!-- Testing: rotate() by 0 does nothing -->
michael@0 18816 <canvas id="c592" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18817 <script>
michael@0 18818
michael@0 18819
michael@0 18820 function test_2d_transformation_rotate_zero() {
michael@0 18821
michael@0 18822 var canvas = document.getElementById('c592');
michael@0 18823 var ctx = canvas.getContext('2d');
michael@0 18824
michael@0 18825 ctx.fillStyle = '#f00';
michael@0 18826 ctx.fillRect(0, 0, 100, 50);
michael@0 18827
michael@0 18828 ctx.rotate(0);
michael@0 18829 ctx.fillStyle = '#0f0';
michael@0 18830 ctx.fillRect(0, 0, 100, 50);
michael@0 18831 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18832
michael@0 18833
michael@0 18834 }
michael@0 18835 </script>
michael@0 18836
michael@0 18837 <!-- [[[ test_2d.transformation.scale.basic.html ]]] -->
michael@0 18838
michael@0 18839 <p>Canvas test: 2d.transformation.scale.basic</p>
michael@0 18840 <!-- Testing: scale() works -->
michael@0 18841 <canvas id="c593" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18842 <script>
michael@0 18843
michael@0 18844
michael@0 18845 function test_2d_transformation_scale_basic() {
michael@0 18846
michael@0 18847 var canvas = document.getElementById('c593');
michael@0 18848 var ctx = canvas.getContext('2d');
michael@0 18849
michael@0 18850 ctx.fillStyle = '#f00';
michael@0 18851 ctx.fillRect(0, 0, 100, 50);
michael@0 18852
michael@0 18853 ctx.scale(2, 4);
michael@0 18854 ctx.fillStyle = '#0f0';
michael@0 18855 ctx.fillRect(0, 0, 50, 12.5);
michael@0 18856 isPixel(ctx, 90,40, 0,255,0,255, 0);
michael@0 18857
michael@0 18858
michael@0 18859 }
michael@0 18860 </script>
michael@0 18861
michael@0 18862 <!-- [[[ test_2d.transformation.scale.large.html ]]] -->
michael@0 18863
michael@0 18864 <p>Canvas test: 2d.transformation.scale.large</p>
michael@0 18865 <!-- Testing: scale() with large scale factors works -->
michael@0 18866 <canvas id="c594" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18867 <script>
michael@0 18868
michael@0 18869
michael@0 18870 function test_2d_transformation_scale_large() {
michael@0 18871
michael@0 18872 var canvas = document.getElementById('c594');
michael@0 18873 var ctx = canvas.getContext('2d');
michael@0 18874
michael@0 18875 ctx.fillStyle = '#f00';
michael@0 18876 ctx.fillRect(0, 0, 100, 50);
michael@0 18877
michael@0 18878 ctx.scale(1e5, 1e5);
michael@0 18879 ctx.fillStyle = '#0f0';
michael@0 18880 ctx.fillRect(0, 0, 1, 1);
michael@0 18881 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18882
michael@0 18883
michael@0 18884 }
michael@0 18885 </script>
michael@0 18886
michael@0 18887 <!-- [[[ test_2d.transformation.scale.multiple.html ]]] -->
michael@0 18888
michael@0 18889 <p>Canvas test: 2d.transformation.scale.multiple</p>
michael@0 18890 <!-- Testing: Multiple scale()s combine -->
michael@0 18891 <canvas id="c595" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18892 <script>
michael@0 18893
michael@0 18894
michael@0 18895 function test_2d_transformation_scale_multiple() {
michael@0 18896
michael@0 18897 var canvas = document.getElementById('c595');
michael@0 18898 var ctx = canvas.getContext('2d');
michael@0 18899
michael@0 18900 ctx.fillStyle = '#f00';
michael@0 18901 ctx.fillRect(0, 0, 100, 50);
michael@0 18902
michael@0 18903 ctx.scale(Math.sqrt(2), Math.sqrt(2));
michael@0 18904 ctx.scale(Math.sqrt(2), Math.sqrt(2));
michael@0 18905 ctx.fillStyle = '#0f0';
michael@0 18906 ctx.fillRect(0, 0, 50, 25);
michael@0 18907 isPixel(ctx, 90,40, 0,255,0,255, 0);
michael@0 18908
michael@0 18909
michael@0 18910 }
michael@0 18911 </script>
michael@0 18912
michael@0 18913 <!-- [[[ test_2d.transformation.scale.negative.html ]]] -->
michael@0 18914
michael@0 18915 <p>Canvas test: 2d.transformation.scale.negative</p>
michael@0 18916 <!-- Testing: scale() with negative scale factors works -->
michael@0 18917 <canvas id="c596" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18918 <script>
michael@0 18919
michael@0 18920
michael@0 18921 function test_2d_transformation_scale_negative() {
michael@0 18922
michael@0 18923 var canvas = document.getElementById('c596');
michael@0 18924 var ctx = canvas.getContext('2d');
michael@0 18925
michael@0 18926 ctx.fillStyle = '#f00';
michael@0 18927 ctx.fillRect(0, 0, 100, 50);
michael@0 18928
michael@0 18929 ctx.save();
michael@0 18930 ctx.scale(-1, 1);
michael@0 18931 ctx.fillStyle = '#0f0';
michael@0 18932 ctx.fillRect(-50, 0, 50, 50);
michael@0 18933 ctx.restore();
michael@0 18934
michael@0 18935 ctx.save();
michael@0 18936 ctx.scale(1, -1);
michael@0 18937 ctx.fillStyle = '#0f0';
michael@0 18938 ctx.fillRect(50, -50, 50, 50);
michael@0 18939 ctx.restore();
michael@0 18940 isPixel(ctx, 25,25, 0,255,0,255, 0);
michael@0 18941 isPixel(ctx, 75,25, 0,255,0,255, 0);
michael@0 18942
michael@0 18943
michael@0 18944 }
michael@0 18945 </script>
michael@0 18946
michael@0 18947 <!-- [[[ test_2d.transformation.scale.nonfinite.html ]]] -->
michael@0 18948
michael@0 18949 <p>Canvas test: 2d.transformation.scale.nonfinite</p>
michael@0 18950 <!-- Testing: scale() with Infinity/NaN is ignored -->
michael@0 18951 <canvas id="c597" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18952 <script>
michael@0 18953
michael@0 18954
michael@0 18955 function test_2d_transformation_scale_nonfinite() {
michael@0 18956
michael@0 18957 var canvas = document.getElementById('c597');
michael@0 18958 var ctx = canvas.getContext('2d');
michael@0 18959
michael@0 18960 var _thrown_outer = false;
michael@0 18961 try {
michael@0 18962
michael@0 18963 ctx.fillStyle = '#f00';
michael@0 18964 ctx.fillRect(0, 0, 100, 50);
michael@0 18965
michael@0 18966 ctx.translate(100, 10);
michael@0 18967 ctx.scale(Infinity, 0.1);
michael@0 18968 ctx.scale(-Infinity, 0.1);
michael@0 18969 ctx.scale(NaN, 0.1);
michael@0 18970 ctx.scale(0.1, Infinity);
michael@0 18971 ctx.scale(0.1, -Infinity);
michael@0 18972 ctx.scale(0.1, NaN);
michael@0 18973 ctx.scale(Infinity, Infinity);
michael@0 18974
michael@0 18975 ctx.fillStyle = '#0f0';
michael@0 18976 ctx.fillRect(-100, -10, 100, 50);
michael@0 18977
michael@0 18978 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 18979
michael@0 18980 } catch (e) {
michael@0 18981 _thrown_outer = true;
michael@0 18982 }
michael@0 18983 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 18984
michael@0 18985
michael@0 18986 }
michael@0 18987 </script>
michael@0 18988
michael@0 18989 <!-- [[[ test_2d.transformation.scale.zero.html ]]] -->
michael@0 18990
michael@0 18991 <p>Canvas test: 2d.transformation.scale.zero</p>
michael@0 18992 <!-- Testing: scale() with a scale factor of zero works -->
michael@0 18993 <canvas id="c598" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 18994 <script>
michael@0 18995
michael@0 18996
michael@0 18997 function test_2d_transformation_scale_zero() {
michael@0 18998
michael@0 18999 var canvas = document.getElementById('c598');
michael@0 19000 var ctx = canvas.getContext('2d');
michael@0 19001
michael@0 19002 ctx.fillStyle = '#0f0';
michael@0 19003 ctx.fillRect(0, 0, 100, 50);
michael@0 19004
michael@0 19005 ctx.save();
michael@0 19006 ctx.translate(50, 0);
michael@0 19007 ctx.scale(0, 1);
michael@0 19008 ctx.fillStyle = '#f00';
michael@0 19009 ctx.fillRect(0, 0, 100, 50);
michael@0 19010 ctx.restore();
michael@0 19011
michael@0 19012 ctx.save();
michael@0 19013 ctx.translate(0, 25);
michael@0 19014 ctx.scale(1, 0);
michael@0 19015 ctx.fillStyle = '#f00';
michael@0 19016 ctx.fillRect(0, 0, 100, 50);
michael@0 19017 ctx.restore();
michael@0 19018 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19019
michael@0 19020
michael@0 19021 }
michael@0 19022 </script>
michael@0 19023
michael@0 19024 <!-- [[[ test_2d.transformation.setTransform.multiple.html ]]] -->
michael@0 19025
michael@0 19026 <p>Canvas test: 2d.transformation.setTransform.multiple</p>
michael@0 19027 <canvas id="c599" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19028 <script>
michael@0 19029
michael@0 19030
michael@0 19031 function test_2d_transformation_setTransform_multiple() {
michael@0 19032
michael@0 19033 var canvas = document.getElementById('c599');
michael@0 19034 var ctx = canvas.getContext('2d');
michael@0 19035
michael@0 19036 ctx.fillStyle = '#f00';
michael@0 19037 ctx.fillRect(0, 0, 100, 50);
michael@0 19038
michael@0 19039 ctx.setTransform(1/2,0, 0,1/2, 0,0);
michael@0 19040 ctx.setTransform(2,0, 0,2, 0,0);
michael@0 19041 ctx.fillStyle = '#0f0';
michael@0 19042 ctx.fillRect(0, 0, 50, 25);
michael@0 19043 isPixel(ctx, 75,35, 0,255,0,255, 0);
michael@0 19044
michael@0 19045
michael@0 19046 }
michael@0 19047 </script>
michael@0 19048
michael@0 19049 <!-- [[[ test_2d.transformation.setTransform.nonfinite.html ]]] -->
michael@0 19050
michael@0 19051 <p>Canvas test: 2d.transformation.setTransform.nonfinite</p>
michael@0 19052 <!-- Testing: setTransform() with Infinity/NaN is ignored -->
michael@0 19053 <canvas id="c600" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19054 <script>
michael@0 19055
michael@0 19056
michael@0 19057 function test_2d_transformation_setTransform_nonfinite() {
michael@0 19058
michael@0 19059 var canvas = document.getElementById('c600');
michael@0 19060 var ctx = canvas.getContext('2d');
michael@0 19061
michael@0 19062 var _thrown_outer = false;
michael@0 19063 try {
michael@0 19064
michael@0 19065 ctx.fillStyle = '#f00';
michael@0 19066 ctx.fillRect(0, 0, 100, 50);
michael@0 19067
michael@0 19068 ctx.translate(100, 10);
michael@0 19069 ctx.setTransform(Infinity, 0, 0, 0, 0, 0);
michael@0 19070 ctx.setTransform(-Infinity, 0, 0, 0, 0, 0);
michael@0 19071 ctx.setTransform(NaN, 0, 0, 0, 0, 0);
michael@0 19072 ctx.setTransform(0, Infinity, 0, 0, 0, 0);
michael@0 19073 ctx.setTransform(0, -Infinity, 0, 0, 0, 0);
michael@0 19074 ctx.setTransform(0, NaN, 0, 0, 0, 0);
michael@0 19075 ctx.setTransform(0, 0, Infinity, 0, 0, 0);
michael@0 19076 ctx.setTransform(0, 0, -Infinity, 0, 0, 0);
michael@0 19077 ctx.setTransform(0, 0, NaN, 0, 0, 0);
michael@0 19078 ctx.setTransform(0, 0, 0, Infinity, 0, 0);
michael@0 19079 ctx.setTransform(0, 0, 0, -Infinity, 0, 0);
michael@0 19080 ctx.setTransform(0, 0, 0, NaN, 0, 0);
michael@0 19081 ctx.setTransform(0, 0, 0, 0, Infinity, 0);
michael@0 19082 ctx.setTransform(0, 0, 0, 0, -Infinity, 0);
michael@0 19083 ctx.setTransform(0, 0, 0, 0, NaN, 0);
michael@0 19084 ctx.setTransform(0, 0, 0, 0, 0, Infinity);
michael@0 19085 ctx.setTransform(0, 0, 0, 0, 0, -Infinity);
michael@0 19086 ctx.setTransform(0, 0, 0, 0, 0, NaN);
michael@0 19087 ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0);
michael@0 19088 ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0);
michael@0 19089 ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0);
michael@0 19090 ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0);
michael@0 19091 ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 19092 ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 19093 ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0);
michael@0 19094 ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 19095 ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity);
michael@0 19096 ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0);
michael@0 19097 ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0);
michael@0 19098 ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 19099 ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity);
michael@0 19100 ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0);
michael@0 19101 ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 19102 ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity);
michael@0 19103 ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0);
michael@0 19104 ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0);
michael@0 19105 ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0);
michael@0 19106 ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 19107 ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity);
michael@0 19108 ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0);
michael@0 19109 ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity);
michael@0 19110 ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity);
michael@0 19111 ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0);
michael@0 19112 ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0);
michael@0 19113 ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity);
michael@0 19114 ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity);
michael@0 19115 ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0);
michael@0 19116 ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity);
michael@0 19117 ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity);
michael@0 19118 ctx.setTransform(0, Infinity, Infinity, 0, 0, 0);
michael@0 19119 ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0);
michael@0 19120 ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0);
michael@0 19121 ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 19122 ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 19123 ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0);
michael@0 19124 ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 19125 ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity);
michael@0 19126 ctx.setTransform(0, Infinity, 0, Infinity, 0, 0);
michael@0 19127 ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0);
michael@0 19128 ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 19129 ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity);
michael@0 19130 ctx.setTransform(0, Infinity, 0, 0, Infinity, 0);
michael@0 19131 ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity);
michael@0 19132 ctx.setTransform(0, Infinity, 0, 0, 0, Infinity);
michael@0 19133 ctx.setTransform(0, 0, Infinity, Infinity, 0, 0);
michael@0 19134 ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0);
michael@0 19135 ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 19136 ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity);
michael@0 19137 ctx.setTransform(0, 0, Infinity, 0, Infinity, 0);
michael@0 19138 ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity);
michael@0 19139 ctx.setTransform(0, 0, Infinity, 0, 0, Infinity);
michael@0 19140 ctx.setTransform(0, 0, 0, Infinity, Infinity, 0);
michael@0 19141 ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity);
michael@0 19142 ctx.setTransform(0, 0, 0, Infinity, 0, Infinity);
michael@0 19143 ctx.setTransform(0, 0, 0, 0, Infinity, Infinity);
michael@0 19144
michael@0 19145 ctx.fillStyle = '#0f0';
michael@0 19146 ctx.fillRect(-100, -10, 100, 50);
michael@0 19147
michael@0 19148 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19149
michael@0 19150 } catch (e) {
michael@0 19151 _thrown_outer = true;
michael@0 19152 }
michael@0 19153 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19154
michael@0 19155
michael@0 19156 }
michael@0 19157 </script>
michael@0 19158
michael@0 19159 <!-- [[[ test_2d.transformation.setTransform.skewed.html ]]] -->
michael@0 19160
michael@0 19161 <p>Canvas test: 2d.transformation.setTransform.skewed</p>
michael@0 19162 <canvas id="c601" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19163 <script>
michael@0 19164
michael@0 19165
michael@0 19166 function test_2d_transformation_setTransform_skewed() {
michael@0 19167
michael@0 19168 var canvas = document.getElementById('c601');
michael@0 19169 var ctx = canvas.getContext('2d');
michael@0 19170
michael@0 19171 // Create green with a red square ring inside it
michael@0 19172 ctx.fillStyle = '#0f0';
michael@0 19173 ctx.fillRect(0, 0, 100, 50);
michael@0 19174 ctx.fillStyle = '#f00';
michael@0 19175 ctx.fillRect(20, 10, 60, 30);
michael@0 19176 ctx.fillStyle = '#0f0';
michael@0 19177 ctx.fillRect(40, 20, 20, 10);
michael@0 19178
michael@0 19179 // Draw a skewed shape to fill that gap, to make sure it is aligned correctly
michael@0 19180 ctx.setTransform(1,4, 2,3, 5,6);
michael@0 19181 // Post-transform coordinates:
michael@0 19182 // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]];
michael@0 19183 // Hence pre-transform coordinates:
michael@0 19184 var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2],
michael@0 19185 [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2],
michael@0 19186 [-7.4,11.2]];
michael@0 19187 ctx.beginPath();
michael@0 19188 ctx.moveTo(pts[0][0], pts[0][1]);
michael@0 19189 for (var i = 0; i < pts.length; ++i)
michael@0 19190 ctx.lineTo(pts[i][0], pts[i][1]);
michael@0 19191 ctx.fill();
michael@0 19192 isPixel(ctx, 21,11, 0,255,0,255, 0);
michael@0 19193 isPixel(ctx, 79,11, 0,255,0,255, 0);
michael@0 19194 isPixel(ctx, 21,39, 0,255,0,255, 0);
michael@0 19195 isPixel(ctx, 79,39, 0,255,0,255, 0);
michael@0 19196 isPixel(ctx, 39,19, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 19197 isPixel(ctx, 61,19, 0,255,0,255, 0);
michael@0 19198 isPixel(ctx, 39,31, 0,255,0,255, 0);
michael@0 19199 isPixel(ctx, 61,31, 0,255,0,255, 0);
michael@0 19200
michael@0 19201
michael@0 19202 }
michael@0 19203 </script>
michael@0 19204
michael@0 19205 <!-- [[[ test_2d.transformation.transform.identity.html ]]] -->
michael@0 19206
michael@0 19207 <p>Canvas test: 2d.transformation.transform.identity</p>
michael@0 19208 <!-- Testing: transform() with the identity matrix does nothing -->
michael@0 19209 <canvas id="c602" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19210 <script>
michael@0 19211
michael@0 19212
michael@0 19213 function test_2d_transformation_transform_identity() {
michael@0 19214
michael@0 19215 var canvas = document.getElementById('c602');
michael@0 19216 var ctx = canvas.getContext('2d');
michael@0 19217
michael@0 19218 ctx.fillStyle = '#f00';
michael@0 19219 ctx.fillRect(0, 0, 100, 50);
michael@0 19220
michael@0 19221 ctx.transform(1,0, 0,1, 0,0);
michael@0 19222 ctx.fillStyle = '#0f0';
michael@0 19223 ctx.fillRect(0, 0, 100, 50);
michael@0 19224 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19225
michael@0 19226
michael@0 19227 }
michael@0 19228 </script>
michael@0 19229
michael@0 19230 <!-- [[[ test_2d.transformation.transform.multiply.html ]]] -->
michael@0 19231
michael@0 19232 <p>Canvas test: 2d.transformation.transform.multiply</p>
michael@0 19233 <!-- Testing: transform() multiplies the CTM -->
michael@0 19234 <canvas id="c603" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19235 <script>
michael@0 19236
michael@0 19237
michael@0 19238 function test_2d_transformation_transform_multiply() {
michael@0 19239
michael@0 19240 var canvas = document.getElementById('c603');
michael@0 19241 var ctx = canvas.getContext('2d');
michael@0 19242
michael@0 19243 ctx.fillStyle = '#f00';
michael@0 19244 ctx.fillRect(0, 0, 100, 50);
michael@0 19245
michael@0 19246 ctx.transform(1,2, 3,4, 5,6);
michael@0 19247 ctx.transform(-2,1, 3/2,-1/2, 1,-2);
michael@0 19248 ctx.fillStyle = '#0f0';
michael@0 19249 ctx.fillRect(0, 0, 100, 50);
michael@0 19250 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19251
michael@0 19252
michael@0 19253 }
michael@0 19254 </script>
michael@0 19255
michael@0 19256 <!-- [[[ test_2d.transformation.transform.nonfinite.html ]]] -->
michael@0 19257
michael@0 19258 <p>Canvas test: 2d.transformation.transform.nonfinite</p>
michael@0 19259 <!-- Testing: transform() with Infinity/NaN is ignored -->
michael@0 19260 <canvas id="c604" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19261 <script>
michael@0 19262
michael@0 19263
michael@0 19264 function test_2d_transformation_transform_nonfinite() {
michael@0 19265
michael@0 19266 var canvas = document.getElementById('c604');
michael@0 19267 var ctx = canvas.getContext('2d');
michael@0 19268
michael@0 19269 var _thrown_outer = false;
michael@0 19270 try {
michael@0 19271
michael@0 19272 ctx.fillStyle = '#f00';
michael@0 19273 ctx.fillRect(0, 0, 100, 50);
michael@0 19274
michael@0 19275 ctx.translate(100, 10);
michael@0 19276 ctx.transform(Infinity, 0, 0, 0, 0, 0);
michael@0 19277 ctx.transform(-Infinity, 0, 0, 0, 0, 0);
michael@0 19278 ctx.transform(NaN, 0, 0, 0, 0, 0);
michael@0 19279 ctx.transform(0, Infinity, 0, 0, 0, 0);
michael@0 19280 ctx.transform(0, -Infinity, 0, 0, 0, 0);
michael@0 19281 ctx.transform(0, NaN, 0, 0, 0, 0);
michael@0 19282 ctx.transform(0, 0, Infinity, 0, 0, 0);
michael@0 19283 ctx.transform(0, 0, -Infinity, 0, 0, 0);
michael@0 19284 ctx.transform(0, 0, NaN, 0, 0, 0);
michael@0 19285 ctx.transform(0, 0, 0, Infinity, 0, 0);
michael@0 19286 ctx.transform(0, 0, 0, -Infinity, 0, 0);
michael@0 19287 ctx.transform(0, 0, 0, NaN, 0, 0);
michael@0 19288 ctx.transform(0, 0, 0, 0, Infinity, 0);
michael@0 19289 ctx.transform(0, 0, 0, 0, -Infinity, 0);
michael@0 19290 ctx.transform(0, 0, 0, 0, NaN, 0);
michael@0 19291 ctx.transform(0, 0, 0, 0, 0, Infinity);
michael@0 19292 ctx.transform(0, 0, 0, 0, 0, -Infinity);
michael@0 19293 ctx.transform(0, 0, 0, 0, 0, NaN);
michael@0 19294 ctx.transform(Infinity, Infinity, 0, 0, 0, 0);
michael@0 19295 ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0);
michael@0 19296 ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0);
michael@0 19297 ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0);
michael@0 19298 ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 19299 ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 19300 ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0);
michael@0 19301 ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 19302 ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity);
michael@0 19303 ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0);
michael@0 19304 ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0);
michael@0 19305 ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 19306 ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity);
michael@0 19307 ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0);
michael@0 19308 ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity);
michael@0 19309 ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity);
michael@0 19310 ctx.transform(Infinity, 0, Infinity, 0, 0, 0);
michael@0 19311 ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0);
michael@0 19312 ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0);
michael@0 19313 ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 19314 ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity);
michael@0 19315 ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0);
michael@0 19316 ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity);
michael@0 19317 ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity);
michael@0 19318 ctx.transform(Infinity, 0, 0, Infinity, 0, 0);
michael@0 19319 ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0);
michael@0 19320 ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity);
michael@0 19321 ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity);
michael@0 19322 ctx.transform(Infinity, 0, 0, 0, Infinity, 0);
michael@0 19323 ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity);
michael@0 19324 ctx.transform(Infinity, 0, 0, 0, 0, Infinity);
michael@0 19325 ctx.transform(0, Infinity, Infinity, 0, 0, 0);
michael@0 19326 ctx.transform(0, Infinity, Infinity, Infinity, 0, 0);
michael@0 19327 ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0);
michael@0 19328 ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity);
michael@0 19329 ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity);
michael@0 19330 ctx.transform(0, Infinity, Infinity, 0, Infinity, 0);
michael@0 19331 ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity);
michael@0 19332 ctx.transform(0, Infinity, Infinity, 0, 0, Infinity);
michael@0 19333 ctx.transform(0, Infinity, 0, Infinity, 0, 0);
michael@0 19334 ctx.transform(0, Infinity, 0, Infinity, Infinity, 0);
michael@0 19335 ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity);
michael@0 19336 ctx.transform(0, Infinity, 0, Infinity, 0, Infinity);
michael@0 19337 ctx.transform(0, Infinity, 0, 0, Infinity, 0);
michael@0 19338 ctx.transform(0, Infinity, 0, 0, Infinity, Infinity);
michael@0 19339 ctx.transform(0, Infinity, 0, 0, 0, Infinity);
michael@0 19340 ctx.transform(0, 0, Infinity, Infinity, 0, 0);
michael@0 19341 ctx.transform(0, 0, Infinity, Infinity, Infinity, 0);
michael@0 19342 ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity);
michael@0 19343 ctx.transform(0, 0, Infinity, Infinity, 0, Infinity);
michael@0 19344 ctx.transform(0, 0, Infinity, 0, Infinity, 0);
michael@0 19345 ctx.transform(0, 0, Infinity, 0, Infinity, Infinity);
michael@0 19346 ctx.transform(0, 0, Infinity, 0, 0, Infinity);
michael@0 19347 ctx.transform(0, 0, 0, Infinity, Infinity, 0);
michael@0 19348 ctx.transform(0, 0, 0, Infinity, Infinity, Infinity);
michael@0 19349 ctx.transform(0, 0, 0, Infinity, 0, Infinity);
michael@0 19350 ctx.transform(0, 0, 0, 0, Infinity, Infinity);
michael@0 19351
michael@0 19352 ctx.fillStyle = '#0f0';
michael@0 19353 ctx.fillRect(-100, -10, 100, 50);
michael@0 19354
michael@0 19355 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19356
michael@0 19357 } catch (e) {
michael@0 19358 _thrown_outer = true;
michael@0 19359 }
michael@0 19360 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19361
michael@0 19362
michael@0 19363 }
michael@0 19364 </script>
michael@0 19365
michael@0 19366 <!-- [[[ test_2d.transformation.transform.skewed.html ]]] -->
michael@0 19367
michael@0 19368 <p>Canvas test: 2d.transformation.transform.skewed</p>
michael@0 19369 <!-- Testing: transform() with skewy matrix transforms correctly -->
michael@0 19370 <canvas id="c605" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19371 <script>
michael@0 19372
michael@0 19373
michael@0 19374 function test_2d_transformation_transform_skewed() {
michael@0 19375
michael@0 19376 var canvas = document.getElementById('c605');
michael@0 19377 var ctx = canvas.getContext('2d');
michael@0 19378
michael@0 19379 // Create green with a red square ring inside it
michael@0 19380 ctx.fillStyle = '#0f0';
michael@0 19381 ctx.fillRect(0, 0, 100, 50);
michael@0 19382 ctx.fillStyle = '#f00';
michael@0 19383 ctx.fillRect(20, 10, 60, 30);
michael@0 19384 ctx.fillStyle = '#0f0';
michael@0 19385 ctx.fillRect(40, 20, 20, 10);
michael@0 19386
michael@0 19387 // Draw a skewed shape to fill that gap, to make sure it is aligned correctly
michael@0 19388 ctx.transform(1,4, 2,3, 5,6);
michael@0 19389 // Post-transform coordinates:
michael@0 19390 // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]];
michael@0 19391 // Hence pre-transform coordinates:
michael@0 19392 var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2],
michael@0 19393 [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2],
michael@0 19394 [-7.4,11.2]];
michael@0 19395 ctx.beginPath();
michael@0 19396 ctx.moveTo(pts[0][0], pts[0][1]);
michael@0 19397 for (var i = 0; i < pts.length; ++i)
michael@0 19398 ctx.lineTo(pts[i][0], pts[i][1]);
michael@0 19399 ctx.fill();
michael@0 19400 isPixel(ctx, 21,11, 0,255,0,255, 0);
michael@0 19401 isPixel(ctx, 79,11, 0,255,0,255, 0);
michael@0 19402 isPixel(ctx, 21,39, 0,255,0,255, 0);
michael@0 19403 isPixel(ctx, 79,39, 0,255,0,255, 0);
michael@0 19404 isPixel(ctx, 39,19, 0,255,0,255, IsAzureSkia() ? 1 : 0);
michael@0 19405 isPixel(ctx, 61,19, 0,255,0,255, 0);
michael@0 19406 isPixel(ctx, 39,31, 0,255,0,255, 0);
michael@0 19407 isPixel(ctx, 61,31, 0,255,0,255, 0);
michael@0 19408
michael@0 19409
michael@0 19410 }
michael@0 19411 </script>
michael@0 19412
michael@0 19413 <!-- [[[ test_2d.transformation.translate.basic.html ]]] -->
michael@0 19414
michael@0 19415 <p>Canvas test: 2d.transformation.translate.basic</p>
michael@0 19416 <!-- Testing: translate() works -->
michael@0 19417 <canvas id="c606" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19418 <script>
michael@0 19419
michael@0 19420
michael@0 19421 function test_2d_transformation_translate_basic() {
michael@0 19422
michael@0 19423 var canvas = document.getElementById('c606');
michael@0 19424 var ctx = canvas.getContext('2d');
michael@0 19425
michael@0 19426 ctx.fillStyle = '#f00';
michael@0 19427 ctx.fillRect(0, 0, 100, 50);
michael@0 19428
michael@0 19429 ctx.translate(100, 50);
michael@0 19430 ctx.fillStyle = '#0f0';
michael@0 19431 ctx.fillRect(-100, -50, 100, 50);
michael@0 19432 isPixel(ctx, 90,40, 0,255,0,255, 0);
michael@0 19433
michael@0 19434
michael@0 19435 }
michael@0 19436 </script>
michael@0 19437
michael@0 19438 <!-- [[[ test_2d.transformation.translate.nonfinite.html ]]] -->
michael@0 19439
michael@0 19440 <p>Canvas test: 2d.transformation.translate.nonfinite</p>
michael@0 19441 <!-- Testing: translate() with Infinity/NaN is ignored -->
michael@0 19442 <canvas id="c607" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19443 <script>
michael@0 19444
michael@0 19445
michael@0 19446 function test_2d_transformation_translate_nonfinite() {
michael@0 19447
michael@0 19448 var canvas = document.getElementById('c607');
michael@0 19449 var ctx = canvas.getContext('2d');
michael@0 19450
michael@0 19451 var _thrown_outer = false;
michael@0 19452 try {
michael@0 19453
michael@0 19454 ctx.fillStyle = '#f00';
michael@0 19455 ctx.fillRect(0, 0, 100, 50);
michael@0 19456
michael@0 19457 ctx.translate(100, 10);
michael@0 19458 ctx.translate(Infinity, 0.1);
michael@0 19459 ctx.translate(-Infinity, 0.1);
michael@0 19460 ctx.translate(NaN, 0.1);
michael@0 19461 ctx.translate(0.1, Infinity);
michael@0 19462 ctx.translate(0.1, -Infinity);
michael@0 19463 ctx.translate(0.1, NaN);
michael@0 19464 ctx.translate(Infinity, Infinity);
michael@0 19465
michael@0 19466 ctx.fillStyle = '#0f0';
michael@0 19467 ctx.fillRect(-100, -10, 100, 50);
michael@0 19468
michael@0 19469 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19470
michael@0 19471 } catch (e) {
michael@0 19472 _thrown_outer = true;
michael@0 19473 }
michael@0 19474 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19475
michael@0 19476
michael@0 19477 }
michael@0 19478 </script>
michael@0 19479
michael@0 19480 <!-- [[[ test_2d.type.exists.html ]]] -->
michael@0 19481
michael@0 19482 <p>Canvas test: 2d.type.exists</p>
michael@0 19483 <!-- Testing: The 2D context interface is a property of 'window' -->
michael@0 19484 <canvas id="c609" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19485 <script>
michael@0 19486
michael@0 19487 function test_2d_type_exists() {
michael@0 19488
michael@0 19489 var canvas = document.getElementById('c609');
michael@0 19490 var ctx = canvas.getContext('2d');
michael@0 19491
michael@0 19492 ok(window.CanvasRenderingContext2D, "window.CanvasRenderingContext2D");
michael@0 19493
michael@0 19494
michael@0 19495 }
michael@0 19496 </script>
michael@0 19497
michael@0 19498 <!-- [[[ test_2d.type.extend.html ]]] -->
michael@0 19499
michael@0 19500 <p>Canvas test: 2d.type.extend</p>
michael@0 19501 <!-- Testing: Interface methods can be added -->
michael@0 19502 <canvas id="c610" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19503 <script>
michael@0 19504
michael@0 19505
michael@0 19506 function test_2d_type_extend() {
michael@0 19507
michael@0 19508 var canvas = document.getElementById('c610');
michael@0 19509 var ctx = canvas.getContext('2d');
michael@0 19510
michael@0 19511 window.CanvasRenderingContext2D.prototype.fillRectGreen = function (x, y, w, h)
michael@0 19512 {
michael@0 19513 this.fillStyle = '#0f0';
michael@0 19514 this.fillRect(x, y, w, h);
michael@0 19515 };
michael@0 19516 ctx.fillStyle = '#f00';
michael@0 19517 ctx.fillRectGreen(0, 0, 100, 50);
michael@0 19518 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19519
michael@0 19520
michael@0 19521 }
michael@0 19522 </script>
michael@0 19523
michael@0 19524 <!-- [[[ test_2d.type.prototype.html ]]] -->
michael@0 19525
michael@0 19526 <p>Canvas test: 2d.type.prototype</p>
michael@0 19527 <!-- Testing: window.CanvasRenderingContext2D.prototype is { DontDelete, ReadOnly }, and its methods are not -->
michael@0 19528 <canvas id="c611" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19529 <script>
michael@0 19530
michael@0 19531 function test_2d_type_prototype() {
michael@0 19532
michael@0 19533 var canvas = document.getElementById('c611');
michael@0 19534 var ctx = canvas.getContext('2d');
michael@0 19535
michael@0 19536 var fill = window.CanvasRenderingContext2D.prototype.fill;
michael@0 19537 ok(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
michael@0 19538 ok(window.CanvasRenderingContext2D.prototype.fill, "window.CanvasRenderingContext2D.prototype.fill");
michael@0 19539 window.CanvasRenderingContext2D.prototype = null;
michael@0 19540 ok(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
michael@0 19541 delete window.CanvasRenderingContext2D.prototype;
michael@0 19542 ok(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
michael@0 19543 window.CanvasRenderingContext2D.prototype.fill = 1;
michael@0 19544 ok(window.CanvasRenderingContext2D.prototype.fill === 1, "window.CanvasRenderingContext2D.prototype.fill === 1");
michael@0 19545 delete window.CanvasRenderingContext2D.prototype.fill;
michael@0 19546 ok(window.CanvasRenderingContext2D.prototype.fill === undefined, "window.CanvasRenderingContext2D.prototype.fill === undefined");
michael@0 19547
michael@0 19548 //restore the original method to ensure that other tests can run successfully
michael@0 19549 window.CanvasRenderingContext2D.prototype.fill = fill;
michael@0 19550 }
michael@0 19551 </script>
michael@0 19552
michael@0 19553 <!-- [[[ test_2d.type.replace.html ]]] -->
michael@0 19554
michael@0 19555 <p>Canvas test: 2d.type.replace</p>
michael@0 19556 <!-- Testing: Interface methods can be overridden -->
michael@0 19557 <canvas id="c612" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19558 <script>
michael@0 19559
michael@0 19560
michael@0 19561 function test_2d_type_replace() {
michael@0 19562
michael@0 19563 var canvas = document.getElementById('c612');
michael@0 19564 var ctx = canvas.getContext('2d');
michael@0 19565
michael@0 19566 var fillRect = window.CanvasRenderingContext2D.prototype.fillRect;
michael@0 19567 window.CanvasRenderingContext2D.prototype.fillRect = function (x, y, w, h)
michael@0 19568 {
michael@0 19569 this.fillStyle = '#0f0';
michael@0 19570 fillRect.call(this, x, y, w, h);
michael@0 19571 };
michael@0 19572 ctx.fillStyle = '#f00';
michael@0 19573 ctx.fillRect(0, 0, 100, 50);
michael@0 19574 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 19575
michael@0 19576 //restore the original method to ensure that other tests can run successfully
michael@0 19577 window.CanvasRenderingContext2D.prototype.fillRect = fillRect;
michael@0 19578 }
michael@0 19579 </script>
michael@0 19580
michael@0 19581 <!-- [[[ test_2d.voidreturn.html ]]] -->
michael@0 19582
michael@0 19583 <p>Canvas test: 2d.voidreturn</p>
michael@0 19584 <!-- Testing: void methods return undefined -->
michael@0 19585 <canvas id="c613" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19586 <script>
michael@0 19587
michael@0 19588 function test_2d_voidreturn() {
michael@0 19589
michael@0 19590 var canvas = document.getElementById('c613');
michael@0 19591 var ctx = canvas.getContext('2d');
michael@0 19592
michael@0 19593 ok(ctx.save() === undefined, "ctx.save() === undefined");
michael@0 19594 ok(ctx.restore() === undefined, "ctx.restore() === undefined");
michael@0 19595 ok(ctx.scale(1, 1) === undefined, "ctx.scale(1, 1) === undefined");
michael@0 19596 ok(ctx.rotate(0) === undefined, "ctx.rotate(0) === undefined");
michael@0 19597 ok(ctx.translate(0, 0) === undefined, "ctx.translate(0, 0) === undefined");
michael@0 19598 if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
michael@0 19599 ok(ctx.transform(1, 0, 0, 1, 0, 0) === undefined, "ctx.transform(1, 0, 0, 1, 0, 0) === undefined");
michael@0 19600 }
michael@0 19601 if (ctx.setTransform) {
michael@0 19602 ok(ctx.setTransform(1, 0, 0, 1, 0, 0) === undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0) === undefined");
michael@0 19603 }
michael@0 19604 ok(ctx.clearRect(0, 0, 0, 0) === undefined, "ctx.clearRect(0, 0, 0, 0) === undefined");
michael@0 19605 ok(ctx.fillRect(0, 0, 0, 0) === undefined, "ctx.fillRect(0, 0, 0, 0) === undefined");
michael@0 19606 ok(ctx.strokeRect(0, 0, 0, 0) === undefined, "ctx.strokeRect(0, 0, 0, 0) === undefined");
michael@0 19607 ok(ctx.beginPath() === undefined, "ctx.beginPath() === undefined");
michael@0 19608 ok(ctx.closePath() === undefined, "ctx.closePath() === undefined");
michael@0 19609 ok(ctx.moveTo(0, 0) === undefined, "ctx.moveTo(0, 0) === undefined");
michael@0 19610 ok(ctx.lineTo(0, 0) === undefined, "ctx.lineTo(0, 0) === undefined");
michael@0 19611 ok(ctx.quadraticCurveTo(0, 0, 0, 0) === undefined, "ctx.quadraticCurveTo(0, 0, 0, 0) === undefined");
michael@0 19612 ok(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0) === undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0) === undefined");
michael@0 19613 ok(ctx.arcTo(0, 0, 0, 0, 1) === undefined, "ctx.arcTo(0, 0, 0, 0, 1) === undefined");
michael@0 19614 ok(ctx.rect(0, 0, 0, 0) === undefined, "ctx.rect(0, 0, 0, 0) === undefined");
michael@0 19615 ok(ctx.arc(0, 0, 1, 0, 0, true) === undefined, "ctx.arc(0, 0, 1, 0, 0, true) === undefined");
michael@0 19616 ok(ctx.fill() === undefined, "ctx.fill() === undefined");
michael@0 19617 ok(ctx.stroke() === undefined, "ctx.stroke() === undefined");
michael@0 19618 ok(ctx.clip() === undefined, "ctx.clip() === undefined");
michael@0 19619 if (ctx.putImageData) {
michael@0 19620 ok(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0) === undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0) === undefined");
michael@0 19621 }
michael@0 19622 ok(ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 1, 1, 0, 0, 0, 0) === undefined, "ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 1, 1, 0, 0, 0, 0) === undefined");
michael@0 19623 ok(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0) === undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0) === undefined");
michael@0 19624 ok(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white') === undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white') === undefined");
michael@0 19625
michael@0 19626
michael@0 19627 }
michael@0 19628 </script>
michael@0 19629 <img src="image_yellow.png" id="yellow_11.png" class="resource">
michael@0 19630
michael@0 19631 <!-- [[[ test_bug397524.html ]]] -->
michael@0 19632
michael@0 19633 <p>Test for Bug 397524</p>
michael@0 19634 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397524">Mozilla Bug 397524</a>
michael@0 19635 <p id="display">
michael@0 19636 <canvas id="canvas1" width="1" height="1"></canvas>
michael@0 19637 <canvas id="canvas2" width="1" height="1"></canvas>
michael@0 19638 <canvas id="canvas3" width="1" height="1"></canvas>
michael@0 19639 <img id="i1", src="image_green-1x1.png">
michael@0 19640 <img id="i2" src="http://example.com/tests/content/canvas/test/image_green-1x1.png">
michael@0 19641 <img id="i3" src="image_green-redirect">
michael@0 19642 </p>
michael@0 19643 <div id="content" style="display: none">
michael@0 19644
michael@0 19645 </div>
michael@0 19646 <pre id="test">
michael@0 19647 <script class="testbody" type="text/javascript">
michael@0 19648
michael@0 19649 /** Test for Bug 397524 **/
michael@0 19650
michael@0 19651 function draw(n) {
michael@0 19652 $("canvas" + n).getContext('2d').drawImage($("i" + n), 0, 0);
michael@0 19653 }
michael@0 19654
michael@0 19655 function test_bug397524() {
michael@0 19656 draw(1);
michael@0 19657 draw(2);
michael@0 19658 draw(3);
michael@0 19659
michael@0 19660 // Should be able to get the data out of the first canvas
michael@0 19661 $("canvas1").toDataURL("image/png");
michael@0 19662
michael@0 19663 // Should not be able to get the data out of a cross-site load
michael@0 19664 var gotData = false;
michael@0 19665 try {
michael@0 19666 $("canvas2").toDataURL("image/png");
michael@0 19667 gotData = true;
michael@0 19668 } catch (ex if (ex.code == 18 && ex.name == "SecurityError")) {
michael@0 19669 }
michael@0 19670 is(gotData, false, "Shouldn't be able to read images cross-site!");
michael@0 19671
michael@0 19672 // Should not be able to get the data out of a redirected cross-site load
michael@0 19673 var gotData = false;
michael@0 19674 try {
michael@0 19675 $("canvas3").toDataURL("image/png");
michael@0 19676 gotData = true;
michael@0 19677 } catch (ex if (ex.code == 18 && ex.name == "SecurityError")) {
michael@0 19678 }
michael@0 19679 is(gotData, false, "Shouldn't be able to read images redirected cross-site!");
michael@0 19680
michael@0 19681 }
michael@0 19682
michael@0 19683 </script>
michael@0 19684 </pre>
michael@0 19685
michael@0 19686 <!-- [[[ test_bug405982.html ]]] -->
michael@0 19687
michael@0 19688 <p>Canvas test: toDataURL.png</p>
michael@0 19689 <canvas id="c614" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19690 <script>
michael@0 19691 function test_bug405982() {
michael@0 19692
michael@0 19693 var canvas = SpecialPowers.wrap(document.getElementById('c614'));
michael@0 19694 var ctx = canvas.getContext('2d');
michael@0 19695
michael@0 19696 var _threw = false;
michael@0 19697 try {
michael@0 19698 var data = canvas.toDataURL('image/png', 'quality=100');
michael@0 19699 }
michael@0 19700 catch (e) {
michael@0 19701 _threw = true;
michael@0 19702 }
michael@0 19703 ok(!_threw, "Should not throw an exception for invalid args to png encoder");
michael@0 19704
michael@0 19705 _threw = false;
michael@0 19706 try {
michael@0 19707 var data = canvas.toDataURL('image/jpeg', 'foobar=true');
michael@0 19708 }
michael@0 19709 catch (e) {
michael@0 19710 _threw = true;
michael@0 19711 }
michael@0 19712 ok(!_threw, "Should not throw an exception for invalid args to jpeg encoder");
michael@0 19713
michael@0 19714 }
michael@0 19715 </script>
michael@0 19716 <!-- [[[ test_context.arguments.extra.html ]]] -->
michael@0 19717
michael@0 19718 <p>Canvas test: context.arguments.extra</p>
michael@0 19719 <canvas id="c615" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19720 <script>
michael@0 19721
michael@0 19722 function test_context_arguments_extra() {
michael@0 19723
michael@0 19724 var canvas = document.getElementById('c615');
michael@0 19725 var ctx = canvas.getContext('2d');
michael@0 19726
michael@0 19727 ok(canvas.getContext('2d', 'foo') !== null, "canvas.getContext('2d', 'foo') !== null");
michael@0 19728
michael@0 19729
michael@0 19730 }
michael@0 19731 </script>
michael@0 19732
michael@0 19733 <!-- [[[ test_context.arguments.missing.html ]]] -->
michael@0 19734
michael@0 19735 <p>Canvas test: context.arguments.missing</p>
michael@0 19736 <canvas id="c616" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19737 <script>
michael@0 19738
michael@0 19739 function test_context_arguments_missing() {
michael@0 19740
michael@0 19741 var canvas = document.getElementById('c616');
michael@0 19742 var ctx = canvas.getContext('2d');
michael@0 19743
michael@0 19744 var _thrown = undefined; try {
michael@0 19745 canvas.getContext();
michael@0 19746 } catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "NotSupportedError" && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NotSupportedError");
michael@0 19747
michael@0 19748
michael@0 19749 }
michael@0 19750 </script>
michael@0 19751
michael@0 19752 <!-- [[[ test_context.casesensitive.html ]]] -->
michael@0 19753
michael@0 19754 <p>Canvas test: context.casesensitive - bug 401788</p>
michael@0 19755 <!-- Testing: Context name "2D" is unrecognised; matching is case sensitive -->
michael@0 19756 <canvas id="c617" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19757 <script>
michael@0 19758
michael@0 19759 function test_context_casesensitive() {
michael@0 19760
michael@0 19761 var canvas = document.getElementById('c617');
michael@0 19762 var ctx = canvas.getContext('2d');
michael@0 19763
michael@0 19764 var _thrown_outer = false;
michael@0 19765 try {
michael@0 19766
michael@0 19767 ok(canvas.getContext('2D') === null, "canvas.getContext('2D') === null");
michael@0 19768
michael@0 19769 } catch (e) {
michael@0 19770 _thrown_outer = true;
michael@0 19771 }
michael@0 19772 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19773
michael@0 19774
michael@0 19775 }
michael@0 19776 </script>
michael@0 19777
michael@0 19778 <!-- [[[ test_context.emptystring.html ]]] -->
michael@0 19779
michael@0 19780 <p>Canvas test: context.emptystring - bug 401788</p>
michael@0 19781 <!-- Testing: getContext with empty string returns null -->
michael@0 19782 <canvas id="c618" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19783 <script>
michael@0 19784
michael@0 19785 function test_context_emptystring() {
michael@0 19786
michael@0 19787 var canvas = document.getElementById('c618');
michael@0 19788 var ctx = canvas.getContext('2d');
michael@0 19789
michael@0 19790 var _thrown_outer = false;
michael@0 19791 try {
michael@0 19792
michael@0 19793 ok(canvas.getContext("") === null, "canvas.getContext(\"\") === null");
michael@0 19794
michael@0 19795 } catch (e) {
michael@0 19796 _thrown_outer = true;
michael@0 19797 }
michael@0 19798 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19799
michael@0 19800
michael@0 19801 }
michael@0 19802 </script>
michael@0 19803
michael@0 19804 <!-- [[[ test_context.unrecognised.badname.html ]]] -->
michael@0 19805
michael@0 19806 <p>Canvas test: context.unrecognised.badname - bug 401788</p>
michael@0 19807 <!-- Testing: getContext with unrecognised context name returns null -->
michael@0 19808 <canvas id="c619" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19809 <script>
michael@0 19810
michael@0 19811 function test_context_unrecognised_badname() {
michael@0 19812
michael@0 19813 var canvas = document.getElementById('c619');
michael@0 19814 var ctx = canvas.getContext('2d');
michael@0 19815
michael@0 19816 var _thrown_outer = false;
michael@0 19817 try {
michael@0 19818
michael@0 19819 ok(canvas.getContext('This is not an implemented context in any real browser') === null, "canvas.getContext('This is not an implemented context in any real browser') === null");
michael@0 19820
michael@0 19821 } catch (e) {
michael@0 19822 _thrown_outer = true;
michael@0 19823 }
michael@0 19824 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19825
michael@0 19826
michael@0 19827 }
michael@0 19828 </script>
michael@0 19829
michael@0 19830 <!-- [[[ test_context.unrecognised.badsuffix.html ]]] -->
michael@0 19831
michael@0 19832 <p>Canvas test: context.unrecognised.badsuffix - bug 401788</p>
michael@0 19833 <!-- Testing: Context name "2d" plus a suffix is unrecognised -->
michael@0 19834 <canvas id="c620" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19835 <script>
michael@0 19836
michael@0 19837 function test_context_unrecognised_badsuffix() {
michael@0 19838
michael@0 19839 var canvas = document.getElementById('c620');
michael@0 19840 var ctx = canvas.getContext('2d');
michael@0 19841
michael@0 19842 var _thrown_outer = false;
michael@0 19843 try {
michael@0 19844
michael@0 19845 ok(canvas.getContext("2d#") === null, "canvas.getContext(\"2d#\") === null");
michael@0 19846
michael@0 19847 } catch (e) {
michael@0 19848 _thrown_outer = true;
michael@0 19849 }
michael@0 19850 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19851
michael@0 19852
michael@0 19853 }
michael@0 19854 </script>
michael@0 19855
michael@0 19856 <!-- [[[ test_context.unrecognised.nullsuffix.html ]]] -->
michael@0 19857
michael@0 19858 <p>Canvas test: context.unrecognised.nullsuffix - bug 401788</p>
michael@0 19859 <!-- Testing: Context name "2d" plus a "\0" suffix is unrecognised -->
michael@0 19860 <canvas id="c621" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19861 <script>
michael@0 19862
michael@0 19863 function test_context_unrecognised_nullsuffix() {
michael@0 19864
michael@0 19865 var canvas = document.getElementById('c621');
michael@0 19866 var ctx = canvas.getContext('2d');
michael@0 19867
michael@0 19868 var _thrown_outer = false;
michael@0 19869 try {
michael@0 19870
michael@0 19871 ok(canvas.getContext("2d\0") === null, "canvas.getContext(\"2d\\0\") === null");
michael@0 19872
michael@0 19873 } catch (e) {
michael@0 19874 _thrown_outer = true;
michael@0 19875 }
michael@0 19876 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19877
michael@0 19878
michael@0 19879 }
michael@0 19880 </script>
michael@0 19881
michael@0 19882 <!-- [[[ test_context.unrecognised.unicode.html ]]] -->
michael@0 19883
michael@0 19884 <p>Canvas test: context.unrecognised.unicode - bug 401788</p>
michael@0 19885 <!-- Testing: Context name which kind of looks like "2d" is unrecognised -->
michael@0 19886 <canvas id="c622" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19887 <script>
michael@0 19888
michael@0 19889 function test_context_unrecognised_unicode() {
michael@0 19890
michael@0 19891 var canvas = document.getElementById('c622');
michael@0 19892 var ctx = canvas.getContext('2d');
michael@0 19893
michael@0 19894 var _thrown_outer = false;
michael@0 19895 try {
michael@0 19896
michael@0 19897 ok(canvas.getContext("2\uFF44") === null, "canvas.getContext(\"2\\uFF44\") === null"); // Fullwidth Latin Small Letter D
michael@0 19898
michael@0 19899 } catch (e) {
michael@0 19900 _thrown_outer = true;
michael@0 19901 }
michael@0 19902 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 19903
michael@0 19904
michael@0 19905 }
michael@0 19906 </script>
michael@0 19907
michael@0 19908 <!-- [[[ test_fallback.basic.html ]]] -->
michael@0 19909
michael@0 19910 <p>Canvas test: fallback.basic</p>
michael@0 19911 <!-- Testing: Fallback content is inserted into the DOM -->
michael@0 19912 <canvas id="c623" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19913 <script>
michael@0 19914
michael@0 19915 function test_fallback_basic() {
michael@0 19916
michael@0 19917 var canvas = document.getElementById('c623');
michael@0 19918 var ctx = canvas.getContext('2d');
michael@0 19919
michael@0 19920 ok(canvas.childNodes.length == 1, "canvas.childNodes.length == 1");
michael@0 19921
michael@0 19922
michael@0 19923 }
michael@0 19924 </script>
michael@0 19925
michael@0 19926 <!-- [[[ test_fallback.multiple.html ]]] -->
michael@0 19927
michael@0 19928 <p>Canvas test: fallback.multiple</p>
michael@0 19929 <!-- Testing: Fallback content with multiple elements -->
michael@0 19930 <canvas id="c624" width="100" height="50"><p class="fallback">FAIL</p><p class="fallback">FAIL</p></canvas>
michael@0 19931 <script>
michael@0 19932
michael@0 19933 function test_fallback_multiple() {
michael@0 19934
michael@0 19935 var canvas = document.getElementById('c624');
michael@0 19936 var ctx = canvas.getContext('2d');
michael@0 19937
michael@0 19938 ok(canvas.childNodes.length == 2, "canvas.childNodes.length == 2");
michael@0 19939
michael@0 19940
michael@0 19941 }
michael@0 19942 </script>
michael@0 19943
michael@0 19944 <!-- [[[ test_fallback.nested.html ]]] -->
michael@0 19945
michael@0 19946 <p>Canvas test: fallback.nested</p>
michael@0 19947 <!-- Testing: Fallback content containing another canvas (mostly testing parsers) -->
michael@0 19948 <canvas id="c625" width="100" height="50"><canvas><p class="fallback">FAIL (fallback content)</p></canvas><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19949 <script>
michael@0 19950
michael@0 19951 function test_fallback_nested() {
michael@0 19952
michael@0 19953 var canvas = document.getElementById('c625');
michael@0 19954 var ctx = canvas.getContext('2d');
michael@0 19955
michael@0 19956 ok(canvas.childNodes.length == 2, "canvas.childNodes.length == 2");
michael@0 19957
michael@0 19958
michael@0 19959 }
michael@0 19960 </script>
michael@0 19961
michael@0 19962 <!-- [[[ test_initial.colour.html ]]] -->
michael@0 19963
michael@0 19964 <p>Canvas test: initial.colour</p>
michael@0 19965 <!-- Testing: Initial state is transparent black -->
michael@0 19966 <canvas id="c626" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19967 <script>
michael@0 19968
michael@0 19969
michael@0 19970 function test_initial_colour() {
michael@0 19971
michael@0 19972 var canvas = document.getElementById('c626');
michael@0 19973 var ctx = canvas.getContext('2d');
michael@0 19974
michael@0 19975 isPixel(ctx, 20,20, 0,0,0,0, 0);
michael@0 19976
michael@0 19977
michael@0 19978 }
michael@0 19979 </script>
michael@0 19980
michael@0 19981 <!-- [[[ test_initial.reset.2dstate.html ]]] -->
michael@0 19982
michael@0 19983 <p>Canvas test: initial.reset.2dstate</p>
michael@0 19984 <!-- Testing: Resetting the canvas state resets 2D state variables -->
michael@0 19985 <canvas id="c627" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 19986 <script>
michael@0 19987
michael@0 19988 function test_initial_reset_2dstate() {
michael@0 19989
michael@0 19990 var canvas = document.getElementById('c627');
michael@0 19991 var ctx = canvas.getContext('2d');
michael@0 19992
michael@0 19993 canvas.width = 100;
michael@0 19994 var default_val;
michael@0 19995
michael@0 19996 default_val = ctx.strokeStyle;
michael@0 19997 ctx.strokeStyle = "#ff0000";
michael@0 19998 canvas.width = 100;
michael@0 19999 ok(ctx.strokeStyle === default_val, "ctx.strokeStyle === default_val");
michael@0 20000
michael@0 20001 default_val = ctx.fillStyle;
michael@0 20002 ctx.fillStyle = "#ff0000";
michael@0 20003 canvas.width = 100;
michael@0 20004 ok(ctx.fillStyle === default_val, "ctx.fillStyle === default_val");
michael@0 20005
michael@0 20006 default_val = ctx.globalAlpha;
michael@0 20007 ctx.globalAlpha = 0.5;
michael@0 20008 canvas.width = 100;
michael@0 20009 ok(ctx.globalAlpha === default_val, "ctx.globalAlpha === default_val");
michael@0 20010
michael@0 20011 default_val = ctx.lineWidth;
michael@0 20012 ctx.lineWidth = 0.5;
michael@0 20013 canvas.width = 100;
michael@0 20014 ok(ctx.lineWidth === default_val, "ctx.lineWidth === default_val");
michael@0 20015
michael@0 20016 default_val = ctx.lineCap;
michael@0 20017 ctx.lineCap = "round";
michael@0 20018 canvas.width = 100;
michael@0 20019 ok(ctx.lineCap === default_val, "ctx.lineCap === default_val");
michael@0 20020
michael@0 20021 default_val = ctx.lineJoin;
michael@0 20022 ctx.lineJoin = "round";
michael@0 20023 canvas.width = 100;
michael@0 20024 ok(ctx.lineJoin === default_val, "ctx.lineJoin === default_val");
michael@0 20025
michael@0 20026 default_val = ctx.miterLimit;
michael@0 20027 ctx.miterLimit = 0.5;
michael@0 20028 canvas.width = 100;
michael@0 20029 ok(ctx.miterLimit === default_val, "ctx.miterLimit === default_val");
michael@0 20030
michael@0 20031 default_val = ctx.shadowOffsetX;
michael@0 20032 ctx.shadowOffsetX = 5;
michael@0 20033 canvas.width = 100;
michael@0 20034 ok(ctx.shadowOffsetX === default_val, "ctx.shadowOffsetX === default_val");
michael@0 20035
michael@0 20036 default_val = ctx.shadowOffsetY;
michael@0 20037 ctx.shadowOffsetY = 5;
michael@0 20038 canvas.width = 100;
michael@0 20039 ok(ctx.shadowOffsetY === default_val, "ctx.shadowOffsetY === default_val");
michael@0 20040
michael@0 20041 default_val = ctx.shadowBlur;
michael@0 20042 ctx.shadowBlur = 5;
michael@0 20043 canvas.width = 100;
michael@0 20044 ok(ctx.shadowBlur === default_val, "ctx.shadowBlur === default_val");
michael@0 20045
michael@0 20046 default_val = ctx.shadowColor;
michael@0 20047 ctx.shadowColor = "#ff0000";
michael@0 20048 canvas.width = 100;
michael@0 20049 ok(ctx.shadowColor === default_val, "ctx.shadowColor === default_val");
michael@0 20050
michael@0 20051 default_val = ctx.globalCompositeOperation;
michael@0 20052 ctx.globalCompositeOperation = "copy";
michael@0 20053 canvas.width = 100;
michael@0 20054 ok(ctx.globalCompositeOperation === default_val, "ctx.globalCompositeOperation === default_val");
michael@0 20055
michael@0 20056
michael@0 20057 }
michael@0 20058 </script>
michael@0 20059
michael@0 20060 <!-- [[[ test_initial.reset.clip.html ]]] -->
michael@0 20061
michael@0 20062 <p>Canvas test: initial.reset.clip</p>
michael@0 20063 <!-- Testing: Resetting the canvas state resets the current clip region -->
michael@0 20064 <canvas id="c628" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20065 <script>
michael@0 20066
michael@0 20067
michael@0 20068 function test_initial_reset_clip() {
michael@0 20069
michael@0 20070 var canvas = document.getElementById('c628');
michael@0 20071 var ctx = canvas.getContext('2d');
michael@0 20072
michael@0 20073 canvas.width = 100;
michael@0 20074 ctx.rect(0, 0, 1, 1);
michael@0 20075 ctx.clip();
michael@0 20076 canvas.width = 100;
michael@0 20077 ctx.fillStyle = '#0f0';
michael@0 20078 ctx.fillRect(0, 0, 100, 50);
michael@0 20079 isPixel(ctx, 20,20, 0,255,0,255, 0);
michael@0 20080
michael@0 20081
michael@0 20082 }
michael@0 20083 </script>
michael@0 20084
michael@0 20085 <!-- [[[ test_initial.reset.different.html ]]] -->
michael@0 20086
michael@0 20087 <p>Canvas test: initial.reset.different</p>
michael@0 20088 <!-- Testing: Changing size resets canvas to transparent black -->
michael@0 20089 <canvas id="c629" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20090 <script>
michael@0 20091
michael@0 20092
michael@0 20093 function test_initial_reset_different() {
michael@0 20094
michael@0 20095 var canvas = document.getElementById('c629');
michael@0 20096 var ctx = canvas.getContext('2d');
michael@0 20097
michael@0 20098 ctx.fillStyle = '#f00';
michael@0 20099 ctx.fillRect(0, 0, 50, 50);
michael@0 20100 isPixel(ctx, 20,20, 255,0,0,255, 0);
michael@0 20101 canvas.width = 50;
michael@0 20102 isPixel(ctx, 20,20, 0,0,0,0, 0);
michael@0 20103
michael@0 20104
michael@0 20105 }
michael@0 20106 </script>
michael@0 20107
michael@0 20108 <!-- [[[ test_initial.reset.gradient.html ]]] -->
michael@0 20109
michael@0 20110 <p>Canvas test: initial.reset.gradient</p>
michael@0 20111 <!-- Testing: Resetting the canvas state does not invalidate any existing gradients -->
michael@0 20112 <canvas id="c630" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20113 <script>
michael@0 20114
michael@0 20115
michael@0 20116 function test_initial_reset_gradient() {
michael@0 20117
michael@0 20118 var canvas = document.getElementById('c630');
michael@0 20119 var ctx = canvas.getContext('2d');
michael@0 20120
michael@0 20121 canvas.width = 50;
michael@0 20122 var g = ctx.createLinearGradient(0, 0, 100, 0);
michael@0 20123 g.addColorStop(0, '#0f0');
michael@0 20124 g.addColorStop(1, '#0f0');
michael@0 20125 canvas.width = 100;
michael@0 20126 ctx.fillStyle = '#f00';
michael@0 20127 ctx.fillRect(0, 0, 100, 50);
michael@0 20128 ctx.fillStyle = g;
michael@0 20129 ctx.fillRect(0, 0, 100, 50);
michael@0 20130 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 20131
michael@0 20132
michael@0 20133 }
michael@0 20134 </script>
michael@0 20135
michael@0 20136 <!-- [[[ test_initial.reset.path.html ]]] -->
michael@0 20137
michael@0 20138 <p>Canvas test: initial.reset.path</p>
michael@0 20139 <!-- Testing: Resetting the canvas state resets the current path -->
michael@0 20140 <canvas id="c631" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20141 <script>
michael@0 20142
michael@0 20143
michael@0 20144 function test_initial_reset_path() {
michael@0 20145
michael@0 20146 var canvas = document.getElementById('c631');
michael@0 20147 var ctx = canvas.getContext('2d');
michael@0 20148
michael@0 20149 canvas.width = 100;
michael@0 20150 ctx.rect(0, 0, 100, 50);
michael@0 20151 canvas.width = 100;
michael@0 20152 ctx.fillStyle = '#f00';
michael@0 20153 ctx.fill();
michael@0 20154 isPixel(ctx, 20,20, 0,0,0,0, 0);
michael@0 20155
michael@0 20156
michael@0 20157 }
michael@0 20158 </script>
michael@0 20159
michael@0 20160 <!-- [[[ test_initial.reset.pattern.html ]]] -->
michael@0 20161
michael@0 20162 <p>Canvas test: initial.reset.pattern</p>
michael@0 20163 <!-- Testing: Resetting the canvas state does not invalidate any existing patterns -->
michael@0 20164 <canvas id="c632" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20165 <script>
michael@0 20166
michael@0 20167
michael@0 20168 function test_initial_reset_pattern() {
michael@0 20169
michael@0 20170 var canvas = document.getElementById('c632');
michael@0 20171 var ctx = canvas.getContext('2d');
michael@0 20172
michael@0 20173 canvas.width = 50;
michael@0 20174 ctx.fillStyle = '#0f0';
michael@0 20175 ctx.fillRect(0, 0, 50, 50);
michael@0 20176 var p = ctx.createPattern(canvas, 'repeat-x');
michael@0 20177 canvas.width = 100;
michael@0 20178 ctx.fillStyle = '#f00';
michael@0 20179 ctx.fillRect(0, 0, 100, 50);
michael@0 20180 ctx.fillStyle = p;
michael@0 20181 ctx.fillRect(0, 0, 100, 50);
michael@0 20182 isPixel(ctx, 50,25, 0,255,0,255, 0);
michael@0 20183
michael@0 20184
michael@0 20185 }
michael@0 20186 </script>
michael@0 20187
michael@0 20188 <!-- [[[ test_initial.reset.same.html ]]] -->
michael@0 20189
michael@0 20190 <p>Canvas test: initial.reset.same</p>
michael@0 20191 <!-- Testing: Setting size (not changing the value) resets canvas to transparent black -->
michael@0 20192 <canvas id="c633" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20193 <script>
michael@0 20194
michael@0 20195
michael@0 20196 function test_initial_reset_same() {
michael@0 20197
michael@0 20198 var canvas = document.getElementById('c633');
michael@0 20199 var ctx = canvas.getContext('2d');
michael@0 20200
michael@0 20201 canvas.width = 100;
michael@0 20202 ctx.fillStyle = '#f00';
michael@0 20203 ctx.fillRect(0, 0, 50, 50);
michael@0 20204 isPixel(ctx, 20,20, 255,0,0,255, 0);
michael@0 20205 canvas.width = 100;
michael@0 20206 isPixel(ctx, 20,20, 0,0,0,0, 0);
michael@0 20207
michael@0 20208
michael@0 20209 }
michael@0 20210 </script>
michael@0 20211
michael@0 20212 <!-- [[[ test_initial.reset.transform.html ]]] -->
michael@0 20213
michael@0 20214 <p>Canvas test: initial.reset.transform</p>
michael@0 20215 <!-- Testing: Resetting the canvas state resets the current transformation matrix -->
michael@0 20216 <canvas id="c634" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20217 <script>
michael@0 20218
michael@0 20219
michael@0 20220 function test_initial_reset_transform() {
michael@0 20221
michael@0 20222 var canvas = document.getElementById('c634');
michael@0 20223 var ctx = canvas.getContext('2d');
michael@0 20224
michael@0 20225 canvas.width = 100;
michael@0 20226 ctx.scale(0, 0);
michael@0 20227 canvas.width = 100;
michael@0 20228 ctx.fillStyle = '#0f0';
michael@0 20229 ctx.fillRect(0, 0, 100, 50);
michael@0 20230 isPixel(ctx, 20,20, 0,255,0,255, 0);
michael@0 20231
michael@0 20232
michael@0 20233 }
michael@0 20234 </script>
michael@0 20235
michael@0 20236 <!-- [[[ test_size.attributes.default.html ]]] -->
michael@0 20237
michael@0 20238 <p>Canvas test: size.attributes.default</p>
michael@0 20239 <!-- Testing: Default width/height -->
michael@0 20240 <canvas id="c635" ><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20241 <script>
michael@0 20242
michael@0 20243 function test_size_attributes_default() {
michael@0 20244
michael@0 20245 var canvas = document.getElementById('c635');
michael@0 20246 var ctx = canvas.getContext('2d');
michael@0 20247
michael@0 20248 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20249 ok(canvas.height == 150, "canvas.height == 150");
michael@0 20250 ok(!canvas.hasAttribute('width'), "!canvas.hasAttribute('width')");
michael@0 20251 ok(!canvas.hasAttribute('height'), "!canvas.hasAttribute('height')");
michael@0 20252
michael@0 20253
michael@0 20254 }
michael@0 20255 </script>
michael@0 20256
michael@0 20257 <!-- [[[ test_size.attributes.html ]]] -->
michael@0 20258
michael@0 20259 <p>Canvas test: size.attributes</p>
michael@0 20260 <!-- Testing: width/height DOM attributes and content attributes -->
michael@0 20261 <canvas id="c636" width="120" height="60"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20262 <script>
michael@0 20263
michael@0 20264 function test_size_attributes() {
michael@0 20265
michael@0 20266 var canvas = document.getElementById('c636');
michael@0 20267 var ctx = canvas.getContext('2d');
michael@0 20268
michael@0 20269 ok(canvas.width == 120, "canvas.width == 120");
michael@0 20270 ok(canvas.height == 60, "canvas.height == 60");
michael@0 20271 ok(canvas.getAttribute('width') == 120, "canvas.getAttribute('width') == 120");
michael@0 20272 ok(canvas.getAttribute('height') == 60, "canvas.getAttribute('height') == 60");
michael@0 20273
michael@0 20274
michael@0 20275 }
michael@0 20276 </script>
michael@0 20277
michael@0 20278 <!-- [[[ test_size.attributes.parse.badsuffix.html ]]] -->
michael@0 20279
michael@0 20280 <p>Canvas test: size.attributes.parse.badsuffix</p>
michael@0 20281 <!-- Testing: Parsing of non-negative integers -->
michael@0 20282 <canvas id="c637" width="100foo" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20283 <script>
michael@0 20284
michael@0 20285 function test_size_attributes_parse_badsuffix() {
michael@0 20286
michael@0 20287 var canvas = document.getElementById('c637');
michael@0 20288 var ctx = canvas.getContext('2d');
michael@0 20289
michael@0 20290 is(canvas.width, 100, "canvas.width == 100");
michael@0 20291
michael@0 20292
michael@0 20293 }
michael@0 20294 </script>
michael@0 20295
michael@0 20296 <!-- [[[ test_size.attributes.parse.floatsuffix.html ]]] -->
michael@0 20297
michael@0 20298 <p>Canvas test: size.attributes.parse.floatsuffix</p>
michael@0 20299 <!-- Testing: Parsing of non-negative integers -->
michael@0 20300 <canvas id="c638" width="100.9" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20301 <script>
michael@0 20302
michael@0 20303 function test_size_attributes_parse_floatsuffix() {
michael@0 20304
michael@0 20305 var canvas = document.getElementById('c638');
michael@0 20306 var ctx = canvas.getContext('2d');
michael@0 20307
michael@0 20308 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20309
michael@0 20310
michael@0 20311 }
michael@0 20312 </script>
michael@0 20313
michael@0 20314 <!-- [[[ test_size.attributes.parse.negative.html ]]] -->
michael@0 20315
michael@0 20316 <p>Canvas test: size.attributes.parse.negative</p>
michael@0 20317 <!-- Testing: Parsing of non-negative integers -->
michael@0 20318 <canvas id="c639" width="-100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20319 <script>
michael@0 20320
michael@0 20321 function test_size_attributes_parse_negative() {
michael@0 20322
michael@0 20323 var canvas = document.getElementById('c639');
michael@0 20324 var ctx = canvas.getContext('2d');
michael@0 20325
michael@0 20326 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20327
michael@0 20328
michael@0 20329 }
michael@0 20330 </script>
michael@0 20331
michael@0 20332 <!-- [[[ test_size.attributes.parse.nonnumber.html ]]] -->
michael@0 20333
michael@0 20334 <p>Canvas test: size.attributes.parse.nonnumber</p>
michael@0 20335 <!-- Testing: Parsing of non-negative integers -->
michael@0 20336 <canvas id="c640" width="foo" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20337 <script>
michael@0 20338
michael@0 20339 function test_size_attributes_parse_nonnumber() {
michael@0 20340
michael@0 20341 var canvas = document.getElementById('c640');
michael@0 20342 var ctx = canvas.getContext('2d');
michael@0 20343
michael@0 20344 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20345
michael@0 20346
michael@0 20347 }
michael@0 20348 </script>
michael@0 20349
michael@0 20350 <!-- [[[ test_size.attributes.parse.percentsuffix.html ]]] -->
michael@0 20351
michael@0 20352 <p>Canvas test: size.attributes.parse.percentsuffix</p>
michael@0 20353 <!-- Testing: Parsing of non-negative integers -->
michael@0 20354 <canvas id="c641" width="100%" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20355 <script>
michael@0 20356
michael@0 20357 function test_size_attributes_parse_percentsuffix() {
michael@0 20358
michael@0 20359 var canvas = document.getElementById('c641');
michael@0 20360 var ctx = canvas.getContext('2d');
michael@0 20361
michael@0 20362 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20363
michael@0 20364
michael@0 20365 }
michael@0 20366 </script>
michael@0 20367
michael@0 20368 <!-- [[[ test_size.attributes.parse.whitespace.html ]]] -->
michael@0 20369
michael@0 20370 <p>Canvas test: size.attributes.parse.whitespace</p>
michael@0 20371 <!-- Testing: Parsing of non-negative integers -->
michael@0 20372 <canvas id="c642" width=" 100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20373 <script>
michael@0 20374
michael@0 20375 function test_size_attributes_parse_whitespace() {
michael@0 20376
michael@0 20377 var canvas = document.getElementById('c642');
michael@0 20378 var ctx = canvas.getContext('2d');
michael@0 20379
michael@0 20380 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20381
michael@0 20382
michael@0 20383 }
michael@0 20384 </script>
michael@0 20385
michael@0 20386 <!-- [[[ test_size.attributes.parse.zero.html ]]] -->
michael@0 20387
michael@0 20388 <p>Canvas test: size.attributes.parse.zero</p>
michael@0 20389 <!-- Testing: Parsing of non-negative integers -->
michael@0 20390 <canvas id="c643" width="0" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20391 <script>
michael@0 20392
michael@0 20393 function test_size_attributes_parse_zero() {
michael@0 20394
michael@0 20395 var canvas = document.getElementById('c643');
michael@0 20396 var ctx = canvas.getContext('2d');
michael@0 20397
michael@0 20398 ok(canvas.width == 0, "canvas.width == 0");
michael@0 20399
michael@0 20400
michael@0 20401 }
michael@0 20402 </script>
michael@0 20403
michael@0 20404 <!-- [[[ test_size.attributes.parse.zerosuffix.html ]]] -->
michael@0 20405
michael@0 20406 <p>Canvas test: size.attributes.parse.zerosuffix</p>
michael@0 20407 <!-- Testing: Parsing of non-negative integers -->
michael@0 20408 <canvas id="c644" width="100.0" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20409 <script>
michael@0 20410
michael@0 20411 function test_size_attributes_parse_zerosuffix() {
michael@0 20412
michael@0 20413 var canvas = document.getElementById('c644');
michael@0 20414 var ctx = canvas.getContext('2d');
michael@0 20415
michael@0 20416 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20417
michael@0 20418
michael@0 20419 }
michael@0 20420 </script>
michael@0 20421
michael@0 20422 <!-- [[[ test_size.attributes.reflect.1.html ]]] -->
michael@0 20423
michael@0 20424 <p>Canvas test: size.attributes.reflect.1</p>
michael@0 20425 <!-- Testing: Setting DOM attributes updates DOM and content attributes -->
michael@0 20426 <canvas id="c645" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20427 <script>
michael@0 20428
michael@0 20429 function test_size_attributes_reflect_1() {
michael@0 20430
michael@0 20431 var canvas = document.getElementById('c645');
michael@0 20432 var ctx = canvas.getContext('2d');
michael@0 20433
michael@0 20434 canvas.width = 120;
michael@0 20435 canvas.height = 60;
michael@0 20436 ok(canvas.getAttribute('width') == '120', "canvas.getAttribute('width') == '120'");
michael@0 20437 ok(canvas.getAttribute('height') == '60', "canvas.getAttribute('height') == '60'");
michael@0 20438 ok(canvas.width == 120, "canvas.width == 120");
michael@0 20439 ok(canvas.height == 60, "canvas.height == 60");
michael@0 20440
michael@0 20441
michael@0 20442 }
michael@0 20443 </script>
michael@0 20444
michael@0 20445 <!-- [[[ test_size.attributes.reflect.2.html ]]] -->
michael@0 20446
michael@0 20447 <p>Canvas test: size.attributes.reflect.2</p>
michael@0 20448 <!-- Testing: Setting content attributes updates DOM and content attributes -->
michael@0 20449 <canvas id="c646" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20450 <script>
michael@0 20451
michael@0 20452 function test_size_attributes_reflect_2() {
michael@0 20453
michael@0 20454 var canvas = document.getElementById('c646');
michael@0 20455 var ctx = canvas.getContext('2d');
michael@0 20456
michael@0 20457 canvas.setAttribute('width', '120');
michael@0 20458 canvas.setAttribute('height', '60');
michael@0 20459 ok(canvas.getAttribute('width') == '120', "canvas.getAttribute('width') == '120'");
michael@0 20460 ok(canvas.getAttribute('height') == '60', "canvas.getAttribute('height') == '60'");
michael@0 20461 ok(canvas.width == 120, "canvas.width == 120");
michael@0 20462 ok(canvas.height == 60, "canvas.height == 60");
michael@0 20463
michael@0 20464
michael@0 20465 }
michael@0 20466 </script>
michael@0 20467
michael@0 20468 <!-- [[[ test_size.attributes.removed.html ]]] -->
michael@0 20469
michael@0 20470 <p>Canvas test: size.attributes.removed</p>
michael@0 20471 <!-- Testing: Removing content attributes reverts to default size -->
michael@0 20472 <canvas id="c647" width="120" height="60"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20473 <script>
michael@0 20474
michael@0 20475 function test_size_attributes_removed() {
michael@0 20476
michael@0 20477 var canvas = document.getElementById('c647');
michael@0 20478 var ctx = canvas.getContext('2d');
michael@0 20479
michael@0 20480 canvas.removeAttribute('width');
michael@0 20481 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20482
michael@0 20483
michael@0 20484 }
michael@0 20485 </script>
michael@0 20486
michael@0 20487 <!-- [[[ test_size.attributes.setAttribute.badsuffix.html ]]] -->
michael@0 20488
michael@0 20489 <p>Canvas test: size.attributes.setAttribute.badsuffix</p>
michael@0 20490 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20491 <canvas id="c648" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20492 <script>
michael@0 20493
michael@0 20494 function test_size_attributes_setAttribute_badsuffix() {
michael@0 20495
michael@0 20496 var canvas = document.getElementById('c648');
michael@0 20497 var ctx = canvas.getContext('2d');
michael@0 20498
michael@0 20499 canvas.setAttribute('width', '100foo');
michael@0 20500 is(canvas.width, 100, "canvas.width == 100");
michael@0 20501
michael@0 20502
michael@0 20503 }
michael@0 20504 </script>
michael@0 20505
michael@0 20506 <!-- [[[ test_size.attributes.setAttribute.floatsuffix.html ]]] -->
michael@0 20507
michael@0 20508 <p>Canvas test: size.attributes.setAttribute.floatsuffix</p>
michael@0 20509 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20510 <canvas id="c649" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20511 <script>
michael@0 20512
michael@0 20513 function test_size_attributes_setAttribute_floatsuffix() {
michael@0 20514
michael@0 20515 var canvas = document.getElementById('c649');
michael@0 20516 var ctx = canvas.getContext('2d');
michael@0 20517
michael@0 20518 canvas.setAttribute('width', '1');
michael@0 20519 canvas.setAttribute('width', '100.9');
michael@0 20520 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20521
michael@0 20522
michael@0 20523 }
michael@0 20524 </script>
michael@0 20525
michael@0 20526 <!-- [[[ test_size.attributes.setAttribute.negative.html ]]] -->
michael@0 20527
michael@0 20528 <p>Canvas test: size.attributes.setAttribute.negative</p>
michael@0 20529 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20530 <canvas id="c650" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20531 <script>
michael@0 20532
michael@0 20533 function test_size_attributes_setAttribute_negative() {
michael@0 20534
michael@0 20535 var canvas = document.getElementById('c650');
michael@0 20536 var ctx = canvas.getContext('2d');
michael@0 20537
michael@0 20538 canvas.setAttribute('width', '-100');
michael@0 20539 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20540
michael@0 20541
michael@0 20542 }
michael@0 20543 </script>
michael@0 20544
michael@0 20545 <!-- [[[ test_size.attributes.setAttribute.nonnumber.html ]]] -->
michael@0 20546
michael@0 20547 <p>Canvas test: size.attributes.setAttribute.nonnumber</p>
michael@0 20548 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20549 <canvas id="c651" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20550 <script>
michael@0 20551
michael@0 20552 function test_size_attributes_setAttribute_nonnumber() {
michael@0 20553
michael@0 20554 var canvas = document.getElementById('c651');
michael@0 20555 var ctx = canvas.getContext('2d');
michael@0 20556
michael@0 20557 canvas.setAttribute('width', 'foo');
michael@0 20558 ok(canvas.width == 300, "canvas.width == 300");
michael@0 20559
michael@0 20560
michael@0 20561 }
michael@0 20562 </script>
michael@0 20563
michael@0 20564 <!-- [[[ test_size.attributes.setAttribute.percentsuffix.html ]]] -->
michael@0 20565
michael@0 20566 <p>Canvas test: size.attributes.setAttribute.percentsuffix</p>
michael@0 20567 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20568 <canvas id="c652" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20569 <script>
michael@0 20570
michael@0 20571 function test_size_attributes_setAttribute_percentsuffix() {
michael@0 20572
michael@0 20573 var canvas = document.getElementById('c652');
michael@0 20574 var ctx = canvas.getContext('2d');
michael@0 20575
michael@0 20576 canvas.setAttribute('width', '100%');
michael@0 20577 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20578
michael@0 20579
michael@0 20580 }
michael@0 20581 </script>
michael@0 20582
michael@0 20583 <!-- [[[ test_size.attributes.setAttribute.whitespace.html ]]] -->
michael@0 20584
michael@0 20585 <p>Canvas test: size.attributes.setAttribute.whitespace</p>
michael@0 20586 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20587 <canvas id="c653" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20588 <script>
michael@0 20589
michael@0 20590 function test_size_attributes_setAttribute_whitespace() {
michael@0 20591
michael@0 20592 var canvas = document.getElementById('c653');
michael@0 20593 var ctx = canvas.getContext('2d');
michael@0 20594
michael@0 20595 canvas.setAttribute('width', ' 100');
michael@0 20596 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20597
michael@0 20598
michael@0 20599 }
michael@0 20600 </script>
michael@0 20601
michael@0 20602 <!-- [[[ test_size.attributes.setAttribute.zero.html ]]] -->
michael@0 20603
michael@0 20604 <p>Canvas test: size.attributes.setAttribute.zero</p>
michael@0 20605 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20606 <canvas id="c654" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20607 <script>
michael@0 20608
michael@0 20609 function test_size_attributes_setAttribute_zero() {
michael@0 20610
michael@0 20611 var canvas = document.getElementById('c654');
michael@0 20612 var ctx = canvas.getContext('2d');
michael@0 20613
michael@0 20614 canvas.setAttribute('width', '0');
michael@0 20615 ok(canvas.width == 0, "canvas.width == 0");
michael@0 20616
michael@0 20617
michael@0 20618 }
michael@0 20619 </script>
michael@0 20620
michael@0 20621 <!-- [[[ test_size.attributes.setAttribute.zerosuffix.html ]]] -->
michael@0 20622
michael@0 20623 <p>Canvas test: size.attributes.setAttribute.zerosuffix</p>
michael@0 20624 <!-- Testing: Parsing of non-negative integers in setAttribute -->
michael@0 20625 <canvas id="c655" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20626 <script>
michael@0 20627
michael@0 20628 function test_size_attributes_setAttribute_zerosuffix() {
michael@0 20629
michael@0 20630 var canvas = document.getElementById('c655');
michael@0 20631 var ctx = canvas.getContext('2d');
michael@0 20632
michael@0 20633 canvas.setAttribute('width', '1');
michael@0 20634 canvas.setAttribute('width', '100.0');
michael@0 20635 ok(canvas.width == 100, "canvas.width == 100");
michael@0 20636
michael@0 20637
michael@0 20638 }
michael@0 20639 </script>
michael@0 20640
michael@0 20641 <!-- [[[ test_size.attributes.style.html ]]] -->
michael@0 20642
michael@0 20643 <p>Canvas test: size.attributes.style</p>
michael@0 20644 <!-- Testing: Canvas size is independent of CSS resizing -->
michael@0 20645 <canvas id="c656" width="50" height="30" style="width: 100px; height: 50px"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20646 <script>
michael@0 20647
michael@0 20648 function test_size_attributes_style() {
michael@0 20649
michael@0 20650 var canvas = document.getElementById('c656');
michael@0 20651 var ctx = canvas.getContext('2d');
michael@0 20652
michael@0 20653 ok(canvas.width == 50, "canvas.width == 50");
michael@0 20654 ok(canvas.height == 30, "canvas.height == 30");
michael@0 20655
michael@0 20656
michael@0 20657 }
michael@0 20658 </script>
michael@0 20659
michael@0 20660 <!-- [[[ test_size.attributes.type.get.html ]]] -->
michael@0 20661
michael@0 20662 <p>Canvas test: size.attributes.type.get</p>
michael@0 20663 <!-- Testing: width/height DOM/content attributes - string vs number types -->
michael@0 20664 <canvas id="c657" width="120" height="60"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20665 <script>
michael@0 20666
michael@0 20667 function test_size_attributes_type_get() {
michael@0 20668
michael@0 20669 var canvas = document.getElementById('c657');
michael@0 20670 var ctx = canvas.getContext('2d');
michael@0 20671
michael@0 20672 ok(canvas.width === 120, "canvas.width === 120");
michael@0 20673 ok(canvas.height === 60, "canvas.height === 60");
michael@0 20674 ok(canvas.getAttribute('width') === '120', "canvas.getAttribute('width') === '120'");
michael@0 20675 ok(canvas.getAttribute('height') === '60', "canvas.getAttribute('height') === '60'");
michael@0 20676
michael@0 20677
michael@0 20678 }
michael@0 20679 </script>
michael@0 20680
michael@0 20681 <!-- [[[ test_size.attributes.type.set.html ]]] -->
michael@0 20682
michael@0 20683 <p>Canvas test: size.attributes.type.set</p>
michael@0 20684 <!-- Testing: Setting width/height DOM attributes -->
michael@0 20685 <canvas id="c658" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20686 <script>
michael@0 20687
michael@0 20688 function test_size_attributes_type_set() {
michael@0 20689
michael@0 20690 var canvas = document.getElementById('c658');
michael@0 20691 var ctx = canvas.getContext('2d');
michael@0 20692
michael@0 20693 canvas.width = 120;
michael@0 20694 canvas.height = 60;
michael@0 20695 ok(canvas.width === 120, "canvas.width === 120");
michael@0 20696 ok(canvas.height === 60, "canvas.height === 60");
michael@0 20697
michael@0 20698
michael@0 20699 }
michael@0 20700 </script>
michael@0 20701
michael@0 20702 <!-- [[[ test_text.font.html ]]] -->
michael@0 20703
michael@0 20704 <p>Canvas test: text.font</p>
michael@0 20705 <canvas id="c659" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20706 <script>
michael@0 20707 var _deferred = true;
michael@0 20708
michael@0 20709 function test_text_font() {
michael@0 20710
michael@0 20711 var canvas = document.getElementById('c659');
michael@0 20712 var ctx = canvas.getContext('2d');
michael@0 20713
michael@0 20714 is(ctx.font, '10px sans-serif', "default font is not '10px sans-serif'");
michael@0 20715
michael@0 20716 ctx.save();
michael@0 20717 ctx.font = '20pt serif';
michael@0 20718 is(ctx.font, '20pt serif', 'font getter returns incorrect value');
michael@0 20719
michael@0 20720 ctx.restore();
michael@0 20721 is(ctx.font, '10px sans-serif', 'font not being stored in the context state');
michael@0 20722
michael@0 20723 if (!_deferred) SimpleTest.finish();
michael@0 20724 }
michael@0 20725 </script>
michael@0 20726
michael@0 20727 <!-- [[[ test_text.measure.html ]]] -->
michael@0 20728
michael@0 20729 <p>Canvas test: text.measure</p>
michael@0 20730 <canvas id="c660" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20731 <script>
michael@0 20732 var _deferred = true;
michael@0 20733
michael@0 20734 function test_text_measure() {
michael@0 20735
michael@0 20736 var canvas = document.getElementById('c660');
michael@0 20737 var ctx = canvas.getContext('2d');
michael@0 20738
michael@0 20739 ctx.font = "10px sans-serif";
michael@0 20740 ctx.textAlign = "left";
michael@0 20741 ctx.textBaseline = "top";
michael@0 20742
michael@0 20743 var str = 'Test String';
michael@0 20744 var wid = ctx.measureText(str).width;
michael@0 20745
michael@0 20746 ok(wid > 0, "measureText returns nonpositive value for non-empty string");
michael@0 20747
michael@0 20748 ctx.font = "20px sans-serif";
michael@0 20749 isnot(wid, ctx.measureText(str).width, "measureText does not change with a different font size");
michael@0 20750
michael@0 20751 ctx.font = "10px sans-serif";
michael@0 20752 ctx.textAlign = "center";
michael@0 20753 ctx.textBaseline = "alphabetic";
michael@0 20754
michael@0 20755 is(wid, ctx.measureText(str).width, "measureText changes when alignement/baseline is changed");
michael@0 20756
michael@0 20757
michael@0 20758 if (!_deferred) SimpleTest.finish();
michael@0 20759 }
michael@0 20760 </script>
michael@0 20761
michael@0 20762 <!-- [[[ test_text.space.replace.html ]]] -->
michael@0 20763
michael@0 20764 <p>Canvas test: text.space.replace</p>
michael@0 20765 <canvas id="c661" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20766 <script>
michael@0 20767 var _deferred = true;
michael@0 20768
michael@0 20769 function test_text_space_replace() {
michael@0 20770
michael@0 20771 var canvas = document.getElementById('c661');
michael@0 20772 var ctx = canvas.getContext('2d');
michael@0 20773
michael@0 20774 var swid = ctx.measureText(' ').width;
michael@0 20775 ctx.font = "10px sans-serif";
michael@0 20776
michael@0 20777 isnot(swid, 0.0, "measureText reutuns zero for a non-empty string");
michael@0 20778 is(swid, ctx.measureText('\x09').width, "measureText does not replace whitespace char with a space");
michael@0 20779 is(swid, ctx.measureText('\x0A').width, "measureText does not replace whitespace char with a space");
michael@0 20780 is(swid, ctx.measureText('\x0B').width, "measureText does not replace whitespace char with a space");
michael@0 20781 is(swid, ctx.measureText('\x0C').width, "measureText does not replace whitespace char with a space");
michael@0 20782 is(swid, ctx.measureText('\x0D').width, "measureText does not replace whitespace char with a space");
michael@0 20783
michael@0 20784 if (!_deferred) SimpleTest.finish();
michael@0 20785 }
michael@0 20786 </script>
michael@0 20787
michael@0 20788 <!-- [[[ test_text.textAlign.html ]]] -->
michael@0 20789
michael@0 20790 <p>Canvas test: text.textAlign</p>
michael@0 20791 <canvas id="c662" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20792 <script>
michael@0 20793 var _deferred = true;
michael@0 20794
michael@0 20795 function test_text_textAlign() {
michael@0 20796
michael@0 20797 var canvas = document.getElementById('c662');
michael@0 20798 var ctx = canvas.getContext('2d');
michael@0 20799
michael@0 20800 is(ctx.textAlign, 'start', "default textAlign is not 'start'");
michael@0 20801
michael@0 20802 ctx.save();
michael@0 20803 ctx.textAlign = 'end';
michael@0 20804 is(ctx.textAlign, 'end', 'textAlign getter returns incorrect value');
michael@0 20805
michael@0 20806 ctx.save();
michael@0 20807 ctx.textAlign = 'left';
michael@0 20808 is(ctx.textAlign, 'left', 'textAlign getter returns incorrect value');
michael@0 20809
michael@0 20810 ctx.save();
michael@0 20811 ctx.textAlign = 'center';
michael@0 20812 is(ctx.textAlign, 'center', 'textAlign getter returns incorrect value');
michael@0 20813
michael@0 20814 ctx.save();
michael@0 20815 ctx.textAlign = 'right';
michael@0 20816 is(ctx.textAlign, 'right', 'textAlign getter returns incorrect value');
michael@0 20817
michael@0 20818 ctx.save();
michael@0 20819 ctx.textAlign = 'start';
michael@0 20820 is(ctx.textAlign, 'start', 'textAlign getter returns incorrect value');
michael@0 20821
michael@0 20822 ctx.restore();
michael@0 20823 is(ctx.textAlign, 'right', 'textAlign not being stored in the context state');
michael@0 20824
michael@0 20825 ctx.restore();
michael@0 20826 is(ctx.textAlign, 'center', 'textAlign not being stored in the context state');
michael@0 20827
michael@0 20828 ctx.restore();
michael@0 20829 is(ctx.textAlign, 'left', 'textAlign not being stored in the context state');
michael@0 20830
michael@0 20831 ctx.restore();
michael@0 20832 is(ctx.textAlign, 'end', 'textAlign not being stored in the context state');
michael@0 20833
michael@0 20834 ctx.restore();
michael@0 20835 is(ctx.textAlign, 'start', 'textAlign not being stored in the context state');
michael@0 20836
michael@0 20837 if (!_deferred) SimpleTest.finish();
michael@0 20838 }
michael@0 20839 </script>
michael@0 20840
michael@0 20841 <!-- [[[ test_text.textBaseline.html ]]] -->
michael@0 20842
michael@0 20843 <p>Canvas test: text.textBaseline</p>
michael@0 20844 <canvas id="c663" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20845 <script>
michael@0 20846 var _deferred = true;
michael@0 20847
michael@0 20848 function test_text_textBaseline() {
michael@0 20849
michael@0 20850 var canvas = document.getElementById('c663');
michael@0 20851 var ctx = canvas.getContext('2d');
michael@0 20852
michael@0 20853 is(ctx.textBaseline, 'alphabetic', "default textBaseline is not 'alphabetic'");
michael@0 20854
michael@0 20855 ctx.save();
michael@0 20856 ctx.textBaseline = 'ideographic';
michael@0 20857 is(ctx.textBaseline, 'ideographic', 'textBaseline getter returns incorrect value');
michael@0 20858
michael@0 20859 ctx.save();
michael@0 20860 ctx.textBaseline = 'top';
michael@0 20861 is(ctx.textBaseline, 'top', 'textBaseline getter returns incorrect value');
michael@0 20862
michael@0 20863 ctx.save();
michael@0 20864 ctx.textBaseline = 'middle';
michael@0 20865 is(ctx.textBaseline, 'middle', 'textBaseline getter returns incorrect value');
michael@0 20866
michael@0 20867 ctx.save();
michael@0 20868 ctx.textBaseline = 'bottom';
michael@0 20869 is(ctx.textBaseline, 'bottom', 'textBaseline getter returns incorrect value');
michael@0 20870
michael@0 20871 ctx.save();
michael@0 20872 ctx.textBaseline = 'hanging';
michael@0 20873 is(ctx.textBaseline, 'hanging', 'textBaseline getter returns incorrect value');
michael@0 20874
michael@0 20875 ctx.save();
michael@0 20876 ctx.textBaseline = 'alphabetic';
michael@0 20877 is(ctx.textBaseline, 'alphabetic', 'textBaseline getter returns incorrect value');
michael@0 20878
michael@0 20879 ctx.restore();
michael@0 20880 is(ctx.textBaseline, 'hanging', 'textBaseline not being stored in the context state');
michael@0 20881
michael@0 20882 ctx.restore();
michael@0 20883 is(ctx.textBaseline, 'bottom', 'textBaseline not being stored in the context state');
michael@0 20884
michael@0 20885 ctx.restore();
michael@0 20886 is(ctx.textBaseline, 'middle', 'textBaseline not being stored in the context state');
michael@0 20887
michael@0 20888 ctx.restore();
michael@0 20889 is(ctx.textBaseline, 'top', 'textBaseline not being stored in the context state');
michael@0 20890
michael@0 20891 ctx.restore();
michael@0 20892 is(ctx.textBaseline, 'ideographic', 'textBaseline not being stored in the context state');
michael@0 20893
michael@0 20894 ctx.restore();
michael@0 20895 is(ctx.textBaseline, 'alphabetic', 'textBaseline not being stored in the context state');
michael@0 20896
michael@0 20897 if (!_deferred) SimpleTest.finish();
michael@0 20898 }
michael@0 20899 </script>
michael@0 20900
michael@0 20901 <!-- [[[ test_toDataURL.arguments.1.html ]]] -->
michael@0 20902
michael@0 20903 <p>Canvas test: toDataURL.arguments.1 - bug 401795</p>
michael@0 20904 <!-- Testing: toDataURL ignores extra arguments -->
michael@0 20905 <canvas id="c664" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20906 <script>
michael@0 20907
michael@0 20908 function test_toDataURL_arguments_1() {
michael@0 20909
michael@0 20910 var canvas = document.getElementById('c664');
michael@0 20911 var ctx = canvas.getContext('2d');
michael@0 20912
michael@0 20913 var _thrown_outer = false;
michael@0 20914 try {
michael@0 20915
michael@0 20916 var data = canvas.toDataURL('image/png', 'another argument that should not raise an exception');
michael@0 20917 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 20918
michael@0 20919 } catch (e) {
michael@0 20920 _thrown_outer = true;
michael@0 20921 }
michael@0 20922 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 20923
michael@0 20924
michael@0 20925 }
michael@0 20926 </script>
michael@0 20927
michael@0 20928 <!-- [[[ test_toDataURL.arguments.2.html ]]] -->
michael@0 20929
michael@0 20930 <p>Canvas test: toDataURL.arguments.2 - bug 401795</p>
michael@0 20931 <!-- Testing: toDataURL ignores extra arguments -->
michael@0 20932 <canvas id="c665" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20933 <script>
michael@0 20934
michael@0 20935 function test_toDataURL_arguments_2() {
michael@0 20936
michael@0 20937 var canvas = document.getElementById('c665');
michael@0 20938 var ctx = canvas.getContext('2d');
michael@0 20939
michael@0 20940 var _thrown_outer = false;
michael@0 20941 try {
michael@0 20942
michael@0 20943 var data = canvas.toDataURL('image/png', 'another argument that should not raise an exception', 'and another');
michael@0 20944 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 20945
michael@0 20946 } catch (e) {
michael@0 20947 _thrown_outer = true;
michael@0 20948 }
michael@0 20949 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 20950
michael@0 20951
michael@0 20952 }
michael@0 20953 </script>
michael@0 20954
michael@0 20955 <!-- [[[ test_toDataURL.arguments.3.html ]]] -->
michael@0 20956
michael@0 20957 <p>Canvas test: toDataURL.arguments.3 - bug 401795</p>
michael@0 20958 <!-- Testing: toDataURL ignores extra arguments -->
michael@0 20959 <canvas id="c666" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20960 <script>
michael@0 20961
michael@0 20962 function test_toDataURL_arguments_3() {
michael@0 20963
michael@0 20964 var canvas = document.getElementById('c666');
michael@0 20965 var ctx = canvas.getContext('2d');
michael@0 20966
michael@0 20967 var _thrown_outer = false;
michael@0 20968 try {
michael@0 20969
michael@0 20970 // More arguments that should not raise exceptions
michael@0 20971 var data = canvas.toDataURL('image/png', null, null, null);
michael@0 20972 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 20973
michael@0 20974 } catch (e) {
michael@0 20975 _thrown_outer = true;
michael@0 20976 }
michael@0 20977 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 20978
michael@0 20979
michael@0 20980 }
michael@0 20981 </script>
michael@0 20982
michael@0 20983 <!-- [[[ test_toDataURL.complexcolours.html ]]] -->
michael@0 20984
michael@0 20985 <p>Canvas test: toDataURL.complexcolours</p>
michael@0 20986 <!-- Testing: toDataURL handles non-primary and non-solid colours correctly -->
michael@0 20987 <canvas id="c667" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 20988 <script>
michael@0 20989
michael@0 20990 var canvas667 = document.getElementById('c667');
michael@0 20991 var ctx667 = canvas667.getContext('2d');
michael@0 20992
michael@0 20993 function test_toDataURL_complexcolours() {
michael@0 20994
michael@0 20995 // (These values are chosen to survive relatively alright through being premultiplied)
michael@0 20996 ctx667.fillStyle = 'rgba(1, 3, 254, 1)';
michael@0 20997 ctx667.fillRect(0, 0, 25, 25);
michael@0 20998 ctx667.fillStyle = 'rgba(8, 252, 248, 0.75)';
michael@0 20999 ctx667.fillRect(25, 0, 25, 25);
michael@0 21000 ctx667.fillStyle = 'rgba(6, 10, 250, 0.502)';
michael@0 21001 ctx667.fillRect(50, 0, 25, 25);
michael@0 21002 ctx667.fillStyle = 'rgba(12, 16, 244, 0.25)';
michael@0 21003 ctx667.fillRect(75, 0, 25, 25);
michael@0 21004 var img = new Image();
michael@0 21005 deferTest();
michael@0 21006 img.onload = wrapFunction(function ()
michael@0 21007 {
michael@0 21008 ctx667.drawImage(img, 0, 25);
michael@0 21009 // (The alpha values do not really survive float->int conversion, so just
michael@0 21010 // do approximate comparisons)
michael@0 21011 isPixel(ctx667, 12,40, 1,3,254,255, 0);
michael@0 21012 isPixel(ctx667, 37,40, 8,252,248,191, 2);
michael@0 21013 isPixel(ctx667, 62,40, 6,10,250,127, 4);
michael@0 21014 isPixel(ctx667, 87,40, 12,16,244,63, 8);
michael@0 21015 });
michael@0 21016 img.src = canvas667.toDataURL();
michael@0 21017
michael@0 21018
michael@0 21019 }
michael@0 21020 </script>
michael@0 21021
michael@0 21022 <!-- [[[ test_toDataURL.default.html ]]] -->
michael@0 21023
michael@0 21024 <p>Canvas test: toDataURL.default</p>
michael@0 21025 <!-- Testing: toDataURL with no arguments returns a PNG -->
michael@0 21026 <canvas id="c668" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21027 <script>
michael@0 21028
michael@0 21029 function test_toDataURL_default() {
michael@0 21030
michael@0 21031 var canvas = document.getElementById('c668');
michael@0 21032 var ctx = canvas.getContext('2d');
michael@0 21033
michael@0 21034 var data = canvas.toDataURL();
michael@0 21035 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 21036
michael@0 21037
michael@0 21038 }
michael@0 21039 </script>
michael@0 21040
michael@0 21041 <!-- [[[ test_toDataURL.lowercase.html ]]] -->
michael@0 21042
michael@0 21043 <p>Canvas test: toDataURL.lowercase - bug 401795</p>
michael@0 21044 <!-- Testing: toDataURL type is case-sensitive -->
michael@0 21045 <canvas id="c669" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21046 <script>
michael@0 21047
michael@0 21048 function test_toDataURL_lowercase() {
michael@0 21049
michael@0 21050 var canvas = document.getElementById('c669');
michael@0 21051 var ctx = canvas.getContext('2d');
michael@0 21052
michael@0 21053 var _thrown_outer = false;
michael@0 21054 try {
michael@0 21055
michael@0 21056 var data = canvas.toDataURL('ImAgE/PnG');
michael@0 21057 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 21058
michael@0 21059 } catch (e) {
michael@0 21060 _thrown_outer = true;
michael@0 21061 }
michael@0 21062 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 21063
michael@0 21064
michael@0 21065 }
michael@0 21066 </script>
michael@0 21067
michael@0 21068 <!-- [[[ test_toDataURL.nocontext.html ]]] -->
michael@0 21069
michael@0 21070 <p>Canvas test: toDataURL.nocontext</p>
michael@0 21071 <!-- Testing: toDataURL works before any context has been got -->
michael@0 21072 <canvas id="c670" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21073 <script>
michael@0 21074
michael@0 21075 function test_toDataURL_nocontext() {
michael@0 21076
michael@0 21077 var canvas = document.getElementById('c670');
michael@0 21078 var ctx = canvas.getContext('2d');
michael@0 21079
michael@0 21080 var canvas2 = document.createElement('canvas');
michael@0 21081
michael@0 21082 var data = canvas2.toDataURL();
michael@0 21083 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 21084
michael@0 21085
michael@0 21086 }
michael@0 21087 </script>
michael@0 21088
michael@0 21089 <!-- [[[ test_toDataURL.png.html ]]] -->
michael@0 21090
michael@0 21091 <p>Canvas test: toDataURL.png</p>
michael@0 21092 <!-- Testing: toDataURL with image/png returns a PNG -->
michael@0 21093 <canvas id="c671" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21094 <script>
michael@0 21095
michael@0 21096 function test_toDataURL_png() {
michael@0 21097
michael@0 21098 var canvas = document.getElementById('c671');
michael@0 21099 var ctx = canvas.getContext('2d');
michael@0 21100
michael@0 21101 var data = canvas.toDataURL('image/png');
michael@0 21102 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 21103
michael@0 21104
michael@0 21105 }
michael@0 21106 </script>
michael@0 21107
michael@0 21108 <!-- [[[ test_toDataURL.primarycolours.html ]]] -->
michael@0 21109
michael@0 21110 <p>Canvas test: toDataURL.primarycolours</p>
michael@0 21111 <!-- Testing: toDataURL handles simple colours correctly -->
michael@0 21112 <canvas id="c672" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21113 <script>
michael@0 21114
michael@0 21115
michael@0 21116 var canvas672 = document.getElementById('c672');
michael@0 21117 var ctx672 = canvas672.getContext('2d');
michael@0 21118
michael@0 21119 function test_toDataURL_primarycolours() {
michael@0 21120
michael@0 21121 ctx672.fillStyle = '#ff0';
michael@0 21122 ctx672.fillRect(0, 0, 25, 40);
michael@0 21123 ctx672.fillStyle = '#0ff';
michael@0 21124 ctx672.fillRect(25, 0, 50, 40);
michael@0 21125 ctx672.fillStyle = '#00f';
michael@0 21126 ctx672.fillRect(75, 0, 25, 40);
michael@0 21127 ctx672.fillStyle = '#fff';
michael@0 21128 ctx672.fillRect(0, 40, 100, 10);
michael@0 21129 var data = canvas672.toDataURL();
michael@0 21130 ctx672.fillStyle = '#f00';
michael@0 21131 ctx672.fillRect(0, 0, 100, 50);
michael@0 21132 var img = new Image();
michael@0 21133 deferTest();
michael@0 21134 img.onload = wrapFunction(function ()
michael@0 21135 {
michael@0 21136 ctx672.drawImage(img, 0, 0);
michael@0 21137 isPixel(ctx672, 12,20, 255,255,0,255, 0);
michael@0 21138 isPixel(ctx672, 50,20, 0,255,255,255, 0);
michael@0 21139 isPixel(ctx672, 87,20, 0,0,255,255, 0);
michael@0 21140 isPixel(ctx672, 50,45, 255,255,255,255, 0);
michael@0 21141 });
michael@0 21142 img.src = data;
michael@0 21143
michael@0 21144
michael@0 21145 }
michael@0 21146 </script>
michael@0 21147
michael@0 21148 <!-- [[[ test_toDataURL.unrecognised.html ]]] -->
michael@0 21149
michael@0 21150 <p>Canvas test: toDataURL.unrecognised - bug 401795</p>
michael@0 21151 <!-- Testing: toDataURL with an unhandled type returns a PNG -->
michael@0 21152 <canvas id="c673" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21153 <script>
michael@0 21154
michael@0 21155 function test_toDataURL_unrecognised() {
michael@0 21156
michael@0 21157 var canvas = document.getElementById('c673');
michael@0 21158 var ctx = canvas.getContext('2d');
michael@0 21159
michael@0 21160 var _thrown_outer = false;
michael@0 21161 try {
michael@0 21162
michael@0 21163 var data = canvas.toDataURL('image/example');
michael@0 21164 ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
michael@0 21165
michael@0 21166 } catch (e) {
michael@0 21167 _thrown_outer = true;
michael@0 21168 }
michael@0 21169 ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
michael@0 21170
michael@0 21171
michael@0 21172 }
michael@0 21173 </script>
michael@0 21174
michael@0 21175 <!-- [[[ test_toDataURL.zerosize.html ]]] -->
michael@0 21176
michael@0 21177 <p>Canvas test: toDataURL.zerosize</p>
michael@0 21178 <!-- Testing: toDataURL on zero-size canvas returns 'data:,' -->
michael@0 21179 <canvas id="c674" width="0" height="0"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21180 <script>
michael@0 21181
michael@0 21182 function test_toDataURL_zerosize() {
michael@0 21183
michael@0 21184 var canvas = document.getElementById('c674');
michael@0 21185 var ctx = canvas.getContext('2d');
michael@0 21186
michael@0 21187 var data = canvas.toDataURL();
michael@0 21188 ok(data === 'data:,', "data === 'data:,'");
michael@0 21189
michael@0 21190
michael@0 21191 }
michael@0 21192 </script>
michael@0 21193
michael@0 21194 <!-- [[[ test_type.exists.html ]]] -->
michael@0 21195
michael@0 21196 <p>Canvas test: type.exists</p>
michael@0 21197 <!-- Testing: HTMLCanvasElement is a property of window -->
michael@0 21198 <canvas id="c676" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21199 <script>
michael@0 21200
michael@0 21201 function test_type_exists() {
michael@0 21202
michael@0 21203 var canvas = document.getElementById('c676');
michael@0 21204 var ctx = canvas.getContext('2d');
michael@0 21205
michael@0 21206 ok(window.HTMLCanvasElement, "window.HTMLCanvasElement");
michael@0 21207
michael@0 21208
michael@0 21209 }
michael@0 21210 </script>
michael@0 21211
michael@0 21212 <!-- [[[ test_type.extend.html ]]] -->
michael@0 21213
michael@0 21214 <p>Canvas test: type.extend</p>
michael@0 21215 <!-- Testing: HTMLCanvasElement methods can be added, and the new methods used by canvases -->
michael@0 21216 <canvas id="c677" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21217 <script>
michael@0 21218
michael@0 21219 function test_type_extend() {
michael@0 21220
michael@0 21221 var canvas = document.getElementById('c677');
michael@0 21222 var ctx = canvas.getContext('2d');
michael@0 21223
michael@0 21224 window.HTMLCanvasElement.prototype.getZero = function () { return 0; };
michael@0 21225 ok(canvas.getZero() === 0, "canvas.getZero() === 0");
michael@0 21226
michael@0 21227
michael@0 21228 }
michael@0 21229 </script>
michael@0 21230
michael@0 21231 <!-- [[[ test_type.name.html ]]] -->
michael@0 21232
michael@0 21233 <p>Canvas test: type.name</p>
michael@0 21234 <!-- Testing: HTMLCanvasElement type and toString -->
michael@0 21235 <canvas id="c678" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21236 <script>
michael@0 21237
michael@0 21238 function test_type_name() {
michael@0 21239
michael@0 21240 var canvas = document.getElementById('c678');
michael@0 21241 var ctx = canvas.getContext('2d');
michael@0 21242
michael@0 21243 ok(Object.prototype.toString.call(canvas) === '[object HTMLCanvasElement]', "Object.prototype.toString.call(canvas) === '[object HTMLCanvasElement]'");
michael@0 21244
michael@0 21245
michael@0 21246 }
michael@0 21247 </script>
michael@0 21248
michael@0 21249 <!-- [[[ test_type.prototype.html ]]] -->
michael@0 21250
michael@0 21251 <p>Canvas test: type.prototype</p>
michael@0 21252 <!-- Testing: window.HTMLCanvasElement has prototype, which is { ReadOnly, DontDelete }. prototype has getContext, which is not -->
michael@0 21253 <canvas id="c679" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21254 <script>
michael@0 21255
michael@0 21256 function test_type_prototype() {
michael@0 21257
michael@0 21258 var canvas = document.getElementById('c679');
michael@0 21259 var ctx = canvas.getContext('2d');
michael@0 21260
michael@0 21261 ok(window.HTMLCanvasElement.prototype, "window.HTMLCanvasElement.prototype");
michael@0 21262 ok(window.HTMLCanvasElement.prototype.getContext, "window.HTMLCanvasElement.prototype.getContext");
michael@0 21263 window.HTMLCanvasElement.prototype = null;
michael@0 21264 ok(window.HTMLCanvasElement.prototype, "window.HTMLCanvasElement.prototype");
michael@0 21265 delete window.HTMLCanvasElement.prototype;
michael@0 21266 ok(window.HTMLCanvasElement.prototype, "window.HTMLCanvasElement.prototype");
michael@0 21267 var getContext = window.HTMLCanvasElement.prototype.getContext;
michael@0 21268 window.HTMLCanvasElement.prototype.getContext = 1;
michael@0 21269 ok(window.HTMLCanvasElement.prototype.getContext === 1, "window.HTMLCanvasElement.prototype.getContext === 1");
michael@0 21270 delete window.HTMLCanvasElement.prototype.getContext;
michael@0 21271 ok(window.HTMLCanvasElement.prototype.getContext === undefined, "window.HTMLCanvasElement.prototype.getContext === undefined");
michael@0 21272 window.HTMLCanvasElement.prototype.getContext = getContext;
michael@0 21273
michael@0 21274
michael@0 21275 }
michael@0 21276 </script>
michael@0 21277
michael@0 21278 <!-- [[[ test_type.replace.html ]]] -->
michael@0 21279
michael@0 21280 <p>Canvas test: type.replace</p>
michael@0 21281 <!-- Testing: HTMLCanvasElement methods can be replaced, and the replacement methods used by canvases -->
michael@0 21282 <canvas id="c680" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21283 <script>
michael@0 21284
michael@0 21285 function test_type_replace() {
michael@0 21286
michael@0 21287 var canvas = document.getElementById('c680');
michael@0 21288 var ctx = canvas.getContext('2d');
michael@0 21289
michael@0 21290 var getContext = window.HTMLCanvasElement.prototype.getContext;
michael@0 21291 window.HTMLCanvasElement.prototype.getContext = function (name) { return 0; };
michael@0 21292 ok(canvas.getContext('2d') === 0, "canvas.getContext('2d') === 0");
michael@0 21293 window.HTMLCanvasElement.prototype.getContext = getContext;
michael@0 21294
michael@0 21295
michael@0 21296 }
michael@0 21297 </script>
michael@0 21298
michael@0 21299 <!-- [[[ test_2d.imagedata_coercion.html ]]] -->
michael@0 21300
michael@0 21301 <p>Canvas test: 2d.imagedata_coercion</p>
michael@0 21302 <!-- Testing: imagedata coerced correctly on set -->
michael@0 21303 <canvas id="c681" width="100" height="1"><p class="fallback">FAIL (fallback content)</p></canvas>
michael@0 21304 <script>
michael@0 21305
michael@0 21306 /* NOTE: Due to round-tripping through premultiplied values and the rounding
michael@0 21307 that ensues, values of alpha < 255 will tend to do weird things. In
michael@0 21308 particular, the premultiplied color values are computed by multiplying by a,
michael@0 21309 dividing by 255, then always rounding up. The conversion the other way is done
michael@0 21310 by multiplying by 255/a and rounding down. So if
michael@0 21311
michael@0 21312 255/a * (amount added when rounding) > 1
michael@0 21313
michael@0 21314 we will get a change in value when we go through a putImageData/getImageData cycle. Therefore, to make sure we don't have to worry about our color
michael@0 21315 channels, our alpha channel should never be < 250, unless it's 0. And when it's 0, all our color channels will come back as 0 too. */
michael@0 21316
michael@0 21317 /* Our tests. Each test has two arrays: the array of values to set and the
michael@0 21318 array of values that should read back as a result. */
michael@0 21319 var tests = [
michael@0 21320 [
michael@0 21321 [ 0, 1, 3, 250 ], [ 0, 1, 3, 250 ]
michael@0 21322 ],
michael@0 21323 [
michael@0 21324 [ 0, 1, 2, 250, 4, 5, 6, 250 ], [ 0, 1, 2, 250, 4, 5, 6, 250 ]
michael@0 21325 ],
michael@0 21326 [
michael@0 21327 [ 0, 1000, 2, 300, 400, 5, 600, 250 ], [ 0, 255, 2, 255, 255, 5, 255, 250 ]
michael@0 21328 ],
michael@0 21329 [
michael@0 21330 [ -10, -5, NaN, 250, 4, 5, 6, -250 ], [ 0, 0, 0, 250, 0, 0, 0, 0 ]
michael@0 21331 ],
michael@0 21332 [
michael@0 21333 [ 0.5, 12.2, 12.8, 251.5, 12.5, 13.5, 13.2, 250.5 ],
michael@0 21334 [ 0, 12, 13, 252, 12, 14, 13, 250 ]
michael@0 21335 ]
michael@0 21336 ];
michael@0 21337
michael@0 21338 function doTest(type, idx) {
michael@0 21339 var testPair = tests[idx];
michael@0 21340 var test = testPair[0];
michael@0 21341 var ref = testPair[1];
michael@0 21342 var descSuffix = " for " + type + " test #" + (idx+1);
michael@0 21343 function myIs(a, b, str) {
michael@0 21344 is(a, b, str + descSuffix);
michael@0 21345 }
michael@0 21346
michael@0 21347 myIs(test.length, ref.length, "Length mismatch");
michael@0 21348 myIs(test.length % 4, 0, "Length not a multiple of 4");
michael@0 21349 var pixels = test.length / 4;
michael@0 21350 var imageData = ctx681.createImageData(pixels, 1);
michael@0 21351 myIs(imageData.width, pixels, "Incorrect created data width");
michael@0 21352 myIs(imageData.height, 1, "Incorrect created data height");
michael@0 21353 myIs(imageData.data.length, test.length,
michael@0 21354 "Incorrect length in created image data");
michael@0 21355
michael@0 21356 ctx681.putImageData(imageData, 0, 0);
michael@0 21357 var testImageData = ctx681.getImageData(0, 0, pixels, 1);
michael@0 21358 myIs(testImageData.data.length, test.length,
michael@0 21359 "Incorrect length in test image data after clearing pixels");
michael@0 21360 var j;
michael@0 21361 for (j = 0; j < testImageData.data.length; ++j) {
michael@0 21362 myIs(testImageData.data[j], 0,
michael@0 21363 "Nonzero value at position " + j + " in test image data " +
michael@0 21364 "after clearing pixels");
michael@0 21365 }
michael@0 21366 for (j = 0; j < imageData.data.length; ++j) {
michael@0 21367 imageData.data[j] = test[j];
michael@0 21368 }
michael@0 21369 if (type == "slow") {
michael@0 21370 // convert to a non-dense array so we can test that codepath
michael@0 21371 imageData.data.makeMeSlow = 1;
michael@0 21372 }
michael@0 21373 ctx681.putImageData(imageData, 0, 0);
michael@0 21374 testImageData = ctx681.getImageData(0, 0, pixels, 1);
michael@0 21375 myIs(testImageData.data.length, test.length,
michael@0 21376 "Incorrect length in test image data after putting our imagedata");
michael@0 21377 for (j = 0; j < testImageData.data.length; ++j) {
michael@0 21378 myIs(testImageData.data[j], ref[j],
michael@0 21379 "Incorrect value at position " + j + " in test image data " +
michael@0 21380 "after putting our imagedata");
michael@0 21381 }
michael@0 21382 }
michael@0 21383
michael@0 21384 function doTests(type) {
michael@0 21385 for (var i = 0; i < tests.length; ++i) {
michael@0 21386 doTest(type, i);
michael@0 21387 }
michael@0 21388 }
michael@0 21389
michael@0 21390 var canvas681;
michael@0 21391 var ctx681;
michael@0 21392
michael@0 21393 function test_2d_imagedata_coercion() {
michael@0 21394
michael@0 21395 canvas681 = document.getElementById('c681');
michael@0 21396 ctx681 = canvas681.getContext('2d');
michael@0 21397
michael@0 21398 doTests("fast");
michael@0 21399 doTests("slow");
michael@0 21400
michael@0 21401 }
michael@0 21402 </script>
michael@0 21403
michael@0 21404 <!-- [[[ test_2d.imageSmoothing.html ]]] -->
michael@0 21405
michael@0 21406 <p>Canvas test: 2d.imageRenderingQuality</p>
michael@0 21407 <canvas id="c682" width="10" height="10"></canvas><br>
michael@0 21408 <canvas style="visibility: hidden" id="c683" width="2" height="2"></canvas>
michael@0 21409 <script type="text/javascript">
michael@0 21410
michael@0 21411 function setup_test_2d_imageSmoothing() {
michael@0 21412 var c683 = document.getElementById("c683");
michael@0 21413 var cx683 = c683.getContext("2d");
michael@0 21414
michael@0 21415 cx683.fillStyle = "red";
michael@0 21416 cx683.fillRect(0, 0, 2, 2);
michael@0 21417
michael@0 21418 cx683.fillStyle = "rgb(0,255,0)";
michael@0 21419 cx683.fillRect(0, 0, 1, 1);
michael@0 21420 }
michael@0 21421
michael@0 21422 function test_2d_imageSmoothing() {
michael@0 21423 setup_test_2d_imageSmoothing();
michael@0 21424
michael@0 21425 var c682 = document.getElementById("c682");
michael@0 21426 var c683 = document.getElementById("c683");
michael@0 21427
michael@0 21428 var cx682 = c682.getContext("2d");
michael@0 21429
michael@0 21430 ok(cx682.mozImageSmoothingEnabled == true, "initial mozImageSmoothingEnabled is true");
michael@0 21431
michael@0 21432 // check that mozImageSmoothingEnabled is part of the context
michael@0 21433 cx682.save();
michael@0 21434 cx682.mozImageSmoothingEnabled = false;
michael@0 21435 ok(cx682.mozImageSmoothingEnabled == false, "mozImageSmoothingEnabled is false after setting");
michael@0 21436 cx682.restore();
michael@0 21437 ok(cx682.mozImageSmoothingEnabled == true, "mozImageSmoothingEnabled is true after restore");
michael@0 21438
michael@0 21439 // check that false works
michael@0 21440 cx682.mozImageSmoothingEnabled = false;
michael@0 21441
michael@0 21442 cx682.scale(10,10);
michael@0 21443 cx682.drawImage(c683, 0, 0);
michael@0 21444
michael@0 21445 // this should be all red
michael@0 21446 var data = cx682.getImageData(9, 9, 1, 1);
michael@0 21447 var pixels = data.data;
michael@0 21448 ok (pixels[0] == 0 &&
michael@0 21449 pixels[1] == 255 &&
michael@0 21450 pixels[2] == 0 &&
michael@0 21451 pixels[3] == 255,
michael@0 21452 "pixel is " + pixels.toSource() + " (expected [0,255,0,255])");
michael@0 21453 }
michael@0 21454
michael@0 21455 </script>
michael@0 21456
michael@0 21457 <p>Canvas test: zero_dimensions</p>
michael@0 21458 <canvas id="c684" width="0" height="0"></canvas>
michael@0 21459 <script type="text/javascript">
michael@0 21460 function test_zero_dimensions() {
michael@0 21461 var c = document.getElementById("c684");
michael@0 21462 ok(c.width == 0, "c.width not 0");
michael@0 21463 ok(c.height == 0, "c.height not 0");
michael@0 21464 }
michael@0 21465 </script>
michael@0 21466
michael@0 21467 <p>Canvas test: zero_dimensions_image_data</p>
michael@0 21468 <canvas id="c685" width="0" height="0"></canvas>
michael@0 21469 <script type="text/javascript">
michael@0 21470 function test_zero_dimensions_imagedata() {
michael@0 21471 var c = document.getElementById("c685");
michael@0 21472 var ctx = c.getContext("2d");
michael@0 21473 ctx.fillStyle = "blue";
michael@0 21474 ctx.fillRect(0, 0, 100, 100);
michael@0 21475 var imgdata = ctx.getImageData(0, 0, 100, 100);
michael@0 21476 var isTransparentBlack = true;
michael@0 21477 for (var i = 0; i < imgdata.data.length; ++i)
michael@0 21478 if (imgdata.data[i] !== 0)
michael@0 21479 isTransparentBlack = false;
michael@0 21480 ok(isTransparentBlack, "isTransparentBlack");
michael@0 21481 }
michael@0 21482 </script>
michael@0 21483
michael@0 21484 <p>Canvas test: getImageData_after_zero_canvas</p>
michael@0 21485 <canvas id="c686" width="100" height="100"></canvas>
michael@0 21486 <script type="text/javascript">
michael@0 21487 function test_getImageData_after_zero_canvas() {
michael@0 21488 var c = document.getElementById("c686");
michael@0 21489 var ctx = c.getContext("2d");
michael@0 21490 ctx.fillStyle = "rgba(0, 0, 0, 1.0)";
michael@0 21491 ctx.fillRect(0, 0, c.width, c.height);
michael@0 21492 var oldimgdata = ctx.getImageData(0, 0, c.width, c.height);
michael@0 21493 c.width = c.height = 0;
michael@0 21494 c.width = c.height = 100;
michael@0 21495 ctx.fillRect(0, 0, c.width, c.height);
michael@0 21496 var imgdata = ctx.getImageData(0, 0, c.width, c.height);
michael@0 21497 var same = false;
michael@0 21498 ok(imgdata.data.length === oldimgdata.data.length, "not the same length");
michael@0 21499 for (var i = 0; i < imgdata.data.length; ++i)
michael@0 21500 same = imgdata.data[i] === oldimgdata.data[i];
michael@0 21501 ok(same, "changing dimensions broke canvas");
michael@0 21502 }
michael@0 21503 </script>
michael@0 21504
michael@0 21505 <p>Canvas test: zero_dimensions_image_data</p>
michael@0 21506 <canvas id="c687" width="150" height="50"></canvas>
michael@0 21507 <script type="text/javascript">
michael@0 21508
michael@0 21509 function test_linedash() {
michael@0 21510 var c = document.getElementById("c687");
michael@0 21511 var ctx = c.getContext("2d");
michael@0 21512 ok(ctx.lineDashOffset==0, "initial dash offset is not 0");
michael@0 21513
michael@0 21514 ctx.setLineDash([15, 10]);
michael@0 21515 ctx.lineDashOffset = 5;
michael@0 21516 ctx.strokeRect (10,10,100,100);
michael@0 21517
michael@0 21518 var lineDash = ctx.getLineDash();
michael@0 21519 ok(lineDash[0]==15&&lineDash[1]==10, "dash pattern [15, 10] is wrong");
michael@0 21520 ok(ctx.lineDashOffset==5, "dash offset is wrong");
michael@0 21521
michael@0 21522 ctx.setLineDash([5, 10, 15]);
michael@0 21523 ctx.strokeRect(20, 20, 120, 120);
michael@0 21524 lineDash = ctx.getLineDash();
michael@0 21525 ok(lineDash[0]==5
michael@0 21526 && lineDash[1]==10
michael@0 21527 && lineDash[2]==15
michael@0 21528 && lineDash[3]==5
michael@0 21529 && lineDash[4]==10
michael@0 21530 && lineDash[5]==15, "dash pattern [5, 10, 15] is wrong");
michael@0 21531
michael@0 21532 ctx.setLineDash(["1", 2]);
michael@0 21533 lineDash = ctx.getLineDash();
michael@0 21534 ok(lineDash[0] == 1 && lineDash[1] == 2, "dash pattern ['1', 2] is wrong");
michael@0 21535
michael@0 21536 ctx.clearRect(0, 0, 700, 700);
michael@0 21537 ok(ctx.lineDashOffset==5, "dash offset is wrong");
michael@0 21538
michael@0 21539 ctx.setLineDash([20, 10]);
michael@0 21540 ctx.lineDashOffset = 0;
michael@0 21541 ctx.lineWidth = 4; // To make the test immune to plaform anti-aliasing discrepancies
michael@0 21542 ctx.strokeStyle = '#00FF00';
michael@0 21543 ctx.strokeRect(10.5, 10.5, 30, 30);
michael@0 21544
michael@0 21545 isPixel(ctx, 25, 10, 0, 255, 0, 255, 0);
michael@0 21546 isPixel(ctx, 35, 10, 0, 0, 0, 0, 0);
michael@0 21547 isPixel(ctx, 40, 25, 0, 255, 0, 255, 0);
michael@0 21548 isPixel(ctx, 40, 35, 0, 0, 0, 0, 0);
michael@0 21549 isPixel(ctx, 25, 40, 0, 255, 0, 255, 0);
michael@0 21550 isPixel(ctx, 15, 40, 0, 0, 0, 0, 0);
michael@0 21551 isPixel(ctx, 10, 25, 0, 255, 0, 255, 0);
michael@0 21552 isPixel(ctx, 10, 15, 0, 0, 0, 0, 0);
michael@0 21553
michael@0 21554 // Verify that lineDashOffset works as expected
michael@0 21555 ctx.lineDashOffset = 20;
michael@0 21556 ctx.strokeRect(50.5, 10.5, 30, 30);
michael@0 21557 isPixel(ctx, 55, 10, 0, 0, 0, 0, 0);
michael@0 21558 isPixel(ctx, 65, 10, 0, 255, 0, 255, 0);
michael@0 21559 isPixel(ctx, 80, 15, 0, 0, 0, 0, 0);
michael@0 21560 isPixel(ctx, 80, 25, 0, 255, 0, 255, 0);
michael@0 21561 isPixel(ctx, 75, 40, 0, 0, 0, 0, 0);
michael@0 21562 isPixel(ctx, 65, 40, 0, 255, 0, 255, 0);
michael@0 21563 isPixel(ctx, 50, 35, 0, 0, 0, 0, 0);
michael@0 21564 isPixel(ctx, 50, 25, 0, 255, 0, 255, 0);
michael@0 21565
michael@0 21566 // Verify negative lineDashOffset
michael@0 21567 ctx.lineDashOffset = -10;
michael@0 21568 ctx.strokeRect(90.5, 10.5, 30, 30);
michael@0 21569 isPixel(ctx, 95, 10, 0, 0, 0, 0, 0);
michael@0 21570 isPixel(ctx, 105, 10, 0, 255, 0, 255, 0);
michael@0 21571 isPixel(ctx, 120, 15, 0, 0, 0, 0, 0);
michael@0 21572 isPixel(ctx, 120, 25, 0, 255, 0, 255, 0);
michael@0 21573 isPixel(ctx, 115, 40, 0, 0, 0, 0, 0);
michael@0 21574 isPixel(ctx, 105, 40, 0, 255, 0, 255, 0);
michael@0 21575 isPixel(ctx, 90, 35, 0, 0, 0, 0, 0);
michael@0 21576 isPixel(ctx, 90, 25, 0, 255, 0, 255, 0);
michael@0 21577 }
michael@0 21578 </script>
michael@0 21579
michael@0 21580 <p>Canvas test: test_opaque</p>
michael@0 21581 <canvas id="c688" width="150" height="50"></canvas>
michael@0 21582 <script type="text/javascript">
michael@0 21583
michael@0 21584 function test_opaque() {
michael@0 21585 var c = document.getElementById("c688");
michael@0 21586 var ctx = c.getContext("2d", {alpha: false});
michael@0 21587 ctx.fillStyle = "green";
michael@0 21588 ctx.fillRect(0,0,10,10);
michael@0 21589 ctx.fillStyle = "rgba(255,0,0,.5)";
michael@0 21590 ctx.fillRect(10,0,10,10);
michael@0 21591
michael@0 21592 isPixel(ctx, 20, 20, 0, 0, 0, 255, 0);
michael@0 21593 isPixel(ctx, 5, 5, 0, 128, 0, 255, 0);
michael@0 21594 isPixel(ctx, 15, 5, 128, 0, 0, 255, 0);
michael@0 21595 }
michael@0 21596 </script>
michael@0 21597
michael@0 21598 <script>
michael@0 21599
michael@0 21600 function asyncTestsDone() {
michael@0 21601 if (isDone_test_2d_drawImage_animated_apng &&
michael@0 21602 isDone_test_2d_drawImage_animated_gif) {
michael@0 21603 SimpleTest.finish();
michael@0 21604 } else {
michael@0 21605 setTimeout(asyncTestsDone, 500);
michael@0 21606 }
michael@0 21607 }
michael@0 21608
michael@0 21609 function runTests() {
michael@0 21610 /**
michael@0 21611 * xor and lighter aren't well handled by cairo; they mostly work, but we don't want
michael@0 21612 * to test that
michael@0 21613 */
michael@0 21614 //test_2d_composite_solid_lighter();
michael@0 21615 //test_2d_composite_transparent_xor();
michael@0 21616 //test_2d_composite_solid_xor();
michael@0 21617 //test_2d_composite_transparent_lighter();
michael@0 21618 //test_2d_composite_image_xor();
michael@0 21619 //test_2d_composite_image_lighter();
michael@0 21620 //test_2d_composite_canvas_xor();
michael@0 21621 //test_2d_composite_canvas_lighter();
michael@0 21622 //test_2d_composite_clip_xor();
michael@0 21623 //test_2d_composite_clip_lighter();
michael@0 21624
michael@0 21625 /**
michael@0 21626 * Temporarily disabled tests; unbounded operators changed behaviour, need to reevaluate tests
michael@0 21627 */
michael@0 21628 //test_2d_composite_canvas_destination_atop();
michael@0 21629 //test_2d_composite_canvas_destination_in();
michael@0 21630 //test_2d_composite_canvas_source_in();
michael@0 21631 //test_2d_composite_canvas_source_out();
michael@0 21632 //test_2d_composite_image_destination_atop();
michael@0 21633 //test_2d_composite_image_destination_in();
michael@0 21634 //test_2d_composite_image_source_in();
michael@0 21635 //test_2d_composite_image_source_out();
michael@0 21636
michael@0 21637 /**
michael@0 21638 * These tests only pass on Mac OS X >= 10.5; see bug 450114
michael@0 21639 */
michael@0 21640 //test_2d_gradient_radial_equal();
michael@0 21641 //test_2d_gradient_radial_touch1();
michael@0 21642 //test_2d_gradient_radial_touch2();
michael@0 21643 //test_2d_gradient_radial_touch3();
michael@0 21644
michael@0 21645 /**
michael@0 21646 * These 19 tests receive special makefile treatment
michael@0 21647 */
michael@0 21648 //test_2d_composite_uncovered_image_destination_atop();
michael@0 21649 //test_2d_composite_uncovered_image_destination_in();
michael@0 21650 //test_2d_composite_uncovered_image_source_in();
michael@0 21651 //test_2d_composite_uncovered_image_source_out();
michael@0 21652 //test_2d_gradient_radial_cone_behind();
michael@0 21653 //test_2d_gradient_radial_cone_beside();
michael@0 21654 //test_2d_gradient_radial_cone_front();
michael@0 21655 //test_2d_gradient_radial_cone_shape2();
michael@0 21656 //test_2d_gradient_radial_cone_top();
michael@0 21657 //test_2d_gradient_radial_inside2();
michael@0 21658 //test_2d_gradient_radial_inside3();
michael@0 21659 //test_2d_gradient_radial_outside1();
michael@0 21660 //test_2d_gradient_radial_outside2();
michael@0 21661 //test_2d_gradient_radial_outside3();
michael@0 21662 //test_2d_line_cap_closed();
michael@0 21663 //test_2d_line_join_parallel();
michael@0 21664 //test_2d_path_arc_shape_3();
michael@0 21665 //test_2d_path_rect_selfintersect();
michael@0 21666 //test_2d_strokeRect_zero_5();
michael@0 21667
michael@0 21668 /**
michael@0 21669 * Other tests not being run
michael@0 21670 */
michael@0 21671 //test_2d_composite_uncovered_fill_destination_atop();
michael@0 21672 //test_2d_composite_uncovered_fill_destination_in();
michael@0 21673 //test_2d_composite_uncovered_fill_source_in();
michael@0 21674 //test_2d_composite_uncovered_fill_source_out();
michael@0 21675 //test_2d_composite_uncovered_pattern_destination_atop();
michael@0 21676 //test_2d_composite_uncovered_pattern_destination_in();
michael@0 21677 //test_2d_composite_uncovered_pattern_source_in();
michael@0 21678 //test_2d_composite_uncovered_pattern_source_out();
michael@0 21679
michael@0 21680 //test_2d_path_rect_zero_6(); // This test is bogus according to the spec; see bug 407107
michael@0 21681
michael@0 21682 // These tests are bogus according to the spec: shadows should not be
michael@0 21683 // drawn if shadowBlur, shadowOffsetX, and shadowOffsetY are all zero, whic
michael@0 21684 // they are in these tests
michael@0 21685 //test_2d_shadow_composite_3();
michael@0 21686 //test_2d_shadow_composite_4();
michael@0 21687 try {
michael@0 21688 test_2d_canvas_readonly();
michael@0 21689 } catch (e) {
michael@0 21690 ok(false, "unexpected exception thrown in: test_2d_canvas_readonly");
michael@0 21691 }
michael@0 21692 try {
michael@0 21693 test_2d_canvas_reference();
michael@0 21694 } catch (e) {
michael@0 21695 ok(false, "unexpected exception thrown in: test_2d_canvas_reference");
michael@0 21696 }
michael@0 21697 try {
michael@0 21698 test_2d_clearRect_basic();
michael@0 21699 } catch (e) {
michael@0 21700 ok(false, "unexpected exception thrown in: test_2d_clearRect_basic");
michael@0 21701 }
michael@0 21702 try {
michael@0 21703 test_2d_clearRect_clip();
michael@0 21704 } catch (e) {
michael@0 21705 ok(false, "unexpected exception thrown in: test_2d_clearRect_clip");
michael@0 21706 }
michael@0 21707 try {
michael@0 21708 test_2d_clearRect_globalalpha();
michael@0 21709 } catch (e) {
michael@0 21710 ok(false, "unexpected exception thrown in: test_2d_clearRect_globalalpha");
michael@0 21711 }
michael@0 21712 try {
michael@0 21713 test_2d_clearRect_globalcomposite();
michael@0 21714 } catch (e) {
michael@0 21715 ok(false, "unexpected exception thrown in: test_2d_clearRect_globalcomposite");
michael@0 21716 }
michael@0 21717 try {
michael@0 21718 test_2d_clearRect_negative();
michael@0 21719 } catch (e) {
michael@0 21720 ok(false, "unexpected exception thrown in: test_2d_clearRect_negative");
michael@0 21721 }
michael@0 21722 try {
michael@0 21723 test_2d_clearRect_nonfinite();
michael@0 21724 } catch (e) {
michael@0 21725 ok(false, "unexpected exception thrown in: test_2d_clearRect_nonfinite");
michael@0 21726 }
michael@0 21727 try {
michael@0 21728 test_2d_clearRect_path();
michael@0 21729 } catch (e) {
michael@0 21730 ok(false, "unexpected exception thrown in: test_2d_clearRect_path");
michael@0 21731 }
michael@0 21732 try {
michael@0 21733 test_2d_clearRect_shadow();
michael@0 21734 } catch (e) {
michael@0 21735 ok(false, "unexpected exception thrown in: test_2d_clearRect_shadow");
michael@0 21736 }
michael@0 21737 try {
michael@0 21738 test_2d_clearRect_transform();
michael@0 21739 } catch (e) {
michael@0 21740 ok(false, "unexpected exception thrown in: test_2d_clearRect_transform");
michael@0 21741 }
michael@0 21742 try {
michael@0 21743 test_2d_clearRect_zero();
michael@0 21744 } catch (e) {
michael@0 21745 ok(false, "unexpected exception thrown in: test_2d_clearRect_zero");
michael@0 21746 }
michael@0 21747 try {
michael@0 21748 test_2d_composite_canvas_copy();
michael@0 21749 } catch (e) {
michael@0 21750 ok(false, "unexpected exception thrown in: test_2d_composite_canvas_copy");
michael@0 21751 }
michael@0 21752 try {
michael@0 21753 test_2d_composite_canvas_destination_out();
michael@0 21754 } catch (e) {
michael@0 21755 ok(false, "unexpected exception thrown in: test_2d_composite_canvas_destination_out");
michael@0 21756 }
michael@0 21757 try {
michael@0 21758 test_2d_composite_canvas_destination_over();
michael@0 21759 } catch (e) {
michael@0 21760 ok(false, "unexpected exception thrown in: test_2d_composite_canvas_destination_over");
michael@0 21761 }
michael@0 21762 try {
michael@0 21763 test_2d_composite_canvas_source_atop();
michael@0 21764 } catch (e) {
michael@0 21765 ok(false, "unexpected exception thrown in: test_2d_composite_canvas_source_atop");
michael@0 21766 }
michael@0 21767 try {
michael@0 21768 test_2d_composite_canvas_source_over();
michael@0 21769 } catch (e) {
michael@0 21770 ok(false, "unexpected exception thrown in: test_2d_composite_canvas_source_over");
michael@0 21771 }
michael@0 21772 try {
michael@0 21773 test_2d_composite_clip_copy();
michael@0 21774 } catch (e) {
michael@0 21775 ok(false, "unexpected exception thrown in: test_2d_composite_clip_copy");
michael@0 21776 }
michael@0 21777 try {
michael@0 21778 test_2d_composite_clip_destination_atop();
michael@0 21779 } catch (e) {
michael@0 21780 ok(false, "unexpected exception thrown in: test_2d_composite_clip_destination_atop");
michael@0 21781 }
michael@0 21782 try {
michael@0 21783 test_2d_composite_clip_destination_in();
michael@0 21784 } catch (e) {
michael@0 21785 ok(false, "unexpected exception thrown in: test_2d_composite_clip_destination_in");
michael@0 21786 }
michael@0 21787 try {
michael@0 21788 test_2d_composite_clip_destination_out();
michael@0 21789 } catch (e) {
michael@0 21790 ok(false, "unexpected exception thrown in: test_2d_composite_clip_destination_out");
michael@0 21791 }
michael@0 21792 try {
michael@0 21793 test_2d_composite_clip_destination_over();
michael@0 21794 } catch (e) {
michael@0 21795 ok(false, "unexpected exception thrown in: test_2d_composite_clip_destination_over");
michael@0 21796 }
michael@0 21797 try {
michael@0 21798 test_2d_composite_clip_source_atop();
michael@0 21799 } catch (e) {
michael@0 21800 ok(false, "unexpected exception thrown in: test_2d_composite_clip_source_atop");
michael@0 21801 }
michael@0 21802 try {
michael@0 21803 test_2d_composite_clip_source_in();
michael@0 21804 } catch (e) {
michael@0 21805 ok(false, "unexpected exception thrown in: test_2d_composite_clip_source_in");
michael@0 21806 }
michael@0 21807 try {
michael@0 21808 test_2d_composite_clip_source_out();
michael@0 21809 } catch (e) {
michael@0 21810 ok(false, "unexpected exception thrown in: test_2d_composite_clip_source_out");
michael@0 21811 }
michael@0 21812 try {
michael@0 21813 test_2d_composite_clip_source_over();
michael@0 21814 } catch (e) {
michael@0 21815 ok(false, "unexpected exception thrown in: test_2d_composite_clip_source_over");
michael@0 21816 }
michael@0 21817 try {
michael@0 21818 test_2d_composite_globalAlpha_canvas();
michael@0 21819 } catch (e) {
michael@0 21820 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_canvas");
michael@0 21821 }
michael@0 21822 try {
michael@0 21823 test_2d_composite_globalAlpha_canvaspattern();
michael@0 21824 } catch (e) {
michael@0 21825 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_canvaspattern");
michael@0 21826 }
michael@0 21827 try {
michael@0 21828 test_2d_composite_globalAlpha_default();
michael@0 21829 } catch (e) {
michael@0 21830 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_default");
michael@0 21831 }
michael@0 21832 try {
michael@0 21833 test_2d_composite_globalAlpha_fill();
michael@0 21834 } catch (e) {
michael@0 21835 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_fill");
michael@0 21836 }
michael@0 21837 try {
michael@0 21838 test_2d_composite_globalAlpha_image();
michael@0 21839 } catch (e) {
michael@0 21840 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_image");
michael@0 21841 }
michael@0 21842 try {
michael@0 21843 test_2d_composite_globalAlpha_imagepattern();
michael@0 21844 } catch (e) {
michael@0 21845 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_imagepattern");
michael@0 21846 }
michael@0 21847 try {
michael@0 21848 test_2d_composite_globalAlpha_invalid();
michael@0 21849 } catch (e) {
michael@0 21850 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_invalid");
michael@0 21851 }
michael@0 21852 try {
michael@0 21853 test_2d_composite_globalAlpha_range();
michael@0 21854 } catch (e) {
michael@0 21855 ok(false, "unexpected exception thrown in: test_2d_composite_globalAlpha_range");
michael@0 21856 }
michael@0 21857 try {
michael@0 21858 test_2d_composite_image_copy();
michael@0 21859 } catch (e) {
michael@0 21860 ok(false, "unexpected exception thrown in: test_2d_composite_image_copy");
michael@0 21861 }
michael@0 21862 try {
michael@0 21863 test_2d_composite_image_destination_out();
michael@0 21864 } catch (e) {
michael@0 21865 ok(false, "unexpected exception thrown in: test_2d_composite_image_destination_out");
michael@0 21866 }
michael@0 21867 try {
michael@0 21868 test_2d_composite_image_destination_over();
michael@0 21869 } catch (e) {
michael@0 21870 ok(false, "unexpected exception thrown in: test_2d_composite_image_destination_over");
michael@0 21871 }
michael@0 21872 try {
michael@0 21873 test_2d_composite_image_source_atop();
michael@0 21874 } catch (e) {
michael@0 21875 ok(false, "unexpected exception thrown in: test_2d_composite_image_source_atop");
michael@0 21876 }
michael@0 21877 try {
michael@0 21878 test_2d_composite_image_source_over();
michael@0 21879 } catch (e) {
michael@0 21880 ok(false, "unexpected exception thrown in: test_2d_composite_image_source_over");
michael@0 21881 }
michael@0 21882 try {
michael@0 21883 test_2d_composite_operation_casesensitive();
michael@0 21884 } catch (e) {
michael@0 21885 ok(false, "unexpected exception thrown in: test_2d_composite_operation_casesensitive");
michael@0 21886 }
michael@0 21887 try {
michael@0 21888 test_2d_composite_operation_clear();
michael@0 21889 } catch (e) {
michael@0 21890 ok(false, "unexpected exception thrown in: test_2d_composite_operation_clear");
michael@0 21891 }
michael@0 21892 try {
michael@0 21893 test_2d_composite_operation_darker();
michael@0 21894 } catch (e) {
michael@0 21895 ok(false, "unexpected exception thrown in: test_2d_composite_operation_darker");
michael@0 21896 }
michael@0 21897 try {
michael@0 21898 test_2d_composite_operation_default();
michael@0 21899 } catch (e) {
michael@0 21900 ok(false, "unexpected exception thrown in: test_2d_composite_operation_default");
michael@0 21901 }
michael@0 21902 try {
michael@0 21903 test_2d_composite_operation_get();
michael@0 21904 } catch (e) {
michael@0 21905 ok(false, "unexpected exception thrown in: test_2d_composite_operation_get");
michael@0 21906 }
michael@0 21907 try {
michael@0 21908 test_2d_composite_operation_highlight();
michael@0 21909 } catch (e) {
michael@0 21910 ok(false, "unexpected exception thrown in: test_2d_composite_operation_highlight");
michael@0 21911 }
michael@0 21912 try {
michael@0 21913 test_2d_composite_operation_nullsuffix();
michael@0 21914 } catch (e) {
michael@0 21915 ok(false, "unexpected exception thrown in: test_2d_composite_operation_nullsuffix");
michael@0 21916 }
michael@0 21917 try {
michael@0 21918 test_2d_composite_operation_over();
michael@0 21919 } catch (e) {
michael@0 21920 ok(false, "unexpected exception thrown in: test_2d_composite_operation_over");
michael@0 21921 }
michael@0 21922 try {
michael@0 21923 test_2d_composite_operation_unrecognised();
michael@0 21924 } catch (e) {
michael@0 21925 ok(false, "unexpected exception thrown in: test_2d_composite_operation_unrecognised");
michael@0 21926 }
michael@0 21927 try {
michael@0 21928 test_2d_composite_solid_copy();
michael@0 21929 } catch (e) {
michael@0 21930 ok(false, "unexpected exception thrown in: test_2d_composite_solid_copy");
michael@0 21931 }
michael@0 21932 try {
michael@0 21933 test_2d_composite_solid_destination_atop();
michael@0 21934 } catch (e) {
michael@0 21935 ok(false, "unexpected exception thrown in: test_2d_composite_solid_destination_atop");
michael@0 21936 }
michael@0 21937 try {
michael@0 21938 test_2d_composite_solid_destination_in();
michael@0 21939 } catch (e) {
michael@0 21940 ok(false, "unexpected exception thrown in: test_2d_composite_solid_destination_in");
michael@0 21941 }
michael@0 21942 try {
michael@0 21943 test_2d_composite_solid_destination_out();
michael@0 21944 } catch (e) {
michael@0 21945 ok(false, "unexpected exception thrown in: test_2d_composite_solid_destination_out");
michael@0 21946 }
michael@0 21947 try {
michael@0 21948 test_2d_composite_solid_destination_over();
michael@0 21949 } catch (e) {
michael@0 21950 ok(false, "unexpected exception thrown in: test_2d_composite_solid_destination_over");
michael@0 21951 }
michael@0 21952 try {
michael@0 21953 test_2d_composite_solid_source_atop();
michael@0 21954 } catch (e) {
michael@0 21955 ok(false, "unexpected exception thrown in: test_2d_composite_solid_source_atop");
michael@0 21956 }
michael@0 21957 try {
michael@0 21958 test_2d_composite_solid_source_in();
michael@0 21959 } catch (e) {
michael@0 21960 ok(false, "unexpected exception thrown in: test_2d_composite_solid_source_in");
michael@0 21961 }
michael@0 21962 try {
michael@0 21963 test_2d_composite_solid_source_out();
michael@0 21964 } catch (e) {
michael@0 21965 ok(false, "unexpected exception thrown in: test_2d_composite_solid_source_out");
michael@0 21966 }
michael@0 21967 try {
michael@0 21968 test_2d_composite_solid_source_over();
michael@0 21969 } catch (e) {
michael@0 21970 ok(false, "unexpected exception thrown in: test_2d_composite_solid_source_over");
michael@0 21971 }
michael@0 21972 try {
michael@0 21973 test_2d_composite_transparent_copy();
michael@0 21974 } catch (e) {
michael@0 21975 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_copy");
michael@0 21976 }
michael@0 21977 try {
michael@0 21978 test_2d_composite_transparent_destination_atop();
michael@0 21979 } catch (e) {
michael@0 21980 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_destination_atop");
michael@0 21981 }
michael@0 21982 try {
michael@0 21983 test_2d_composite_transparent_destination_in();
michael@0 21984 } catch (e) {
michael@0 21985 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_destination_in");
michael@0 21986 }
michael@0 21987 try {
michael@0 21988 test_2d_composite_transparent_destination_out();
michael@0 21989 } catch (e) {
michael@0 21990 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_destination_out");
michael@0 21991 }
michael@0 21992 try {
michael@0 21993 test_2d_composite_transparent_destination_over();
michael@0 21994 } catch (e) {
michael@0 21995 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_destination_over");
michael@0 21996 }
michael@0 21997 try {
michael@0 21998 test_2d_composite_transparent_source_atop();
michael@0 21999 } catch (e) {
michael@0 22000 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_source_atop");
michael@0 22001 }
michael@0 22002 try {
michael@0 22003 test_2d_composite_transparent_source_in();
michael@0 22004 } catch (e) {
michael@0 22005 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_source_in");
michael@0 22006 }
michael@0 22007 try {
michael@0 22008 test_2d_composite_transparent_source_out();
michael@0 22009 } catch (e) {
michael@0 22010 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_source_out");
michael@0 22011 }
michael@0 22012 try {
michael@0 22013 test_2d_composite_transparent_source_over();
michael@0 22014 } catch (e) {
michael@0 22015 ok(false, "unexpected exception thrown in: test_2d_composite_transparent_source_over");
michael@0 22016 }
michael@0 22017 try {
michael@0 22018 test_2d_composite_uncovered_fill_copy();
michael@0 22019 } catch (e) {
michael@0 22020 ok(false, "unexpected exception thrown in: test_2d_composite_uncovered_fill_copy");
michael@0 22021 }
michael@0 22022 try {
michael@0 22023 test_2d_composite_uncovered_image_copy();
michael@0 22024 } catch (e) {
michael@0 22025 ok(false, "unexpected exception thrown in: test_2d_composite_uncovered_image_copy");
michael@0 22026 }
michael@0 22027 try {
michael@0 22028 test_2d_composite_uncovered_pattern_copy();
michael@0 22029 } catch (e) {
michael@0 22030 ok(false, "unexpected exception thrown in: test_2d_composite_uncovered_pattern_copy");
michael@0 22031 }
michael@0 22032 try {
michael@0 22033 test_2d_drawImage_3arg();
michael@0 22034 } catch (e) {
michael@0 22035 ok(false, "unexpected exception thrown in: test_2d_drawImage_3arg");
michael@0 22036 }
michael@0 22037 try {
michael@0 22038 test_2d_drawImage_5arg();
michael@0 22039 } catch (e) {
michael@0 22040 ok(false, "unexpected exception thrown in: test_2d_drawImage_5arg");
michael@0 22041 }
michael@0 22042 try {
michael@0 22043 test_2d_drawImage_9arg_basic();
michael@0 22044 } catch (e) {
michael@0 22045 ok(false, "unexpected exception thrown in: test_2d_drawImage_9arg_basic");
michael@0 22046 }
michael@0 22047 try {
michael@0 22048 test_2d_drawImage_9arg_destpos();
michael@0 22049 } catch (e) {
michael@0 22050 ok(false, "unexpected exception thrown in: test_2d_drawImage_9arg_destpos");
michael@0 22051 }
michael@0 22052 try {
michael@0 22053 test_2d_drawImage_9arg_destsize();
michael@0 22054 } catch (e) {
michael@0 22055 ok(false, "unexpected exception thrown in: test_2d_drawImage_9arg_destsize");
michael@0 22056 }
michael@0 22057 try {
michael@0 22058 test_2d_drawImage_9arg_sourcepos();
michael@0 22059 } catch (e) {
michael@0 22060 ok(false, "unexpected exception thrown in: test_2d_drawImage_9arg_sourcepos");
michael@0 22061 }
michael@0 22062 try {
michael@0 22063 test_2d_drawImage_9arg_sourcesize();
michael@0 22064 } catch (e) {
michael@0 22065 ok(false, "unexpected exception thrown in: test_2d_drawImage_9arg_sourcesize");
michael@0 22066 }
michael@0 22067 try {
michael@0 22068 test_2d_drawImage_alpha();
michael@0 22069 } catch (e) {
michael@0 22070 ok(false, "unexpected exception thrown in: test_2d_drawImage_alpha");
michael@0 22071 }
michael@0 22072 try {
michael@0 22073 test_2d_drawImage_animated_poster();
michael@0 22074 } catch (e) {
michael@0 22075 ok(false, "unexpected exception thrown in: test_2d_drawImage_animated_poster");
michael@0 22076 }
michael@0 22077 try {
michael@0 22078 test_2d_drawImage_broken();
michael@0 22079 } catch (e) {
michael@0 22080 ok(false, "unexpected exception thrown in: test_2d_drawImage_broken");
michael@0 22081 }
michael@0 22082 try {
michael@0 22083 test_2d_drawImage_canvas();
michael@0 22084 } catch (e) {
michael@0 22085 ok(false, "unexpected exception thrown in: test_2d_drawImage_canvas");
michael@0 22086 }
michael@0 22087 try {
michael@0 22088 test_2d_drawImage_clip();
michael@0 22089 } catch (e) {
michael@0 22090 ok(false, "unexpected exception thrown in: test_2d_drawImage_clip");
michael@0 22091 }
michael@0 22092 try {
michael@0 22093 test_2d_drawImage_composite();
michael@0 22094 } catch (e) {
michael@0 22095 ok(false, "unexpected exception thrown in: test_2d_drawImage_composite");
michael@0 22096 }
michael@0 22097 try {
michael@0 22098 test_2d_drawImage_floatsource();
michael@0 22099 } catch (e) {
michael@0 22100 ok(false, "unexpected exception thrown in: test_2d_drawImage_floatsource");
michael@0 22101 }
michael@0 22102 try {
michael@0 22103 test_2d_drawImage_incomplete();
michael@0 22104 } catch (e) {
michael@0 22105 ok(false, "unexpected exception thrown in: test_2d_drawImage_incomplete");
michael@0 22106 }
michael@0 22107 try {
michael@0 22108 test_2d_drawImage_negativedest();
michael@0 22109 } catch (e) {
michael@0 22110 ok(false, "unexpected exception thrown in: test_2d_drawImage_negativedest");
michael@0 22111 }
michael@0 22112 try {
michael@0 22113 test_2d_drawImage_negativesource();
michael@0 22114 } catch (e) {
michael@0 22115 ok(false, "unexpected exception thrown in: test_2d_drawImage_negativesource");
michael@0 22116 }
michael@0 22117 try {
michael@0 22118 test_2d_drawImage_nonfinite();
michael@0 22119 } catch (e) {
michael@0 22120 ok(false, "unexpected exception thrown in: test_2d_drawImage_nonfinite");
michael@0 22121 }
michael@0 22122 try {
michael@0 22123 test_2d_drawImage_nowrap();
michael@0 22124 } catch (e) {
michael@0 22125 ok(false, "unexpected exception thrown in: test_2d_drawImage_nowrap");
michael@0 22126 }
michael@0 22127 try {
michael@0 22128 test_2d_drawImage_null();
michael@0 22129 } catch (e) {
michael@0 22130 ok(false, "unexpected exception thrown in: test_2d_drawImage_null");
michael@0 22131 }
michael@0 22132 try {
michael@0 22133 test_2d_drawImage_outsidesource();
michael@0 22134 } catch (e) {
michael@0 22135 ok(false, "unexpected exception thrown in: test_2d_drawImage_outsidesource");
michael@0 22136 }
michael@0 22137 try {
michael@0 22138 test_2d_drawImage_path();
michael@0 22139 } catch (e) {
michael@0 22140 ok(false, "unexpected exception thrown in: test_2d_drawImage_path");
michael@0 22141 }
michael@0 22142 try {
michael@0 22143 test_2d_drawImage_self_1();
michael@0 22144 } catch (e) {
michael@0 22145 ok(false, "unexpected exception thrown in: test_2d_drawImage_self_1");
michael@0 22146 }
michael@0 22147 try {
michael@0 22148 test_2d_drawImage_self_2();
michael@0 22149 } catch (e) {
michael@0 22150 ok(false, "unexpected exception thrown in: test_2d_drawImage_self_2");
michael@0 22151 }
michael@0 22152 try {
michael@0 22153 test_2d_drawImage_transform();
michael@0 22154 } catch (e) {
michael@0 22155 ok(false, "unexpected exception thrown in: test_2d_drawImage_transform");
michael@0 22156 }
michael@0 22157 try {
michael@0 22158 test_2d_drawImage_wrongtype();
michael@0 22159 } catch (e) {
michael@0 22160 ok(false, "unexpected exception thrown in: test_2d_drawImage_wrongtype");
michael@0 22161 }
michael@0 22162 try {
michael@0 22163 test_2d_drawImage_zerosource();
michael@0 22164 } catch (e) {
michael@0 22165 ok(false, "unexpected exception thrown in: test_2d_drawImage_zerosource");
michael@0 22166 }
michael@0 22167 try {
michael@0 22168 test_2d_fillRect_basic();
michael@0 22169 } catch (e) {
michael@0 22170 ok(false, "unexpected exception thrown in: test_2d_fillRect_basic");
michael@0 22171 }
michael@0 22172 try {
michael@0 22173 test_2d_fillRect_clip();
michael@0 22174 } catch (e) {
michael@0 22175 ok(false, "unexpected exception thrown in: test_2d_fillRect_clip");
michael@0 22176 }
michael@0 22177 try {
michael@0 22178 test_2d_fillRect_negative();
michael@0 22179 } catch (e) {
michael@0 22180 ok(false, "unexpected exception thrown in: test_2d_fillRect_negative");
michael@0 22181 }
michael@0 22182 try {
michael@0 22183 test_2d_fillRect_nonfinite();
michael@0 22184 } catch (e) {
michael@0 22185 ok(false, "unexpected exception thrown in: test_2d_fillRect_nonfinite");
michael@0 22186 }
michael@0 22187 try {
michael@0 22188 test_2d_fillRect_path();
michael@0 22189 } catch (e) {
michael@0 22190 ok(false, "unexpected exception thrown in: test_2d_fillRect_path");
michael@0 22191 }
michael@0 22192 try {
michael@0 22193 test_2d_fillRect_shadow();
michael@0 22194 } catch (e) {
michael@0 22195 ok(false, "unexpected exception thrown in: test_2d_fillRect_shadow");
michael@0 22196 }
michael@0 22197 try {
michael@0 22198 test_2d_fillRect_transform();
michael@0 22199 } catch (e) {
michael@0 22200 ok(false, "unexpected exception thrown in: test_2d_fillRect_transform");
michael@0 22201 }
michael@0 22202 try {
michael@0 22203 test_2d_fillRect_zero();
michael@0 22204 } catch (e) {
michael@0 22205 ok(false, "unexpected exception thrown in: test_2d_fillRect_zero");
michael@0 22206 }
michael@0 22207 try {
michael@0 22208 test_2d_fillStyle_default();
michael@0 22209 } catch (e) {
michael@0 22210 ok(false, "unexpected exception thrown in: test_2d_fillStyle_default");
michael@0 22211 }
michael@0 22212 try {
michael@0 22213 test_2d_fillStyle_get_semitransparent();
michael@0 22214 } catch (e) {
michael@0 22215 ok(false, "unexpected exception thrown in: test_2d_fillStyle_get_semitransparent");
michael@0 22216 }
michael@0 22217 try {
michael@0 22218 test_2d_fillStyle_get_solid();
michael@0 22219 } catch (e) {
michael@0 22220 ok(false, "unexpected exception thrown in: test_2d_fillStyle_get_solid");
michael@0 22221 }
michael@0 22222 try {
michael@0 22223 test_2d_fillStyle_get_transparent();
michael@0 22224 } catch (e) {
michael@0 22225 ok(false, "unexpected exception thrown in: test_2d_fillStyle_get_transparent");
michael@0 22226 }
michael@0 22227 try {
michael@0 22228 test_2d_fillStyle_invalidstring();
michael@0 22229 } catch (e) {
michael@0 22230 ok(false, "unexpected exception thrown in: test_2d_fillStyle_invalidstring");
michael@0 22231 }
michael@0 22232 try {
michael@0 22233 test_2d_fillStyle_invalidtype();
michael@0 22234 } catch (e) {
michael@0 22235 ok(false, "unexpected exception thrown in: test_2d_fillStyle_invalidtype");
michael@0 22236 }
michael@0 22237 try {
michael@0 22238 test_2d_fillStyle_parse_current_basic();
michael@0 22239 } catch (e) {
michael@0 22240 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_current_basic");
michael@0 22241 }
michael@0 22242 try {
michael@0 22243 test_2d_fillStyle_parse_current_changed();
michael@0 22244 } catch (e) {
michael@0 22245 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_current_changed");
michael@0 22246 }
michael@0 22247 try {
michael@0 22248 test_2d_fillStyle_parse_current_removed();
michael@0 22249 } catch (e) {
michael@0 22250 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_current_removed");
michael@0 22251 }
michael@0 22252 try {
michael@0 22253 test_2d_fillStyle_parse_hex3();
michael@0 22254 } catch (e) {
michael@0 22255 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hex3");
michael@0 22256 }
michael@0 22257 try {
michael@0 22258 test_2d_fillStyle_parse_hex6();
michael@0 22259 } catch (e) {
michael@0 22260 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hex6");
michael@0 22261 }
michael@0 22262 try {
michael@0 22263 test_2d_fillStyle_parse_hsl_1();
michael@0 22264 } catch (e) {
michael@0 22265 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_1");
michael@0 22266 }
michael@0 22267 try {
michael@0 22268 test_2d_fillStyle_parse_hsl_2();
michael@0 22269 } catch (e) {
michael@0 22270 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_2");
michael@0 22271 }
michael@0 22272 try {
michael@0 22273 test_2d_fillStyle_parse_hsl_3();
michael@0 22274 } catch (e) {
michael@0 22275 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_3");
michael@0 22276 }
michael@0 22277 try {
michael@0 22278 test_2d_fillStyle_parse_hsl_4();
michael@0 22279 } catch (e) {
michael@0 22280 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_4");
michael@0 22281 }
michael@0 22282 try {
michael@0 22283 test_2d_fillStyle_parse_hsl_5();
michael@0 22284 } catch (e) {
michael@0 22285 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_5");
michael@0 22286 }
michael@0 22287 try {
michael@0 22288 test_2d_fillStyle_parse_hsl_clamp_1();
michael@0 22289 } catch (e) {
michael@0 22290 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_clamp_1");
michael@0 22291 }
michael@0 22292 try {
michael@0 22293 test_2d_fillStyle_parse_hsl_clamp_2();
michael@0 22294 } catch (e) {
michael@0 22295 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_clamp_2");
michael@0 22296 }
michael@0 22297 try {
michael@0 22298 test_2d_fillStyle_parse_hsl_clamp_3();
michael@0 22299 } catch (e) {
michael@0 22300 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_clamp_3");
michael@0 22301 }
michael@0 22302 try {
michael@0 22303 test_2d_fillStyle_parse_hsl_clamp_4();
michael@0 22304 } catch (e) {
michael@0 22305 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsl_clamp_4");
michael@0 22306 }
michael@0 22307 try {
michael@0 22308 test_2d_fillStyle_parse_hsla_1();
michael@0 22309 } catch (e) {
michael@0 22310 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_1");
michael@0 22311 }
michael@0 22312 try {
michael@0 22313 test_2d_fillStyle_parse_hsla_2();
michael@0 22314 } catch (e) {
michael@0 22315 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_2");
michael@0 22316 }
michael@0 22317 try {
michael@0 22318 test_2d_fillStyle_parse_hsla_clamp_1();
michael@0 22319 } catch (e) {
michael@0 22320 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_1");
michael@0 22321 }
michael@0 22322 try {
michael@0 22323 test_2d_fillStyle_parse_hsla_clamp_2();
michael@0 22324 } catch (e) {
michael@0 22325 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_2");
michael@0 22326 }
michael@0 22327 try {
michael@0 22328 test_2d_fillStyle_parse_hsla_clamp_3();
michael@0 22329 } catch (e) {
michael@0 22330 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_3");
michael@0 22331 }
michael@0 22332 try {
michael@0 22333 test_2d_fillStyle_parse_hsla_clamp_4();
michael@0 22334 } catch (e) {
michael@0 22335 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_4");
michael@0 22336 }
michael@0 22337 try {
michael@0 22338 test_2d_fillStyle_parse_hsla_clamp_5();
michael@0 22339 } catch (e) {
michael@0 22340 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_5");
michael@0 22341 }
michael@0 22342 try {
michael@0 22343 test_2d_fillStyle_parse_hsla_clamp_6();
michael@0 22344 } catch (e) {
michael@0 22345 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_hsla_clamp_6");
michael@0 22346 }
michael@0 22347 try {
michael@0 22348 test_2d_fillStyle_parse_html4();
michael@0 22349 } catch (e) {
michael@0 22350 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_html4");
michael@0 22351 }
michael@0 22352 try {
michael@0 22353 test_2d_fillStyle_parse_invalid_hex3();
michael@0 22354 } catch (e) {
michael@0 22355 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hex3");
michael@0 22356 }
michael@0 22357 try {
michael@0 22358 test_2d_fillStyle_parse_invalid_hex6();
michael@0 22359 } catch (e) {
michael@0 22360 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hex6");
michael@0 22361 }
michael@0 22362 try {
michael@0 22363 test_2d_fillStyle_parse_invalid_hsl_1();
michael@0 22364 } catch (e) {
michael@0 22365 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsl_1");
michael@0 22366 }
michael@0 22367 try {
michael@0 22368 test_2d_fillStyle_parse_invalid_hsl_2();
michael@0 22369 } catch (e) {
michael@0 22370 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsl_2");
michael@0 22371 }
michael@0 22372 try {
michael@0 22373 test_2d_fillStyle_parse_invalid_hsl_3();
michael@0 22374 } catch (e) {
michael@0 22375 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsl_3");
michael@0 22376 }
michael@0 22377 try {
michael@0 22378 test_2d_fillStyle_parse_invalid_hsl_4();
michael@0 22379 } catch (e) {
michael@0 22380 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsl_4");
michael@0 22381 }
michael@0 22382 try {
michael@0 22383 test_2d_fillStyle_parse_invalid_hsl_5();
michael@0 22384 } catch (e) {
michael@0 22385 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsl_5");
michael@0 22386 }
michael@0 22387 try {
michael@0 22388 test_2d_fillStyle_parse_invalid_hsla_1();
michael@0 22389 } catch (e) {
michael@0 22390 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsla_1");
michael@0 22391 }
michael@0 22392 try {
michael@0 22393 test_2d_fillStyle_parse_invalid_hsla_2();
michael@0 22394 } catch (e) {
michael@0 22395 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_hsla_2");
michael@0 22396 }
michael@0 22397 try {
michael@0 22398 test_2d_fillStyle_parse_invalid_name_1()
michael@0 22399 } catch (e) {
michael@0 22400 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_name_1");
michael@0 22401 }
michael@0 22402 try {
michael@0 22403 test_2d_fillStyle_parse_invalid_name_2()
michael@0 22404 } catch (e) {
michael@0 22405 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_name_2");
michael@0 22406 }
michael@0 22407 try {
michael@0 22408 test_2d_fillStyle_parse_invalid_name_3()
michael@0 22409 } catch (e) {
michael@0 22410 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_name_3");
michael@0 22411 }
michael@0 22412 try {
michael@0 22413 test_2d_fillStyle_parse_invalid_rgb_1();
michael@0 22414 } catch (e) {
michael@0 22415 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_1");
michael@0 22416 }
michael@0 22417 try {
michael@0 22418 test_2d_fillStyle_parse_invalid_rgb_2();
michael@0 22419 } catch (e) {
michael@0 22420 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_2");
michael@0 22421 }
michael@0 22422 try {
michael@0 22423 test_2d_fillStyle_parse_invalid_rgb_3();
michael@0 22424 } catch (e) {
michael@0 22425 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_3");
michael@0 22426 }
michael@0 22427 try {
michael@0 22428 test_2d_fillStyle_parse_invalid_rgb_4();
michael@0 22429 } catch (e) {
michael@0 22430 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_4");
michael@0 22431 }
michael@0 22432 try {
michael@0 22433 test_2d_fillStyle_parse_invalid_rgb_5();
michael@0 22434 } catch (e) {
michael@0 22435 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_5");
michael@0 22436 }
michael@0 22437 try {
michael@0 22438 test_2d_fillStyle_parse_invalid_rgb_6();
michael@0 22439 } catch (e) {
michael@0 22440 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_6");
michael@0 22441 }
michael@0 22442 try {
michael@0 22443 test_2d_fillStyle_parse_invalid_rgb_7();
michael@0 22444 } catch (e) {
michael@0 22445 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgb_7");
michael@0 22446 }
michael@0 22447 try {
michael@0 22448 test_2d_fillStyle_parse_invalid_rgba_1();
michael@0 22449 } catch (e) {
michael@0 22450 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgba_1");
michael@0 22451 }
michael@0 22452 try {
michael@0 22453 test_2d_fillStyle_parse_invalid_rgba_2();
michael@0 22454 } catch (e) {
michael@0 22455 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgba_2");
michael@0 22456 }
michael@0 22457 try {
michael@0 22458 test_2d_fillStyle_parse_invalid_rgba_3();
michael@0 22459 } catch (e) {
michael@0 22460 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgba_3");
michael@0 22461 }
michael@0 22462 try {
michael@0 22463 test_2d_fillStyle_parse_invalid_rgba_4();
michael@0 22464 } catch (e) {
michael@0 22465 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgba_4");
michael@0 22466 }
michael@0 22467 try {
michael@0 22468 test_2d_fillStyle_parse_invalid_rgba_5();
michael@0 22469 } catch (e) {
michael@0 22470 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_invalid_rgba_5");
michael@0 22471 }
michael@0 22472 try {
michael@0 22473 test_2d_fillStyle_parse_rgb_clamp_1();
michael@0 22474 } catch (e) {
michael@0 22475 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_clamp_1");
michael@0 22476 }
michael@0 22477 try {
michael@0 22478 test_2d_fillStyle_parse_rgb_clamp_2();
michael@0 22479 } catch (e) {
michael@0 22480 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_clamp_2");
michael@0 22481 }
michael@0 22482 try {
michael@0 22483 test_2d_fillStyle_parse_rgb_clamp_3();
michael@0 22484 } catch (e) {
michael@0 22485 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_clamp_3");
michael@0 22486 }
michael@0 22487 try {
michael@0 22488 test_2d_fillStyle_parse_rgb_clamp_4();
michael@0 22489 } catch (e) {
michael@0 22490 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_clamp_4");
michael@0 22491 }
michael@0 22492 try {
michael@0 22493 test_2d_fillStyle_parse_rgb_clamp_5();
michael@0 22494 } catch (e) {
michael@0 22495 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_clamp_5");
michael@0 22496 }
michael@0 22497 try {
michael@0 22498 test_2d_fillStyle_parse_rgb_num();
michael@0 22499 } catch (e) {
michael@0 22500 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_num");
michael@0 22501 }
michael@0 22502 try {
michael@0 22503 test_2d_fillStyle_parse_rgb_percent();
michael@0 22504 } catch (e) {
michael@0 22505 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgb_percent");
michael@0 22506 }
michael@0 22507 try {
michael@0 22508 test_2d_fillStyle_parse_rgba_clamp_1();
michael@0 22509 } catch (e) {
michael@0 22510 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_clamp_1");
michael@0 22511 }
michael@0 22512 try {
michael@0 22513 test_2d_fillStyle_parse_rgba_clamp_2();
michael@0 22514 } catch (e) {
michael@0 22515 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_clamp_2");
michael@0 22516 }
michael@0 22517 try {
michael@0 22518 test_2d_fillStyle_parse_rgba_num_1();
michael@0 22519 } catch (e) {
michael@0 22520 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_num_1");
michael@0 22521 }
michael@0 22522 try {
michael@0 22523 test_2d_fillStyle_parse_rgba_num_2();
michael@0 22524 } catch (e) {
michael@0 22525 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_num_2");
michael@0 22526 }
michael@0 22527 try {
michael@0 22528 test_2d_fillStyle_parse_rgba_percent();
michael@0 22529 } catch (e) {
michael@0 22530 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_percent");
michael@0 22531 }
michael@0 22532 try {
michael@0 22533 test_2d_fillStyle_parse_rgba_solid_1();
michael@0 22534 } catch (e) {
michael@0 22535 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_solid_1");
michael@0 22536 }
michael@0 22537 try {
michael@0 22538 test_2d_fillStyle_parse_rgba_solid_2();
michael@0 22539 } catch (e) {
michael@0 22540 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_rgba_solid_2");
michael@0 22541 }
michael@0 22542 try {
michael@0 22543 test_2d_fillStyle_parse_svg_1();
michael@0 22544 } catch (e) {
michael@0 22545 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_svg_1");
michael@0 22546 }
michael@0 22547 try {
michael@0 22548 test_2d_fillStyle_parse_svg_2();
michael@0 22549 } catch (e) {
michael@0 22550 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_svg_2");
michael@0 22551 }
michael@0 22552 try {
michael@0 22553 test_2d_fillStyle_parse_system();
michael@0 22554 } catch (e) {
michael@0 22555 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_system");
michael@0 22556 }
michael@0 22557 try {
michael@0 22558 test_2d_fillStyle_parse_transparent_1();
michael@0 22559 } catch (e) {
michael@0 22560 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_transparent_1");
michael@0 22561 }
michael@0 22562 try {
michael@0 22563 test_2d_fillStyle_parse_transparent_2();
michael@0 22564 } catch (e) {
michael@0 22565 ok(false, "unexpected exception thrown in: test_2d_fillStyle_parse_transparent_2");
michael@0 22566 }
michael@0 22567 try {
michael@0 22568 test_2d_getcontext_exists();
michael@0 22569 } catch (e) {
michael@0 22570 ok(false, "unexpected exception thrown in: test_2d_getcontext_exists");
michael@0 22571 }
michael@0 22572 try {
michael@0 22573 test_2d_getcontext_shared();
michael@0 22574 } catch (e) {
michael@0 22575 ok(false, "unexpected exception thrown in: test_2d_getcontext_shared");
michael@0 22576 }
michael@0 22577 try {
michael@0 22578 test_2d_getcontext_unique();
michael@0 22579 } catch (e) {
michael@0 22580 ok(false, "unexpected exception thrown in: test_2d_getcontext_unique");
michael@0 22581 }
michael@0 22582 try {
michael@0 22583 test_2d_gradient_empty();
michael@0 22584 } catch (e) {
michael@0 22585 ok(false, "unexpected exception thrown in: test_2d_gradient_empty");
michael@0 22586 }
michael@0 22587 try {
michael@0 22588 test_2d_gradient_interpolate_alpha();
michael@0 22589 } catch (e) {
michael@0 22590 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_alpha");
michael@0 22591 }
michael@0 22592 try {
michael@0 22593 test_2d_gradient_interpolate_colour();
michael@0 22594 } catch (e) {
michael@0 22595 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_colour");
michael@0 22596 }
michael@0 22597 try {
michael@0 22598 test_2d_gradient_interpolate_colouralpha();
michael@0 22599 } catch (e) {
michael@0 22600 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_colouralpha");
michael@0 22601 }
michael@0 22602 try {
michael@0 22603 test_2d_gradient_interpolate_multiple();
michael@0 22604 } catch (e) {
michael@0 22605 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_multiple");
michael@0 22606 }
michael@0 22607 try {
michael@0 22608 test_2d_gradient_interpolate_outside();
michael@0 22609 } catch (e) {
michael@0 22610 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_outside");
michael@0 22611 }
michael@0 22612 try {
michael@0 22613 test_2d_gradient_interpolate_overlap();
michael@0 22614 } catch (e) {
michael@0 22615 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_overlap");
michael@0 22616 }
michael@0 22617 try {
michael@0 22618 test_2d_gradient_interpolate_overlap2();
michael@0 22619 } catch (e) {
michael@0 22620 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_overlap2");
michael@0 22621 }
michael@0 22622 try {
michael@0 22623 test_2d_gradient_interpolate_solid();
michael@0 22624 } catch (e) {
michael@0 22625 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_solid");
michael@0 22626 }
michael@0 22627 try {
michael@0 22628 test_2d_gradient_interpolate_vertical();
michael@0 22629 } catch (e) {
michael@0 22630 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_vertical");
michael@0 22631 }
michael@0 22632 try {
michael@0 22633 test_2d_gradient_interpolate_zerosize();
michael@0 22634 } catch (e) {
michael@0 22635 ok(false, "unexpected exception thrown in: test_2d_gradient_interpolate_zerosize");
michael@0 22636 }
michael@0 22637 try {
michael@0 22638 test_2d_gradient_linear_nonfinite();
michael@0 22639 } catch (e) {
michael@0 22640 ok(false, "unexpected exception thrown in: test_2d_gradient_linear_nonfinite");
michael@0 22641 }
michael@0 22642 try {
michael@0 22643 test_2d_gradient_linear_transform_1();
michael@0 22644 } catch (e) {
michael@0 22645 ok(false, "unexpected exception thrown in: test_2d_gradient_linear_transform_1");
michael@0 22646 }
michael@0 22647 try {
michael@0 22648 test_2d_gradient_linear_transform_2();
michael@0 22649 } catch (e) {
michael@0 22650 ok(false, "unexpected exception thrown in: test_2d_gradient_linear_transform_2");
michael@0 22651 }
michael@0 22652 try {
michael@0 22653 test_2d_gradient_linear_transform_3();
michael@0 22654 } catch (e) {
michael@0 22655 ok(false, "unexpected exception thrown in: test_2d_gradient_linear_transform_3");
michael@0 22656 }
michael@0 22657 try {
michael@0 22658 test_2d_gradient_object_compare();
michael@0 22659 } catch (e) {
michael@0 22660 ok(false, "unexpected exception thrown in: test_2d_gradient_object_compare");
michael@0 22661 }
michael@0 22662 try {
michael@0 22663 test_2d_gradient_object_crosscanvas();
michael@0 22664 } catch (e) {
michael@0 22665 ok(false, "unexpected exception thrown in: test_2d_gradient_object_crosscanvas");
michael@0 22666 }
michael@0 22667 try {
michael@0 22668 test_2d_gradient_object_invalidcolour();
michael@0 22669 } catch (e) {
michael@0 22670 ok(false, "unexpected exception thrown in: test_2d_gradient_object_invalidcolour");
michael@0 22671 }
michael@0 22672 try {
michael@0 22673 test_2d_gradient_object_invalidoffset();
michael@0 22674 } catch (e) {
michael@0 22675 ok(false, "unexpected exception thrown in: test_2d_gradient_object_invalidoffset");
michael@0 22676 }
michael@0 22677 try {
michael@0 22678 test_2d_gradient_object_return();
michael@0 22679 } catch (e) {
michael@0 22680 ok(false, "unexpected exception thrown in: test_2d_gradient_object_return");
michael@0 22681 }
michael@0 22682 try {
michael@0 22683 test_2d_gradient_object_type();
michael@0 22684 } catch (e) {
michael@0 22685 ok(false, "unexpected exception thrown in: test_2d_gradient_object_type");
michael@0 22686 }
michael@0 22687 try {
michael@0 22688 test_2d_gradient_object_update();
michael@0 22689 } catch (e) {
michael@0 22690 ok(false, "unexpected exception thrown in: test_2d_gradient_object_update");
michael@0 22691 }
michael@0 22692 try {
michael@0 22693 test_2d_gradient_radial_cone_bottom();
michael@0 22694 } catch (e) {
michael@0 22695 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_cone_bottom");
michael@0 22696 }
michael@0 22697 try {
michael@0 22698 test_2d_gradient_radial_cone_cylinder();
michael@0 22699 } catch (e) {
michael@0 22700 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_cone_cylinder");
michael@0 22701 }
michael@0 22702 try {
michael@0 22703 test_2d_gradient_radial_cone_shape1();
michael@0 22704 } catch (e) {
michael@0 22705 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_cone_shape1");
michael@0 22706 }
michael@0 22707 try {
michael@0 22708 test_2d_gradient_radial_inside1();
michael@0 22709 } catch (e) {
michael@0 22710 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_inside1");
michael@0 22711 }
michael@0 22712 try {
michael@0 22713 test_2d_gradient_radial_negative();
michael@0 22714 } catch (e) {
michael@0 22715 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_negative");
michael@0 22716 }
michael@0 22717 try {
michael@0 22718 test_2d_gradient_radial_nonfinite();
michael@0 22719 } catch (e) {
michael@0 22720 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_nonfinite");
michael@0 22721 }
michael@0 22722 try {
michael@0 22723 test_2d_gradient_radial_transform_1();
michael@0 22724 } catch (e) {
michael@0 22725 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_transform_1");
michael@0 22726 }
michael@0 22727 try {
michael@0 22728 test_2d_gradient_radial_transform_2();
michael@0 22729 } catch (e) {
michael@0 22730 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_transform_2");
michael@0 22731 }
michael@0 22732 try {
michael@0 22733 test_2d_gradient_radial_transform_3();
michael@0 22734 } catch (e) {
michael@0 22735 ok(false, "unexpected exception thrown in: test_2d_gradient_radial_transform_3");
michael@0 22736 }
michael@0 22737 try {
michael@0 22738 test_2d_imageData_create_basic();
michael@0 22739 } catch (e) {
michael@0 22740 ok(false, "unexpected exception thrown in: test_2d_imageData_create_basic");
michael@0 22741 }
michael@0 22742 try {
michael@0 22743 test_2d_imageData_create1_basic();
michael@0 22744 } catch (e) {
michael@0 22745 ok(false, "unexpected exception thrown in: test_2d_imageData_create1_basic");
michael@0 22746 }
michael@0 22747 try {
michael@0 22748 test_2d_imageData_create_initial();
michael@0 22749 } catch (e) {
michael@0 22750 ok(false, "unexpected exception thrown in: test_2d_imageData_create_initial");
michael@0 22751 }
michael@0 22752 try {
michael@0 22753 test_2d_imageData_create1_initial();
michael@0 22754 } catch (e) {
michael@0 22755 ok(false, "unexpected exception thrown in: test_2d_imageData_create1_initial");
michael@0 22756 }
michael@0 22757 try {
michael@0 22758 test_2d_imageData_create_large();
michael@0 22759 } catch (e) {
michael@0 22760 ok(false, "unexpected exception thrown in: test_2d_imageData_create_large");
michael@0 22761 }
michael@0 22762 try {
michael@0 22763 test_2d_imageData_create_negative();
michael@0 22764 } catch (e) {
michael@0 22765 ok(false, "unexpected exception thrown in: test_2d_imageData_create_negative");
michael@0 22766 }
michael@0 22767 try {
michael@0 22768 test_2d_imageData_create_nonfinite();
michael@0 22769 } catch (e) {
michael@0 22770 ok(false, "unexpected exception thrown in: test_2d_imageData_create_nonfinite");
michael@0 22771 }
michael@0 22772 try {
michael@0 22773 test_2d_imageData_create_round();
michael@0 22774 } catch (e) {
michael@0 22775 ok(false, "unexpected exception thrown in: test_2d_imageData_create_round");
michael@0 22776 }
michael@0 22777 try {
michael@0 22778 test_2d_imageData_create_tiny();
michael@0 22779 } catch (e) {
michael@0 22780 ok(false, "unexpected exception thrown in: test_2d_imageData_create_tiny");
michael@0 22781 }
michael@0 22782 try {
michael@0 22783 test_2d_imageData_create_type();
michael@0 22784 } catch (e) {
michael@0 22785 ok(false, "unexpected exception thrown in: test_2d_imageData_create_type");
michael@0 22786 }
michael@0 22787 try {
michael@0 22788 test_2d_imageData_create1_type();
michael@0 22789 } catch (e) {
michael@0 22790 ok(false, "unexpected exception thrown in: test_2d_imageData_create1_type");
michael@0 22791 }
michael@0 22792 try {
michael@0 22793 test_2d_imageData_create_zero();
michael@0 22794 } catch (e) {
michael@0 22795 ok(false, "unexpected exception thrown in: test_2d_imageData_create_zero");
michael@0 22796 }
michael@0 22797 try {
michael@0 22798 test_2d_imageData_create1_zero();
michael@0 22799 } catch (e) {
michael@0 22800 ok(false, "unexpected exception thrown in: test_2d_imageData_create1_zero");
michael@0 22801 }
michael@0 22802 try {
michael@0 22803 test_2d_imageData_get_basic();
michael@0 22804 } catch (e) {
michael@0 22805 ok(false, "unexpected exception thrown in: test_2d_imageData_get_basic");
michael@0 22806 }
michael@0 22807 try {
michael@0 22808 test_2d_imageData_get_clamp();
michael@0 22809 } catch (e) {
michael@0 22810 ok(false, "unexpected exception thrown in: test_2d_imageData_get_clamp");
michael@0 22811 }
michael@0 22812 try {
michael@0 22813 test_2d_imageData_get_nonfinite();
michael@0 22814 } catch (e) {
michael@0 22815 ok(false, "unexpected exception thrown in: test_2d_imageData_get_nonfinite");
michael@0 22816 }
michael@0 22817 try {
michael@0 22818 test_2d_imageData_get_nonpremul();
michael@0 22819 } catch (e) {
michael@0 22820 ok(false, "unexpected exception thrown in: test_2d_imageData_get_nonpremul");
michael@0 22821 }
michael@0 22822 try {
michael@0 22823 test_2d_imageData_get_order_alpha();
michael@0 22824 } catch (e) {
michael@0 22825 ok(false, "unexpected exception thrown in: test_2d_imageData_get_order_alpha");
michael@0 22826 }
michael@0 22827 try {
michael@0 22828 test_2d_imageData_get_order_cols();
michael@0 22829 } catch (e) {
michael@0 22830 ok(false, "unexpected exception thrown in: test_2d_imageData_get_order_cols");
michael@0 22831 }
michael@0 22832 try {
michael@0 22833 test_2d_imageData_get_order_rgb();
michael@0 22834 } catch (e) {
michael@0 22835 ok(false, "unexpected exception thrown in: test_2d_imageData_get_order_rgb");
michael@0 22836 }
michael@0 22837 try {
michael@0 22838 test_2d_imageData_get_order_rows();
michael@0 22839 } catch (e) {
michael@0 22840 ok(false, "unexpected exception thrown in: test_2d_imageData_get_order_rows");
michael@0 22841 }
michael@0 22842 try {
michael@0 22843 test_2d_imageData_get_range();
michael@0 22844 } catch (e) {
michael@0 22845 ok(false, "unexpected exception thrown in: test_2d_imageData_get_range");
michael@0 22846 }
michael@0 22847 try {
michael@0 22848 test_2d_imageData_get_source_negative();
michael@0 22849 } catch (e) {
michael@0 22850 ok(false, "unexpected exception thrown in: test_2d_imageData_get_source_negative");
michael@0 22851 }
michael@0 22852 try {
michael@0 22853 test_2d_imageData_get_source_outside();
michael@0 22854 } catch (e) {
michael@0 22855 ok(false, "unexpected exception thrown in: test_2d_imageData_get_source_outside");
michael@0 22856 }
michael@0 22857 try {
michael@0 22858 test_2d_imageData_get_source_size();
michael@0 22859 } catch (e) {
michael@0 22860 ok(false, "unexpected exception thrown in: test_2d_imageData_get_source_size");
michael@0 22861 }
michael@0 22862 try {
michael@0 22863 test_2d_imageData_get_tiny();
michael@0 22864 } catch (e) {
michael@0 22865 ok(false, "unexpected exception thrown in: test_2d_imageData_get_tiny");
michael@0 22866 }
michael@0 22867 try {
michael@0 22868 test_2d_imageData_get_type();
michael@0 22869 } catch (e) {
michael@0 22870 ok(false, "unexpected exception thrown in: test_2d_imageData_get_type");
michael@0 22871 }
michael@0 22872 try {
michael@0 22873 test_2d_imageData_get_unaffected();
michael@0 22874 } catch (e) {
michael@0 22875 ok(false, "unexpected exception thrown in: test_2d_imageData_get_unaffected");
michael@0 22876 }
michael@0 22877 try {
michael@0 22878 test_2d_imageData_get_zero();
michael@0 22879 } catch (e) {
michael@0 22880 ok(false, "unexpected exception thrown in: test_2d_imageData_get_zero");
michael@0 22881 }
michael@0 22882 try {
michael@0 22883 test_2d_imageData_object_clamp();
michael@0 22884 } catch (e) {
michael@0 22885 ok(false, "unexpected exception thrown in: test_2d_imageData_object_clamp");
michael@0 22886 }
michael@0 22887 try {
michael@0 22888 test_2d_imageData_object_ctor();
michael@0 22889 } catch (e) {
michael@0 22890 ok(false, "unexpected exception thrown in: test_2d_imageData_object_ctor");
michael@0 22891 }
michael@0 22892 try {
michael@0 22893 test_2d_imageData_object_nan();
michael@0 22894 } catch (e) {
michael@0 22895 ok(false, "unexpected exception thrown in: test_2d_imageData_object_nan");
michael@0 22896 }
michael@0 22897 try {
michael@0 22898 test_2d_imageData_object_properties();
michael@0 22899 } catch (e) {
michael@0 22900 ok(false, "unexpected exception thrown in: test_2d_imageData_object_properties");
michael@0 22901 }
michael@0 22902 try {
michael@0 22903 test_2d_imageData_object_readonly();
michael@0 22904 } catch (e) {
michael@0 22905 ok(false, "unexpected exception thrown in: test_2d_imageData_object_readonly");
michael@0 22906 }
michael@0 22907 try {
michael@0 22908 test_2d_imageData_object_round();
michael@0 22909 } catch (e) {
michael@0 22910 ok(false, "unexpected exception thrown in: test_2d_imageData_object_round");
michael@0 22911 }
michael@0 22912 try {
michael@0 22913 test_2d_imageData_object_set();
michael@0 22914 } catch (e) {
michael@0 22915 ok(false, "unexpected exception thrown in: test_2d_imageData_object_set");
michael@0 22916 }
michael@0 22917 try {
michael@0 22918 test_2d_imageData_object_string();
michael@0 22919 } catch (e) {
michael@0 22920 ok(false, "unexpected exception thrown in: test_2d_imageData_object_string");
michael@0 22921 }
michael@0 22922 try {
michael@0 22923 test_2d_imageData_object_undefined();
michael@0 22924 } catch (e) {
michael@0 22925 ok(false, "unexpected exception thrown in: test_2d_imageData_object_undefined");
michael@0 22926 }
michael@0 22927 try {
michael@0 22928 test_2d_imageData_put_alpha();
michael@0 22929 } catch (e) {
michael@0 22930 ok(false, "unexpected exception thrown in: test_2d_imageData_put_alpha");
michael@0 22931 }
michael@0 22932 try {
michael@0 22933 test_2d_imageData_put_basic();
michael@0 22934 } catch (e) {
michael@0 22935 ok(false, "unexpected exception thrown in: test_2d_imageData_put_basic");
michael@0 22936 }
michael@0 22937 try {
michael@0 22938 test_2d_imageData_put_clip();
michael@0 22939 } catch (e) {
michael@0 22940 ok(false, "unexpected exception thrown in: test_2d_imageData_put_clip");
michael@0 22941 }
michael@0 22942 try {
michael@0 22943 test_2d_imageData_put_created();
michael@0 22944 } catch (e) {
michael@0 22945 ok(false, "unexpected exception thrown in: test_2d_imageData_put_created");
michael@0 22946 }
michael@0 22947 try {
michael@0 22948 test_2d_imageData_put_cross();
michael@0 22949 } catch (e) {
michael@0 22950 ok(false, "unexpected exception thrown in: test_2d_imageData_put_cross");
michael@0 22951 }
michael@0 22952 try {
michael@0 22953 test_2d_imageData_put_dirty_negative();
michael@0 22954 } catch (e) {
michael@0 22955 ok(false, "unexpected exception thrown in: test_2d_imageData_put_dirty_negative");
michael@0 22956 }
michael@0 22957 try {
michael@0 22958 test_2d_imageData_put_dirty_outside();
michael@0 22959 } catch (e) {
michael@0 22960 ok(false, "unexpected exception thrown in: test_2d_imageData_put_dirty_outside");
michael@0 22961 }
michael@0 22962 try {
michael@0 22963 test_2d_imageData_put_dirty_rect1();
michael@0 22964 } catch (e) {
michael@0 22965 ok(false, "unexpected exception thrown in: test_2d_imageData_put_dirty_rect1");
michael@0 22966 }
michael@0 22967 try {
michael@0 22968 test_2d_imageData_put_dirty_rect2();
michael@0 22969 } catch (e) {
michael@0 22970 ok(false, "unexpected exception thrown in: test_2d_imageData_put_dirty_rect2");
michael@0 22971 }
michael@0 22972 try {
michael@0 22973 test_2d_imageData_put_dirty_zero();
michael@0 22974 } catch (e) {
michael@0 22975 ok(false, "unexpected exception thrown in: test_2d_imageData_put_dirty_zero");
michael@0 22976 }
michael@0 22977 try {
michael@0 22978 test_2d_imageData_put_modified();
michael@0 22979 } catch (e) {
michael@0 22980 ok(false, "unexpected exception thrown in: test_2d_imageData_put_modified");
michael@0 22981 }
michael@0 22982 try {
michael@0 22983 test_2d_imageData_put_nonfinite();
michael@0 22984 } catch (e) {
michael@0 22985 ok(false, "unexpected exception thrown in: test_2d_imageData_put_nonfinite");
michael@0 22986 }
michael@0 22987 try {
michael@0 22988 test_2d_imageData_put_null();
michael@0 22989 } catch (e) {
michael@0 22990 ok(false, "unexpected exception thrown in: test_2d_imageData_put_null");
michael@0 22991 }
michael@0 22992 try {
michael@0 22993 test_2d_imageData_put_path();
michael@0 22994 } catch (e) {
michael@0 22995 ok(false, "unexpected exception thrown in: test_2d_imageData_put_path");
michael@0 22996 }
michael@0 22997 try {
michael@0 22998 test_2d_imageData_put_unaffected();
michael@0 22999 } catch (e) {
michael@0 23000 ok(false, "unexpected exception thrown in: test_2d_imageData_put_unaffected");
michael@0 23001 }
michael@0 23002 try {
michael@0 23003 test_2d_imageData_put_unchanged();
michael@0 23004 } catch (e) {
michael@0 23005 ok(false, "unexpected exception thrown in: test_2d_imageData_put_unchanged");
michael@0 23006 }
michael@0 23007 try {
michael@0 23008 test_2d_imageData_put_wrongtype();
michael@0 23009 } catch (e) {
michael@0 23010 ok(false, "unexpected exception thrown in: test_2d_imageData_put_wrongtype");
michael@0 23011 }
michael@0 23012 try {
michael@0 23013 test_2d_line_cap_butt();
michael@0 23014 } catch (e) {
michael@0 23015 ok(false, "unexpected exception thrown in: test_2d_line_cap_butt");
michael@0 23016 }
michael@0 23017 try {
michael@0 23018 test_2d_line_cap_invalid();
michael@0 23019 } catch (e) {
michael@0 23020 ok(false, "unexpected exception thrown in: test_2d_line_cap_invalid");
michael@0 23021 }
michael@0 23022 try {
michael@0 23023 test_2d_line_cap_open();
michael@0 23024 } catch (e) {
michael@0 23025 ok(false, "unexpected exception thrown in: test_2d_line_cap_open");
michael@0 23026 }
michael@0 23027 try {
michael@0 23028 test_2d_line_cap_round();
michael@0 23029 } catch (e) {
michael@0 23030 ok(false, "unexpected exception thrown in: test_2d_line_cap_round");
michael@0 23031 }
michael@0 23032 try {
michael@0 23033 test_2d_line_cap_square();
michael@0 23034 } catch (e) {
michael@0 23035 ok(false, "unexpected exception thrown in: test_2d_line_cap_square");
michael@0 23036 }
michael@0 23037 try {
michael@0 23038 test_2d_line_cross();
michael@0 23039 } catch (e) {
michael@0 23040 ok(false, "unexpected exception thrown in: test_2d_line_cross");
michael@0 23041 }
michael@0 23042 try {
michael@0 23043 test_2d_line_defaults();
michael@0 23044 } catch (e) {
michael@0 23045 ok(false, "unexpected exception thrown in: test_2d_line_defaults");
michael@0 23046 }
michael@0 23047 try {
michael@0 23048 test_2d_line_join_bevel();
michael@0 23049 } catch (e) {
michael@0 23050 ok(false, "unexpected exception thrown in: test_2d_line_join_bevel");
michael@0 23051 }
michael@0 23052 try {
michael@0 23053 test_2d_line_join_closed();
michael@0 23054 } catch (e) {
michael@0 23055 ok(false, "unexpected exception thrown in: test_2d_line_join_closed");
michael@0 23056 }
michael@0 23057 try {
michael@0 23058 test_2d_line_join_invalid();
michael@0 23059 } catch (e) {
michael@0 23060 ok(false, "unexpected exception thrown in: test_2d_line_join_invalid");
michael@0 23061 }
michael@0 23062 try {
michael@0 23063 test_2d_line_join_miter();
michael@0 23064 } catch (e) {
michael@0 23065 ok(false, "unexpected exception thrown in: test_2d_line_join_miter");
michael@0 23066 }
michael@0 23067 try {
michael@0 23068 test_2d_line_join_open();
michael@0 23069 } catch (e) {
michael@0 23070 ok(false, "unexpected exception thrown in: test_2d_line_join_open");
michael@0 23071 }
michael@0 23072 try {
michael@0 23073 test_2d_line_join_round();
michael@0 23074 } catch (e) {
michael@0 23075 ok(false, "unexpected exception thrown in: test_2d_line_join_round");
michael@0 23076 }
michael@0 23077 try {
michael@0 23078 test_2d_line_miter_acute();
michael@0 23079 } catch (e) {
michael@0 23080 ok(false, "unexpected exception thrown in: test_2d_line_miter_acute");
michael@0 23081 }
michael@0 23082 try {
michael@0 23083 test_2d_line_miter_exceeded();
michael@0 23084 } catch (e) {
michael@0 23085 ok(false, "unexpected exception thrown in: test_2d_line_miter_exceeded");
michael@0 23086 }
michael@0 23087 try {
michael@0 23088 test_2d_line_miter_invalid();
michael@0 23089 } catch (e) {
michael@0 23090 ok(false, "unexpected exception thrown in: test_2d_line_miter_invalid");
michael@0 23091 }
michael@0 23092 try {
michael@0 23093 test_2d_line_miter_lineedge();
michael@0 23094 } catch (e) {
michael@0 23095 ok(false, "unexpected exception thrown in: test_2d_line_miter_lineedge");
michael@0 23096 }
michael@0 23097 try {
michael@0 23098 test_2d_line_miter_obtuse();
michael@0 23099 } catch (e) {
michael@0 23100 ok(false, "unexpected exception thrown in: test_2d_line_miter_obtuse");
michael@0 23101 }
michael@0 23102 try {
michael@0 23103 test_2d_line_miter_rightangle();
michael@0 23104 } catch (e) {
michael@0 23105 ok(false, "unexpected exception thrown in: test_2d_line_miter_rightangle");
michael@0 23106 }
michael@0 23107 try {
michael@0 23108 test_2d_line_miter_within();
michael@0 23109 } catch (e) {
michael@0 23110 ok(false, "unexpected exception thrown in: test_2d_line_miter_within");
michael@0 23111 }
michael@0 23112 try {
michael@0 23113 test_2d_line_union();
michael@0 23114 } catch (e) {
michael@0 23115 ok(false, "unexpected exception thrown in: test_2d_line_union");
michael@0 23116 }
michael@0 23117 try {
michael@0 23118 test_2d_line_width_basic();
michael@0 23119 } catch (e) {
michael@0 23120 ok(false, "unexpected exception thrown in: test_2d_line_width_basic");
michael@0 23121 }
michael@0 23122 try {
michael@0 23123 test_2d_line_width_invalid();
michael@0 23124 } catch (e) {
michael@0 23125 ok(false, "unexpected exception thrown in: test_2d_line_width_invalid");
michael@0 23126 }
michael@0 23127 try {
michael@0 23128 test_2d_line_width_transformed();
michael@0 23129 } catch (e) {
michael@0 23130 ok(false, "unexpected exception thrown in: test_2d_line_width_transformed");
michael@0 23131 }
michael@0 23132 try {
michael@0 23133 test_2d_missingargs();
michael@0 23134 } catch (e) {
michael@0 23135 ok(false, "unexpected exception thrown in: test_2d_missingargs");
michael@0 23136 }
michael@0 23137 try {
michael@0 23138 test_2d_path_arc_angle_1();
michael@0 23139 } catch (e) {
michael@0 23140 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_1");
michael@0 23141 }
michael@0 23142 try {
michael@0 23143 test_2d_path_arc_angle_2();
michael@0 23144 } catch (e) {
michael@0 23145 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_2");
michael@0 23146 }
michael@0 23147 try {
michael@0 23148 test_2d_path_arc_angle_3();
michael@0 23149 } catch (e) {
michael@0 23150 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_3");
michael@0 23151 }
michael@0 23152 try {
michael@0 23153 test_2d_path_arc_angle_4();
michael@0 23154 } catch (e) {
michael@0 23155 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_4");
michael@0 23156 }
michael@0 23157 try {
michael@0 23158 test_2d_path_arc_angle_5();
michael@0 23159 } catch (e) {
michael@0 23160 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_5");
michael@0 23161 }
michael@0 23162 try {
michael@0 23163 test_2d_path_arc_angle_6();
michael@0 23164 } catch (e) {
michael@0 23165 ok(false, "unexpected exception thrown in: test_2d_path_arc_angle_6");
michael@0 23166 }
michael@0 23167 try {
michael@0 23168 test_2d_path_arc_empty();
michael@0 23169 } catch (e) {
michael@0 23170 ok(false, "unexpected exception thrown in: test_2d_path_arc_empty");
michael@0 23171 }
michael@0 23172 try {
michael@0 23173 test_2d_path_arc_end();
michael@0 23174 } catch (e) {
michael@0 23175 ok(false, "unexpected exception thrown in: test_2d_path_arc_end");
michael@0 23176 }
michael@0 23177 try {
michael@0 23178 test_2d_path_arc_negative();
michael@0 23179 } catch (e) {
michael@0 23180 ok(false, "unexpected exception thrown in: test_2d_path_arc_negative");
michael@0 23181 }
michael@0 23182 try {
michael@0 23183 test_2d_path_arc_nonempty();
michael@0 23184 } catch (e) {
michael@0 23185 ok(false, "unexpected exception thrown in: test_2d_path_arc_nonempty");
michael@0 23186 }
michael@0 23187 try {
michael@0 23188 test_2d_path_arc_nonfinite();
michael@0 23189 } catch (e) {
michael@0 23190 ok(false, "unexpected exception thrown in: test_2d_path_arc_nonfinite");
michael@0 23191 }
michael@0 23192 try {
michael@0 23193 test_2d_path_arc_scale_1();
michael@0 23194 } catch (e) {
michael@0 23195 ok(false, "unexpected exception thrown in: test_2d_path_arc_scale_1");
michael@0 23196 }
michael@0 23197 try {
michael@0 23198 test_2d_path_arc_scale_2();
michael@0 23199 } catch (e) {
michael@0 23200 ok(false, "unexpected exception thrown in: test_2d_path_arc_scale_2");
michael@0 23201 }
michael@0 23202 try {
michael@0 23203 test_2d_path_arc_selfintersect_1();
michael@0 23204 } catch (e) {
michael@0 23205 ok(false, "unexpected exception thrown in: test_2d_path_arc_selfintersect_1");
michael@0 23206 }
michael@0 23207 try {
michael@0 23208 test_2d_path_arc_selfintersect_2();
michael@0 23209 } catch (e) {
michael@0 23210 ok(false, "unexpected exception thrown in: test_2d_path_arc_selfintersect_2");
michael@0 23211 }
michael@0 23212 try {
michael@0 23213 test_2d_path_arc_shape_1();
michael@0 23214 } catch (e) {
michael@0 23215 ok(false, "unexpected exception thrown in: test_2d_path_arc_shape_1");
michael@0 23216 }
michael@0 23217 try {
michael@0 23218 test_2d_path_arc_shape_2();
michael@0 23219 } catch (e) {
michael@0 23220 ok(false, "unexpected exception thrown in: test_2d_path_arc_shape_2");
michael@0 23221 }
michael@0 23222 try {
michael@0 23223 test_2d_path_arc_shape_4();
michael@0 23224 } catch (e) {
michael@0 23225 ok(false, "unexpected exception thrown in: test_2d_path_arc_shape_4");
michael@0 23226 }
michael@0 23227 try {
michael@0 23228 test_2d_path_arc_shape_5();
michael@0 23229 } catch (e) {
michael@0 23230 ok(false, "unexpected exception thrown in: test_2d_path_arc_shape_5");
michael@0 23231 }
michael@0 23232 try {
michael@0 23233 test_2d_path_arc_twopie_1();
michael@0 23234 } catch (e) {
michael@0 23235 ok(false, "unexpected exception thrown in: test_2d_path_arc_twopie_1");
michael@0 23236 }
michael@0 23237 try {
michael@0 23238 test_2d_path_arc_twopie_2();
michael@0 23239 } catch (e) {
michael@0 23240 ok(false, "unexpected exception thrown in: test_2d_path_arc_twopie_2");
michael@0 23241 }
michael@0 23242 try {
michael@0 23243 test_2d_path_arc_twopie_3();
michael@0 23244 } catch (e) {
michael@0 23245 ok(false, "unexpected exception thrown in: test_2d_path_arc_twopie_3");
michael@0 23246 }
michael@0 23247 try {
michael@0 23248 test_2d_path_arc_twopie_4();
michael@0 23249 } catch (e) {
michael@0 23250 ok(false, "unexpected exception thrown in: test_2d_path_arc_twopie_4");
michael@0 23251 }
michael@0 23252 try {
michael@0 23253 test_2d_path_arc_zero_1();
michael@0 23254 } catch (e) {
michael@0 23255 ok(false, "unexpected exception thrown in: test_2d_path_arc_zero_1");
michael@0 23256 }
michael@0 23257 try {
michael@0 23258 test_2d_path_arc_zero_2();
michael@0 23259 } catch (e) {
michael@0 23260 ok(false, "unexpected exception thrown in: test_2d_path_arc_zero_2");
michael@0 23261 }
michael@0 23262 try {
michael@0 23263 test_2d_path_arc_zeroradius();
michael@0 23264 } catch (e) {
michael@0 23265 ok(false, "unexpected exception thrown in: test_2d_path_arc_zeroradius");
michael@0 23266 }
michael@0 23267 try {
michael@0 23268 test_2d_path_arcTo_coincide_1();
michael@0 23269 } catch (e) {
michael@0 23270 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_coincide_1");
michael@0 23271 }
michael@0 23272 try {
michael@0 23273 test_2d_path_arcTo_coincide_2();
michael@0 23274 } catch (e) {
michael@0 23275 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_coincide_2");
michael@0 23276 }
michael@0 23277 try {
michael@0 23278 test_2d_path_arcTo_collinear_1();
michael@0 23279 } catch (e) {
michael@0 23280 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_collinear_1");
michael@0 23281 }
michael@0 23282 try {
michael@0 23283 test_2d_path_arcTo_collinear_2();
michael@0 23284 } catch (e) {
michael@0 23285 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_collinear_2");
michael@0 23286 }
michael@0 23287 try {
michael@0 23288 test_2d_path_arcTo_collinear_3();
michael@0 23289 } catch (e) {
michael@0 23290 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_collinear_3");
michael@0 23291 }
michael@0 23292 try {
michael@0 23293 test_2d_path_arcTo_emptysubpath();
michael@0 23294 } catch (e) {
michael@0 23295 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_emptysubpath");
michael@0 23296 }
michael@0 23297 try {
michael@0 23298 test_2d_path_arcTo_negative();
michael@0 23299 } catch (e) {
michael@0 23300 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_negative");
michael@0 23301 }
michael@0 23302 try {
michael@0 23303 test_2d_path_arcTo_nonfinite();
michael@0 23304 } catch (e) {
michael@0 23305 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_nonfinite");
michael@0 23306 }
michael@0 23307 try {
michael@0 23308 test_2d_path_arcTo_scale();
michael@0 23309 } catch (e) {
michael@0 23310 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_scale");
michael@0 23311 }
michael@0 23312 try {
michael@0 23313 test_2d_path_arcTo_shape_curve1();
michael@0 23314 } catch (e) {
michael@0 23315 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_shape_curve1");
michael@0 23316 }
michael@0 23317 try {
michael@0 23318 test_2d_path_arcTo_shape_curve2();
michael@0 23319 } catch (e) {
michael@0 23320 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_shape_curve2");
michael@0 23321 }
michael@0 23322 try {
michael@0 23323 test_2d_path_arcTo_shape_end();
michael@0 23324 } catch (e) {
michael@0 23325 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_shape_end");
michael@0 23326 }
michael@0 23327 try {
michael@0 23328 test_2d_path_arcTo_shape_start();
michael@0 23329 } catch (e) {
michael@0 23330 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_shape_start");
michael@0 23331 }
michael@0 23332 try {
michael@0 23333 test_2d_path_arcTo_transformation();
michael@0 23334 } catch (e) {
michael@0 23335 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_transformation");
michael@0 23336 }
michael@0 23337 try {
michael@0 23338 test_2d_path_arcTo_zero_1();
michael@0 23339 } catch (e) {
michael@0 23340 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_zero_1");
michael@0 23341 }
michael@0 23342 try {
michael@0 23343 test_2d_path_arcTo_zero_2();
michael@0 23344 } catch (e) {
michael@0 23345 ok(false, "unexpected exception thrown in: test_2d_path_arcTo_zero_2");
michael@0 23346 }
michael@0 23347 try {
michael@0 23348 test_2d_path_beginPath();
michael@0 23349 } catch (e) {
michael@0 23350 ok(false, "unexpected exception thrown in: test_2d_path_beginPath");
michael@0 23351 }
michael@0 23352 try {
michael@0 23353 test_2d_path_bezierCurveTo_basic();
michael@0 23354 } catch (e) {
michael@0 23355 ok(false, "unexpected exception thrown in: test_2d_path_bezierCurveTo_basic");
michael@0 23356 }
michael@0 23357 try {
michael@0 23358 test_2d_path_bezierCurveTo_emptysubpath();
michael@0 23359 } catch (e) {
michael@0 23360 ok(false, "unexpected exception thrown in: test_2d_path_bezierCurveTo_emptysubpath");
michael@0 23361 }
michael@0 23362 try {
michael@0 23363 test_2d_path_bezierCurveTo_nonfinite();
michael@0 23364 } catch (e) {
michael@0 23365 ok(false, "unexpected exception thrown in: test_2d_path_bezierCurveTo_nonfinite");
michael@0 23366 }
michael@0 23367 try {
michael@0 23368 test_2d_path_bezierCurveTo_scaled();
michael@0 23369 } catch (e) {
michael@0 23370 ok(false, "unexpected exception thrown in: test_2d_path_bezierCurveTo_scaled");
michael@0 23371 }
michael@0 23372 try {
michael@0 23373 test_2d_path_bezierCurveTo_shape();
michael@0 23374 } catch (e) {
michael@0 23375 ok(false, "unexpected exception thrown in: test_2d_path_bezierCurveTo_shape");
michael@0 23376 }
michael@0 23377 try {
michael@0 23378 test_2d_path_clip_basic_1();
michael@0 23379 } catch (e) {
michael@0 23380 ok(false, "unexpected exception thrown in: test_2d_path_clip_basic_1");
michael@0 23381 }
michael@0 23382 try {
michael@0 23383 test_2d_path_clip_basic_2();
michael@0 23384 } catch (e) {
michael@0 23385 ok(false, "unexpected exception thrown in: test_2d_path_clip_basic_2");
michael@0 23386 }
michael@0 23387 try {
michael@0 23388 test_2d_path_clip_empty();
michael@0 23389 } catch (e) {
michael@0 23390 ok(false, "unexpected exception thrown in: test_2d_path_clip_empty");
michael@0 23391 }
michael@0 23392 try {
michael@0 23393 test_2d_path_clip_intersect();
michael@0 23394 } catch (e) {
michael@0 23395 ok(false, "unexpected exception thrown in: test_2d_path_clip_intersect");
michael@0 23396 }
michael@0 23397 try {
michael@0 23398 test_2d_path_clip_unaffected();
michael@0 23399 } catch (e) {
michael@0 23400 ok(false, "unexpected exception thrown in: test_2d_path_clip_unaffected");
michael@0 23401 }
michael@0 23402 try {
michael@0 23403 test_2d_path_clip_winding_1();
michael@0 23404 } catch (e) {
michael@0 23405 ok(false, "unexpected exception thrown in: test_2d_path_clip_winding_1");
michael@0 23406 }
michael@0 23407 try {
michael@0 23408 test_2d_path_clip_winding_2();
michael@0 23409 } catch (e) {
michael@0 23410 ok(false, "unexpected exception thrown in: test_2d_path_clip_winding_2");
michael@0 23411 }
michael@0 23412 try {
michael@0 23413 test_2d_path_closePath_empty();
michael@0 23414 } catch (e) {
michael@0 23415 ok(false, "unexpected exception thrown in: test_2d_path_closePath_empty");
michael@0 23416 }
michael@0 23417 try {
michael@0 23418 test_2d_path_closePath_newline();
michael@0 23419 } catch (e) {
michael@0 23420 ok(false, "unexpected exception thrown in: test_2d_path_closePath_newline");
michael@0 23421 }
michael@0 23422 try {
michael@0 23423 test_2d_path_closePath_nextpoint();
michael@0 23424 } catch (e) {
michael@0 23425 ok(false, "unexpected exception thrown in: test_2d_path_closePath_nextpoint");
michael@0 23426 }
michael@0 23427 try {
michael@0 23428 test_2d_path_fill_closed_basic();
michael@0 23429 } catch (e) {
michael@0 23430 ok(false, "unexpected exception thrown in: test_2d_path_fill_closed_basic");
michael@0 23431 }
michael@0 23432 try {
michael@0 23433 test_2d_path_fill_closed_unaffected();
michael@0 23434 } catch (e) {
michael@0 23435 ok(false, "unexpected exception thrown in: test_2d_path_fill_closed_unaffected");
michael@0 23436 }
michael@0 23437 try {
michael@0 23438 test_2d_path_fill_overlap();
michael@0 23439 } catch (e) {
michael@0 23440 ok(false, "unexpected exception thrown in: test_2d_path_fill_overlap");
michael@0 23441 }
michael@0 23442 try {
michael@0 23443 test_2d_path_fill_winding_add();
michael@0 23444 } catch (e) {
michael@0 23445 ok(false, "unexpected exception thrown in: test_2d_path_fill_winding_add");
michael@0 23446 }
michael@0 23447 try {
michael@0 23448 test_2d_path_fill_winding_subtract_1();
michael@0 23449 } catch (e) {
michael@0 23450 ok(false, "unexpected exception thrown in: test_2d_path_fill_winding_subtract_1");
michael@0 23451 }
michael@0 23452 try {
michael@0 23453 test_2d_path_fill_winding_subtract_2();
michael@0 23454 } catch (e) {
michael@0 23455 ok(false, "unexpected exception thrown in: test_2d_path_fill_winding_subtract_2");
michael@0 23456 }
michael@0 23457 try {
michael@0 23458 test_2d_path_fill_winding_subtract_3();
michael@0 23459 } catch (e) {
michael@0 23460 ok(false, "unexpected exception thrown in: test_2d_path_fill_winding_subtract_3");
michael@0 23461 }
michael@0 23462 try {
michael@0 23463 test_2d_path_initial();
michael@0 23464 } catch (e) {
michael@0 23465 ok(false, "unexpected exception thrown in: test_2d_path_initial");
michael@0 23466 }
michael@0 23467 try {
michael@0 23468 test_2d_path_isPointInPath_arc();
michael@0 23469 } catch (e) {
michael@0 23470 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_arc");
michael@0 23471 }
michael@0 23472 try {
michael@0 23473 test_2d_path_isPointInPath_basic_1();
michael@0 23474 } catch (e) {
michael@0 23475 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_basic_1");
michael@0 23476 }
michael@0 23477 try {
michael@0 23478 test_2d_path_isPointInPath_basic_2();
michael@0 23479 } catch (e) {
michael@0 23480 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_basic_2");
michael@0 23481 }
michael@0 23482 try {
michael@0 23483 test_2d_path_isPointInPath_bezier();
michael@0 23484 } catch (e) {
michael@0 23485 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_bezier");
michael@0 23486 }
michael@0 23487 try {
michael@0 23488 test_2d_path_isPointInPath_bigarc();
michael@0 23489 } catch (e) {
michael@0 23490 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_bigarc");
michael@0 23491 }
michael@0 23492 try {
michael@0 23493 test_2d_path_isPointInPath_edge();
michael@0 23494 } catch (e) {
michael@0 23495 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_edge");
michael@0 23496 }
michael@0 23497 try {
michael@0 23498 test_2d_path_isPointInPath_empty();
michael@0 23499 } catch (e) {
michael@0 23500 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_empty");
michael@0 23501 }
michael@0 23502 try {
michael@0 23503 test_2d_path_isPointInPath_nonfinite();
michael@0 23504 } catch (e) {
michael@0 23505 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_nonfinite");
michael@0 23506 }
michael@0 23507 try {
michael@0 23508 test_2d_path_isPointInPath_outside();
michael@0 23509 } catch (e) {
michael@0 23510 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_outside");
michael@0 23511 }
michael@0 23512 try {
michael@0 23513 test_2d_path_isPointInPath_subpath();
michael@0 23514 } catch (e) {
michael@0 23515 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_subpath");
michael@0 23516 }
michael@0 23517 try {
michael@0 23518 test_2d_path_isPointInPath_transform_1();
michael@0 23519 } catch (e) {
michael@0 23520 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_transform_1");
michael@0 23521 }
michael@0 23522 try {
michael@0 23523 test_2d_path_isPointInPath_transform_2();
michael@0 23524 } catch (e) {
michael@0 23525 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_transform_2");
michael@0 23526 }
michael@0 23527 try {
michael@0 23528 test_2d_path_isPointInPath_transform_3();
michael@0 23529 } catch (e) {
michael@0 23530 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_transform_3");
michael@0 23531 }
michael@0 23532 try {
michael@0 23533 test_2d_path_isPointInPath_unclosed();
michael@0 23534 } catch (e) {
michael@0 23535 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_unclosed");
michael@0 23536 }
michael@0 23537 try {
michael@0 23538 test_2d_path_isPointInPath_winding();
michael@0 23539 } catch (e) {
michael@0 23540 ok(false, "unexpected exception thrown in: test_2d_path_isPointInPath_winding");
michael@0 23541 }
michael@0 23542 try {
michael@0 23543 test_2d_path_lineTo_basic();
michael@0 23544 } catch (e) {
michael@0 23545 ok(false, "unexpected exception thrown in: test_2d_path_lineTo_basic");
michael@0 23546 }
michael@0 23547 try {
michael@0 23548 test_2d_path_lineTo_emptysubpath();
michael@0 23549 } catch (e) {
michael@0 23550 ok(false, "unexpected exception thrown in: test_2d_path_lineTo_emptysubpath");
michael@0 23551 }
michael@0 23552 try {
michael@0 23553 test_2d_path_lineTo_nextpoint();
michael@0 23554 } catch (e) {
michael@0 23555 ok(false, "unexpected exception thrown in: test_2d_path_lineTo_nextpoint");
michael@0 23556 }
michael@0 23557 try {
michael@0 23558 test_2d_path_lineTo_nonfinite();
michael@0 23559 } catch (e) {
michael@0 23560 ok(false, "unexpected exception thrown in: test_2d_path_lineTo_nonfinite");
michael@0 23561 }
michael@0 23562 try {
michael@0 23563 test_2d_path_moveTo_basic();
michael@0 23564 } catch (e) {
michael@0 23565 ok(false, "unexpected exception thrown in: test_2d_path_moveTo_basic");
michael@0 23566 }
michael@0 23567 try {
michael@0 23568 test_2d_path_moveTo_multiple();
michael@0 23569 } catch (e) {
michael@0 23570 ok(false, "unexpected exception thrown in: test_2d_path_moveTo_multiple");
michael@0 23571 }
michael@0 23572 try {
michael@0 23573 test_2d_path_moveTo_newsubpath();
michael@0 23574 } catch (e) {
michael@0 23575 ok(false, "unexpected exception thrown in: test_2d_path_moveTo_newsubpath");
michael@0 23576 }
michael@0 23577 try {
michael@0 23578 test_2d_path_moveTo_nonfinite();
michael@0 23579 } catch (e) {
michael@0 23580 ok(false, "unexpected exception thrown in: test_2d_path_moveTo_nonfinite");
michael@0 23581 }
michael@0 23582 try {
michael@0 23583 test_2d_path_quadraticCurveTo_basic();
michael@0 23584 } catch (e) {
michael@0 23585 ok(false, "unexpected exception thrown in: test_2d_path_quadraticCurveTo_basic");
michael@0 23586 }
michael@0 23587 try {
michael@0 23588 test_2d_path_quadraticCurveTo_emptysubpath();
michael@0 23589 } catch (e) {
michael@0 23590 ok(false, "unexpected exception thrown in: test_2d_path_quadraticCurveTo_emptysubpath");
michael@0 23591 }
michael@0 23592 try {
michael@0 23593 test_2d_path_quadraticCurveTo_nonfinite();
michael@0 23594 } catch (e) {
michael@0 23595 ok(false, "unexpected exception thrown in: test_2d_path_quadraticCurveTo_nonfinite");
michael@0 23596 }
michael@0 23597 try {
michael@0 23598 test_2d_path_quadraticCurveTo_scaled();
michael@0 23599 } catch (e) {
michael@0 23600 ok(false, "unexpected exception thrown in: test_2d_path_quadraticCurveTo_scaled");
michael@0 23601 }
michael@0 23602 try {
michael@0 23603 test_2d_path_quadraticCurveTo_shape();
michael@0 23604 } catch (e) {
michael@0 23605 ok(false, "unexpected exception thrown in: test_2d_path_quadraticCurveTo_shape");
michael@0 23606 }
michael@0 23607 try {
michael@0 23608 test_2d_path_rect_basic();
michael@0 23609 } catch (e) {
michael@0 23610 ok(false, "unexpected exception thrown in: test_2d_path_rect_basic");
michael@0 23611 }
michael@0 23612 try {
michael@0 23613 test_2d_path_rect_closed();
michael@0 23614 } catch (e) {
michael@0 23615 ok(false, "unexpected exception thrown in: test_2d_path_rect_closed");
michael@0 23616 }
michael@0 23617 try {
michael@0 23618 test_2d_path_rect_end_1();
michael@0 23619 } catch (e) {
michael@0 23620 ok(false, "unexpected exception thrown in: test_2d_path_rect_end_1");
michael@0 23621 }
michael@0 23622 try {
michael@0 23623 test_2d_path_rect_end_2();
michael@0 23624 } catch (e) {
michael@0 23625 ok(false, "unexpected exception thrown in: test_2d_path_rect_end_2");
michael@0 23626 }
michael@0 23627 try {
michael@0 23628 test_2d_path_rect_negative();
michael@0 23629 } catch (e) {
michael@0 23630 ok(false, "unexpected exception thrown in: test_2d_path_rect_negative");
michael@0 23631 }
michael@0 23632 try {
michael@0 23633 test_2d_path_rect_newsubpath();
michael@0 23634 } catch (e) {
michael@0 23635 ok(false, "unexpected exception thrown in: test_2d_path_rect_newsubpath");
michael@0 23636 }
michael@0 23637 try {
michael@0 23638 test_2d_path_rect_nonfinite();
michael@0 23639 } catch (e) {
michael@0 23640 ok(false, "unexpected exception thrown in: test_2d_path_rect_nonfinite");
michael@0 23641 }
michael@0 23642 try {
michael@0 23643 test_2d_path_rect_winding();
michael@0 23644 } catch (e) {
michael@0 23645 ok(false, "unexpected exception thrown in: test_2d_path_rect_winding");
michael@0 23646 }
michael@0 23647 try {
michael@0 23648 test_2d_path_rect_zero_1();
michael@0 23649 } catch (e) {
michael@0 23650 ok(false, "unexpected exception thrown in: test_2d_path_rect_zero_1");
michael@0 23651 }
michael@0 23652 try {
michael@0 23653 test_2d_path_rect_zero_2();
michael@0 23654 } catch (e) {
michael@0 23655 ok(false, "unexpected exception thrown in: test_2d_path_rect_zero_2");
michael@0 23656 }
michael@0 23657 try {
michael@0 23658 test_2d_path_rect_zero_3();
michael@0 23659 } catch (e) {
michael@0 23660 ok(false, "unexpected exception thrown in: test_2d_path_rect_zero_3");
michael@0 23661 }
michael@0 23662 try {
michael@0 23663 test_2d_path_rect_zero_4();
michael@0 23664 } catch (e) {
michael@0 23665 ok(false, "unexpected exception thrown in: test_2d_path_rect_zero_4");
michael@0 23666 }
michael@0 23667 try {
michael@0 23668 test_2d_path_rect_zero_5();
michael@0 23669 } catch (e) {
michael@0 23670 ok(false, "unexpected exception thrown in: test_2d_path_rect_zero_5");
michael@0 23671 }
michael@0 23672 try {
michael@0 23673 test_2d_path_stroke_empty();
michael@0 23674 } catch (e) {
michael@0 23675 ok(false, "unexpected exception thrown in: test_2d_path_stroke_empty");
michael@0 23676 }
michael@0 23677 try {
michael@0 23678 test_2d_path_stroke_overlap();
michael@0 23679 } catch (e) {
michael@0 23680 ok(false, "unexpected exception thrown in: test_2d_path_stroke_overlap");
michael@0 23681 }
michael@0 23682 try {
michael@0 23683 test_2d_path_stroke_prune_arc();
michael@0 23684 } catch (e) {
michael@0 23685 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_arc");
michael@0 23686 }
michael@0 23687 try {
michael@0 23688 test_2d_path_stroke_prune_closed();
michael@0 23689 } catch (e) {
michael@0 23690 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_closed");
michael@0 23691 }
michael@0 23692 try {
michael@0 23693 test_2d_path_stroke_prune_corner();
michael@0 23694 } catch (e) {
michael@0 23695 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_corner");
michael@0 23696 }
michael@0 23697 try {
michael@0 23698 test_2d_path_stroke_prune_curve();
michael@0 23699 } catch (e) {
michael@0 23700 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_curve");
michael@0 23701 }
michael@0 23702 try {
michael@0 23703 test_2d_path_stroke_prune_line();
michael@0 23704 } catch (e) {
michael@0 23705 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_line");
michael@0 23706 }
michael@0 23707 try {
michael@0 23708 test_2d_path_stroke_prune_rect();
michael@0 23709 } catch (e) {
michael@0 23710 ok(false, "unexpected exception thrown in: test_2d_path_stroke_prune_rect");
michael@0 23711 }
michael@0 23712 try {
michael@0 23713 test_2d_path_stroke_scale1();
michael@0 23714 } catch (e) {
michael@0 23715 ok(false, "unexpected exception thrown in: test_2d_path_stroke_scale1");
michael@0 23716 }
michael@0 23717 try {
michael@0 23718 test_2d_path_stroke_scale2();
michael@0 23719 } catch (e) {
michael@0 23720 ok(false, "unexpected exception thrown in: test_2d_path_stroke_scale2");
michael@0 23721 }
michael@0 23722 try {
michael@0 23723 test_2d_path_stroke_skew();
michael@0 23724 } catch (e) {
michael@0 23725 ok(false, "unexpected exception thrown in: test_2d_path_stroke_skew");
michael@0 23726 }
michael@0 23727 try {
michael@0 23728 test_2d_path_stroke_unaffected();
michael@0 23729 } catch (e) {
michael@0 23730 ok(false, "unexpected exception thrown in: test_2d_path_stroke_unaffected");
michael@0 23731 }
michael@0 23732 try {
michael@0 23733 test_2d_path_stroke_union();
michael@0 23734 } catch (e) {
michael@0 23735 ok(false, "unexpected exception thrown in: test_2d_path_stroke_union");
michael@0 23736 }
michael@0 23737 try {
michael@0 23738 test_2d_path_transformation_basic();
michael@0 23739 } catch (e) {
michael@0 23740 ok(false, "unexpected exception thrown in: test_2d_path_transformation_basic");
michael@0 23741 }
michael@0 23742 try {
michael@0 23743 test_2d_path_transformation_changing();
michael@0 23744 } catch (e) {
michael@0 23745 ok(false, "unexpected exception thrown in: test_2d_path_transformation_changing");
michael@0 23746 }
michael@0 23747 try {
michael@0 23748 test_2d_path_transformation_multiple();
michael@0 23749 } catch (e) {
michael@0 23750 ok(false, "unexpected exception thrown in: test_2d_path_transformation_multiple");
michael@0 23751 }
michael@0 23752 try {
michael@0 23753 test_2d_pattern_animated_gif();
michael@0 23754 } catch (e) {
michael@0 23755 ok(false, "unexpected exception thrown in: test_2d_pattern_animated_gif");
michael@0 23756 }
michael@0 23757 try {
michael@0 23758 test_2d_pattern_basic_canvas();
michael@0 23759 } catch (e) {
michael@0 23760 ok(false, "unexpected exception thrown in: test_2d_pattern_basic_canvas");
michael@0 23761 }
michael@0 23762 try {
michael@0 23763 test_2d_pattern_basic_image();
michael@0 23764 } catch (e) {
michael@0 23765 ok(false, "unexpected exception thrown in: test_2d_pattern_basic_image");
michael@0 23766 }
michael@0 23767 try {
michael@0 23768 test_2d_pattern_basic_nocontext();
michael@0 23769 } catch (e) {
michael@0 23770 ok(false, "unexpected exception thrown in: test_2d_pattern_basic_nocontext");
michael@0 23771 }
michael@0 23772 try {
michael@0 23773 test_2d_pattern_basic_type();
michael@0 23774 } catch (e) {
michael@0 23775 ok(false, "unexpected exception thrown in: test_2d_pattern_basic_type");
michael@0 23776 }
michael@0 23777 try {
michael@0 23778 test_2d_pattern_basic_zerocanvas();
michael@0 23779 } catch (e) {
michael@0 23780 ok(false, "unexpected exception thrown in: test_2d_pattern_basic_zerocanvas");
michael@0 23781 }
michael@0 23782 try {
michael@0 23783 test_2d_pattern_crosscanvas();
michael@0 23784 } catch (e) {
michael@0 23785 ok(false, "unexpected exception thrown in: test_2d_pattern_crosscanvas");
michael@0 23786 }
michael@0 23787 try {
michael@0 23788 test_2d_pattern_image_broken();
michael@0 23789 } catch (e) {
michael@0 23790 ok(false, "unexpected exception thrown in: test_2d_pattern_image_broken");
michael@0 23791 }
michael@0 23792 try {
michael@0 23793 test_2d_pattern_image_incomplete();
michael@0 23794 } catch (e) {
michael@0 23795 ok(false, "unexpected exception thrown in: test_2d_pattern_image_incomplete");
michael@0 23796 }
michael@0 23797 try {
michael@0 23798 test_2d_pattern_image_null();
michael@0 23799 } catch (e) {
michael@0 23800 ok(false, "unexpected exception thrown in: test_2d_pattern_image_null");
michael@0 23801 }
michael@0 23802 try {
michael@0 23803 test_2d_pattern_image_string();
michael@0 23804 } catch (e) {
michael@0 23805 ok(false, "unexpected exception thrown in: test_2d_pattern_image_string");
michael@0 23806 }
michael@0 23807 try {
michael@0 23808 test_2d_pattern_image_undefined();
michael@0 23809 } catch (e) {
michael@0 23810 ok(false, "unexpected exception thrown in: test_2d_pattern_image_undefined");
michael@0 23811 }
michael@0 23812 try {
michael@0 23813 test_2d_pattern_modify_canvas1();
michael@0 23814 } catch (e) {
michael@0 23815 ok(false, "unexpected exception thrown in: test_2d_pattern_modify_canvas1");
michael@0 23816 }
michael@0 23817 try {
michael@0 23818 test_2d_pattern_modify_canvas2();
michael@0 23819 } catch (e) {
michael@0 23820 ok(false, "unexpected exception thrown in: test_2d_pattern_modify_canvas2");
michael@0 23821 }
michael@0 23822 try {
michael@0 23823 test_2d_pattern_modify_image1();
michael@0 23824 } catch (e) {
michael@0 23825 ok(false, "unexpected exception thrown in: test_2d_pattern_modify_image1");
michael@0 23826 }
michael@0 23827 try {
michael@0 23828 test_2d_pattern_modify_image2();
michael@0 23829 } catch (e) {
michael@0 23830 ok(false, "unexpected exception thrown in: test_2d_pattern_modify_image2");
michael@0 23831 }
michael@0 23832 try {
michael@0 23833 test_2d_pattern_paint_norepeat_basic();
michael@0 23834 } catch (e) {
michael@0 23835 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_norepeat_basic");
michael@0 23836 }
michael@0 23837 try {
michael@0 23838 test_2d_pattern_paint_norepeat_coord1();
michael@0 23839 } catch (e) {
michael@0 23840 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_norepeat_coord1");
michael@0 23841 }
michael@0 23842 try {
michael@0 23843 test_2d_pattern_paint_norepeat_coord2();
michael@0 23844 } catch (e) {
michael@0 23845 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_norepeat_coord2");
michael@0 23846 }
michael@0 23847 try {
michael@0 23848 test_2d_pattern_paint_norepeat_coord3();
michael@0 23849 } catch (e) {
michael@0 23850 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_norepeat_coord3");
michael@0 23851 }
michael@0 23852 try {
michael@0 23853 test_2d_pattern_paint_norepeat_outside();
michael@0 23854 } catch (e) {
michael@0 23855 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_norepeat_outside");
michael@0 23856 }
michael@0 23857 try {
michael@0 23858 test_2d_pattern_paint_orientation_canvas();
michael@0 23859 } catch (e) {
michael@0 23860 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_orientation_canvas");
michael@0 23861 }
michael@0 23862 try {
michael@0 23863 test_2d_pattern_paint_orientation_image();
michael@0 23864 } catch (e) {
michael@0 23865 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_orientation_image");
michael@0 23866 }
michael@0 23867 try {
michael@0 23868 test_2d_pattern_paint_repeat_basic();
michael@0 23869 } catch (e) {
michael@0 23870 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeat_basic");
michael@0 23871 }
michael@0 23872 try {
michael@0 23873 test_2d_pattern_paint_repeat_coord1();
michael@0 23874 } catch (e) {
michael@0 23875 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeat_coord1");
michael@0 23876 }
michael@0 23877 try {
michael@0 23878 test_2d_pattern_paint_repeat_coord2();
michael@0 23879 } catch (e) {
michael@0 23880 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeat_coord2");
michael@0 23881 }
michael@0 23882 try {
michael@0 23883 test_2d_pattern_paint_repeat_coord3();
michael@0 23884 } catch (e) {
michael@0 23885 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeat_coord3");
michael@0 23886 }
michael@0 23887 try {
michael@0 23888 test_2d_pattern_paint_repeat_outside();
michael@0 23889 } catch (e) {
michael@0 23890 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeat_outside");
michael@0 23891 }
michael@0 23892 try {
michael@0 23893 test_2d_pattern_paint_repeatx_basic();
michael@0 23894 } catch (e) {
michael@0 23895 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeatx_basic");
michael@0 23896 }
michael@0 23897 try {
michael@0 23898 test_2d_pattern_paint_repeatx_coord1();
michael@0 23899 } catch (e) {
michael@0 23900 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeatx_coord1");
michael@0 23901 }
michael@0 23902 try {
michael@0 23903 test_2d_pattern_paint_repeatx_outside();
michael@0 23904 } catch (e) {
michael@0 23905 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeatx_outside");
michael@0 23906 }
michael@0 23907 try {
michael@0 23908 test_2d_pattern_paint_repeaty_basic();
michael@0 23909 } catch (e) {
michael@0 23910 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeaty_basic");
michael@0 23911 }
michael@0 23912 try {
michael@0 23913 test_2d_pattern_paint_repeaty_coord1();
michael@0 23914 } catch (e) {
michael@0 23915 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeaty_coord1");
michael@0 23916 }
michael@0 23917 try {
michael@0 23918 test_2d_pattern_paint_repeaty_outside();
michael@0 23919 } catch (e) {
michael@0 23920 ok(false, "unexpected exception thrown in: test_2d_pattern_paint_repeaty_outside");
michael@0 23921 }
michael@0 23922 try {
michael@0 23923 test_2d_pattern_repeat_case();
michael@0 23924 } catch (e) {
michael@0 23925 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_case");
michael@0 23926 }
michael@0 23927 try {
michael@0 23928 test_2d_pattern_repeat_empty();
michael@0 23929 } catch (e) {
michael@0 23930 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_empty");
michael@0 23931 }
michael@0 23932 try {
michael@0 23933 test_2d_pattern_repeat_null();
michael@0 23934 } catch (e) {
michael@0 23935 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_null");
michael@0 23936 }
michael@0 23937 try {
michael@0 23938 test_2d_pattern_repeat_nullsuffix();
michael@0 23939 } catch (e) {
michael@0 23940 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_nullsuffix");
michael@0 23941 }
michael@0 23942 try {
michael@0 23943 test_2d_pattern_repeat_undefined();
michael@0 23944 } catch (e) {
michael@0 23945 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_undefined");
michael@0 23946 }
michael@0 23947 try {
michael@0 23948 test_2d_pattern_repeat_unrecognised();
michael@0 23949 } catch (e) {
michael@0 23950 ok(false, "unexpected exception thrown in: test_2d_pattern_repeat_unrecognised");
michael@0 23951 }
michael@0 23952 try {
michael@0 23953 test_2d_scaled();
michael@0 23954 } catch (e) {
michael@0 23955 ok(false, "unexpected exception thrown in: test_2d_scaled");
michael@0 23956 }
michael@0 23957 try {
michael@0 23958 test_2d_shadow_alpha_1();
michael@0 23959 } catch (e) {
michael@0 23960 ok(false, "unexpected exception thrown in: test_2d_shadow_alpha_1");
michael@0 23961 }
michael@0 23962 try {
michael@0 23963 test_2d_shadow_alpha_2();
michael@0 23964 } catch (e) {
michael@0 23965 ok(false, "unexpected exception thrown in: test_2d_shadow_alpha_2");
michael@0 23966 }
michael@0 23967 try {
michael@0 23968 test_2d_shadow_alpha_3();
michael@0 23969 } catch (e) {
michael@0 23970 ok(false, "unexpected exception thrown in: test_2d_shadow_alpha_3");
michael@0 23971 }
michael@0 23972 try {
michael@0 23973 test_2d_shadow_alpha_4();
michael@0 23974 } catch (e) {
michael@0 23975 ok(false, "unexpected exception thrown in: test_2d_shadow_alpha_4");
michael@0 23976 }
michael@0 23977 try {
michael@0 23978 test_2d_shadow_alpha_5();
michael@0 23979 } catch (e) {
michael@0 23980 ok(false, "unexpected exception thrown in: test_2d_shadow_alpha_5");
michael@0 23981 }
michael@0 23982 try {
michael@0 23983 test_2d_shadow_attributes_shadowBlur_1();
michael@0 23984 } catch (e) {
michael@0 23985 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowBlur_1");
michael@0 23986 }
michael@0 23987 try {
michael@0 23988 test_2d_shadow_attributes_shadowBlur_2();
michael@0 23989 } catch (e) {
michael@0 23990 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowBlur_2");
michael@0 23991 }
michael@0 23992 try {
michael@0 23993 test_2d_shadow_attributes_shadowColor_1();
michael@0 23994 } catch (e) {
michael@0 23995 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowColor_1");
michael@0 23996 }
michael@0 23997 try {
michael@0 23998 test_2d_shadow_attributes_shadowColor_2();
michael@0 23999 } catch (e) {
michael@0 24000 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowColor_2");
michael@0 24001 }
michael@0 24002 try {
michael@0 24003 test_2d_shadow_attributes_shadowOffset_1();
michael@0 24004 } catch (e) {
michael@0 24005 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowOffset_1");
michael@0 24006 }
michael@0 24007 try {
michael@0 24008 test_2d_shadow_attributes_shadowOffset_2();
michael@0 24009 } catch (e) {
michael@0 24010 ok(false, "unexpected exception thrown in: test_2d_shadow_attributes_shadowOffset_2");
michael@0 24011 }
michael@0 24012 try {
michael@0 24013 test_2d_shadow_basic_1();
michael@0 24014 } catch (e) {
michael@0 24015 ok(false, "unexpected exception thrown in: test_2d_shadow_basic_1");
michael@0 24016 }
michael@0 24017 try {
michael@0 24018 test_2d_shadow_basic_2();
michael@0 24019 } catch (e) {
michael@0 24020 ok(false, "unexpected exception thrown in: test_2d_shadow_basic_2");
michael@0 24021 }
michael@0 24022 try {
michael@0 24023 test_2d_shadow_blur_high();
michael@0 24024 } catch (e) {
michael@0 24025 ok(false, "unexpected exception thrown in: test_2d_shadow_blur_high");
michael@0 24026 }
michael@0 24027 try {
michael@0 24028 test_2d_shadow_blur_low();
michael@0 24029 } catch (e) {
michael@0 24030 ok(false, "unexpected exception thrown in: test_2d_shadow_blur_low");
michael@0 24031 }
michael@0 24032 try {
michael@0 24033 test_2d_shadow_canvas_alpha();
michael@0 24034 } catch (e) {
michael@0 24035 ok(false, "unexpected exception thrown in: test_2d_shadow_canvas_alpha");
michael@0 24036 }
michael@0 24037 try {
michael@0 24038 test_2d_shadow_canvas_basic();
michael@0 24039 } catch (e) {
michael@0 24040 ok(false, "unexpected exception thrown in: test_2d_shadow_canvas_basic");
michael@0 24041 }
michael@0 24042 try {
michael@0 24043 test_2d_shadow_canvas_transparent_1();
michael@0 24044 } catch (e) {
michael@0 24045 ok(false, "unexpected exception thrown in: test_2d_shadow_canvas_transparent_1");
michael@0 24046 }
michael@0 24047 try {
michael@0 24048 test_2d_shadow_canvas_transparent_2();
michael@0 24049 } catch (e) {
michael@0 24050 ok(false, "unexpected exception thrown in: test_2d_shadow_canvas_transparent_2");
michael@0 24051 }
michael@0 24052 try {
michael@0 24053 test_2d_shadow_clip_1();
michael@0 24054 } catch (e) {
michael@0 24055 ok(false, "unexpected exception thrown in: test_2d_shadow_clip_1");
michael@0 24056 }
michael@0 24057 try {
michael@0 24058 test_2d_shadow_clip_2();
michael@0 24059 } catch (e) {
michael@0 24060 ok(false, "unexpected exception thrown in: test_2d_shadow_clip_2");
michael@0 24061 }
michael@0 24062 try {
michael@0 24063 test_2d_shadow_clip_3();
michael@0 24064 } catch (e) {
michael@0 24065 ok(false, "unexpected exception thrown in: test_2d_shadow_clip_3");
michael@0 24066 }
michael@0 24067 try {
michael@0 24068 test_2d_shadow_composite_1();
michael@0 24069 } catch (e) {
michael@0 24070 ok(false, "unexpected exception thrown in: test_2d_shadow_composite_1");
michael@0 24071 }
michael@0 24072 try {
michael@0 24073 test_2d_shadow_composite_2();
michael@0 24074 } catch (e) {
michael@0 24075 ok(false, "unexpected exception thrown in: test_2d_shadow_composite_2");
michael@0 24076 }
michael@0 24077 try {
michael@0 24078 test_2d_shadow_gradient_alpha();
michael@0 24079 } catch (e) {
michael@0 24080 ok(false, "unexpected exception thrown in: test_2d_shadow_gradient_alpha");
michael@0 24081 }
michael@0 24082 try {
michael@0 24083 test_2d_shadow_gradient_basic();
michael@0 24084 } catch (e) {
michael@0 24085 ok(false, "unexpected exception thrown in: test_2d_shadow_gradient_basic");
michael@0 24086 }
michael@0 24087 try {
michael@0 24088 test_2d_shadow_gradient_transparent_1();
michael@0 24089 } catch (e) {
michael@0 24090 ok(false, "unexpected exception thrown in: test_2d_shadow_gradient_transparent_1");
michael@0 24091 }
michael@0 24092 try {
michael@0 24093 test_2d_shadow_gradient_transparent_2();
michael@0 24094 } catch (e) {
michael@0 24095 ok(false, "unexpected exception thrown in: test_2d_shadow_gradient_transparent_2");
michael@0 24096 }
michael@0 24097 try {
michael@0 24098 test_2d_shadow_image_alpha();
michael@0 24099 } catch (e) {
michael@0 24100 ok(false, "unexpected exception thrown in: test_2d_shadow_image_alpha");
michael@0 24101 }
michael@0 24102 try {
michael@0 24103 test_2d_shadow_image_basic();
michael@0 24104 } catch (e) {
michael@0 24105 ok(false, "unexpected exception thrown in: test_2d_shadow_image_basic");
michael@0 24106 }
michael@0 24107 try {
michael@0 24108 test_2d_shadow_image_scale();
michael@0 24109 } catch (e) {
michael@0 24110 ok(false, "unexpected exception thrown in: test_2d_shadow_image_scale");
michael@0 24111 }
michael@0 24112 try {
michael@0 24113 test_2d_shadow_image_section();
michael@0 24114 } catch (e) {
michael@0 24115 ok(false, "unexpected exception thrown in: test_2d_shadow_image_section");
michael@0 24116 }
michael@0 24117 try {
michael@0 24118 test_2d_shadow_image_transparent_1();
michael@0 24119 } catch (e) {
michael@0 24120 ok(false, "unexpected exception thrown in: test_2d_shadow_image_transparent_1");
michael@0 24121 }
michael@0 24122 try {
michael@0 24123 test_2d_shadow_image_transparent_2();
michael@0 24124 } catch (e) {
michael@0 24125 ok(false, "unexpected exception thrown in: test_2d_shadow_image_transparent_2");
michael@0 24126 }
michael@0 24127 try {
michael@0 24128 test_2d_shadow_offset_negativeX();
michael@0 24129 } catch (e) {
michael@0 24130 ok(false, "unexpected exception thrown in: test_2d_shadow_offset_negativeX");
michael@0 24131 }
michael@0 24132 try {
michael@0 24133 test_2d_shadow_offset_negativeY();
michael@0 24134 } catch (e) {
michael@0 24135 ok(false, "unexpected exception thrown in: test_2d_shadow_offset_negativeY");
michael@0 24136 }
michael@0 24137 try {
michael@0 24138 test_2d_shadow_offset_positiveX();
michael@0 24139 } catch (e) {
michael@0 24140 ok(false, "unexpected exception thrown in: test_2d_shadow_offset_positiveX");
michael@0 24141 }
michael@0 24142 try {
michael@0 24143 test_2d_shadow_offset_positiveY();
michael@0 24144 } catch (e) {
michael@0 24145 ok(false, "unexpected exception thrown in: test_2d_shadow_offset_positiveY");
michael@0 24146 }
michael@0 24147 try {
michael@0 24148 test_2d_shadow_outside();
michael@0 24149 } catch (e) {
michael@0 24150 ok(false, "unexpected exception thrown in: test_2d_shadow_outside");
michael@0 24151 }
michael@0 24152 try {
michael@0 24153 test_2d_shadow_pattern_alpha();
michael@0 24154 } catch (e) {
michael@0 24155 ok(false, "unexpected exception thrown in: test_2d_shadow_pattern_alpha");
michael@0 24156 }
michael@0 24157 try {
michael@0 24158 test_2d_shadow_pattern_basic();
michael@0 24159 } catch (e) {
michael@0 24160 ok(false, "unexpected exception thrown in: test_2d_shadow_pattern_basic");
michael@0 24161 }
michael@0 24162 try {
michael@0 24163 test_2d_shadow_pattern_transparent_1();
michael@0 24164 } catch (e) {
michael@0 24165 ok(false, "unexpected exception thrown in: test_2d_shadow_pattern_transparent_1");
michael@0 24166 }
michael@0 24167 try {
michael@0 24168 test_2d_shadow_pattern_transparent_2();
michael@0 24169 } catch (e) {
michael@0 24170 ok(false, "unexpected exception thrown in: test_2d_shadow_pattern_transparent_2");
michael@0 24171 }
michael@0 24172 try {
michael@0 24173 test_2d_shadow_stroke_basic();
michael@0 24174 } catch (e) {
michael@0 24175 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_basic");
michael@0 24176 }
michael@0 24177 try {
michael@0 24178 test_2d_shadow_stroke_cap_1();
michael@0 24179 } catch (e) {
michael@0 24180 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_cap_1");
michael@0 24181 }
michael@0 24182 try {
michael@0 24183 test_2d_shadow_stroke_cap_2();
michael@0 24184 } catch (e) {
michael@0 24185 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_cap_2");
michael@0 24186 }
michael@0 24187 try {
michael@0 24188 test_2d_shadow_stroke_join_1();
michael@0 24189 } catch (e) {
michael@0 24190 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_join_1");
michael@0 24191 }
michael@0 24192 try {
michael@0 24193 test_2d_shadow_stroke_join_2();
michael@0 24194 } catch (e) {
michael@0 24195 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_join_2");
michael@0 24196 }
michael@0 24197 try {
michael@0 24198 test_2d_shadow_stroke_join_3();
michael@0 24199 } catch (e) {
michael@0 24200 ok(false, "unexpected exception thrown in: test_2d_shadow_stroke_join_3");
michael@0 24201 }
michael@0 24202 try {
michael@0 24203 test_2d_shadow_transform_1();
michael@0 24204 } catch (e) {
michael@0 24205 ok(false, "unexpected exception thrown in: test_2d_shadow_transform_1");
michael@0 24206 }
michael@0 24207 try {
michael@0 24208 test_2d_shadow_transform_2();
michael@0 24209 } catch (e) {
michael@0 24210 ok(false, "unexpected exception thrown in: test_2d_shadow_transform_2");
michael@0 24211 }
michael@0 24212 try {
michael@0 24213 test_2d_state_saverestore_bitmap();
michael@0 24214 } catch (e) {
michael@0 24215 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_bitmap");
michael@0 24216 }
michael@0 24217 try {
michael@0 24218 test_2d_state_saverestore_clip();
michael@0 24219 } catch (e) {
michael@0 24220 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_clip");
michael@0 24221 }
michael@0 24222 try {
michael@0 24223 test_2d_state_saverestore_fillStyle();
michael@0 24224 } catch (e) {
michael@0 24225 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_fillStyle");
michael@0 24226 }
michael@0 24227 try {
michael@0 24228 test_2d_state_saverestore_globalAlpha();
michael@0 24229 } catch (e) {
michael@0 24230 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_globalAlpha");
michael@0 24231 }
michael@0 24232 try {
michael@0 24233 test_2d_state_saverestore_globalCompositeOperation();
michael@0 24234 } catch (e) {
michael@0 24235 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_globalCompositeOperation");
michael@0 24236 }
michael@0 24237 try {
michael@0 24238 test_2d_state_saverestore_lineCap();
michael@0 24239 } catch (e) {
michael@0 24240 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_lineCap");
michael@0 24241 }
michael@0 24242 try {
michael@0 24243 test_2d_state_saverestore_lineJoin();
michael@0 24244 } catch (e) {
michael@0 24245 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_lineJoin");
michael@0 24246 }
michael@0 24247 try {
michael@0 24248 test_2d_state_saverestore_lineWidth();
michael@0 24249 } catch (e) {
michael@0 24250 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_lineWidth");
michael@0 24251 }
michael@0 24252 try {
michael@0 24253 test_2d_state_saverestore_miterLimit();
michael@0 24254 } catch (e) {
michael@0 24255 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_miterLimit");
michael@0 24256 }
michael@0 24257 try {
michael@0 24258 test_2d_state_saverestore_path();
michael@0 24259 } catch (e) {
michael@0 24260 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_path");
michael@0 24261 }
michael@0 24262 try {
michael@0 24263 test_2d_state_saverestore_shadowBlur();
michael@0 24264 } catch (e) {
michael@0 24265 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_shadowBlur");
michael@0 24266 }
michael@0 24267 try {
michael@0 24268 test_2d_state_saverestore_shadowColor();
michael@0 24269 } catch (e) {
michael@0 24270 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_shadowColor");
michael@0 24271 }
michael@0 24272 try {
michael@0 24273 test_2d_state_saverestore_shadowOffsetX();
michael@0 24274 } catch (e) {
michael@0 24275 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_shadowOffsetX");
michael@0 24276 }
michael@0 24277 try {
michael@0 24278 test_2d_state_saverestore_shadowOffsetY();
michael@0 24279 } catch (e) {
michael@0 24280 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_shadowOffsetY");
michael@0 24281 }
michael@0 24282 try {
michael@0 24283 test_2d_state_saverestore_stack();
michael@0 24284 } catch (e) {
michael@0 24285 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_stack");
michael@0 24286 }
michael@0 24287 try {
michael@0 24288 test_2d_state_saverestore_stackdepth();
michael@0 24289 } catch (e) {
michael@0 24290 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_stackdepth");
michael@0 24291 }
michael@0 24292 try {
michael@0 24293 test_2d_state_saverestore_strokeStyle();
michael@0 24294 } catch (e) {
michael@0 24295 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_strokeStyle");
michael@0 24296 }
michael@0 24297 try {
michael@0 24298 test_2d_state_saverestore_transformation();
michael@0 24299 } catch (e) {
michael@0 24300 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_transformation");
michael@0 24301 }
michael@0 24302 try {
michael@0 24303 test_2d_state_saverestore_underflow();
michael@0 24304 } catch (e) {
michael@0 24305 ok(false, "unexpected exception thrown in: test_2d_state_saverestore_underflow");
michael@0 24306 }
michael@0 24307 try {
michael@0 24308 test_2d_strokeRect_basic();
michael@0 24309 } catch (e) {
michael@0 24310 ok(false, "unexpected exception thrown in: test_2d_strokeRect_basic");
michael@0 24311 }
michael@0 24312 try {
michael@0 24313 test_2d_strokeRect_clip();
michael@0 24314 } catch (e) {
michael@0 24315 ok(false, "unexpected exception thrown in: test_2d_strokeRect_clip");
michael@0 24316 }
michael@0 24317 try {
michael@0 24318 test_2d_strokeRect_globalalpha();
michael@0 24319 } catch (e) {
michael@0 24320 ok(false, "unexpected exception thrown in: test_2d_strokeRect_globalalpha");
michael@0 24321 }
michael@0 24322 try {
michael@0 24323 test_2d_strokeRect_globalcomposite();
michael@0 24324 } catch (e) {
michael@0 24325 ok(false, "unexpected exception thrown in: test_2d_strokeRect_globalcomposite");
michael@0 24326 }
michael@0 24327 try {
michael@0 24328 test_2d_strokeRect_negative();
michael@0 24329 } catch (e) {
michael@0 24330 ok(false, "unexpected exception thrown in: test_2d_strokeRect_negative");
michael@0 24331 }
michael@0 24332 try {
michael@0 24333 test_2d_strokeRect_nonfinite();
michael@0 24334 } catch (e) {
michael@0 24335 ok(false, "unexpected exception thrown in: test_2d_strokeRect_nonfinite");
michael@0 24336 }
michael@0 24337 try {
michael@0 24338 test_2d_strokeRect_path();
michael@0 24339 } catch (e) {
michael@0 24340 ok(false, "unexpected exception thrown in: test_2d_strokeRect_path");
michael@0 24341 }
michael@0 24342 try {
michael@0 24343 test_2d_strokeRect_shadow();
michael@0 24344 } catch (e) {
michael@0 24345 ok(false, "unexpected exception thrown in: test_2d_strokeRect_shadow");
michael@0 24346 }
michael@0 24347 try {
michael@0 24348 test_2d_strokeRect_transform();
michael@0 24349 } catch (e) {
michael@0 24350 ok(false, "unexpected exception thrown in: test_2d_strokeRect_transform");
michael@0 24351 }
michael@0 24352 try {
michael@0 24353 test_2d_strokeRect_zero_1();
michael@0 24354 } catch (e) {
michael@0 24355 ok(false, "unexpected exception thrown in: test_2d_strokeRect_zero_1");
michael@0 24356 }
michael@0 24357 try {
michael@0 24358 test_2d_strokeRect_zero_2();
michael@0 24359 } catch (e) {
michael@0 24360 ok(false, "unexpected exception thrown in: test_2d_strokeRect_zero_2");
michael@0 24361 }
michael@0 24362 try {
michael@0 24363 test_2d_strokeRect_zero_3();
michael@0 24364 } catch (e) {
michael@0 24365 ok(false, "unexpected exception thrown in: test_2d_strokeRect_zero_3");
michael@0 24366 }
michael@0 24367 try {
michael@0 24368 test_2d_strokeRect_zero_4();
michael@0 24369 } catch (e) {
michael@0 24370 ok(false, "unexpected exception thrown in: test_2d_strokeRect_zero_4");
michael@0 24371 }
michael@0 24372 try {
michael@0 24373 test_2d_strokeStyle_default();
michael@0 24374 } catch (e) {
michael@0 24375 ok(false, "unexpected exception thrown in: test_2d_strokeStyle_default");
michael@0 24376 }
michael@0 24377 try {
michael@0 24378 test_2d_text_align_default();
michael@0 24379 } catch (e) {
michael@0 24380 ok(false, "unexpected exception thrown in: test_2d_text_align_default");
michael@0 24381 }
michael@0 24382 try {
michael@0 24383 test_2d_text_align_invalid();
michael@0 24384 } catch (e) {
michael@0 24385 ok(false, "unexpected exception thrown in: test_2d_text_align_invalid");
michael@0 24386 }
michael@0 24387 try {
michael@0 24388 test_2d_text_baseline_default();
michael@0 24389 } catch (e) {
michael@0 24390 ok(false, "unexpected exception thrown in: test_2d_text_baseline_default");
michael@0 24391 }
michael@0 24392 try {
michael@0 24393 test_2d_text_baseline_invalid();
michael@0 24394 } catch (e) {
michael@0 24395 ok(false, "unexpected exception thrown in: test_2d_text_baseline_invalid");
michael@0 24396 }
michael@0 24397 try {
michael@0 24398 test_2d_transformation_order();
michael@0 24399 } catch (e) {
michael@0 24400 ok(false, "unexpected exception thrown in: test_2d_transformation_order");
michael@0 24401 }
michael@0 24402 try {
michael@0 24403 test_2d_transformation_rotate_direction();
michael@0 24404 } catch (e) {
michael@0 24405 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_direction");
michael@0 24406 }
michael@0 24407 try {
michael@0 24408 test_2d_transformation_rotate_nonfinite();
michael@0 24409 } catch (e) {
michael@0 24410 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_nonfinite");
michael@0 24411 }
michael@0 24412 try {
michael@0 24413 test_2d_transformation_rotate_radians();
michael@0 24414 } catch (e) {
michael@0 24415 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_radians");
michael@0 24416 }
michael@0 24417 try {
michael@0 24418 test_2d_transformation_rotate_wrap();
michael@0 24419 } catch (e) {
michael@0 24420 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_wrap");
michael@0 24421 }
michael@0 24422 try {
michael@0 24423 test_2d_transformation_rotate_wrapnegative();
michael@0 24424 } catch (e) {
michael@0 24425 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_wrapnegative");
michael@0 24426 }
michael@0 24427 try {
michael@0 24428 test_2d_transformation_rotate_zero();
michael@0 24429 } catch (e) {
michael@0 24430 ok(false, "unexpected exception thrown in: test_2d_transformation_rotate_zero");
michael@0 24431 }
michael@0 24432 try {
michael@0 24433 test_2d_transformation_scale_basic();
michael@0 24434 } catch (e) {
michael@0 24435 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_basic");
michael@0 24436 }
michael@0 24437 try {
michael@0 24438 test_2d_transformation_scale_large();
michael@0 24439 } catch (e) {
michael@0 24440 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_large");
michael@0 24441 }
michael@0 24442 try {
michael@0 24443 test_2d_transformation_scale_multiple();
michael@0 24444 } catch (e) {
michael@0 24445 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_multiple");
michael@0 24446 }
michael@0 24447 try {
michael@0 24448 test_2d_transformation_scale_negative();
michael@0 24449 } catch (e) {
michael@0 24450 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_negative");
michael@0 24451 }
michael@0 24452 try {
michael@0 24453 test_2d_transformation_scale_nonfinite();
michael@0 24454 } catch (e) {
michael@0 24455 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_nonfinite");
michael@0 24456 }
michael@0 24457 try {
michael@0 24458 test_2d_transformation_scale_zero();
michael@0 24459 } catch (e) {
michael@0 24460 ok(false, "unexpected exception thrown in: test_2d_transformation_scale_zero");
michael@0 24461 }
michael@0 24462 try {
michael@0 24463 test_2d_transformation_setTransform_multiple();
michael@0 24464 } catch (e) {
michael@0 24465 ok(false, "unexpected exception thrown in: test_2d_transformation_setTransform_multiple");
michael@0 24466 }
michael@0 24467 try {
michael@0 24468 test_2d_transformation_setTransform_nonfinite();
michael@0 24469 } catch (e) {
michael@0 24470 ok(false, "unexpected exception thrown in: test_2d_transformation_setTransform_nonfinite");
michael@0 24471 }
michael@0 24472 try {
michael@0 24473 test_2d_transformation_setTransform_skewed();
michael@0 24474 } catch (e) {
michael@0 24475 ok(false, "unexpected exception thrown in: test_2d_transformation_setTransform_skewed");
michael@0 24476 }
michael@0 24477 try {
michael@0 24478 test_2d_transformation_transform_identity();
michael@0 24479 } catch (e) {
michael@0 24480 ok(false, "unexpected exception thrown in: test_2d_transformation_transform_identity");
michael@0 24481 }
michael@0 24482 try {
michael@0 24483 test_2d_transformation_transform_multiply();
michael@0 24484 } catch (e) {
michael@0 24485 ok(false, "unexpected exception thrown in: test_2d_transformation_transform_multiply");
michael@0 24486 }
michael@0 24487 try {
michael@0 24488 test_2d_transformation_transform_nonfinite();
michael@0 24489 } catch (e) {
michael@0 24490 ok(false, "unexpected exception thrown in: test_2d_transformation_transform_nonfinite");
michael@0 24491 }
michael@0 24492 try {
michael@0 24493 test_2d_transformation_transform_skewed();
michael@0 24494 } catch (e) {
michael@0 24495 ok(false, "unexpected exception thrown in: test_2d_transformation_transform_skewed");
michael@0 24496 }
michael@0 24497 try {
michael@0 24498 test_2d_transformation_translate_basic();
michael@0 24499 } catch (e) {
michael@0 24500 ok(false, "unexpected exception thrown in: test_2d_transformation_translate_basic");
michael@0 24501 }
michael@0 24502 try {
michael@0 24503 test_2d_transformation_translate_nonfinite();
michael@0 24504 } catch (e) {
michael@0 24505 ok(false, "unexpected exception thrown in: test_2d_transformation_translate_nonfinite");
michael@0 24506 }
michael@0 24507 try {
michael@0 24508 test_2d_type_exists();
michael@0 24509 } catch (e) {
michael@0 24510 ok(false, "unexpected exception thrown in: test_2d_type_exists");
michael@0 24511 }
michael@0 24512 try {
michael@0 24513 test_2d_type_extend();
michael@0 24514 } catch (e) {
michael@0 24515 ok(false, "unexpected exception thrown in: test_2d_type_extend");
michael@0 24516 }
michael@0 24517 try {
michael@0 24518 test_2d_type_prototype();
michael@0 24519 } catch (e) {
michael@0 24520 ok(false, "unexpected exception thrown in: test_2d_type_prototype");
michael@0 24521 }
michael@0 24522 try {
michael@0 24523 test_2d_type_replace();
michael@0 24524 } catch (e) {
michael@0 24525 ok(false, "unexpected exception thrown in: test_2d_type_replace");
michael@0 24526 }
michael@0 24527 try {
michael@0 24528 test_2d_voidreturn();
michael@0 24529 } catch (e) {
michael@0 24530 ok(false, "unexpected exception thrown in: test_2d_voidreturn");
michael@0 24531 }
michael@0 24532 try {
michael@0 24533 test_bug397524();
michael@0 24534 } catch (e) {
michael@0 24535 ok(false, "unexpected exception thrown in: test_bug397524");
michael@0 24536 }
michael@0 24537 try {
michael@0 24538 test_bug405982();
michael@0 24539 } catch (e) {
michael@0 24540 ok(false, "unexpected exception thrown in: test_bug405982");
michael@0 24541 }
michael@0 24542 try {
michael@0 24543 test_context_arguments_extra();
michael@0 24544 } catch (e) {
michael@0 24545 ok(false, "unexpected exception thrown in: test_context_arguments_extra");
michael@0 24546 }
michael@0 24547 try {
michael@0 24548 test_context_arguments_missing();
michael@0 24549 } catch (e) {
michael@0 24550 ok(false, "unexpected exception thrown in: test_context_arguments_missing");
michael@0 24551 }
michael@0 24552 try {
michael@0 24553 test_context_casesensitive();
michael@0 24554 } catch (e) {
michael@0 24555 ok(false, "unexpected exception thrown in: test_context_casesensitive");
michael@0 24556 }
michael@0 24557 try {
michael@0 24558 test_context_emptystring();
michael@0 24559 } catch (e) {
michael@0 24560 ok(false, "unexpected exception thrown in: test_context_emptystring");
michael@0 24561 }
michael@0 24562 try {
michael@0 24563 test_context_unrecognised_badname();
michael@0 24564 } catch (e) {
michael@0 24565 ok(false, "unexpected exception thrown in: test_context_unrecognised_badname");
michael@0 24566 }
michael@0 24567 try {
michael@0 24568 test_context_unrecognised_badsuffix();
michael@0 24569 } catch (e) {
michael@0 24570 ok(false, "unexpected exception thrown in: test_context_unrecognised_badsuffix");
michael@0 24571 }
michael@0 24572 try {
michael@0 24573 test_context_unrecognised_nullsuffix();
michael@0 24574 } catch (e) {
michael@0 24575 ok(false, "unexpected exception thrown in: test_context_unrecognised_nullsuffix");
michael@0 24576 }
michael@0 24577 try {
michael@0 24578 test_context_unrecognised_unicode();
michael@0 24579 } catch (e) {
michael@0 24580 ok(false, "unexpected exception thrown in: test_context_unrecognised_unicode");
michael@0 24581 }
michael@0 24582 try {
michael@0 24583 test_fallback_basic();
michael@0 24584 } catch (e) {
michael@0 24585 ok(false, "unexpected exception thrown in: test_fallback_basic");
michael@0 24586 }
michael@0 24587 try {
michael@0 24588 test_fallback_multiple();
michael@0 24589 } catch (e) {
michael@0 24590 ok(false, "unexpected exception thrown in: test_fallback_multiple");
michael@0 24591 }
michael@0 24592 try {
michael@0 24593 test_fallback_nested();
michael@0 24594 } catch (e) {
michael@0 24595 ok(false, "unexpected exception thrown in: test_fallback_nested");
michael@0 24596 }
michael@0 24597 try {
michael@0 24598 test_initial_colour();
michael@0 24599 } catch (e) {
michael@0 24600 ok(false, "unexpected exception thrown in: test_initial_colour");
michael@0 24601 }
michael@0 24602 try {
michael@0 24603 test_initial_reset_2dstate();
michael@0 24604 } catch (e) {
michael@0 24605 ok(false, "unexpected exception thrown in: test_initial_reset_2dstate");
michael@0 24606 }
michael@0 24607 try {
michael@0 24608 test_initial_reset_clip();
michael@0 24609 } catch (e) {
michael@0 24610 ok(false, "unexpected exception thrown in: test_initial_reset_clip");
michael@0 24611 }
michael@0 24612 try {
michael@0 24613 test_initial_reset_different();
michael@0 24614 } catch (e) {
michael@0 24615 ok(false, "unexpected exception thrown in: test_initial_reset_different");
michael@0 24616 }
michael@0 24617 try {
michael@0 24618 test_initial_reset_gradient();
michael@0 24619 } catch (e) {
michael@0 24620 ok(false, "unexpected exception thrown in: test_initial_reset_gradient");
michael@0 24621 }
michael@0 24622 try {
michael@0 24623 test_initial_reset_path();
michael@0 24624 } catch (e) {
michael@0 24625 ok(false, "unexpected exception thrown in: test_initial_reset_path");
michael@0 24626 }
michael@0 24627 try {
michael@0 24628 test_initial_reset_pattern();
michael@0 24629 } catch (e) {
michael@0 24630 ok(false, "unexpected exception thrown in: test_initial_reset_pattern");
michael@0 24631 }
michael@0 24632 try {
michael@0 24633 test_initial_reset_same();
michael@0 24634 } catch (e) {
michael@0 24635 ok(false, "unexpected exception thrown in: test_initial_reset_same");
michael@0 24636 }
michael@0 24637 try {
michael@0 24638 test_initial_reset_transform();
michael@0 24639 } catch (e) {
michael@0 24640 ok(false, "unexpected exception thrown in: test_initial_reset_transform");
michael@0 24641 }
michael@0 24642 try {
michael@0 24643 test_size_attributes_default();
michael@0 24644 } catch (e) {
michael@0 24645 ok(false, "unexpected exception thrown in: test_size_attributes_default");
michael@0 24646 }
michael@0 24647 try {
michael@0 24648 test_size_attributes();
michael@0 24649 } catch (e) {
michael@0 24650 ok(false, "unexpected exception thrown in: test_size_attributes");
michael@0 24651 }
michael@0 24652 try {
michael@0 24653 test_size_attributes_parse_badsuffix();
michael@0 24654 } catch (e) {
michael@0 24655 ok(false, "unexpected exception thrown in: test_size_attributes_parse_badsuffix");
michael@0 24656 }
michael@0 24657 try {
michael@0 24658 test_size_attributes_parse_floatsuffix();
michael@0 24659 } catch (e) {
michael@0 24660 ok(false, "unexpected exception thrown in: test_size_attributes_parse_floatsuffix");
michael@0 24661 }
michael@0 24662 try {
michael@0 24663 test_size_attributes_parse_negative();
michael@0 24664 } catch (e) {
michael@0 24665 ok(false, "unexpected exception thrown in: test_size_attributes_parse_negative");
michael@0 24666 }
michael@0 24667 try {
michael@0 24668 test_size_attributes_parse_nonnumber();
michael@0 24669 } catch (e) {
michael@0 24670 ok(false, "unexpected exception thrown in: test_size_attributes_parse_nonnumber");
michael@0 24671 }
michael@0 24672 try {
michael@0 24673 test_size_attributes_parse_percentsuffix();
michael@0 24674 } catch (e) {
michael@0 24675 ok(false, "unexpected exception thrown in: test_size_attributes_parse_percentsuffix");
michael@0 24676 }
michael@0 24677 try {
michael@0 24678 test_size_attributes_parse_whitespace();
michael@0 24679 } catch (e) {
michael@0 24680 ok(false, "unexpected exception thrown in: test_size_attributes_parse_whitespace");
michael@0 24681 }
michael@0 24682 try {
michael@0 24683 test_size_attributes_parse_zero();
michael@0 24684 } catch (e) {
michael@0 24685 ok(false, "unexpected exception thrown in: test_size_attributes_parse_zero");
michael@0 24686 }
michael@0 24687 try {
michael@0 24688 test_size_attributes_parse_zerosuffix();
michael@0 24689 } catch (e) {
michael@0 24690 ok(false, "unexpected exception thrown in: test_size_attributes_parse_zerosuffix");
michael@0 24691 }
michael@0 24692 try {
michael@0 24693 test_size_attributes_reflect_1();
michael@0 24694 } catch (e) {
michael@0 24695 ok(false, "unexpected exception thrown in: test_size_attributes_reflect_1");
michael@0 24696 }
michael@0 24697 try {
michael@0 24698 test_size_attributes_reflect_2();
michael@0 24699 } catch (e) {
michael@0 24700 ok(false, "unexpected exception thrown in: test_size_attributes_reflect_2");
michael@0 24701 }
michael@0 24702 try {
michael@0 24703 test_size_attributes_removed();
michael@0 24704 } catch (e) {
michael@0 24705 ok(false, "unexpected exception thrown in: test_size_attributes_removed");
michael@0 24706 }
michael@0 24707 try {
michael@0 24708 test_size_attributes_setAttribute_badsuffix();
michael@0 24709 } catch (e) {
michael@0 24710 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_badsuffix");
michael@0 24711 }
michael@0 24712 try {
michael@0 24713 test_size_attributes_setAttribute_floatsuffix();
michael@0 24714 } catch (e) {
michael@0 24715 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_floatsuffix");
michael@0 24716 }
michael@0 24717 try {
michael@0 24718 test_size_attributes_setAttribute_negative();
michael@0 24719 } catch (e) {
michael@0 24720 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_negative");
michael@0 24721 }
michael@0 24722 try {
michael@0 24723 test_size_attributes_setAttribute_nonnumber();
michael@0 24724 } catch (e) {
michael@0 24725 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_nonnumber");
michael@0 24726 }
michael@0 24727 try {
michael@0 24728 test_size_attributes_setAttribute_percentsuffix();
michael@0 24729 } catch (e) {
michael@0 24730 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_percentsuffix");
michael@0 24731 }
michael@0 24732 try {
michael@0 24733 test_size_attributes_setAttribute_whitespace();
michael@0 24734 } catch (e) {
michael@0 24735 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_whitespace");
michael@0 24736 }
michael@0 24737 try {
michael@0 24738 test_size_attributes_setAttribute_zero();
michael@0 24739 } catch (e) {
michael@0 24740 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_zero");
michael@0 24741 }
michael@0 24742 try {
michael@0 24743 test_size_attributes_setAttribute_zerosuffix();
michael@0 24744 } catch (e) {
michael@0 24745 ok(false, "unexpected exception thrown in: test_size_attributes_setAttribute_zerosuffix");
michael@0 24746 }
michael@0 24747 try {
michael@0 24748 test_size_attributes_style();
michael@0 24749 } catch (e) {
michael@0 24750 ok(false, "unexpected exception thrown in: test_size_attributes_style");
michael@0 24751 }
michael@0 24752 try {
michael@0 24753 test_size_attributes_type_get();
michael@0 24754 } catch (e) {
michael@0 24755 ok(false, "unexpected exception thrown in: test_size_attributes_type_get");
michael@0 24756 }
michael@0 24757 try {
michael@0 24758 test_size_attributes_type_set();
michael@0 24759 } catch (e) {
michael@0 24760 ok(false, "unexpected exception thrown in: test_size_attributes_type_set");
michael@0 24761 }
michael@0 24762 try {
michael@0 24763 test_text_font();
michael@0 24764 } catch (e) {
michael@0 24765 ok(false, "unexpected exception thrown in: test_text_font");
michael@0 24766 }
michael@0 24767 try {
michael@0 24768 test_text_measure();
michael@0 24769 } catch (e) {
michael@0 24770 ok(false, "unexpected exception thrown in: test_text_measure");
michael@0 24771 }
michael@0 24772 try {
michael@0 24773 test_text_space_replace();
michael@0 24774 } catch (e) {
michael@0 24775 ok(false, "unexpected exception thrown in: test_text_space_replace");
michael@0 24776 }
michael@0 24777 try {
michael@0 24778 test_text_textAlign();
michael@0 24779 } catch (e) {
michael@0 24780 ok(false, "unexpected exception thrown in: test_text_textAlign");
michael@0 24781 }
michael@0 24782 try {
michael@0 24783 test_text_textBaseline();
michael@0 24784 } catch (e) {
michael@0 24785 ok(false, "unexpected exception thrown in: test_text_textBaseline");
michael@0 24786 }
michael@0 24787 try {
michael@0 24788 test_toDataURL_arguments_1();
michael@0 24789 } catch (e) {
michael@0 24790 ok(false, "unexpected exception thrown in: test_toDataURL_arguments_1");
michael@0 24791 }
michael@0 24792 try {
michael@0 24793 test_toDataURL_arguments_2();
michael@0 24794 } catch (e) {
michael@0 24795 ok(false, "unexpected exception thrown in: test_toDataURL_arguments_2");
michael@0 24796 }
michael@0 24797 try {
michael@0 24798 test_toDataURL_arguments_3();
michael@0 24799 } catch (e) {
michael@0 24800 ok(false, "unexpected exception thrown in: test_toDataURL_arguments_3");
michael@0 24801 }
michael@0 24802 try {
michael@0 24803 test_toDataURL_complexcolours();
michael@0 24804 } catch (e) {
michael@0 24805 ok(false, "unexpected exception thrown in: test_toDataURL_complexcolours");
michael@0 24806 }
michael@0 24807 try {
michael@0 24808 test_toDataURL_default();
michael@0 24809 } catch (e) {
michael@0 24810 ok(false, "unexpected exception thrown in: test_toDataURL_default");
michael@0 24811 }
michael@0 24812 try {
michael@0 24813 test_toDataURL_lowercase();
michael@0 24814 } catch (e) {
michael@0 24815 ok(false, "unexpected exception thrown in: test_toDataURL_lowercase");
michael@0 24816 }
michael@0 24817 try {
michael@0 24818 test_toDataURL_nocontext();
michael@0 24819 } catch (e) {
michael@0 24820 ok(false, "unexpected exception thrown in: test_toDataURL_nocontext");
michael@0 24821 }
michael@0 24822 try {
michael@0 24823 test_toDataURL_png();
michael@0 24824 } catch (e) {
michael@0 24825 ok(false, "unexpected exception thrown in: test_toDataURL_png");
michael@0 24826 }
michael@0 24827 try {
michael@0 24828 test_toDataURL_primarycolours();
michael@0 24829 } catch (e) {
michael@0 24830 ok(false, "unexpected exception thrown in: test_toDataURL_primarycolours");
michael@0 24831 }
michael@0 24832 try {
michael@0 24833 test_toDataURL_unrecognised();
michael@0 24834 } catch (e) {
michael@0 24835 ok(false, "unexpected exception thrown in: test_toDataURL_unrecognised");
michael@0 24836 }
michael@0 24837 try {
michael@0 24838 test_toDataURL_zerosize();
michael@0 24839 } catch (e) {
michael@0 24840 ok(false, "unexpected exception thrown in: test_toDataURL_zerosize");
michael@0 24841 }
michael@0 24842 try {
michael@0 24843 test_type_exists();
michael@0 24844 } catch (e) {
michael@0 24845 ok(false, "unexpected exception thrown in: test_type_exists");
michael@0 24846 }
michael@0 24847 try {
michael@0 24848 test_type_extend();
michael@0 24849 } catch (e) {
michael@0 24850 ok(false, "unexpected exception thrown in: test_type_extend");
michael@0 24851 }
michael@0 24852 try {
michael@0 24853 test_type_name();
michael@0 24854 } catch (e) {
michael@0 24855 ok(false, "unexpected exception thrown in: test_type_name");
michael@0 24856 }
michael@0 24857 try {
michael@0 24858 test_type_prototype();
michael@0 24859 } catch (e) {
michael@0 24860 ok(false, "unexpected exception thrown in: test_type_prototype");
michael@0 24861 }
michael@0 24862 try {
michael@0 24863 test_2d_imagedata_coercion();
michael@0 24864 } catch (e) {
michael@0 24865 ok(false, "unexpected exception thrown in: test_2d_imagedata_coercion");
michael@0 24866 }
michael@0 24867 try {
michael@0 24868 test_2d_imageSmoothing();
michael@0 24869 } catch (e) {
michael@0 24870 ok(false, "unexpected exception thrown in: test_2d_imageSmoothing");
michael@0 24871 }
michael@0 24872 try {
michael@0 24873 test_zero_dimensions();
michael@0 24874 } catch (e) {
michael@0 24875 ok(false, "unexpected exception thrown in: test_zero_dimensions");
michael@0 24876 }
michael@0 24877 try {
michael@0 24878 test_zero_dimensions_imagedata();
michael@0 24879 } catch(e) {
michael@0 24880 ok(false, "unexpected exception thrown in: test_zero_dimensions_imagedata");
michael@0 24881 }
michael@0 24882 try {
michael@0 24883 test_getImageData_after_zero_canvas();
michael@0 24884 } catch(e) {
michael@0 24885 throw e;
michael@0 24886 ok(false, "unexpected exception thrown in: test_getImageData_after_zero_canvas");
michael@0 24887 }
michael@0 24888 try {
michael@0 24889 test_linedash();
michael@0 24890 } catch(e) {
michael@0 24891 throw e;
michael@0 24892 ok(false, "unexpected exception thrown in: test_linedash");
michael@0 24893 }
michael@0 24894 try {
michael@0 24895 test_opaque();
michael@0 24896 } catch(e) {
michael@0 24897 throw e;
michael@0 24898 ok(false, "unexpected exception thrown in: test_opaque");
michael@0 24899 }
michael@0 24900 try {
michael@0 24901 // run this test last since it replaces the getContext method
michael@0 24902 test_type_replace();
michael@0 24903 } catch (e) {
michael@0 24904 ok(false, "unexpected exception thrown in: test_type_replace");
michael@0 24905 }
michael@0 24906
michael@0 24907 //run the asynchronous tests
michael@0 24908 try {
michael@0 24909 test_2d_drawImage_animated_apng();
michael@0 24910 } catch (e) {
michael@0 24911 ok(false, "unexpected exception thrown in: test_2d_drawImage_animated_apng");
michael@0 24912 }
michael@0 24913 try {
michael@0 24914 test_2d_drawImage_animated_gif();
michael@0 24915 } catch (e) {
michael@0 24916 ok(false, "unexpected exception thrown in: test_2d_drawImage_animated_gif");
michael@0 24917 }
michael@0 24918
michael@0 24919 setTimeout(asyncTestsDone, 500);
michael@0 24920 }
michael@0 24921
michael@0 24922 addLoadEvent(runTests);
michael@0 24923
michael@0 24924 </script>

mercurial