accessible/tests/mochitest/jsat/test_content_text.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/jsat/test_content_text.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,259 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Tests AccessFu content integration</title>
     1.8 +  <meta charset="utf-8" />
     1.9 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +  <script type="application/javascript"
    1.12 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
    1.13 +  </script>
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/chrome-harness.js">
    1.16 +  </script>
    1.17 +
    1.18 +  <script type="application/javascript" src="../common.js"></script>
    1.19 +  <script type="application/javascript" src="../browser.js"></script>
    1.20 +  <script type="application/javascript" src="../events.js"></script>
    1.21 +  <script type="application/javascript" src="../role.js"></script>
    1.22 +  <script type="application/javascript" src="../states.js"></script>
    1.23 +  <script type="application/javascript" src="../layout.js"></script>
    1.24 +  <script type="application/javascript" src="jsatcommon.js"></script>
    1.25 +
    1.26 +  <script type="application/javascript">
    1.27 +    function doTest() {
    1.28 +      var doc = currentTabDocument();
    1.29 +      var textTest = new AccessFuContentTest(
    1.30 +        [
    1.31 +          // Read-only text tests
    1.32 +          [ContentMessages.simpleMoveFirst, {
    1.33 +            speak: 'These are my awards, Mother. From Army. ' +
    1.34 +              'The seal is for marksmanship, and the gorilla is ' +
    1.35 +              'for sand racing. Text content test document'
    1.36 +          }],
    1.37 +          [ContentMessages.moveNextBy('word'), {
    1.38 +            speak: 'These',
    1.39 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.40 +            android: [{
    1.41 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.42 +              fromIndex: 0,
    1.43 +              toIndex: 5
    1.44 +            }]
    1.45 +          }],
    1.46 +          [ContentMessages.moveNextBy('word'), {
    1.47 +            speak: 'are',
    1.48 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.49 +            android: [{
    1.50 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.51 +              fromIndex: 6,
    1.52 +              toIndex: 9
    1.53 +            }]
    1.54 +          }],
    1.55 +          [ContentMessages.moveNextBy('word'), {
    1.56 +            speak: 'my',
    1.57 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.58 +            android: [{
    1.59 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.60 +              fromIndex: 10,
    1.61 +              toIndex: 12
    1.62 +            }]
    1.63 +          }],
    1.64 +          [ContentMessages.moveNextBy('word'), {
    1.65 +            speak: 'awards,',
    1.66 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.67 +            android: [{
    1.68 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.69 +              fromIndex: 13,
    1.70 +              toIndex: 20
    1.71 +            }]
    1.72 +          }],
    1.73 +          [ContentMessages.moveNextBy('word'), {
    1.74 +            speak: 'Mother.',
    1.75 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.76 +            android: [{
    1.77 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.78 +              fromIndex: 21,
    1.79 +              toIndex: 28
    1.80 +            }]
    1.81 +          }],
    1.82 +          [ContentMessages.movePreviousBy('word'), {
    1.83 +            speak: 'awards,',
    1.84 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.85 +            android: [{
    1.86 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.87 +              fromIndex: 13,
    1.88 +              toIndex: 20
    1.89 +            }]
    1.90 +          }],
    1.91 +          [ContentMessages.movePreviousBy('word'), {
    1.92 +            speak: 'my',
    1.93 +            speak_checkFunc: 'todo_is', // Bug 980509
    1.94 +            android: [{
    1.95 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
    1.96 +              fromIndex: 10,
    1.97 +              toIndex: 12
    1.98 +            }]
    1.99 +          }],
   1.100 +          [ContentMessages.movePreviousBy('word'), {
   1.101 +            speak: 'are',
   1.102 +            speak_checkFunc: 'todo_is', // Bug 980509
   1.103 +            android: [{
   1.104 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.105 +              fromIndex: 6,
   1.106 +              toIndex: 9
   1.107 +            }]
   1.108 +          }],
   1.109 +          [ContentMessages.movePreviousBy('word'), {
   1.110 +            speak: 'These',
   1.111 +            speak_checkFunc: 'todo_is', // Bug 980509
   1.112 +            android: [{
   1.113 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.114 +              fromIndex: 0,
   1.115 +              toIndex: 5
   1.116 +            }]
   1.117 +          }],
   1.118 +          // XXX: Bug 980510: doing next after text traversal should
   1.119 +          // bring us to the next paragraph.
   1.120 +          [ContentMessages.simpleMoveNext, {
   1.121 +            speak: 'You\'re a good guy, mon frere. ' +
   1.122 +              'That means brother in French. ' +
   1.123 +              'I don\'t know how I know that. ' +
   1.124 +              'I took four years of Spanish.',
   1.125 +            speak_checkFunc: 'todo_is' // Bug 980510
   1.126 +          }],
   1.127 +          // XXX: extra move op here because of bug 980510.
   1.128 +          [ContentMessages.simpleMoveNext, {
   1.129 +            speak: 'You\'re a good guy, mon frere. ' +
   1.130 +              'That means brother in French. ' +
   1.131 +              'I don\'t know how I know that. ' +
   1.132 +              'I took four years of Spanish.',
   1.133 +          }],
   1.134 +          // XXX: Word boundary should be past the apostraphe.
   1.135 +          [ContentMessages.moveNextBy('word'), {
   1.136 +            speak: 'You\'re',
   1.137 +            speak_checkFunc: 'todo_is', // Bug 980509
   1.138 +            android: [{
   1.139 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.140 +              fromIndex: 0,
   1.141 +              toIndex: 6
   1.142 +            }],
   1.143 +            android_checkFunc: 'todo' // Bug 980512
   1.144 +          }],
   1.145 +
   1.146 +          // Editable text tests.
   1.147 +          [ContentMessages.focusSelector('textarea'), {
   1.148 +            speak: 'Please refrain from Mayoneggs during this ' +
   1.149 +              'salmonella scare. text area'
   1.150 +          }],
   1.151 +          [null, { // When we first focus, caret is at 0.
   1.152 +              android: [{
   1.153 +                eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED,
   1.154 +                brailleOutput: {
   1.155 +                  selectionStart: 0,
   1.156 +                  selectionEnd: 0
   1.157 +                }
   1.158 +              }]
   1.159 +            }
   1.160 +          ],
   1.161 +          [ContentMessages.activateCurrent(10), {
   1.162 +            android: [{
   1.163 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.164 +              fromIndex: 0,
   1.165 +              toIndex: 10
   1.166 +            }]
   1.167 +          }],
   1.168 +          [null, {
   1.169 +            android: [{
   1.170 +              eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED,
   1.171 +              brailleOutput: {
   1.172 +                selectionStart: 10,
   1.173 +                selectionEnd: 10
   1.174 +              }
   1.175 +            }]
   1.176 +          }],
   1.177 +          [ContentMessages.activateCurrent(20), {
   1.178 +            android: [{
   1.179 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.180 +              fromIndex: 10,
   1.181 +              toIndex: 20
   1.182 +            }]
   1.183 +          }],
   1.184 +          [null, {
   1.185 +            android: [{
   1.186 +              eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED,
   1.187 +              brailleOutput: {
   1.188 +                selectionStart: 20,
   1.189 +                selectionEnd: 20
   1.190 +              }
   1.191 +            }]
   1.192 +          }],
   1.193 +          [ContentMessages.moveCaretNextBy('word'), {
   1.194 +            android: [{
   1.195 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.196 +              fromIndex: 20,
   1.197 +              toIndex: 29
   1.198 +            }]
   1.199 +          }],
   1.200 +          [ContentMessages.moveCaretNextBy('word'), {
   1.201 +            android: [{
   1.202 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.203 +              fromIndex: 29,
   1.204 +              toIndex: 36
   1.205 +            }]
   1.206 +          }],
   1.207 +          [ContentMessages.moveCaretNextBy('character'), {
   1.208 +            android: [{
   1.209 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.210 +              fromIndex: 36,
   1.211 +              toIndex: 37
   1.212 +            }]
   1.213 +          }],
   1.214 +          [ContentMessages.moveCaretNextBy('character'), {
   1.215 +            android: [{
   1.216 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.217 +              fromIndex: 37,
   1.218 +              toIndex: 38
   1.219 +            }]
   1.220 +          }],
   1.221 +          [ContentMessages.moveCaretNextBy('paragraph'), {
   1.222 +            android: [{
   1.223 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.224 +              fromIndex: 38,
   1.225 +              toIndex: 59
   1.226 +            }]
   1.227 +          }],
   1.228 +          [ContentMessages.moveCaretPreviousBy('word'), {
   1.229 +            android: [{
   1.230 +              eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
   1.231 +              fromIndex: 53,
   1.232 +              toIndex: 59
   1.233 +            }]
   1.234 +          }]
   1.235 +        ]);
   1.236 +
   1.237 +      textTest.start(function () {
   1.238 +        closeBrowserWindow();
   1.239 +        SimpleTest.finish();
   1.240 +      });
   1.241 +    }
   1.242 +
   1.243 +    SimpleTest.waitForExplicitFinish();
   1.244 +    addLoadEvent(
   1.245 +      function () {
   1.246 +        openBrowserWindow(
   1.247 +          doTest,
   1.248 +          getRootDirectory(window.location.href) + "doc_content_text.html");
   1.249 +        });
   1.250 +  </script>
   1.251 +</head>
   1.252 +<body id="body">
   1.253 +
   1.254 +  <a target="_blank"
   1.255 +     title="Add tests for text editing and navigating"
   1.256 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a>
   1.257 +  <p id="display"></p>
   1.258 +  <div id="content" style="display: none"></div>
   1.259 +  <pre id="test">
   1.260 +  </pre>
   1.261 +</body>
   1.262 +</html>

mercurial