testing/web-platform/tests/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.html
author Cosmin Sabou <csabou@mozilla.com>
Sat, 12 Jul 2025 09:18:08 +0300 (9 hours ago)
changeset 796290 5ad1f0c58c82bdfa2f42fed870bbe143465398d0
parent 752939 1996e4a4973941fa87e76e5646d5bb0088c0de84
permissions -rw-r--r--
Revert "Bug 1977019 - re-enable hw video decoding testing. r=media-playback-reviewers,jolin" for causing win mda failures on test_hw_video_decoding.html This reverts commit 158474bdc0cf585b701bc47921f0a7d84f7bb84d.
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<title>Canvas test: 2d.gradient.interpolate.zerosize.strokeRect</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.gradient.interpolate.zerosize.strokeRect</h1>
<p class="desc"></p>


<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("");
_addTest(function(canvas, ctx) {

  ctx.fillStyle = '#0f0';
  ctx.fillRect(0, 0, 100, 50);

  var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction)
  g.addColorStop(0, '#f00');
  g.addColorStop(1, '#f00');
  ctx.strokeStyle = g;
  ctx.strokeRect(20, 20, 60, 10);
  _assertPixel(canvas, 19,19, 0,255,0,255);
  _assertPixel(canvas, 20,19, 0,255,0,255);
  _assertPixel(canvas, 21,19, 0,255,0,255);
  _assertPixel(canvas, 19,20, 0,255,0,255);
  _assertPixel(canvas, 20,20, 0,255,0,255);
  _assertPixel(canvas, 21,20, 0,255,0,255);
  _assertPixel(canvas, 19,21, 0,255,0,255);
  _assertPixel(canvas, 20,21, 0,255,0,255);
  _assertPixel(canvas, 21,21, 0,255,0,255);

});
</script>