зеркало из https://github.com/mozilla/pjs.git
30 строки
1023 B
HTML
30 строки
1023 B
HTML
<!DOCTYPE HTML>
|
|
<title>Canvas test: 2d.imageData.get.nonpremul</title>
|
|
<script src="/MochiKit/MochiKit.js"></script>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
|
<body>
|
|
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
|
<script>
|
|
var _deferred = false;
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
MochiKit.DOM.addLoadEvent(function () {
|
|
|
|
var canvas = document.getElementById('c');
|
|
var ctx = canvas.getContext('2d');
|
|
|
|
ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
|
|
ctx.fillRect(0, 0, 100, 50);
|
|
var imgdata = ctx.getImageData(10, 10, 10, 10);
|
|
ok(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200");
|
|
ok(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200");
|
|
ok(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200");
|
|
ok(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100");
|
|
ok(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200");
|
|
|
|
if (!_deferred) SimpleTest.finish();
|
|
});
|
|
</script>
|
|
|