blob: cf6594c62f83194ffef48e8a4ff7d0099e648bb4 [file] [log] [blame]
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.drawImage.path</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/2dcontext/resources/canvas-tests.js"></script>
<h1>2d.drawImage.path</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.fillStyle = '#0f0';
ctx.rect(0, 0, 100, 50);
var promise = new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open("GET", '/images/red.png');
xhr.responseType = 'blob';
xhr.send();
xhr.onload = function() {
resolve(xhr.response);
};
});
promise.then(function(response) {
ctx.drawImage(response, 0, 0);
ctx.fill();
_assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
});
t.done();
});
</script>