Bug 919508 - layout: add more tests for text inspection from accessibility layer r=jfkthame
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 22 Feb 2019 22:13:06 +0100
changeset 518600 4dee747dc404598c2f322ffbfc519536162b7a96
parent 518599 6c919109707924424b9fb47c10252388c5503d3e
child 518601 965d985aeda572d16800fa301ca9fee410cb2fe7
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs919508
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 919508 - layout: add more tests for text inspection from accessibility layer r=jfkthame
accessible/tests/mochitest/text/test_wordboundary.html
--- a/accessible/tests/mochitest/text/test_wordboundary.html
+++ b/accessible/tests/mochitest/text/test_wordboundary.html
@@ -31,17 +31,17 @@
       testTextAfterOffset(ids, BOUNDARY_WORD_START,
                           [ [ 0, 5, "", 5, 5 ] ]);
       testTextAfterOffset(ids, BOUNDARY_WORD_END,
                           [ [ 0, 5, "", 5, 5 ] ]);
 
       // "hello "
       // __h__e__l__l__o__ __
       //  0  1  2  3  4  5  6
-      ids = [ "i2", "d2", "e2", "t2" ];
+      ids = [ "i2", "d2", "p2", "e2", "t2" ];
       testTextBeforeOffset(ids, BOUNDARY_WORD_START,
                            [ [ 0, 6, "", 0, 0 ] ]);
       testTextBeforeOffset(ids, BOUNDARY_WORD_END,
                            [ [ 0, 5, "", 0, 0 ],
                              [ 6, 6, "hello", 0, 5 ],
                            ]);
 
       testTextAtOffset(ids, BOUNDARY_WORD_START,
@@ -78,20 +78,48 @@
 
       testTextAfterOffset(ids, BOUNDARY_WORD_START,
                           [ [ 0, 5, "all", 6, 9 ],
                             [ 6, 9, "", 9, 9 ] ]);
       testTextAfterOffset(ids, BOUNDARY_WORD_END,
                           [ [ 0, 5, " all", 5, 9 ],
                             [ 6, 9, "", 9, 9 ] ]);
 
+      // "  hello  all  " (with whitespace collapsing)
+      // __h__e__l__l__o__ __a__l__l__ __
+      //  0  1  2  3  4  5  6  7  8  9 10
+      ids = [ "d6a", "e6a" ];
+      testTextBeforeOffset(ids, BOUNDARY_WORD_START,
+                           [ [ 0, 5, "", 0, 0 ],
+                             [ 6, 10, "hello ", 0, 6 ] ]);
+      testTextBeforeOffset(ids, BOUNDARY_WORD_END,
+                           [ [ 0, 5, "", 0, 0 ],
+                             [ 6, 9, "hello", 0, 5 ],
+                             [ 10, 10, " all", 5, 9 ] ]);
+
+      testTextAtOffset(ids, BOUNDARY_WORD_START,
+                       [ [ 0, 5, "hello ", 0, 6 ],
+                         [ 6, 10, "all ", 6, 10 ] ]);
+      testTextAtOffset(ids, BOUNDARY_WORD_END,
+                       [ [ 0, 4, "hello", 0, 5 ],
+                         [ 5, 8, " all", 5, 9 ],
+                         [ 9, 10, " ", 9, 10 ] ]);
+
+      testTextAfterOffset(ids, BOUNDARY_WORD_START,
+                          [ [ 0, 5, "all ", 6, 10 ],
+                            [ 6, 10, "", 10, 10 ] ]);
+      testTextAfterOffset(ids, BOUNDARY_WORD_END,
+                          [ [ 0, 5, " all", 5, 9 ],
+                            [ 6, 9, " ", 9, 10 ],
+                            [ 10, 10, "", 10, 10 ] ]);
+
       // "hello my friend"
       // __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
       //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-      ids = [ "i7", "d7", "e7", "t7" ];
+      ids = [ "i7", "d7", "e7", "t7", "w7" ];
       testTextBeforeOffset(ids, BOUNDARY_WORD_START,
                            [ [ 0, 5, "", 0, 0 ],
                              [ 6, 8, "hello ", 0, 6 ],
                              [ 9, 15, "my ", 6, 9 ] ]);
       testTextBeforeOffset(ids, BOUNDARY_WORD_END,
                            [ [ 0, 5, "", 0, 0 ],
                              [ 6, 8, "hello", 0, 5 ],
                              [ 9, 15, " my", 5, 8 ] ]);
@@ -242,29 +270,34 @@
   </pre>
 
   <input id="i1" value="hello"/>
   <div id="d1">hello</div>
   <div id="e1" contenteditable="true">hello</div>
   <textarea id="t1">hello</textarea>
 
   <input id="i2" value="hello "/>
-  <pre><div id="d2">hello </div></pre>
+  <div id="d2"> hello </div>
+  <pre><div id="p2">hello </div></pre>
   <div id="e2" contenteditable="true" style='white-space:pre'>hello </div>
   <textarea id="t2">hello </textarea>
 
   <input id="i6" value="hello all"/>
-  <div id="d6">hello all</div>
+  <div id="d6"> hello  all</div>
   <div id="e6" contenteditable="true">hello all</div>
   <textarea id="t6">hello all</textarea>
 
+  <div id="d6a">  hello  all  </div>
+  <div id="e6a" contenteditable="true">  hello  all  </div>
+
   <input id="i7" value="hello my friend"/>
-  <div id="d7">hello my friend</div>
+  <div id="d7"> hello  my   friend</div>
   <div id="e7" contenteditable="true">hello my friend</div>
   <textarea id="t7">hello my friend</textarea>
+  <div id="w7" style="width:1em"> hello my friend</div>
 
   <input id="i8" value="Brave Sir  Robin   ran"/>
   <pre>
     <div id="d8">Brave Sir  Robin   ran</div>
     <div id="e8" contenteditable="true">Brave Sir  Robin   ran</div>
   </pre>
   <textarea id="t8" cols="300">Brave Sir  Robin   ran</textarea>