blob: 347b8df3f05205d60edca5c6b31d920a61239b65 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 10;
var offscreen = canvas.transferControlToOffscreen();
var ctx = offscreen.getContext('2d');
ctx.fillStyle = '#ff0';
ctx.fillRect(0, 0, 10, 10);
ctx.commit();
var pixel = ctx.getImageData(0, 0, 1, 1).data;
assert_array_equals(pixel, [255, 255, 0, 255]);
}, "Verify that commit() preserves the contents of an OffscreenCanvas with a 2d context.");
</script>