2010-02-09 19:09:59 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Reftests with caret drawing</title>
|
2011-06-29 22:22:39 +04:00
|
|
|
<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" />
|
2011-01-27 08:26:33 +03:00
|
|
|
<style>
|
|
|
|
iframe {
|
|
|
|
width: 600px;
|
|
|
|
height: 600px;
|
|
|
|
}
|
|
|
|
</style>
|
2010-02-09 19:09:59 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
2012-01-14 04:09:39 +04:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2010-02-09 19:09:59 +03:00
|
|
|
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);
|
|
|
|
}
|
2014-07-27 02:19:00 +04:00
|
|
|
|
2010-02-09 19:09:59 +03:00
|
|
|
canvases = [];
|
2014-01-22 00:45:18 +04:00
|
|
|
SimpleTest.waitForFocus(nextTest);
|
2010-02-09 19:09:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function doSnapShot(iframe) {
|
|
|
|
iframe.snapshot = snapshotWindow(iframe.contentWindow, true);
|
|
|
|
callbackTestCanvas(iframe);
|
|
|
|
};
|
|
|
|
|
2013-03-05 18:32:51 +04:00
|
|
|
function remotePageLoaded(callback) {
|
2010-02-09 19:09:59 +03:00
|
|
|
var iframe = this;
|
2013-03-05 18:32:51 +04:00
|
|
|
setTimeout(function(){
|
|
|
|
doSnapShot(iframe);
|
|
|
|
callback();
|
2013-03-08 23:19:13 +04:00
|
|
|
}, 0);
|
2010-02-09 19:09:59 +03:00
|
|
|
};
|
|
|
|
|
2011-02-11 00:23:09 +03:00
|
|
|
const MAX_ITERATIONS = 1000;
|
2010-08-24 07:49:15 +04:00
|
|
|
|
2010-02-09 19:09:59 +03:00
|
|
|
function createIframe(url,next) {
|
|
|
|
var iframe = document.createElement("iframe");
|
|
|
|
iframe.src = url;
|
|
|
|
iframe.remotePageLoaded = remotePageLoaded;
|
|
|
|
var me = this;
|
2010-08-24 07:49:15 +04:00
|
|
|
var currentIteration = 0;
|
|
|
|
function iframeLoadCompleted() {
|
|
|
|
var docEl = iframe.contentDocument.documentElement;
|
|
|
|
if (docEl.className.indexOf("reftest-wait") >= 0) {
|
|
|
|
if (currentIteration++ > MAX_ITERATIONS) {
|
|
|
|
ok(false, "iframe load for " + url + " timed out");
|
2012-01-14 04:09:39 +04:00
|
|
|
endTest();
|
2010-08-24 07:49:15 +04:00
|
|
|
} else {
|
|
|
|
setTimeout(iframeLoadCompleted, 10);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2013-03-05 18:32:51 +04:00
|
|
|
iframe.remotePageLoaded(function() {
|
|
|
|
if (next) {
|
|
|
|
setTimeout(function(){createIframe(next,null);}, 0)
|
|
|
|
}
|
|
|
|
});
|
2010-08-24 07:49:15 +04:00
|
|
|
}
|
|
|
|
iframe.addEventListener("load", iframeLoadCompleted, false);
|
2010-02-09 19:09:59 +03:00
|
|
|
window.document.body.appendChild(iframe);
|
2014-01-21 02:27:27 +04:00
|
|
|
iframe.focus();
|
2010-02-09 19:09:59 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
function refTest(test,ref) {
|
|
|
|
createIframe(test,ref);
|
|
|
|
};
|
|
|
|
|
2011-01-27 00:18:15 +03:00
|
|
|
var caretBlinkTime = null;
|
2010-02-09 19:09:59 +03:00
|
|
|
function endTest() {
|
2011-01-27 00:18:15 +03:00
|
|
|
if (caretBlinkTime !== null) {
|
2012-09-06 09:43:21 +04:00
|
|
|
SpecialPowers.setIntPref("ui.caretBlinkTime", caretBlinkTime);
|
2011-01-27 00:18:15 +03:00
|
|
|
} else {
|
2012-09-06 09:43:21 +04:00
|
|
|
SpecialPowers.clearUserPref("ui.caretBlinkTime");
|
2011-01-27 00:18:15 +03:00
|
|
|
}
|
2012-01-14 04:09:39 +04:00
|
|
|
|
|
|
|
// finish(), yet let the test actually end first, to be safe.
|
|
|
|
SimpleTest.executeSoon(SimpleTest.finish);
|
2010-02-09 19:09:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
var tests = [
|
2014-01-30 02:07:36 +04:00
|
|
|
[ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
|
|
|
|
[ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
|
2014-07-27 02:19:00 +04:00
|
|
|
[ 'bug389321-2.html' , 'bug389321-2-ref.html' ] ,
|
|
|
|
[ 'bug389321-3.html' , 'bug389321-3-ref.html' ] ,
|
|
|
|
[ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
|
|
|
|
// The following test cases are all involving with one sending
|
|
|
|
// synthesizeKey(), the other without. They ought to be failed
|
|
|
|
// when touch caret preference on. Test them with preference off.
|
|
|
|
function() {SpecialPowers.setBoolPref("touchcaret.enabled", false);} ,
|
2014-01-30 02:07:36 +04:00
|
|
|
[ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
|
|
|
|
[ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
|
|
|
|
[ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
|
|
|
|
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
2010-09-24 23:10:53 +04:00
|
|
|
[ 'bug585922.html' , 'bug585922-ref.html' ] ,
|
2014-01-30 02:07:36 +04:00
|
|
|
[ 'bug597519-1.html' , 'bug597519-1-ref.html' ] ,
|
|
|
|
[ 'bug602141-1.html' , 'bug602141-1-ref.html' ] ,
|
|
|
|
[ 'bug602141-2.html' , 'bug602141-2-ref.html' ] ,
|
|
|
|
[ 'bug602141-3.html' , 'bug602141-3-ref.html' ] ,
|
|
|
|
[ 'bug602141-4.html' , 'bug602141-4-ref.html' ] ,
|
|
|
|
[ 'bug612271-1.html' , 'bug612271-ref.html' ] ,
|
|
|
|
[ 'bug612271-2.html' , 'bug612271-ref.html' ] ,
|
|
|
|
[ 'bug612271-3.html' , 'bug612271-ref.html' ] ,
|
|
|
|
[ 'bug613433-1.html' , 'bug613433-ref.html' ] ,
|
|
|
|
[ 'bug613433-2.html' , 'bug613433-ref.html' ] ,
|
|
|
|
[ 'bug613433-3.html' , 'bug613433-ref.html' ] ,
|
2011-02-11 00:23:09 +03:00
|
|
|
[ 'bug632215-1.html' , 'bug632215-ref.html' ] ,
|
2011-02-15 09:11:18 +03:00
|
|
|
[ 'bug632215-2.html' , 'bug632215-ref.html' ] ,
|
2011-03-29 04:17:16 +04:00
|
|
|
[ 'bug633044-1.html' , 'bug633044-1-ref.html' ] ,
|
2014-01-30 02:07:36 +04:00
|
|
|
[ 'bug634406-1.html' , 'bug634406-1-ref.html' ] ,
|
|
|
|
[ 'bug644428-1.html' , 'bug644428-1-ref.html' ] ,
|
|
|
|
function() {SpecialPowers.setBoolPref("bidi.browser.ui", true);} ,
|
|
|
|
[ 'bug646382-1.html' , 'bug646382-1-ref.html' ] ,
|
|
|
|
[ 'bug646382-2.html' , 'bug646382-2-ref.html' ] ,
|
|
|
|
[ 'bug664087-1.html' , 'bug664087-1-ref.html' ] ,
|
|
|
|
[ 'bug664087-2.html' , 'bug664087-2-ref.html' ] ,
|
|
|
|
[ 'bug682712-1.html' , 'bug682712-1-ref.html' ] ,
|
|
|
|
function() {SpecialPowers.clearUserPref("bidi.browser.ui");} ,
|
|
|
|
[ 'bug746993-1.html' , 'bug746993-1-ref.html' ] ,
|
2014-05-12 15:45:27 +04:00
|
|
|
[ 'bug1007065-1.html' , 'bug1007065-1-ref.html' ] ,
|
2014-05-29 19:15:14 +04:00
|
|
|
[ 'bug1007067-1.html' , 'bug1007067-1-ref.html' ] ,
|
2014-09-10 03:27:56 +04:00
|
|
|
[ 'bug1061468.html' , 'bug1061468-ref.html' ] ,
|
2014-07-27 02:19:00 +04:00
|
|
|
function() {SpecialPowers.clearUserPref("touchcaret.enabled");} ,
|
2010-02-09 19:09:59 +03:00
|
|
|
];
|
2011-08-24 19:04:16 +04:00
|
|
|
|
2014-01-30 02:07:36 +04:00
|
|
|
if (navigator.appVersion.indexOf("Android") == -1 &&
|
|
|
|
SpecialPowers.Services.appinfo.name != "B2G") {
|
2014-08-18 08:02:00 +04:00
|
|
|
tests.push(function() {SpecialPowers.setBoolPref("touchcaret.enabled", false);});
|
2014-01-30 02:07:36 +04:00
|
|
|
tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);
|
|
|
|
tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);
|
2014-08-18 08:02:00 +04:00
|
|
|
tests.push(function() {SpecialPowers.clearUserPref("touchcaret.enabled");});
|
2014-02-22 05:18:24 +04:00
|
|
|
tests.push(function() {SpecialPowers.setBoolPref("layout.css.overflow-clip-box.enabled", true);});
|
|
|
|
tests.push([ 'bug966992-1.html' , 'bug966992-1-ref.html' ]);
|
|
|
|
tests.push([ 'bug966992-2.html' , 'bug966992-2-ref.html' ]);
|
|
|
|
tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]);
|
|
|
|
tests.push(function() {SpecialPowers.setBoolPref("layout.css.overflow-clip-box.enabled", false);});
|
2014-04-06 18:56:08 +04:00
|
|
|
tests.push([ 'bug923376.html' , 'bug923376-ref.html' ]);
|
2014-01-30 02:07:36 +04:00
|
|
|
} else {
|
|
|
|
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed");
|
2012-09-15 21:35:19 +04:00
|
|
|
}
|
2011-08-24 19:04:16 +04:00
|
|
|
|
2010-02-09 19:09:59 +03:00
|
|
|
var testIndex = 0;
|
|
|
|
|
|
|
|
function nextTest() {
|
|
|
|
if (testIndex < tests.length) {
|
2011-04-08 11:35:49 +04:00
|
|
|
if (typeof(tests[testIndex]) == 'function') {
|
|
|
|
tests[testIndex]();
|
|
|
|
SimpleTest.executeSoon(nextTest);
|
|
|
|
} else {
|
|
|
|
refTest(tests[testIndex][0],tests[testIndex][1]);
|
|
|
|
}
|
2010-02-09 19:09:59 +03:00
|
|
|
++testIndex;
|
|
|
|
} else {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function runTests() {
|
|
|
|
try {
|
2011-01-27 00:18:15 +03:00
|
|
|
try {
|
2012-09-06 09:43:21 +04:00
|
|
|
caretBlinkTime = SpecialPowers.getIntPref("ui.caretBlinkTime");
|
2011-01-27 00:18:15 +03:00
|
|
|
} catch (e) {}
|
2012-09-06 09:43:21 +04:00
|
|
|
SpecialPowers.setIntPref("ui.caretBlinkTime", -1);
|
2010-02-09 19:09:59 +03:00
|
|
|
|
|
|
|
nextTest();
|
|
|
|
} catch(e) {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-21 02:27:27 +04:00
|
|
|
SimpleTest.waitForFocus(runTests);
|
|
|
|
|
2010-02-09 19:09:59 +03:00
|
|
|
</script>
|
|
|
|
</head>
|
2014-01-21 02:27:27 +04:00
|
|
|
<body>
|
2010-02-09 19:09:59 +03:00
|
|
|
</body>
|
|
|
|
</html>
|