Bug 666446, Part 10/10 - Add mochitests to imagelib for testing animated gif image cases [r=dholbert,joe].

This commit is contained in:
Scott Johnson 2011-11-01 11:06:54 -04:00
parent 467fa16f95
commit 111a0573d5
20 changed files with 915 additions and 0 deletions

View File

@ -93,8 +93,27 @@ _TEST_FILES = imgutils.js \
# test_bug478398.html disabled - See bug 579139
_CHROME_FILES = imgutils.js \
animationPolling.js \
lime-anim-100x100.svg \
animation.svg \
test_animSVGImage.html \
test_animation.html \
animated-gif-finalframe.gif \
animated-gif.gif \
animated-gif2.gif \
purple.gif \
test_svg_animatedGIF.html \
test_bullet_animation.html \
test_background_image_anim.html \
filter.svg \
filter-final.svg \
test_svg_filter_animation.html \
test_xultree_animation.xhtml \
test_changeOfSource.html \
test_changeOfSource2.html \
test_undisplayed_iframe.html \
iframe.html \
ref-iframe.html \
$(NULL)
libs:: $(_TEST_FILES)

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<image id="anim" xlink:href="animated-gif.gif" width="40" height="40"/>
</svg>

After

Width:  |  Height:  |  Size: 170 B

View File

