Bug 1635004 [wpt PR 23378] - Move more tests from non-wpt to wpt, a=testonly
authorYi Xu <yiyix@chromium.org>
Wed, 13 May 2020 03:59:52 +0000
changeset 531035 31f8fb052fa3c6aad2168f8149f386dcbe343e39
parent 531034 8e076e55467160c0eec3d9a304bae1117e193287
child 531036 591dbff92d7ffe8983a1964898bc7fd464590eb9
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1635004, 23378, 2169370, 764975
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1635004 [wpt PR 23378] - Move more tests from non-wpt to wpt, a=testonly Automatic update from web-platform-tests Move more tests from non-wpt to wpt Change-Id: I6b39eab08c686f05c13707d937bc670b82dd04e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2169370 Commit-Queue: Yi Xu <yiyix@chromium.org> Reviewed-by: Fernando Serboncini <fserb@chromium.org> Cr-Commit-Position: refs/heads/master@{#764975} -- wpt-commits: 7ef67f2d8c667d7f5a828fa0f6878ed45d1432d8 wpt-pr: 23378
testing/web-platform/tests/html/canvas/element/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.large.png
testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arc.negative.html
testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html
testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html
testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html
testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html
testing/web-platform/tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html
testing/web-platform/tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html
testing/web-platform/tests/html/canvas/tools/tests2d.yaml
index 1e313371d828e9f5edf61480e64ea5c689653fca..70d7b046cb226cfcb2bfeebe3477d3b580d8270a
GIT binary patch
literal 1137
zc$@)o1djWOP)<h;3K|Lk000e1NJLTq003kF001%w0ssI2C0FU`00006VoOIv0RI60
z0RN!9r;`8x1SUyDK~!jg?U-9=R7V)cf4eot)C*QCRtZ)`Ew;ACTG6NvQd%V<4OCGS
z32hMzy_i0Dp-LzeydW6x%?tWauhl4u5Nqv?LIa^*NJ&d;THBCntw}?Sw-`;f59Ql_
zXZOt6Io-2cALhq-n9Tg=Ki_^ibLIjLhr{7;I2;bg!^r|j1U|Rm8k~n6Fdt&p&byV#
z;*e1dhUIV=zK2%mhO5v3d*D^*pGOl98IzUr)WKK_+al;tz0O+4^9Z~JZGkbg!MlO~
zwn$8T2%D?~w7{rLwo65P4-(L0m*O~lY#qi&5YL%O=4ACrYmLEUPz<j?y;7dYWP4ha
z)l%4K5zHzz#CNa)CO{zo{h<Wjhigi+I%g*S1Sd<=7d}_w$!6t9cmN4#f-%qw3AmEU
zzYwm7c?}d8WJBS+no0w5U}D5RS-^Pc5%Gs+*&5O81mIiwvpmrJMUi#Fpg`p~ncWFk
zkpq)ZQ`1Nj)JwU<EUS>hKeM$){!EL>!vrZ@gw8<a&u~V{&*#9z;<d5kGL!-^!XTIm
zlK{8@UjR@8TL377V))(A@qrYIEy6esarg@wa$sU4)HDS4iTE3XV7mzRsLJHxP-S+W
zr6O5s8GUX{jD$_rIT0W6Yb}85BABD<-;v7S%-@3;G>WVnw!yfNza=UYBcYP@jQYT@
z@)MLxYqK{gk3+XK%`^MYggf4S(2uYk%Ip`ch)n#kPnKS8yA0o~V<Om;)^t*>=mE@y
ztA4x3`%nj)V7A4!I}#Hgf|Jz`hC?ZA@D5+?XEjtU#!siUE>yE)cwk6FV6%7MnDR8k
zI@xFD)FhSvaNIcuMSfOqD?vJi&@O_t7J(JOORyCh3}O5P)AC~SFQJmv0|(7BKe^<+
zXAtZV!KIM1U<6dae)!WH&rNtXpC%cT)egTvEqnk^nSCazF7<HM?`c$;Io3Z?6NA}s
zM)`b}Pm{1)2NRn^&gBDHj1_}z%IdkinM9JTIJAUJ)?FB)9HzrwI0bv{M(nE=oYx{X
z2_lkYy(|v*yeUZMNwrg}RP~Fb@{akcAcf>D(E3PCfM^cVCXy%TPoX_f*$iJxS)Z#f
zNTCRp*bVxG6j~xR2_pM9YarYfhvgRfH`Iuws{W!>{%Ss@Cz&DFWC`z{E)o+X*(d9D
z_3{t2&<|3_5q;QRq9Xaho5vJN)D7P!-lj-QjAWmzucZ4?>n?|+%Pn<97gMLD1oT2J
ztb`I63BzC_EQ7=9tJjrw6%~nzkt~xnTD{4Otb3KILElvMk3y~WdfEjG{mdgV@h8h<
zRY~7Y!x_kzKJbThOgS6Hp%Pj%{m3r^cgT^L_>fJqV$dXg_l4|Rt;U^_)>;IMVHecF
zCFp=IXqG#J7wm?J#KhrnI2;a#!{Kl^91e%W@jvl5XF~slY@&Fz00000NkvXXu0mjf
Ddixa5
--- a/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arc.negative.html
+++ b/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arc.negative.html
@@ -15,13 +15,15 @@
 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
 
 <ul id="d"></ul>
 <script>
 var t = async_test("arc() with negative radius throws INDEX_SIZE_ERR");
 _addTest(function(canvas, ctx) {
 
 assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); });
+var path = new Path2D();
+assert_throws_dom("INDEX_SIZE_ERR", function() { path.arc(10, 10, -5, 0, 1, false); });
 
 
 });
 </script>
 
--- a/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html
+++ b/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html
@@ -15,13 +15,15 @@
 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
 
 <ul id="d"></ul>
 <script>
 var t = async_test("arcTo() with negative radius throws an exception");
 _addTest(function(canvas, ctx) {
 
 assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); });
+var path = new Path2D();
+assert_throws_dom("INDEX_SIZE_ERR", function() { path.arcTo(10, 10, 20, 20, -5); });
 
 
 });
 </script>
 
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.path.isPointInPath.basic</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.path.isPointInPath.basic</h1>
+<p class="desc">Verify the winding rule in isPointInPath works for for rect path.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Verify the winding rule in isPointInPath works for for rect path.");
+_addTest(function(canvas, ctx) {
+
+canvas.width = 200;
+canvas.height = 200;
+
+// Testing default isPointInPath
+ctx.beginPath();
+ctx.rect(0, 0, 100, 100);
+ctx.rect(25, 25, 50, 50);
+_assertSame(ctx.isPointInPath(50, 50), true, "ctx.isPointInPath(50, 50)", "true");
+_assertSame(ctx.isPointInPath(NaN, 50), false, "ctx.isPointInPath(NaN, 50)", "false");
+_assertSame(ctx.isPointInPath(50, NaN), false, "ctx.isPointInPath(50, NaN)", "false");
+
+// Testing nonzero isPointInPath
+ctx.beginPath();
+ctx.rect(0, 0, 100, 100);
+ctx.rect(25, 25, 50, 50);
+_assertSame(ctx.isPointInPath(50, 50, 'nonzero'), true, "ctx.isPointInPath(50, 50, 'nonzero')", "true");
+
+// Testing evenodd isPointInPath
+ctx.beginPath();
+ctx.rect(0, 0, 100, 100);
+ctx.rect(25, 25, 50, 50);
+_assertSame(ctx.isPointInPath(50, 50, 'evenodd'), false, "ctx.isPointInPath(50, 50, 'evenodd')", "false");
+
+// Testing extremely large scale
+ctx.save();
+ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE);
+ctx.beginPath();
+ctx.rect(-10, -10, 20, 20);
+_assertSame(ctx.isPointInPath(0, 0, 'nonzero'), true, "ctx.isPointInPath(0, 0, 'nonzero')", "true");
+_assertSame(ctx.isPointInPath(0, 0, 'evenodd'), true, "ctx.isPointInPath(0, 0, 'evenodd')", "true");
+ctx.restore();
+
+// Check with non-invertible ctm.
+ctx.save();
+ctx.scale(0, 0);
+ctx.beginPath();
+ctx.rect(-10, -10, 20, 20);
+_assertSame(ctx.isPointInPath(0, 0, 'nonzero'), false, "ctx.isPointInPath(0, 0, 'nonzero')", "false");
+_assertSame(ctx.isPointInPath(0, 0, 'evenodd'), false, "ctx.isPointInPath(0, 0, 'evenodd')", "false");
+ctx.restore();
+
+
+});
+</script>
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.path.isPointInpath.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.path.isPointInpath.invalid</h1>
+<p class="desc">Verify isPointInPath throws exceptions with invalid inputs.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Verify isPointInPath throws exceptions with invalid inputs.");
+_addTest(function(canvas, ctx) {
+
+canvas.width = 200;
+canvas.height = 200;
+path = new Path2D();
+path.rect(0, 0, 100, 100);
+path.rect(25, 25, 50, 50);
+// Testing invalid enumeration isPointInPath (w/ and w/o Path object');
+assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); });
+
+// Testing invalid type isPointInPath with Path object');
+assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); });
+assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); });
+
+
+});
+</script>
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.path.isPointInpath.multi.path</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.path.isPointInpath.multi.path</h1>
+<p class="desc">Verify the winding rule in isPointInPath works for path object.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Verify the winding rule in isPointInPath works for path object.");
+_addTest(function(canvas, ctx) {
+
+canvas.width = 200;
+canvas.height = 200;
+
+// Testing default isPointInPath with Path object');
+path = new Path2D();
+path.rect(0, 0, 100, 100);
+path.rect(25, 25, 50, 50);
+_assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true");
+_assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true");
+_assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false");
+_assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false");
+
+// Testing nonzero isPointInPath with Path object');
+path = new Path2D();
+path.rect(0, 0, 100, 100);
+path.rect(25, 25, 50, 50);
+_assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true");
+
+// Testing evenodd isPointInPath with Path object');
+path = new Path2D();
+path.rect(0, 0, 100, 100);
+path.rect(25, 25, 50, 50);
+assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd'));
+
+
+});
+</script>
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.imageData.create.and.resize</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.imageData.create.and.resize</h1>
+<p class="desc">Verify no crash when resizing an image bitmap to zero.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Verify no crash when resizing an image bitmap to zero.");
+_addTest(function(canvas, ctx) {
+
+var image = new Image();
+image.onload = t.step_func(function() {
+  var options = { resizeHeight: 0 };
+  var p1 = createImageBitmap(image, options);
+  p1.catch(function(error){});
+  t.done();
+});
+image.src = 'red.png';
+
+
+});
+</script>
+<img src="/images/red.png" id="red.png" class="resource">
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.imageData.get.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.imageData.get.invalid</h1>
+<p class="desc">Verify getImageData() behavior in invalid cases.</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("Verify getImageData() behavior in invalid cases.");
+_addTest(function(canvas, ctx) {
+
+imageData = ctx.getImageData(0,0,2,2);
+var testValues = [NaN, true, false, "\"garbage\"", "-1",
+                  "0", "1", "2", Infinity, -Infinity,
+                  -5, -0.5, 0, 0.5, 5,
+                  5.4, 255, 256, null, undefined];
+var testResults = [0, 1, 0, 0, 0,
+                   0, 1, 2, 255, 0,
+                   0, 0, 0, 0, 5,
+                   5, 255, 255, 0, 0];
+for (var i = 0; i < testValues.length; i++) {
+    imageData.data[0] = testValues[i];
+    _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]");
+}
+imageData.data['foo']='garbage';
+_assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'");
+imageData.data[-1]='garbage';
+_assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined");
+imageData.data[17]='garbage';
+_assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined");
+
+
+});
+</script>
+
--- a/testing/web-platform/tests/html/canvas/tools/tests2d.yaml
+++ b/testing/web-platform/tests/html/canvas/tools/tests2d.yaml
@@ -6908,16 +6908,18 @@
   expected: green
 
 - name: 2d.path.arcTo.negative
   desc: arcTo() with negative radius throws an exception
   testing:
     - 2d.path.arcTo.negative
   code: |
     @assert throws INDEX_SIZE_ERR ctx.arcTo(0, 0, 0, 0, -1);
+    var path = new Path2D();
+    @assert throws INDEX_SIZE_ERR path.arcTo(10, 10, 20, 20, -5);
 
 - name: 2d.path.arcTo.zero.1
   desc: arcTo() with zero radius draws a straight line from P0 to P1
   testing:
     - 2d.path.arcTo.zeroradius
   code: |
     ctx.fillStyle = '#f00';
     ctx.fillRect(0, 0, 100, 50);
@@ -7419,16 +7421,18 @@
   expected: green
 
 - name: 2d.path.arc.negative
   desc: arc() with negative radius throws INDEX_SIZE_ERR
   testing:
     - 2d.path.arc.negative
   code: |
     @assert throws INDEX_SIZE_ERR ctx.arc(0, 0, -1, 0, 0, true);
+    var path = new Path2D();
+    @assert throws INDEX_SIZE_ERR path.arc(10, 10, -5, 0, 1, false);
 
 - name: 2d.path.arc.zeroradius
   desc: arc() with zero radius draws a line to the start point
   testing:
     - 2d.path.arc.zero
   code: |
     ctx.fillStyle = '#f00'
     ctx.fillRect(0, 0, 100, 50);
@@ -9487,16 +9491,32 @@
   code: |
     var imgdata1 = ctx.createImageData(10.01, 10.99);
     var imgdata2 = ctx.createImageData(-10.01, -10.99);
     @assert imgdata1.width === 10;
     @assert imgdata1.height === 10;
     @assert imgdata2.width === 10;
     @assert imgdata2.height === 10;
 
+- name: 2d.imageData.create.and.resize
+  desc: Verify no crash when resizing an image bitmap to zero.
+  testing:
+    - 2d.imageData.resize
+  images:
+    - red.png
+  code: |
+    var image = new Image();
+    image.onload = t.step_func(function() {
+      var options = { resizeHeight: 0 };
+      var p1 = createImageBitmap(image, options);
+      p1.catch(function(error){});
+      t.done();
+    });
+    image.src = 'red.png';
+
 - name: 2d.imageData.get.basic
   desc: getImageData() exists and returns something
   testing:
     - 2d.imageData.get.basic
   code: |
     @assert ctx.getImageData(0, 0, 100, 50) !== null;
 
 - name: 2d.imageData.get.type
@@ -9816,16 +9836,41 @@
     testDimensions(0, 0, 20.9, 10.9, 20, 10);
     testDimensions(0, 0, 20.1, 10.1, 20, 10);
 
     testDimensions(-1, -1, 20, 10, 20, 10);
 
     testDimensions(-1.1, 0, 20, 10, 20, 10);
     testDimensions(-1.9,  0, 20, 10, 20, 10);
 
+- name: 2d.imageData.get.invalid
+  desc: Verify getImageData() behavior in invalid cases.
+  testing:
+    - 2d.imageData.get.invalid
+  code: |
+    imageData = ctx.getImageData(0,0,2,2);
+    var testValues = [NaN, true, false, "\"garbage\"", "-1",
+                      "0", "1", "2", Infinity, -Infinity,
+                      -5, -0.5, 0, 0.5, 5,
+                      5.4, 255, 256, null, undefined];
+    var testResults = [0, 1, 0, 0, 0,
+                       0, 1, 2, 255, 0,
+                       0, 0, 0, 0, 5,
+                       5, 255, 255, 0, 0];
+    for (var i = 0; i < testValues.length; i++) {
+        imageData.data[0] = testValues[i];
+        @assert imageData.data[0] == testResults[i];
+    }
+    imageData.data['foo']='garbage';
+    @assert imageData.data['foo'] == 'garbage';
+    imageData.data[-1]='garbage';
+    @assert imageData.data[-1] == undefined;
+    imageData.data[17]='garbage';
+    @assert imageData.data[17] == undefined;
+
 - name: 2d.imageData.object.properties
   desc: ImageData objects have the right properties
   testing:
     - 2d.imageData.type
   code: |
     var imgdata = ctx.getImageData(0, 0, 10, 10);
     @assert typeof(imgdata.width) === 'number';
     @assert typeof(imgdata.height) === 'number';
@@ -10395,16 +10440,122 @@
     ctx.rect(4, 8, 16, 32);
     ctx.scrollPathIntoView();
     var rect = canvas.getBoundingClientRect();
     var viewportWidth = document.scrollingElement.clientWidth;
     var canvasWidth = canvas.width;
     @assert Math.round(rect.top) === 100;
     @assert Math.round(rect.right) === viewportWidth + (canvasWidth - 4 - 16);
 
+- name: 2d.path.isPointInPath.basic
+  desc: Verify the winding rule in isPointInPath works for for rect path.
+  testing:
+    - 2d.isPointInPath.basic
+  code: |
+    canvas.width = 200;
+    canvas.height = 200;
+
+    // Testing default isPointInPath
+    ctx.beginPath();
+    ctx.rect(0, 0, 100, 100);
+    ctx.rect(25, 25, 50, 50);
+    @assert ctx.isPointInPath(50, 50) === true;
+    @assert ctx.isPointInPath(NaN, 50) === false;
+    @assert ctx.isPointInPath(50, NaN) === false;
+
+    // Testing nonzero isPointInPath
+    ctx.beginPath();
+    ctx.rect(0, 0, 100, 100);
+    ctx.rect(25, 25, 50, 50);
+    @assert ctx.isPointInPath(50, 50, 'nonzero') === true;
+
+    // Testing evenodd isPointInPath
+    ctx.beginPath();
+    ctx.rect(0, 0, 100, 100);
+    ctx.rect(25, 25, 50, 50);
+    @assert ctx.isPointInPath(50, 50, 'evenodd') === false;
+
+    // Testing extremely large scale
+    ctx.save();
+    ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE);
+    ctx.beginPath();
+    ctx.rect(-10, -10, 20, 20);
+    @assert ctx.isPointInPath(0, 0, 'nonzero') === true;
+    @assert ctx.isPointInPath(0, 0, 'evenodd') === true;
+    ctx.restore();
+
+    // Check with non-invertible ctm.
+    ctx.save();
+    ctx.scale(0, 0);
+    ctx.beginPath();
+    ctx.rect(-10, -10, 20, 20);
+    @assert ctx.isPointInPath(0, 0, 'nonzero') === false;
+    @assert ctx.isPointInPath(0, 0, 'evenodd') === false;
+    ctx.restore();
+
+- name: 2d.path.isPointInpath.multi.path
+  desc: Verify the winding rule in isPointInPath works for path object.
+  testing:
+    - 2d.isPointInPath.basic
+  code: |
+    canvas.width = 200;
+    canvas.height = 200;
+
+    // Testing default isPointInPath with Path object');
+    path = new Path2D();
+    path.rect(0, 0, 100, 100);
+    path.rect(25, 25, 50, 50);
+    @assert ctx.isPointInPath(path, 50, 50) === true;
+    @assert ctx.isPointInPath(path, 50, 50, undefined) === true;
+    @assert ctx.isPointInPath(path, NaN, 50) === false;
+    @assert ctx.isPointInPath(path, 50, NaN) === false;
+
+    // Testing nonzero isPointInPath with Path object');
+    path = new Path2D();
+    path.rect(0, 0, 100, 100);
+    path.rect(25, 25, 50, 50);
+    @assert ctx.isPointInPath(path, 50, 50, 'nonzero') === true;
+
+    // Testing evenodd isPointInPath with Path object');
+    path = new Path2D();
+    path.rect(0, 0, 100, 100);
+    path.rect(25, 25, 50, 50);
+    assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd'));
+
+- name: 2d.path.isPointInpath.invalid
+  desc: Verify isPointInPath throws exceptions with invalid inputs.
+  testing:
+    - 2d.isPointInPath.basic
+  code: |
+    canvas.width = 200;
+    canvas.height = 200;
+    path = new Path2D();
+    path.rect(0, 0, 100, 100);
+    path.rect(25, 25, 50, 50);
+    // Testing invalid enumeration isPointInPath (w/ and w/o Path object');
+    @assert throws TypeError ctx.isPointInPath(path, 50, 50, 'gazonk');
+    @assert throws TypeError ctx.isPointInPath(50, 50, 'gazonk');
+
+    // Testing invalid type isPointInPath with Path object');
+    @assert throws TypeError ctx.isPointInPath(null, 50, 50);
+    @assert throws TypeError ctx.isPointInPath(null, 50, 50, 'nonzero');
+    @assert throws TypeError ctx.isPointInPath(null, 50, 50, 'evenodd');
+    @assert throws TypeError ctx.isPointInPath(null, 50, 50, null);
+    @assert throws TypeError ctx.isPointInPath(path, 50, 50, null);
+    @assert throws TypeError ctx.isPointInPath(undefined, 50, 50);
+    @assert throws TypeError ctx.isPointInPath(undefined, 50, 50, 'nonzero');
+    @assert throws TypeError ctx.isPointInPath(undefined, 50, 50, 'evenodd');
+    @assert throws TypeError ctx.isPointInPath(undefined, 50, 50, undefined);
+    @assert throws TypeError ctx.isPointInPath([], 50, 50);
+    @assert throws TypeError ctx.isPointInPath([], 50, 50, 'nonzero');
+    @assert throws TypeError ctx.isPointInPath([], 50, 50, 'evenodd');
+    @assert throws TypeError ctx.isPointInPath({}, 50, 50);
+    @assert throws TypeError ctx.isPointInPath({}, 50, 50, 'nonzero');
+    @assert throws TypeError ctx.isPointInPath({}, 50, 50, 'evenodd');
+
 - name: 2d.scrollPathIntoView.path
   desc: scrollPathIntoView() with path argument works
   testing:
     - 2d.scrollPathIntoView.basic
   code: |
     var div = document.createElement('div');
     div.style.cssText = 'width: 200vw; height: 200vh';
     document.body.appendChild(div);