Index: LayoutTests/accessibility/inline-text-word-boundaries.html |
diff --git a/LayoutTests/accessibility/inline-text-word-boundaries.html b/LayoutTests/accessibility/inline-text-word-boundaries.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3bff7cbb28b3f6cbe63a87c181adae87170a1817 |
--- /dev/null |
+++ b/LayoutTests/accessibility/inline-text-word-boundaries.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
+<head> |
+<meta charset="utf-8"> |
+<script src="../fast/js/resources/js-test-pre.js"></script> |
+</head> |
+<body> |
+ |
+<!-- Note: the xxxxxx... should wrap onto another line on all platforms. --> |
+<p id="paragraph" style="width: 8em; word-wrap: break-word;"> |
+Ace ten twenty-one thirty-five. xxxxxxxxxxxxxxxxxxx |
+</p> |
+ |
+<p id="description"></p> |
+ |
+<div id="console"></div> |
+ |
+<script> |
+ |
+ description("Tests that we can compute word boundaries for any character index from the accessibility tree."); |
+ |
+ // Note: all that matters is that characters within actual words are mapped correctly. |
+ // Whether a character between words is mapped to the previous or next word is arbitrary; |
+ // all that matters is that we expose the start and end of real words. |
+ if (window.accessibilityController) { |
+ var axParagraph = accessibilityController.accessibleElementById('paragraph'); |
+ var axStaticText = axParagraph.childAtIndex(0); |
+ var text = axStaticText.stringValue.substr(9); |
+ debug("Accessible text: \"" + text + "\""); |
+ |
+ for (var i = 0; i < text.length; i++) { |
+ // Get the bounds from the accessibility tree. |
+ var wordStart = axStaticText.wordStart(i); |
+ var wordEnd = axStaticText.wordEnd(i); |
+ debug("Character " + i + ": '" + text.substr(i, 1) + |
+ "' word=(" + wordStart + ", " + wordEnd + "): '" + |
+ text.substr(wordStart, wordEnd - wordStart) + "'"); |
+ } |
+ } |
+</script> |
+ |
+<script src="../fast/js/resources/js-test-post.js"></script> |
+</body> |
+</html> |