testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html
author Lando <lando@lando.test>
Thu, 10 Jul 2025 16:11:40 +0000 (3 hours ago)
changeset 795966 8f464d9c468ba1a7c1b0338deaa8bc8023f8ae3d
parent 752939 1996e4a4973941fa87e76e5646d5bb0088c0de84
permissions -rw-r--r--
Merge autoland to mozilla-central
<!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>