diff options
Diffstat (limited to 'testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.create1.initial.html')
-rw-r--r-- | testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.create1.initial.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.create1.initial.html b/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.create1.initial.html new file mode 100644 index 000000000..15f67b72b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.create1.initial.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.imageData.create1.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.imageData.create1.initial</h1> +<p class="desc">createImageData(imgdata) returns transparent black data of the right size</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("createImageData(imgdata) returns transparent black data of the right size"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +var imgdata1 = ctx.getImageData(0, 0, 10, 20); +var imgdata2 = ctx.createImageData(imgdata1); +_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); +_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); +_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); + + +}); +</script> + |