diff --git a/2dcontext/pixel-manipulation/2d.imageData.create2.round.html b/2dcontext/pixel-manipulation/2d.imageData.create2.double.html
similarity index 53%
rename from 2dcontext/pixel-manipulation/2d.imageData.create2.round.html
rename to 2dcontext/pixel-manipulation/2d.imageData.create2.double.html
index 84c2001783bd0c..e8edcf76c1c2b6 100644
--- a/2dcontext/pixel-manipulation/2d.imageData.create2.round.html
+++ b/2dcontext/pixel-manipulation/2d.imageData.create2.double.html
@@ -1,14 +1,14 @@
-
Canvas test: 2d.imageData.create2.round
+Canvas test: 2d.imageData.create2.double
-2d.imageData.create2.round
-createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)
+2d.imageData.create2.double
+createImageData(w, h) double is converted to long
Actual output:
@@ -16,13 +16,15 @@ 2d.imageData.create2.round
-
-
-
-
-
-2d.imageData.create2.tiny
-createImageData(sw, sh) works for sizes smaller than one pixel
-
-
-Actual output:
-
-
-
-
-
diff --git a/2dcontext/pixel-manipulation/2d.imageData.create2.zero.html b/2dcontext/pixel-manipulation/2d.imageData.create2.zero.html
index c8957caac76322..1c1851b6043956 100644
--- a/2dcontext/pixel-manipulation/2d.imageData.create2.zero.html
+++ b/2dcontext/pixel-manipulation/2d.imageData.create2.zero.html
@@ -22,6 +22,8 @@ 2d.imageData.create2.zero
assert_throws("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); });
assert_throws("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); });
assert_throws("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); });
});
diff --git a/2dcontext/pixel-manipulation/2d.imageData.get.double.html b/2dcontext/pixel-manipulation/2d.imageData.get.double.html
new file mode 100644
index 00000000000000..915c3c2cae5a79
--- /dev/null
+++ b/2dcontext/pixel-manipulation/2d.imageData.get.double.html
@@ -0,0 +1,32 @@
+
+
+Canvas test: 2d.imageData.get.double
+
+
+
+
+
+
+2d.imageData.get.double
+createImageData(w, h) double is converted to long
+
+
+Actual output:
+
+
+
+
+
diff --git a/2dcontext/pixel-manipulation/2d.imageData.get.tiny.html b/2dcontext/pixel-manipulation/2d.imageData.get.tiny.html
deleted file mode 100644
index 982f3f28b6f4cb..00000000000000
--- a/2dcontext/pixel-manipulation/2d.imageData.get.tiny.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-Canvas test: 2d.imageData.get.tiny
-
-
-
-
-
-
-2d.imageData.get.tiny
-getImageData() works for sizes smaller than one pixel
-
-
-Actual output:
-
-
-
-
-
diff --git a/2dcontext/pixel-manipulation/2d.imageData.get.zero.html b/2dcontext/pixel-manipulation/2d.imageData.get.zero.html
index ed152172309aa1..7f231c50b68984 100644
--- a/2dcontext/pixel-manipulation/2d.imageData.get.zero.html
+++ b/2dcontext/pixel-manipulation/2d.imageData.get.zero.html
@@ -22,6 +22,10 @@ 2d.imageData.get.zero
assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); });
assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); });
assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); });
+assert_throws("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); });
});
diff --git a/2dcontext/tools/tests2d.yaml b/2dcontext/tools/tests2d.yaml
index d3e29cf243f7a6..caae293bf30085 100644
--- a/2dcontext/tools/tests2d.yaml
+++ b/2dcontext/tools/tests2d.yaml
@@ -9276,22 +9276,6 @@
isTransparentBlack = false;
@assert isTransparentBlack;
-- name: 2d.imageData.create2.tiny
- desc: createImageData(sw, sh) works for sizes smaller than one pixel
- testing:
- - 2d.imageData.create2.size
- - 2d.imageData.one
- code: |
- var imgdata = ctx.createImageData(0.0001, 0.0001);
- @assert imgdata.data.length === imgdata.width*imgdata.height*4;
- @assert imgdata.width === 1;
- @assert imgdata.height === 1;
- var isTransparentBlack = true;
- for (var i = 0; i < imgdata.data.length; ++i)
- if (imgdata.data[i] !== 0)
- isTransparentBlack = false;
- @assert isTransparentBlack;
-
- name: 2d.imageData.create2.negative
desc: createImageData(sw, sh) takes the absolute magnitude of the size arguments
testing:
@@ -9313,6 +9297,8 @@
@assert throws INDEX_SIZE_ERR ctx.createImageData(10, 0);
@assert throws INDEX_SIZE_ERR ctx.createImageData(0, 10);
@assert throws INDEX_SIZE_ERR ctx.createImageData(0, 0);
+ @assert throws INDEX_SIZE_ERR ctx.createImageData(0.99, 10);
+ @assert throws INDEX_SIZE_ERR ctx.createImageData(10, 0.1);
- name: 2d.imageData.create2.nonfinite
desc: createImageData() throws TypeError if arguments are not finite
@@ -9333,15 +9319,17 @@
code: |
@assert throws TypeError ctx.createImageData(null);
-- name: 2d.imageData.create2.round
- desc: createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)
+- name: 2d.imageData.create2.double
+ desc: createImageData(w, h) double is converted to long
testing:
- - 2d.imageData.createround
+ - 2d.imageData.create2.size
code: |
var imgdata1 = ctx.createImageData(10.01, 10.99);
- var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99);
- @assert imgdata1.width === imgdata2.width;
- @assert imgdata1.height === imgdata2.height;
+ 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.get.basic
desc: getImageData() exists and returns something
@@ -9371,6 +9359,10 @@
@assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 10, 0);
@assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 0, 10);
@assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 0, 0);
+ @assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 0.1, 10);
+ @assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 10, 0.99);
+ @assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, -0.1, 10);
+ @assert throws INDEX_SIZE_ERR ctx.getImageData(1, 1, 10, -0.99);
- name: 2d.imageData.get.nonfinite
desc: getImageData() throws TypeError if arguments are not finite
@@ -9488,15 +9480,17 @@
@assert imgdata2.width > imgdata1.width;
@assert imgdata2.height > imgdata1.height;
-- name: 2d.imageData.get.tiny
- desc: getImageData() works for sizes smaller than one pixel
+- name: 2d.imageData.get.double
+ desc: createImageData(w, h) double is converted to long
testing:
- - 2d.imageData.one
+ - 2d.imageData.get.basic
code: |
- var imgdata = ctx.getImageData(0, 0, 0.0001, 0.0001);
- @assert imgdata.data.length === imgdata.width*imgdata.height*4;
- @assert imgdata.width === 1;
- @assert imgdata.height === 1;
+ var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99);
+ var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99);
+ @assert imgdata1.width === 10;
+ @assert imgdata1.height === 10;
+ @assert imgdata2.width === 10;
+ @assert imgdata2.height === 10;
- name: 2d.imageData.get.nonpremul
desc: getImageData() returns non-premultiplied colours
diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.html b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.html
deleted file mode 100644
index 5f5f0eda6a60b0..00000000000000
--- a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-OffscreenCanvas test: 2d.imageData.create2.tiny
-
-
-
-
-2d.imageData.create2.tiny
-createImageData(sw, sh) works for sizes smaller than one pixel
-
-
-
diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.worker.js
deleted file mode 100644
index c6c74d7abaca25..00000000000000
--- a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.tiny.worker.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// DO NOT EDIT! This test has been generated by tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.imageData.create2.tiny
-// Description:createImageData(sw, sh) works for sizes smaller than one pixel
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/common/canvas-tests.js");
-
-var t = async_test("createImageData(sw, sh) works for sizes smaller than one pixel");
-t.step(function() {
-
-var offscreenCanvas = new OffscreenCanvas(100, 50);
-var ctx = offscreenCanvas.getContext('2d');
-
-var imgdata = ctx.createImageData(0.0001, 0.0001);
-_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4");
-_assertSame(imgdata.width, 1, "imgdata.width", "1");
-_assertSame(imgdata.height, 1, "imgdata.height", "1");
-var isTransparentBlack = true;
-for (var i = 0; i < imgdata.data.length; ++i)
- if (imgdata.data[i] !== 0)
- isTransparentBlack = false;
-_assert(isTransparentBlack, "isTransparentBlack");
-
-t.done();
-
-});
-done();
diff --git a/offscreen-canvas/tools/tests2d.yaml b/offscreen-canvas/tools/tests2d.yaml
index 0a1befbb37b068..fc3b1587bd106e 100644
--- a/offscreen-canvas/tools/tests2d.yaml
+++ b/offscreen-canvas/tools/tests2d.yaml
@@ -4936,22 +4936,6 @@
isTransparentBlack = false;
@assert isTransparentBlack;
-- name: 2d.imageData.create2.tiny
- desc: createImageData(sw, sh) works for sizes smaller than one pixel
- testing:
- - 2d.imageData.create2.size
- - 2d.imageData.one
- code: |
- var imgdata = ctx.createImageData(0.0001, 0.0001);
- @assert imgdata.data.length === imgdata.width*imgdata.height*4;
- @assert imgdata.width === 1;
- @assert imgdata.height === 1;
- var isTransparentBlack = true;
- for (var i = 0; i < imgdata.data.length; ++i)
- if (imgdata.data[i] !== 0)
- isTransparentBlack = false;
- @assert isTransparentBlack;
-
- name: 2d.imageData.create2.negative
desc: createImageData(sw, sh) takes the absolute magnitude of the size arguments
testing: