blob: 6fba4106ceac3c185a10393858f419bad2f72aeb [file] [log] [blame]
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>OffscreenCanvas test: initial.reset.different</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<h1>initial.reset.different</h1>
<p class="desc">Changing size resets canvas to transparent black</p>
<script>
var t = async_test("Changing size resets canvas to transparent black");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
});
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(offscreenCanvas, 20,20, 255,0,0,255, "20,20", "255,0,0,255");
offscreenCanvas.width = 50;
_assertPixel(offscreenCanvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
t.done();
});
</script>