Skip to content
Permalink
Browse files
grammar-markers.html and grammar-markers-hidpi.html pass even if elem…
…ent 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.


Canonical link: https://commits.webkit.org/138321@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grzegorz-czajkowski committed Aug 27, 2013
1 parent 634c1dc commit e9a8747a749200fb2a26484cbc0478e7f5b6036b
@@ -1,3 +1,34 @@
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
@@ -1,4 +1,11 @@
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.
@@ -1,4 +1,11 @@
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.
@@ -1,17 +1,45 @@
<!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 @@
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>
@@ -1,16 +1,24 @@
<!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 @@
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>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e9a8747

Please sign in to comment.