Commit d2a110f7 authored by g.czajkowski@samsung.com's avatar g.czajkowski@samsung.com
Browse files

grammar-markers.html and grammar-markers-hidpi.html pass even if element does...

grammar-markers.html and grammar-markers-hidpi.html pass even if element does not have grammar marker
https://bugs.webkit.org/show_bug.cgi?id=119797

Reviewed by Ryosuke Niwa.

After tenth attempts of verifying the grammar marker, the tests call'notifyDone'
even if grammar marker was not be found.

Both grammar-marker.html and grammar-marker-hidpi.html call the text checker
asynchronously. Therefore, we need to wait until either the grammar marker
is found or number of attempts is reached.

Dump more information whether the grammar marker was found to be sure that
the tests do not pass when the element does not have the marker.

* editing/spelling/grammar-markers-expected.txt:
* editing/spelling/grammar-markers-hidpi-expected.txt:
Update the expectations.

* editing/spelling/grammar-markers-hidpi.html:
* editing/spelling/grammar-markers.html:
Dump more information.
Additionally, pass 'document' to hasGrammarMarker instead of
'target' as the method does not work for target/source elements.

* platform/mac/editing/spelling/grammar-markers-expected.png:
* platform/mac/editing/spelling/grammar-markers-hidpi-expected.png: Added.
Update the expectations for Mac.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5fb0af8e
2013-08-27 Grzegorz Czajkowski <g.czajkowski@samsung.com>
grammar-markers.html and grammar-markers-hidpi.html pass even if element does not have grammar marker
https://bugs.webkit.org/show_bug.cgi?id=119797
Reviewed by Ryosuke Niwa.
After tenth attempts of verifying the grammar marker, the tests call'notifyDone'
even if grammar marker was not be found.
Both grammar-marker.html and grammar-marker-hidpi.html call the text checker
asynchronously. Therefore, we need to wait until either the grammar marker
is found or number of attempts is reached.
Dump more information whether the grammar marker was found to be sure that
the tests do not pass when the element does not have the marker.
* editing/spelling/grammar-markers-expected.txt:
* editing/spelling/grammar-markers-hidpi-expected.txt:
Update the expectations.
* editing/spelling/grammar-markers-hidpi.html:
* editing/spelling/grammar-markers.html:
Dump more information.
Additionally, pass 'document' to hasGrammarMarker instead of
'target' as the method does not work for target/source elements.
* platform/mac/editing/spelling/grammar-markers-expected.png:
* platform/mac/editing/spelling/grammar-markers-hidpi-expected.png: Added.
Update the expectations for Mac.
2013-08-27 Christophe Dumez <ch.dumez@sisa.samsung.com>
 
Implement DOM3 wheel event
This tests WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".
This tests whether WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS hasMarker is true
PASS successfullyParsed is true
TEST COMPLETE
You has the right.
You has the right.
This tests WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".
This tests whether WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS hasMarker is true
PASS successfullyParsed is true
TEST COMPLETE
You has the right.
You has the right.
<!DOCTYPE html>
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p>This tests WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".</p>
<div id="source" contenteditable="true" spellcheck="false">You has the right.</div>
<div id="target" contenteditable="true" spellcheck="true"></div>
<script>
if (window.internals)
description('This tests whether WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".');
if (window.internals) {
window.jsTestIsAsync = true;
internals.settings.setAsynchronousSpellCheckingEnabled(true);
}
var retryCount = 10;
var sleepPeriod = 1;
var ungrammaticalPhrase = 'has';
var hasMarker;
function verifyMarker() {
hasMarker = internals.hasGrammarMarker(document, target.innerHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length);
if (!hasMarker && --retryCount > 0) {
sleepPeriod *= 2;
window.setTimeout(verifyMarker, sleepPeriod);
return;
}
shouldBeTrue('hasMarker');
if (window.testRunner) {
finishJSTest();
testRunner.notifyDone();
}
};
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText(true);
testRunner.setBackingScaleFactor(2, function () {
trial();
verifyMarker();
});
}
......@@ -22,16 +50,7 @@ var target = document.getElementById('target');
window.getSelection().selectAllChildren(target);
document.execCommand('Paste');
var retry = 10;
function trial() {
var hasMarker = internals.hasGrammarMarker(target, 4, 3);
if (hasMarker || --retry == 0) {
if (window.testRunner)
testRunner.notifyDone();
return;
}
window.setTimeout(trial, 10);
};
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p>This tests WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".</p>
<div id="source" contenteditable="true" spellcheck="false">You has the right.</div>
<div id="target" contenteditable="true" spellcheck="true"></div>
<script>
description('This tests whether WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".');
if (window.internals) {
window.jsTestIsAsync = true;
internals.settings.setAsynchronousSpellCheckingEnabled(true);
}
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText(true);
}
if (window.internals)
internals.settings.setAsynchronousSpellCheckingEnabled(true);
var source = document.getElementById('source');
window.getSelection().selectAllChildren(source);
......@@ -19,17 +27,29 @@ var target = document.getElementById('target');
window.getSelection().selectAllChildren(target);
document.execCommand('Paste');
var retry = 10;
function trial() {
var hasMarker = internals.hasGrammarMarker(target, 4, 3);
if (hasMarker || --retry == 0) {
if (window.testRunner)
testRunner.notifyDone();
var retryCount = 10;
var sleepPeriod = 1;
var ungrammaticalPhrase = 'has';
var hasMarker;
function verifyMarker() {
hasMarker = internals.hasGrammarMarker(document, target.innerHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length);
if (!hasMarker && --retryCount > 0) {
sleepPeriod *= 2;
window.setTimeout(verifyMarker, sleepPeriod);
return;
}
window.setTimeout(trial, 10);
shouldBeTrue('hasMarker');
if (window.testRunner) {
finishJSTest();
testRunner.notifyDone();
}
};
trial();
window.setTimeout(verifyMarker, sleepPeriod);
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment