gecko/image/test/mochitest/test_bug733553.html

71 lines
1.9 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=733553
-->
<head>
<title>Test for Bug 733553</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=733553">Mozilla Bug 733553</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var testIndex = 0;
var testParts = [
[1, "red.png"],
[40, "animated-gif2.gif"],
[1, "red.png"],
[100, "lime100x100.svg"],
[40, "animated-gif2.gif"],
[1, "red.png"]
];
// We'll append the part number to this, and tell the informant
const BASE_URL = "bug733553-informant.sjs?";
function initializeOnload() {
var iframeelem = document.getElementById('test-iframe');
var firstimg = iframeelem.contentDocument.getElementById('image1');
firstimg.addEventListener("load", imageLoad, false);
}
function readyForNext() {
var loader = document.getElementById("loader");
if (loader) {
testIndex++;
loader.src = BASE_URL + testIndex;
}
}
function imageLoad(aEvent) {
if (testParts.length > testIndex) {
var [width, fileName] = testParts[testIndex];
if (aEvent.target.width == width) {
is(aEvent.target.width, width,
"Test " + testIndex + " " + fileName + " width correct");
readyForNext();
}
} else {
aEvent.target.removeEventListener("load", imageLoad, false);
var loader = document.getElementById("loader");
readyForNext();
SimpleTest.finish();
}
}
</script>
</pre>
<div id="content"> <!-- style="display: none" -->
<iframe id="test-iframe" src="http://mochi.test:8888/tests/image/test/mochitest/bug733553-iframe.html" onload="initializeOnload()"></iframe>
<iframe id="loader"></iframe>
</div>
</body>
</html>