https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 4c581fe88602762273f350d08ccc7371bd1c2c62 authored by Jake Archibald on 10 April 2018, 07:01:54 UTC
Testing "attack 4" & refactoring
Tip revision: 4c581fe
2d.clearRect.clip.html
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.clearRect.clip</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>

<h1>2d.clearRect.clip</h1>
<p class="desc">clearRect is affected by clipping regions</p>


<script>
var t = async_test("clearRect is affected by clipping regions");
t.step(function() {

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

ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
ctx.beginPath();
ctx.rect(0, 0, 16, 16);
ctx.clip();
ctx.clearRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 16, 16);
_assertPixel(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");

t.done();

});
</script>
back to top