Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>CanvasRenderingContext 2D with alpha=flase context creation parameter is re-initialized with solid black.</title>
<link rel="author" title="Justin Novosad" href="mailto:junov@chromium.org">
<link rel="match" href="reset_color_alpha_false-ref.html">
<meta name="assert" content="Canvas pixels are re-initialized to opaque black upon context reset.">
<p>Test passes if a 100x100 black square is displayed below.</p>
<canvas id="c" width=100 height=100></canvas>
<script>
const canvas = document.getElementById("c");
const ctx = canvas.getContext("2d", {alpha: false});
ctx.fillColor = 'red';
ctx.fillRect(25, 25, 50, 50);
canvas.width = canvas.width;
</script>