65 lines
1.4 KiB
HTML
65 lines
1.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<script>
|
|
function debug(str) {
|
|
var c = document.getElementById('console')
|
|
c.appendChild(document.createTextNode(str + '\n'));
|
|
}
|
|
|
|
var numErrs = 0;
|
|
|
|
function imageLoaded() {
|
|
if (!i2.complete) {
|
|
debug('FAILURE: image loaded but complete is false!');
|
|
numErrs++;
|
|
}
|
|
|
|
if (i2.width != 52) {
|
|
debug('FAILURE: image width should be 52, was ' + i2.width)
|
|
numErrs++;
|
|
}
|
|
|
|
if (i2.height != 64) {
|
|
debug('FAILURE: image width should be 64, was ' + i2.height)
|
|
numErrs++;
|
|
}
|
|
|
|
if (numErrs == 0) {
|
|
debug('SUCCESS!')
|
|
}
|
|
|
|
if (window.testRunner) {
|
|
testRunner.notifyDone();
|
|
}
|
|
}
|
|
|
|
function runTests() {
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
i1 = new Image();
|
|
if (!i1.complete) {
|
|
debug('FAILURE: Empty image should have complete set to true.');
|
|
numErrs++;
|
|
}
|
|
|
|
i2 = new Image()
|
|
i2.onload = imageLoaded;
|
|
i2.src = 'resources/apple.gif';
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="runTests();">
|
|
<p>
|
|
This tests that the Image JavaScript object works as expected. If the test is successful, the test "SUCCESS" should be shown below.
|
|
</p>
|
|
<pre id="console">
|
|
</pre>
|
|
</body>
|
|
</html>
|