testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html
author Emilio Cobos Álvarez <emilio@crisal.io>
Thu, 10 Jul 2025 09:08:54 +0000 (91 minutes ago)
changeset 795952 1d422913e1cb1658224a2d269f8e4c9e80032d29
parent 752939 1996e4a4973941fa87e76e5646d5bb0088c0de84
permissions -rw-r--r--
Bug 1976623 - Create drag popups eagerly for now. r=tnikkel,layout-reviewers Trivially restores pre-regression behavior, for now. Differential Revision: https://phabricator.services.mozilla.com/D256769
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<title>OffscreenCanvas test: 2d.path.clip.winding.1</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>

<h1>2d.path.clip.winding.1</h1>
<p class="desc"></p>


<script>
var t = async_test("");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
    throw reason;
});
t.step(function() {

  var canvas = new OffscreenCanvas(100, 50);
  var ctx = canvas.getContext('2d');

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

  ctx.beginPath();
  ctx.moveTo(-10, -10);
  ctx.lineTo(110, -10);
  ctx.lineTo(110, 60);
  ctx.lineTo(-10, 60);
  ctx.lineTo(-10, -10);
  ctx.lineTo(0, 0);
  ctx.lineTo(0, 50);
  ctx.lineTo(100, 50);
  ctx.lineTo(100, 0);
  ctx.clip();

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

  _assertPixel(canvas, 50,25, 0,255,0,255);
  t.done();

});
</script>