зеркало из https://github.com/mozilla/gecko-dev.git
113 строки
3.2 KiB
HTML
113 строки
3.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Reftests with caret drawing</title>
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<script type="text/javascript">
|
|
|
|
var canvases = [];
|
|
function callbackTestCanvas(canvas)
|
|
{
|
|
canvases.push(canvas);
|
|
|
|
if (canvases.length != 2)
|
|
return;
|
|
|
|
var result = canvases[0];
|
|
var reference = canvases[1];
|
|
|
|
var ret = compareSnapshots(result.snapshot, reference.snapshot, true);
|
|
ok(ret[0], "Reftest " + result.src +
|
|
(ret[0] ? "" : (" FAILED\n" +
|
|
"RESULT=" + ret[1] + "\n" +
|
|
"REFERENCE=" + ret[2] + "\n")));
|
|
|
|
// Remove the iframes if the test was successful
|
|
if (ret[0]) {
|
|
result.parentNode.removeChild(result);
|
|
reference.parentNode.removeChild(reference);
|
|
}
|
|
canvases = [];
|
|
nextTest();
|
|
}
|
|
|
|
function doSnapShot(iframe) {
|
|
iframe.snapshot = snapshotWindow(iframe.contentWindow, true);
|
|
callbackTestCanvas(iframe);
|
|
};
|
|
|
|
function remotePageLoaded() {
|
|
var iframe = this;
|
|
setTimeout(function(){doSnapShot(iframe);}, 0)
|
|
};
|
|
|
|
function createIframe(url,next) {
|
|
var iframe = document.createElement("iframe");
|
|
iframe.src = url;
|
|
iframe.remotePageLoaded = remotePageLoaded;
|
|
var me = this;
|
|
iframe.addEventListener("load", function() {
|
|
iframe.remotePageLoaded();
|
|
if (next) setTimeout(function(){createIframe(next,null);}, 0)
|
|
}, false);
|
|
window.document.body.appendChild(iframe);
|
|
};
|
|
|
|
function refTest(test,ref) {
|
|
createIframe(test,ref);
|
|
};
|
|
|
|
var caretBlinkTime;
|
|
function endTest() {
|
|
SimpleTest.finish();
|
|
netscape.security.PrivilegeManager.enablePrivilege(
|
|
'UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
prefs.setIntPref("ui.caretBlinkTime", caretBlinkTime);
|
|
}
|
|
|
|
var tests = [
|
|
[ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
|
|
[ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
|
|
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
|
[ 'bug512295-1.html' , 'bug512295-1-ref.html' ] ,
|
|
[ 'bug512295-2.html' , 'bug512295-2-ref.html' ]
|
|
];
|
|
var testIndex = 0;
|
|
|
|
function nextTest() {
|
|
if (testIndex < tests.length) {
|
|
refTest(tests[testIndex][0],tests[testIndex][1]);
|
|
++testIndex;
|
|
} else {
|
|
endTest();
|
|
}
|
|
}
|
|
function runTests() {
|
|
try {
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege(
|
|
'UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
caretBlinkTime = prefs.getIntPref("ui.caretBlinkTime");
|
|
prefs.setIntPref("ui.caretBlinkTime", -1);
|
|
|
|
nextTest();
|
|
} catch(e) {
|
|
endTest();
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="runTests()">
|
|
</body>
|
|
</html>
|