chromium/third_party/blink/web_tests/external/wpt/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.same.html

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>Canvas test: 2d.canvas.host.initial.reset.same</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
<body class="show_output">

<h1>2d.canvas.host.initial.reset.same</h1>
<p class="desc">Setting size (not changing the value) resets canvas to transparent black</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("Setting size (not changing the value) resets canvas to transparent black");
_addTest(function(canvas, ctx) {

  canvas.width = 100;
  ctx.fillStyle = '#f00';
  ctx.fillRect(0, 0, 50, 50);
  _assertPixel(canvas, 20,20, 255,0,0,255);
  canvas.width = 100;
  _assertPixel(canvas, 20,20, 0,0,0,0);

});
</script>