зеркало из https://github.com/mozilla/pjs.git
26 строки
843 B
HTML
26 строки
843 B
HTML
<!DOCTYPE HTML>
|
|
<title>Canvas test: 2d.imageData.get.smallest</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');
|
|
|
|
var imgdata = ctx.getImageData(0, 0, 1, 1);
|
|
ok(imgdata.width > 0, "imgdata.width > 0");
|
|
ok(imgdata.height > 0, "imgdata.height > 0");
|
|
ok(imgdata.data.length === imgdata.width*imgdata.height*4, "imgdata.data.length === imgdata.width*imgdata.height*4");
|
|
|
|
if (!_deferred) SimpleTest.finish();
|
|
});
|
|
</script>
|
|
|