summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/conformance-requirements')
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html62
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js57
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html141
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js136
4 files changed, 396 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html
new file mode 100644
index 0000000000..e754e6c6ba
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.conformance.requirements.basics</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.conformance.requirements.basics</h1>
+<p class="desc">void methods return undefined</p>
+
+<p class="notes">Defined in "Web IDL" (draft)
+<script>
+var t = async_test("void methods return undefined");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ _assertSame(ctx.save(), undefined, "ctx.save()", "undefined");
+ _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined");
+ _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined");
+ _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined");
+ _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined");
+ if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
+ _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined");
+ }
+ if (ctx.setTransform) {
+ _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined");
+ _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined");
+ }
+ _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined");
+ _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined");
+ _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined");
+ _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined");
+ _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined");
+ _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined");
+ _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined");
+ _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined");
+ _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined");
+ if (ctx.fillText) {
+ _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined");
+ _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined");
+ }
+ if (ctx.putImageData) {
+ _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined");
+ }
+ _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js
new file mode 100644
index 0000000000..b16a39fd3c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js
@@ -0,0 +1,57 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.conformance.requirements.basics
+// Description:void methods return undefined
+// Note:<p class="notes">Defined in "Web IDL" (draft)
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("void methods return undefined");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ _assertSame(ctx.save(), undefined, "ctx.save()", "undefined");
+ _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined");
+ _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined");
+ _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined");
+ _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined");
+ if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
+ _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined");
+ }
+ if (ctx.setTransform) {
+ _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined");
+ _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined");
+ }
+ _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined");
+ _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined");
+ _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined");
+ _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined");
+ _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined");
+ _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined");
+ _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined");
+ _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined");
+ _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined");
+ if (ctx.fillText) {
+ _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined");
+ _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined");
+ }
+ if (ctx.putImageData) {
+ _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined");
+ }
+ _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined");
+ _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html
new file mode 100644
index 0000000000..fe28a68e90
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html
@@ -0,0 +1,141 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.conformance.requirements.missingargs</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.conformance.requirements.missingargs</h1>
+<p class="desc">Missing arguments cause TypeError</p>
+
+
+<script>
+var t = async_test("Missing arguments cause TypeError");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.scale(); });
+ assert_throws_js(TypeError, function() { ctx.scale(1); });
+ assert_throws_js(TypeError, function() { ctx.rotate(); });
+ assert_throws_js(TypeError, function() { ctx.translate(); });
+ assert_throws_js(TypeError, function() { ctx.translate(0); });
+ if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
+ assert_throws_js(TypeError, function() { ctx.transform(); });
+ assert_throws_js(TypeError, function() { ctx.transform(1); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); });
+ }
+ if (ctx.setTransform) {
+ assert_throws_js(TypeError, function() { ctx.setTransform(1); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); });
+ }
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createPattern(canvas); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.moveTo(); });
+ assert_throws_js(TypeError, function() { ctx.moveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.lineTo(); });
+ assert_throws_js(TypeError, function() { ctx.lineTo(0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.rect(); });
+ assert_throws_js(TypeError, function() { ctx.rect(0); });
+ assert_throws_js(TypeError, function() { ctx.rect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arc(); });
+ assert_throws_js(TypeError, function() { ctx.arc(0); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); });
+ // (6th argument to arc is optional)
+ if (ctx.isPointInPath) {
+ assert_throws_js(TypeError, function() { ctx.isPointInPath(); });
+ assert_throws_js(TypeError, function() { ctx.isPointInPath(0); });
+ }
+ if (ctx.drawFocusRing) {
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(); });
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); });
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); });
+ }
+ if (ctx.fillText) {
+ assert_throws_js(TypeError, function() { ctx.fillText(); });
+ assert_throws_js(TypeError, function() { ctx.fillText('test'); });
+ assert_throws_js(TypeError, function() { ctx.fillText('test', 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeText(); });
+ assert_throws_js(TypeError, function() { ctx.strokeText('test'); });
+ assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); });
+ assert_throws_js(TypeError, function() { ctx.measureText(); });
+ }
+ assert_throws_js(TypeError, function() { ctx.drawImage(); });
+ assert_throws_js(TypeError, function() { ctx.drawImage(canvas); });
+ assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); });
+ // TODO: n >= 3 args on drawImage could be either a valid overload,
+ // or too few for another overload, or too many for another
+ // overload - what should happen?
+ if (ctx.createImageData) {
+ assert_throws_js(TypeError, function() { ctx.createImageData(); });
+ assert_throws_js(TypeError, function() { ctx.createImageData(1); });
+ }
+ if (ctx.getImageData) {
+ assert_throws_js(TypeError, function() { ctx.getImageData(); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); });
+ }
+ if (ctx.putImageData) {
+ var imgdata = ctx.getImageData(0, 0, 1, 1);
+ assert_throws_js(TypeError, function() { ctx.putImageData(); });
+ assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); });
+ assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); });
+ }
+ var g = ctx.createLinearGradient(0, 0, 0, 0);
+ assert_throws_js(TypeError, function() { g.addColorStop(); });
+ assert_throws_js(TypeError, function() { g.addColorStop(0); });
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js
new file mode 100644
index 0000000000..f249fcb881
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js
@@ -0,0 +1,136 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.conformance.requirements.missingargs
+// Description:Missing arguments cause TypeError
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Missing arguments cause TypeError");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.scale(); });
+ assert_throws_js(TypeError, function() { ctx.scale(1); });
+ assert_throws_js(TypeError, function() { ctx.rotate(); });
+ assert_throws_js(TypeError, function() { ctx.translate(); });
+ assert_throws_js(TypeError, function() { ctx.translate(0); });
+ if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
+ assert_throws_js(TypeError, function() { ctx.transform(); });
+ assert_throws_js(TypeError, function() { ctx.transform(1); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); });
+ }
+ if (ctx.setTransform) {
+ assert_throws_js(TypeError, function() { ctx.setTransform(1); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); });
+ }
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); });
+ assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.createPattern(canvas); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.moveTo(); });
+ assert_throws_js(TypeError, function() { ctx.moveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.lineTo(); });
+ assert_throws_js(TypeError, function() { ctx.lineTo(0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.rect(); });
+ assert_throws_js(TypeError, function() { ctx.rect(0); });
+ assert_throws_js(TypeError, function() { ctx.rect(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arc(); });
+ assert_throws_js(TypeError, function() { ctx.arc(0); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); });
+ assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); });
+ // (6th argument to arc is optional)
+ if (ctx.isPointInPath) {
+ assert_throws_js(TypeError, function() { ctx.isPointInPath(); });
+ assert_throws_js(TypeError, function() { ctx.isPointInPath(0); });
+ }
+ if (ctx.drawFocusRing) {
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(); });
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); });
+ assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); });
+ }
+ if (ctx.fillText) {
+ assert_throws_js(TypeError, function() { ctx.fillText(); });
+ assert_throws_js(TypeError, function() { ctx.fillText('test'); });
+ assert_throws_js(TypeError, function() { ctx.fillText('test', 0); });
+ assert_throws_js(TypeError, function() { ctx.strokeText(); });
+ assert_throws_js(TypeError, function() { ctx.strokeText('test'); });
+ assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); });
+ assert_throws_js(TypeError, function() { ctx.measureText(); });
+ }
+ assert_throws_js(TypeError, function() { ctx.drawImage(); });
+ assert_throws_js(TypeError, function() { ctx.drawImage(canvas); });
+ assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); });
+ // TODO: n >= 3 args on drawImage could be either a valid overload,
+ // or too few for another overload, or too many for another
+ // overload - what should happen?
+ if (ctx.createImageData) {
+ assert_throws_js(TypeError, function() { ctx.createImageData(); });
+ assert_throws_js(TypeError, function() { ctx.createImageData(1); });
+ }
+ if (ctx.getImageData) {
+ assert_throws_js(TypeError, function() { ctx.getImageData(); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); });
+ assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); });
+ }
+ if (ctx.putImageData) {
+ var imgdata = ctx.getImageData(0, 0, 1, 1);
+ assert_throws_js(TypeError, function() { ctx.putImageData(); });
+ assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); });
+ assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); });
+ }
+ var g = ctx.createLinearGradient(0, 0, 0, 0);
+ assert_throws_js(TypeError, function() { g.addColorStop(); });
+ assert_throws_js(TypeError, function() { g.addColorStop(0); });
+ t.done();
+});
+done();