https://github.com/web-platform-tests/wpt
Raw File
Tip revision: e2dc266c6bd1d441938dfe828d552542a0c0b2b7 authored by Geoffrey Sneddon on 09 April 2018, 14:44:16 UTC
fixup! Fix #2669: Add alternate_hosts
Tip revision: e2dc266
2d.transformation.scale.negative.html
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.transformation.scale.negative</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>

<h1>2d.transformation.scale.negative</h1>
<p class="desc">scale() with negative scale factors works</p>


<script>
var t = async_test("scale() with negative scale factors works");
t.step(function() {

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

ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.save();
ctx.scale(-1, 1);
ctx.fillStyle = '#0f0';
ctx.fillRect(-50, 0, 50, 50);
ctx.restore();
ctx.save();
ctx.scale(1, -1);
ctx.fillStyle = '#0f0';
ctx.fillRect(50, -50, 50, 50);
ctx.restore();
_assertPixel(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255");
_assertPixel(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255");

t.done();

});
</script>
back to top