@ -0,0 +1,395 @@
var currentTest;
var gIsImageLoaded = false;
var gIsRefImageLoaded = false;
function pollForSuccess ()
{
if (!currentTest.isTestFinished) {
if (!currentTest.reusingReferenceImage || (currentTest.reusingReferenceImage
&& gRefImageLoaded)) {
currentTest.checkImage();
}
setTimeout(pollForSuccess, currentTest.pollFreq);
}
};
function imageLoadCallback()
{
gIsImageLoaded = true;
}
function referencePoller()
{
currentTest.takeReferenceSnapshot();
}
function reuseImageCallback()
{
gIsRefImageLoaded = true;
}
function failTest ()
{
if (currentTest.isTestFinished || currentTest.closeFunc) {
return;
}
ok(false, "timing out after " + currentTest.timeout + "ms. "
+ "Animated image still doesn't look correct, " + "after call #"
+ currentTest.onStopFrameCounter + " to onStopFrame");
currentTest.wereFailures = true;
currentTest.enableDisplay(document.getElementById(currentTest.debugElementId));
currentTest.cleanUpAndFinish();
};
/**
* Create a new AnimationTest object.
*
* @param pollFreq The amount of time (in ms) to wait between consecutive
* snapshots if the reference image and the test image don't match.
* @param timeout The total amount of time (in ms) to wait before declaring the
* test as failed.
* @param referenceElementId The id attribute of the reference image element, or
* the source of the image to change to, once the reference snapshot has
* been successfully taken. This latter option could be used if you don't
* want the image to become invisible at any time during the test.
* @param imageElementId The id attribute of the test image element.
* @param debugElementId The id attribute of the div where links should be
* appended if the test fails.
* @param cleanId The id attribute of the div or element to use as the 'clean'
* test. This element is only enabled when we are testing to verify that
* the reference image has been loaded. It can be undefined.
* @param srcAttr The location of the source of the image, for preloading. This
* is usually not required, but it useful for preloading reference
* images.
* @param xulTest A boolean value indicating whether or not this is a XUL test
* (uses hidden=true/false rather than display: none to hide/show
* elements).
* @param closeFunc A function that should be called when this test is finished.
* If null, then cleanUpAndFinish() will be called. This can be used to
* chain tests together, so they are all finished exactly once.
* @returns {AnimationTest}
*/
function AnimationTest(pollFreq, timeout, referenceElementId, imageElementId,
debugElementId, cleanId, srcAttr, xulTest, closeFunc)
{
// We want to test the cold loading behavior, so clear cache in case an
// earlier test got our image in there already.
clearImageCache();
this.wereFailures = false;
this.pollFreq = pollFreq;
this.timeout = timeout;
this.imageElementId = imageElementId;
this.referenceElementId = referenceElementId;
if (!document.getElementById(referenceElementId)) {
// In this case, we're assuming the user passed in a string that
// indicates the source of the image they want to change to,
// after the reference image has been taken.
this.reusingImageAsReference = true;
}
this.srcAttr = srcAttr;
this.debugElementId = debugElementId;
this.referenceSnapshot = ""; // value will be set in takeReferenceSnapshot()
this.onStopFrameCounter = 0;
this.isTestFinished = false;
this.numRefsTaken = 0;
this.blankWaitTime = 0;
this.cleanId = cleanId ? cleanId : '';
this.xulTest = xulTest ? xulTest : '';
this.closeFunc = closeFunc ? closeFunc : '';
if (this.srcAttr) {
this.myImage = new Image();
this.myImage.onload = imageLoadCallback;
this.myImage.src = this.srcAttr;
} else {
gIsImageLoaded = true;
}
}
AnimationTest.prototype.outputDebugInfo = function(message, id, dataUri)
{
var debugElement = document.getElementById(this.debugElementId);
var newDataUriElement = document.createElement("a");
newDataUriElement.setAttribute("id", id);
newDataUriElement.setAttribute("href", dataUri);
newDataUriElement.appendChild(document.createTextNode(message));
debugElement.appendChild(newDataUriElement);
var brElement = document.createElement("br");
debugElement.appendChild(brElement);
};
AnimationTest.prototype.isFinished = function()
{
return this.isTestFinished;
};
AnimationTest.prototype.takeCleanSnapshot = function()
{
var cleanElement;
if (this.cleanId) {
cleanElement = document.getElementById(this.cleanId);
}
// Enable clean page comparison element
if (cleanElement) {
this.enableDisplay(cleanElement);
}
// Take a snapshot of the initial (clean) page
this.cleanSnapshot = snapshotWindow(window, false);
// Disable the clean page comparison element
if (cleanElement) {
this.disableDisplay(cleanElement);
}
var dataString1 = "Clean Snapshot";
this.outputDebugInfo(dataString1, 'cleanSnap',
this.cleanSnapshot.toDataURL());
};
AnimationTest.prototype.takeBlankSnapshot = function()
{
// Take a snapshot of the initial (essentially blank) page
this.blankSnapshot = snapshotWindow(window, false);
var dataString1 = "Initial Blank Snapshot";
this.outputDebugInfo(dataString1, 'blank1Snap',
this.blankSnapshot.toDataURL());
};
/**
* Begin the AnimationTest. This will utilize the information provided in the
* constructor to invoke a mochitest on animated images. It will automatically
* fail if allowed to run past the timeout.
*/
AnimationTest.prototype.beginTest = function ()
{
SimpleTest.waitForExplicitFinish();
currentTest = this;
this.takeReferenceSnapshot();
// In case something goes wrong, fail earlier than mochitest timeout,
// and with more information.
setTimeout(failTest, this.timeout);
if (!this.reusingImageAsReference) {
this.disableDisplay(document.getElementById(this.imageElementId));
}
this.setupPolledImage();
setTimeout(pollForSuccess, 10);
};
AnimationTest.prototype.setupPolledImage = function ()
{
// Make sure the image is visible
if (!this.reusingImageAsReference) {
this.enableDisplay(document.getElementById(this.imageElementId));
var currentSnapshot = snapshotWindow(window, false);
var result = compareSnapshots(currentSnapshot, this.referenceSnapshot, true);
var dataString = "Snapshot #" + this.onStopFrameCounter;
this.outputDebugInfo(dataString, 'snap' + this.onStopFrameCounter,
currentSnapshot.toDataURL());
if (result[0]) {
// SUCCESS!
ok(true, "Animated image looks correct, " + "at call #"
+ this.onStopFrameCounter + " to onStopFrame");
this.cleanUpAndFinish();
}
} else {
if (!gIsRefImageLoaded) {
this.myImage = new Image();
this.myImage.onload = reuseImageCallback;
document.getElementById(this.imageElementId).setAttribute('src',
this.referenceElementId);
}
}
}
AnimationTest.prototype.checkImage = function ()
{
if (this.isTestFinished) {
return;
}
this.onStopFrameCounter++;
// We need this for some tests, because we need to force the
// test image to be visible.
if (!this.reusingImageAsReference) {
this.enableDisplay(document.getElementById(this.imageElementId));
}
var currentSnapshot = snapshotWindow(window, false);
var result = compareSnapshots(currentSnapshot, this.referenceSnapshot, true);
var dataString = "Snapshot #" + this.onStopFrameCounter;
this.outputDebugInfo(dataString, 'snap' + this.onStopFrameCounter,
currentSnapshot.toDataURL());
if (result[0]) {
// SUCCESS!
ok(true, "Animated image looks correct, " + "at call #"
+ this.onStopFrameCounter + " to onStopFrame");
this.cleanUpAndFinish();
}
};
AnimationTest.prototype.takeReferenceSnapshot = function ()
{
this.numRefsTaken++;
// Test to make sure the reference image doesn't match a clean snapshot
if (!this.cleanSnapshot) {
this.takeCleanSnapshot();
}
// Used later to verify that the reference div disappeared
if (!this.blankSnapshot) {
this.takeBlankSnapshot();
}
if (this.reusingImageAsReference) {
// Show reference div, & take a snapshot
var referenceDiv = document.getElementById(this.imageElementId);
this.enableDisplay(referenceDiv);
this.referenceSnapshot = snapshotWindow(window, false);
var snapResult = compareSnapshots(this.cleanSnapshot, this.referenceSnapshot,
false);
if (!snapResult[0]) {
if (this.blankWaitTime > 2000) {
// if it took longer than two seconds to load the image, we probably
// have a problem.
this.wereFailures = true;
ok(snapResult[0],
"Reference snapshot shouldn't match clean (non-image) snapshot");
} else {
this.blankWaitTime += 20;
// let's wait a bit and see if it clears up
setTimeout(referencePoller, 20);
return;
}
}
ok(snapResult[0],
"Reference snapshot shouldn't match clean (non-image) snapshot");
var dataString = "Reference Snapshot #" + this.numRefsTaken;
this.outputDebugInfo(dataString, 'refSnapId',
this.referenceSnapshot.toDataURL());
} else {
// Make sure the animation section is hidden
this.disableDisplay(document.getElementById(this.imageElementId));
// Show reference div, & take a snapshot
var referenceDiv = document.getElementById(this.referenceElementId);
this.enableDisplay(referenceDiv);
this.referenceSnapshot = snapshotWindow(window, false);
var snapResult = compareSnapshots(this.cleanSnapshot, this.referenceSnapshot, false);
if (!snapResult[0]) {
if (this.blankWaitTime > 2000) {
// if it took longer than two seconds to load the image, we probably
// have a problem.
this.wereFailures = true;
ok(snapResult[0],
"Reference snapshot shouldn't match clean (non-image) snapshot");
} else {
this.blankWaitTime += 20;
// let's wait a bit and see if it clears up
setTimeout(referencePoller, 20);
return;
}
}
ok(snapResult[0],
"Reference snapshot shouldn't match clean (non-image) snapshot");
var dataString = "Reference Snapshot #" + this.numRefsTaken;
this.outputDebugInfo(dataString, 'refSnapId',
this.referenceSnapshot.toDataURL());
// Re-hide reference div, and take another snapshot to be sure it's gone
this.disableDisplay(referenceDiv);
this.testBlankCameBack();
}
};
AnimationTest.prototype.enableDisplay = function(element)
{
if (!element) {
return;
}
if (!this.xulTest) {
element.style.display = '';
} else {
element.setAttribute('hidden', 'false');
}
};
AnimationTest.prototype.disableDisplay = function(element)
{
if (!element) {
return;
}
if (!this.xulTest) {
element.style.display = 'none';
} else {
element.setAttribute('hidden', 'true');
}
};
AnimationTest.prototype.testBlankCameBack = function()
{
var blankSnapshot2 = snapshotWindow(window, false);
var result = compareSnapshots(this.blankSnapshot, blankSnapshot2, true);
ok(result[0], "Reference image should disappear when it becomes display:none");
if (!result[0]) {
this.wereFailures = true;
var dataString = "Second Blank Snapshot";
this.outputDebugInfo(dataString, 'blank2SnapId', result[2]);
}
};
AnimationTest.prototype.cleanUpAndFinish = function ()
{
// On the off chance that failTest and checkImage are triggered
// back-to-back, use a flag to prevent multiple calls to SimpleTest.finish.
if (this.isTestFinished) {
return;
}
this.isTestFinished = true;
// Call our closing function, if one exists
if (this.closeFunc) {
this.closeFunc();
return;
}
if (this.wereFailures) {
document.getElementById(this.debugElementId).style.display = 'block';
}
SimpleTest.finish();
document.getElementById(this.debugElementId).style.display = "";
};

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id="filter1" x="0%" y="0%" width="100%" height="100%">
<feImage xlink:href="animated-gif-finalframe.gif"/>
</filter>
<g>
<rect x="0" y="0" width="100%" height="100%" filter="url(#filter1)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id="filter1" x="0%" y="0%" width="100%" height="100%">
<feImage xlink:href="animated-gif.gif"/>
</filter>
<g>
<rect x="0" y="0" width="100%" height="100%" filter="url(#filter1)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 288 B

