Bug 1632041 [wpt PR 23163] - Move 2d.getImageData.* in canvas_api to wpt, a=testonly
Automatic update from web-platform-tests Move 2d.getImageData.* in canvas_api to wpt Move 2d.getImageData.* from canvas_api to wpt. Bug: 1071659 Change-Id: I444088c44eb6f93d4800175deef05f99bfc8e98c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159913 Commit-Queue: Yi Xu <yiyix@chromium.org> Reviewed-by: Fernando Serboncini <fserb@chromium.org> Cr-Commit-Position: refs/heads/master@{#763137} -- wpt-commits: 9d33bb0defdd1625a3af3fe066b1acfc80b23895 wpt-pr: 23163
До Ширина: | Высота: | Размер: 1.5 KiB После Ширина: | Высота: | Размер: 1.1 KiB |
До Ширина: | Высота: | Размер: 1.5 KiB После Ширина: | Высота: | Размер: 1.1 KiB |
До Ширина: | Высота: | Размер: 1.5 KiB После Ширина: | Высота: | Размер: 1.1 KiB |
До Ширина: | Высота: | Размер: 2.0 KiB После Ширина: | Высота: | Размер: 1.6 KiB |
|
@ -0,0 +1,27 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- DO NOT EDIT! This test has been generated by /2dcontext/tools/gentest.py. -->
|
||||||
|
<title>Canvas test: 2d.imageData.get.large.crash</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="/2dcontext/resources/canvas-tests.js"></script>
|
||||||
|
<link rel="stylesheet" href="/2dcontext/resources/canvas-tests.css">
|
||||||
|
<body class="show_output">
|
||||||
|
|
||||||
|
<h1>2d.imageData.get.large.crash</h1>
|
||||||
|
<p class="desc">Test that canvas crash when image data cannot be allocated.</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("Test that canvas crash when image data cannot be allocated.");
|
||||||
|
_addTest(function(canvas, ctx) {
|
||||||
|
|
||||||
|
assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); });
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- DO NOT EDIT! This test has been generated by /2dcontext/tools/gentest.py. -->
|
||||||
|
<title>Canvas test: 2d.imageData.get.rounding</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="/2dcontext/resources/canvas-tests.js"></script>
|
||||||
|
<link rel="stylesheet" href="/2dcontext/resources/canvas-tests.css">
|
||||||
|
<body class="show_output">
|
||||||
|
|
||||||
|
<h1>2d.imageData.get.rounding</h1>
|
||||||
|
<p class="desc">Test the handling of non-integer source coordinates in getImageData().</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("Test the handling of non-integer source coordinates in getImageData().");
|
||||||
|
_addTest(function(canvas, ctx) {
|
||||||
|
|
||||||
|
function testDimensions(sx, sy, sw, sh, width, height)
|
||||||
|
{
|
||||||
|
imageData = ctx.getImageData(sx, sy, sw, sh);
|
||||||
|
_assert(imageData.width == width, "imageData.width == width");
|
||||||
|
_assert(imageData.height == height, "imageData.height == height");
|
||||||
|
}
|
||||||
|
|
||||||
|
testDimensions(0, 0, 20, 10, 20, 10);
|
||||||
|
|
||||||
|
testDimensions(.1, .2, 20, 10, 20, 10);
|
||||||
|
testDimensions(.9, .8, 20, 10, 20, 10);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -50,7 +50,6 @@ _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
|
||||||
ctx.filter = 'blur( 5px)';
|
ctx.filter = 'blur( 5px)';
|
||||||
assert_equals(ctx.filter, 'blur( 5px)');
|
assert_equals(ctx.filter, 'blur( 5px)');
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -9732,6 +9732,38 @@
|
||||||
expected: green
|
expected: green
|
||||||
|
|
||||||
|
|
||||||
|
- name: 2d.imageData.get.large.crash
|
||||||
|
desc: Test that canvas crash when image data cannot be allocated.
|
||||||
|
testing:
|
||||||
|
- 2d.getImageData
|
||||||
|
code: |
|
||||||
|
@assert throws TypeError ctx.getImageData(10, 0xffffffff, 2147483647, 10);
|
||||||
|
|
||||||
|
- name: 2d.imageData.get.rounding
|
||||||
|
desc: Test the handling of non-integer source coordinates in getImageData().
|
||||||
|
testing:
|
||||||
|
- 2d.getImageData
|
||||||
|
code: |
|
||||||
|
function testDimensions(sx, sy, sw, sh, width, height)
|
||||||
|
{
|
||||||
|
imageData = ctx.getImageData(sx, sy, sw, sh);
|
||||||
|
@assert imageData.width == width;
|
||||||
|
@assert imageData.height == height;
|
||||||
|
}
|
||||||
|
|
||||||
|
testDimensions(0, 0, 20, 10, 20, 10);
|
||||||
|
|
||||||
|
testDimensions(.1, .2, 20, 10, 20, 10);
|
||||||
|
testDimensions(.9, .8, 20, 10, 20, 10);
|
||||||
|
|
||||||
|
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.object.properties
|
- name: 2d.imageData.object.properties
|
||||||
desc: ImageData objects have the right properties
|
desc: ImageData objects have the right properties
|
||||||
testing:
|
testing:
|
||||||
|
@ -10363,6 +10395,4 @@
|
||||||
@assert ctx.filter == 'blur(5px)';
|
@assert ctx.filter == 'blur(5px)';
|
||||||
|
|
||||||
ctx.filter = 'blur( 5px)';
|
ctx.filter = 'blur( 5px)';
|
||||||
assert_equals(ctx.filter, 'blur( 5px)');
|
assert_equals(ctx.filter, 'blur( 5px)');
|
||||||
|
|
||||||
|
|