summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html')
-rw-r--r--testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html b/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html
new file mode 100644
index 000000000..59e05fbce
--- /dev/null
+++ b/testing/web-platform/tests/2dcontext/pixel-manipulation/2d.imageData.put.unchanged.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
+<title>Canvas test: 2d.imageData.put.unchanged</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.put.unchanged</h1>
+<p class="desc">putImageData(getImageData(...), ...) has no effect</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("putImageData(getImageData(...), ...) has no effect");
+_addTest(function(canvas, ctx) {
+
+var i = 0;
+for (var y = 0; y < 16; ++y) {
+ for (var x = 0; x < 16; ++x, ++i) {
+ ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')';
+ ctx.fillRect(x, y, 1, 1);
+ }
+}
+var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
+var olddata = [];
+for (var i = 0; i < imgdata1.data.length; ++i)
+ olddata[i] = imgdata1.data[i];
+
+ctx.putImageData(imgdata1, 0.1, 0.2);
+
+var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9);
+for (var i = 0; i < imgdata2.data.length; ++i) {
+ _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]");
+}
+
+
+});
+</script>
+