View File

@ -0,0 +1,5 @@
<html>
<body bgcolor="gray">
<img src="animated-gif.gif">
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

View File

@ -0,0 +1,6 @@
<html>
<body bgcolor="gray">
<div id="referenceImage"
style="height: 40px; width: 40px; background: #2aff00"></div>
</body>
</html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - General Animated GIF Test</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<div id="referenceDiv" style="height: 40px; width: 40px;
display: none; background: #2aff00"></div>
<div id="animatedImage">
<img id="animatedGif" src="animated-gif.gif" style="display: none;">
<div id="text-descr"></div>
</div>
<div id="debug" style="display:none">
</div>
</div>
<pre id="test">
<script type="text/javascript;version=1.8">
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main()
{
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'animatedGif', 'debug');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Animated Background Images</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<div id="referenceDiv" style="height: 140px; width: 140px;
display: none; background: #2aff00"></div>
<div id="bgImage" style="height: 140px; width: 140px; background-image: url(animated-gif.gif); display: none;">
</div>
</div>
<div id="debug" style="display:none"></div>
<pre id="test">
<script type="text/javascript;version=1.8">
/** Test for Bug 666446 nsImageLoader/RasterImage**/
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main() {
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'bgImage', 'debug');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,57 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Animated Bullets</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<div id="cleanDiv" style="display: none;">
<ul>
<li>Test 1</li>
</ul>
</div>
<div id="referenceDiv" style="display: none;">
<ul>
<li style="list-style-image: url(animated-gif-finalframe.gif);">Test 1</li>
</ul>
</div>
<div id="animatedImage" style="display: none;">
<ul>
<li style="list-style-image: url(animated-gif.gif);">Test 1</li>
</ul>
</div>
<div id="text-descr"></div>
<div id="debug" style="display:none">
</div>
</div>
<pre id="test">
<script type="text/javascript;version=1.8">
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main()
{
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'animatedImage', 'debug', 'cleanDiv',
'animated-gif-finalframe.gif');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Change of Source (1st Version)</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<div id="referenceDiv" style="height: 40px; width: 40px;
display: none; background: #2aff00;">
</div>
<div id="animatedImage">
<img id='animatedGif' src="animated-gif.gif" style="display: none;">
</div>
<div id="text-descr"></div>
<div id="debug" style="display:none">
</div>
</div>
<pre id="test">
<script type="text/javascript;version=1.8">
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
var gAnimTest;
var gIntervalId;
function initSecondTest() {
document.getElementById('debug').style.display = 'none';
document.getElementById('referenceDiv').style.background = "#9600ff";
document.getElementById('animatedGif').setAttribute('src',
'animated-gif2.gif');
document.getElementById('animatedGif').style.display = 'none';
var secondTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'animatedGif', 'debug', '', '', false);
secondTest.beginTest();
}
function main()
{
gAnimTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'animatedGif', 'debug', '', '', false,
initSecondTest);
gAnimTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 691792 - Change of Source (2nd Version)</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691792">
Mozilla Bug 691792: Change of src attribute for animated gifs no longer works as expected
</a>
<p id="display"></p>
<div id="content">
<div id="animatedImage">
<img id='animatedGif' src="purple.gif" style="display: none;">
</div>
<div id="text-descr"></div>
<div id="debug" style="display:none">
</div>
</div>
<pre id="test">
<script type="text/javascript;version=1.8">
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
var gAnimTest;
var gIntervalId;
function main()
{
gAnimTest = new AnimationTest(20, FAILURE_TIMEOUT, 'animated-gif2.gif',
'animatedGif', 'debug', '', 'animated-gif2.gif',
false);
gAnimTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Animated Raster Images inside of SVG Frames</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<!-- Make sure embed element is snapped to an exact pixel. -->
<div class="bug-header" style="height: 100px;">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
</div>
<p id="display"></p>
<div id="content">
<div id="referenceDiv" style="height: 40px; width: 40px;
display: none; background: #2aff00"></div>
<!--
We use <embed> here instead of <img> because the <img> tag utilizes
the VectorImage class for SVG, whereas in this test, we are testing
RasterImage.
-->
<embed id="embeddedSVG" src="animation.svg" type="image/svg+xml" style="display: none;"/>
</div>
<div id="debug" style="display:none"></div>
<pre id="test">
<script type="text/javascript;version=1.8">
/** Test for Bug 666446 nsSVGImageFrame/RasterImage**/
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main() {
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'embeddedSVG', 'debug', '', 'src');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Animated Images within SVG Filters</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<embed id="referenceImage" src="filter-final.svg" type="image/svg+xml" style="display: none;"/>
<embed id="embeddedSVGFilt" src="filter.svg" type="image/svg+xml" style="display: none;"/>
</div>
<div id="debug" style="display:none"></div>
<pre id="test">
<script type="text/javascript;version=1.8">
/** Test for Bug 666446 nsSVGFEImageElement/RasterImage**/
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main() {
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceImage',
'embeddedSVGFilt', 'debug', '', 'src');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Test for Animated Gif within IFRAME</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events</a>
<p id="display"></p>
<div id="content">
<div id="referenceDiv" style="display:none;">
<iframe id="referenceIFrame" src="ref-iframe.html" width="50%" height="100">
Browser does not support iframes.
</iframe>
</div>
<div id="animatedImage">
<iframe id="imageIFrame" src="iframe.html" width="50%" height="100" style="display: none;">
Browser does not support iframes.
</iframe>
</div>
<div id="debug" style="display: none"></div>
</div>
<pre id="test">
<script type="text/javascript;version=1.8">
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
function main()
{
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceDiv',
'imageIFrame', 'debug');
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,67 @@
<!DOCTYPE HTML>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xml:lang="en" lang="en">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666446
-->
<head>
<title>Test for Bug 666446 - Animated Images within SVG Filters</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript" src="imgutils.js"></script>
<script type="application/javascript" src="animationPolling.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666446">
Mozilla Bug 666446: lots of animated gifs swamp us with paint events
</a>
<p id="display"></p>
<div id="content">
<xul:caption label="Bug 666446 - XULTree Test" />
<xul:separator />
<br />
<xul:window id="main" title="Bug 666446: XUL Tree Testing" width="100" height="100">
<xul:tree flex="1">
<xul:treecols>
<xul:treecol id="icon" label="Icon" flex="1" />
</xul:treecols>
<xul:treechildren>
<xul:treeitem id="referenceItem" hidden="true">
<xul:treerow>
<xul:treecell src="animated-gif-finalframe.gif" width="40" height="40" />
</xul:treerow>
</xul:treeitem>
<xul:treeitem id="imageItem" hidden="true">
<xul:treerow>
<xul:treecell src="animated-gif.gif" width="40" height="40" />
</xul:treerow>
</xul:treeitem>
</xul:treechildren>
</xul:tree>
</xul:window>
</div>
<div id="debug" style="display:none"></div>
<pre id="test">
<script type="text/javascript;version=1.8">
/** Test for Bug 666446 nsSVGFEImageElement/RasterImage**/
const FAILURE_TIMEOUT = 5000; // Fail early after 120 seconds (2 minutes)
function main() {
var animTest = new AnimationTest(20, FAILURE_TIMEOUT, 'referenceItem',
'imageItem', 'debug', '',
'animated-gif-finalframe.gif', true);
animTest.beginTest();
}
window.onload = main;
</script>
</pre>
</body>
</html>