Skip to content

Add test for norepeat in circle #53314

Open
@sagudev

Description

@sagudev

When using smaller image as no-repeat pattern in circle, it should show as normal image, but in firefox it is extended with edge pixels.

I've also constructed a test:

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<title>Canvas test: 2d.pattern.paint.norepeat.outside_arc</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.pattern.paint.norepeat.outside_arc</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 = '#f00';
  ctx.fillRect(0, 0, 100, 50);

  var img = document.getElementById('red-16x16.png');
  var pattern = ctx.createPattern(img, 'no-repeat');
  ctx.fillStyle = '#0f0';
  ctx.fillRect(0, 0, 100, 50);

  ctx.fillStyle = pattern;
  ctx.beginPath();
  ctx.arc(0, 0, 50, 0, Math.PI * 2);
  ctx.closePath();
  ctx.fill();

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

  _assertPixel(canvas, 1,1, 0,255,0,255);
  _assertPixel(canvas, 20,1, 0,255,0,255);
  _assertPixel(canvas, 1,20, 0,255,0,255);
  _assertPixel(canvas, 48,48, 0,255,0,255);

});
</script>
<img src="/images/red-16x16.png" id="red-16x16.png" class="resource">

but it needs to be ported into yaml and regen for all canvas variants.

Firefox/servo outputs:

Image

while chrome passes as expected:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions