https://bugs.webkit.org/show_bug.cgi?id=81531
Tools:
Make the LayoutTestControllerBlackBerry::findString to test the
BlackBerry port implementation.
Patch by Andy Chen <andchen@rim.com> on 2012-03-19
Reviewed by Rob Buis.
* DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp:
(LayoutTestController::findString):
LayoutTests:
Patch by Andy Chen <andchen@rim.com> on 2012-03-19
Reviewed by Rob Buis.
Add a new layout test for text match marker for BlackBerry port
* platform/blackberry/editing/text-iterator/findString-markers-expected.txt: Added.
* platform/blackberry/editing/text-iterator/findString-markers.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111256
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-19 Andy Chen <andchen@rim.com>
+
+ [BlackBerry] Add new layout test for text match marker
+ https://bugs.webkit.org/show_bug.cgi?id=81531
+
+ Reviewed by Rob Buis.
+
+ Add a new layout test for text match marker for BlackBerry port
+
+ * platform/blackberry/editing/text-iterator/findString-markers-expected.txt: Added.
+ * platform/blackberry/editing/text-iterator/findString-markers.html: Added.
+
2012-03-19 Jessie Berlin <jberlin@apple.com>
r109204 updated the chromium expected results for
--- /dev/null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "a" is "a"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "b" is "b"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "c" is "c"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "d" is "d"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 3
+PASS "e" is "e"
+PASS "e" is "e"
+PASS "e" is "e"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "f" is "f"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "g" is "g"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 2
+PASS "h" is "h"
+PASS "h" is "h"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "i" is "i"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "j" is "j"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "k" is "k"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "l" is "l"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "m" is "m"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "n" is "n"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 4
+PASS "o" is "o"
+PASS "o" is "o"
+PASS "o" is "o"
+PASS "o" is "o"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "p" is "p"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "q" is "q"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 2
+PASS "r" is "r"
+PASS "r" is "r"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "s" is "s"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 2
+PASS "T" is "T"
+PASS "t" is "t"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 2
+PASS "u" is "u"
+PASS "u" is "u"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "v" is "v"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "w" is "w"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "x" is "x"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "y" is "y"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "z" is "z"
+PASS internals.markerCountForNode(e.firstChild, "textmatch") is 1
+PASS "." is "."
+The quick brown fox jumps over the lazy dog.
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.plaintext {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<pre id="description"></pre>
+<pre id="console"></pre>
+<div id="container">
+</div>
+
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function createPlainTextElement(id, text, parent) {
+ var e = document.createElement('div');
+ e.className = 'plaintext';
+ e.id = id;
+ e.innerText = text;
+
+ parent.appendChild(e);
+ return e;
+}
+
+function occurrences(string, substring) {
+ var n=0;
+ var pos=0;
+
+ while (true) {
+ pos = string.toLowerCase().indexOf(substring.toLowerCase(),pos);
+ if (pos!=-1) {
+ ++n;
+ pos+=substring.length;
+ } else
+ break;
+ }
+ return n;
+}
+
+function checkTextMatchMarker(index) {
+ if (index > 26) {
+ layoutTestController.notifyDone();
+ return;
+ }
+ var str = 'abcdefghijklmnopqrstuvwxyz.';
+ var char = str.charAt(index);
+ layoutTestController.findString(str.charAt(index), []);
+ // Start the function later to allow marking process to finish.
+ setTimeout(function() {
+ var count = occurrences(text, char);
+ // The number of markers should match to the occurrences of the charactor.
+ shouldBe('internals.markerCountForNode(e.firstChild, "textmatch")', count.toString());
+ var searchStartIndex = 0;
+ // Get the char from text and compare with the marker range content.
+ for (var i = 0; i < count ; ++i) {
+ var range = internals.markerRangeForNode(e.firstChild, "textmatch", i);
+ var pos = text.toLowerCase().indexOf(char.toLowerCase(), searchStartIndex);
+ searchStartIndex = pos + 1;
+ var expectStr = text.charAt(pos);
+ shouldBe('"' + range + '"', '"' + expectStr + '"');
+ }
+ checkTextMatchMarker(++index);
+ }, 850);
+}
+
+var container = document.getElementById('container');
+
+var id = 'id1'
+var text = 'The quick brown fox jumps over the lazy dog.';
+var e = createPlainTextElement(id, text, container);
+
+if (window.internals && window.layoutTestController)
+ checkTextMatchMarker(0);
+
+var successfullyParsed = true;
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
// need to implement this.
WONTFIX : platform/win/inverted-colors/non-composited.html = IMAGE+TEXT
+// Test for BlackBerry port only
+WONTFIX SKIP : platform/blackberry/editing/text-iterator/findString-markers.html = PASS TIMEOUT FAIL
+
// -----------------------------------------------------------------
// LIGHTTPD
// -----------------------------------------------------------------
+2012-03-19 Andy Chen <andchen@rim.com>
+
+ [BlackBerry] Add new layout test for text match marker
+ https://bugs.webkit.org/show_bug.cgi?id=81531
+
+ Make the LayoutTestControllerBlackBerry::findString to test the
+ BlackBerry port implementation.
+
+ Reviewed by Rob Buis.
+
+ * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp:
+ (LayoutTestController::findString):
+
2012-03-19 Ojan Vafai <ojan@chromium.org>
Don't show WONTFIX tests in garden-o-matic
else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection"))
options |= WebCore::StartInSelection;
}
- return BlackBerry::WebKit::DumpRenderTree::currentInstance()->findString(nameStr, options);
+ return BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(), !(options | WebCore::Backwards));
}
void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL)