summaryrefslogtreecommitdiff
path: root/accessible/tests/mochitest/jsat/test_output_mathml.html
blob: 3fe4779b2e0be88ea6a568731376d795fce1024f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<html>
<head>
  <title>[AccessFu] MathML Accessibility Support</title>

  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="output.js"></script>
  <script type="application/javascript"
          src="jsatcommon.js"></script>
  <script type="application/javascript">

    function doTest() {
      // Test the following accOrElmOrID.
      var tests = [{
          accOrElmOrID: "math-1",
          expectedUtterance: [
            [{"string":"open-fence"},"(","x",",","y",{"string":"close-fence"},")"],
            ["(",{"string":"open-fence"},"x",",","y",")",{"string":"close-fence"}]
          ],
          expectedBraille: [
            [{"string":"open-fenceAbbr"},"(","x",",","y",{"string":"close-fenceAbbr"},")"],
            ["(",{"string":"open-fenceAbbr"},"x",",","y",")",{"string":"close-fenceAbbr"}]
          ]
        }, {
          accOrElmOrID: "mfrac-1",
          expectedUtterance: [
            [{"string":"mathmlfraction"},{"string":"numerator"},"a",{"string":"denominator"},"b"],
            ["a",{"string":"numerator"},"b",{"string":"denominator"},{"string":"mathmlfraction"}]
          ],
          expectedBraille: [
            [{"string":"mathmlfractionAbbr"},{"string":"numeratorAbbr"},"a",{"string":"denominatorAbbr"},"b"],
            ["a",{"string":"numeratorAbbr"},"b",{"string":"denominatorAbbr"},{"string":"mathmlfractionAbbr"}]
          ]
        }, {
          accOrElmOrID: "mfrac-2",
          expectedUtterance: [
            [{"string":"mathmlfractionwithoutbar"},{"string":"numerator"},"a",{"string":"denominator"},"b"],
            ["a",{"string":"numerator"},"b",{"string":"denominator"},{"string":"mathmlfractionwithoutbar"}]
          ],
          expectedBraille: [
            [{"string":"mathmlfractionwithoutbarAbbr"},{"string":"numeratorAbbr"},"a",{"string":"denominatorAbbr"},"b"],
            ["a",{"string":"numeratorAbbr"},"b",{"string":"denominatorAbbr"},{"string":"mathmlfractionwithoutbarAbbr"}]
          ]
        }, {
          accOrElmOrID: "msub-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b"],
            ["a",{"string":"base"},"b",{"string":"subscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b"],
            ["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "msup-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"superscript"},"b"],
            ["a",{"string":"base"},"b",{"string":"superscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"superscriptAbbr"},"b"],
            ["a",{"string":"baseAbbr"},"b",{"string":"superscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "msubsup-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b",{"string":"superscript"},"c"],
            ["a",{"string":"base"},"b",{"string":"subscript"},"c",{"string":"superscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b",{"string":"superscriptAbbr"},"c"],
            ["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},"c",{"string":"superscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "mmultiscripts-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b",{"string":"superscript"},"c",{"string":"superscript"},"d",{"string":"presubscript"},"e",{"string":"presubscript"},"f",{"string":"presuperscript"},"g"],
            ["a",{"string":"base"},"b",{"string":"subscript"},"c",{"string":"superscript"},"d",{"string":"superscript"},"e",{"string":"presubscript"},"f",{"string":"presubscript"},"g",{"string":"presuperscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b",{"string":"superscriptAbbr"},"c",{"string":"superscriptAbbr"},"d",{"string":"presubscriptAbbr"},"e",{"string":"presubscriptAbbr"},"f",{"string":"presuperscriptAbbr"},"g"],
            ["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},"c",{"string":"superscriptAbbr"},"d",{"string":"superscriptAbbr"},"e",{"string":"presubscriptAbbr"},"f",{"string":"presubscriptAbbr"},"g",{"string":"presuperscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "munder-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"underscript"},"b"],
            ["a",{"string":"base"},"b",{"string":"underscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"underscriptAbbr"},"b"],
            ["a",{"string":"baseAbbr"},"b",{"string":"underscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "mover-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"overscript"},"b"],
            ["a",{"string":"base"},"b",{"string":"overscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"overscriptAbbr"},"b"],
            ["a",{"string":"baseAbbr"},"b",{"string":"overscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "munderover-1",
          expectedUtterance: [
            [{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"underscript"},"b",{"string":"overscript"},"c"],
            ["a",{"string":"base"},"b",{"string":"underscript"},"c",{"string":"overscript"},{"string":"mathmlscripted"}]
          ],
          expectedBraille: [
            [{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"underscriptAbbr"},"b",{"string":"overscriptAbbr"},"c"],
            ["a",{"string":"baseAbbr"},"b",{"string":"underscriptAbbr"},"c",{"string":"overscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
          ]
        }, {
          accOrElmOrID: "mroot-1",
          expectedUtterance: [
            [{"string":"mathmlroot"},{"string":"base"},"a",{"string":"root-index"},"b"],
            ["a",{"string":"base"},"b",{"string":"root-index"},{"string":"mathmlroot"}]
          ],
          expectedBraille: [
            [{"string":"mathmlrootAbbr"},{"string":"baseAbbr"},"a",{"string":"root-indexAbbr"},"b"],
            ["a",{"string":"baseAbbr"},"b",{"string":"root-indexAbbr"},{"string":"mathmlrootAbbr"}]
          ]
        }, {
          accOrElmOrID: "mtable-1",
          expectedUtterance: [
            [{"string":"mathmltable"},{"string":"tblColumnInfo","count":3},{"string":"tblRowInfo","count":2},{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[1]},"a",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[1]},"b",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[1]},"c",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[2]},"d",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[2]},"e",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[2]},"f"],
            ["a",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[1]},"b",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[1]},"c",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[1]},"d",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[2]},"e",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[2]},"f",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[2]},{"string":"mathmltable"},{"string":"tblColumnInfo","count":3},{"string":"tblRowInfo","count":2}]
          ],
          expectedBraille: [
            [{"string":"mathmltableAbbr"},{"string":"tblColumnInfoAbbr","count":3},{"string":"tblRowInfoAbbr","count":2},{"string":"cellInfoAbbr","args":[1,1]},"a",{"string":"cellInfoAbbr","args":[2,1]},"b",{"string":"cellInfoAbbr","args":[3,1]},"c",{"string":"cellInfoAbbr","args":[1,2]},"d",{"string":"cellInfoAbbr","args":[2,2]},"e",{"string":"cellInfoAbbr","args":[3,2]},"f"],
            ["a",{"string":"cellInfoAbbr","args":[1,1]},"b",{"string":"cellInfoAbbr","args":[2,1]},"c",{"string":"cellInfoAbbr","args":[3,1]},"d",{"string":"cellInfoAbbr","args":[1,2]},"e",{"string":"cellInfoAbbr","args":[2,2]},"f",{"string":"cellInfoAbbr","args":[3,2]},{"string":"mathmltableAbbr"},{"string":"tblColumnInfoAbbr","count":3},{"string":"tblRowInfoAbbr","count":2}]
          ]
      }, {
          accOrElmOrID: "menclose-1",
          expectedUtterance: [
            [{"string":"mathmlenclosed"},{"string":"notation-longdiv"},"a"],
            ["a",{"string":"notation-longdiv"},{"string":"mathmlenclosed"}]
          ],
          expectedBraille: [
            [{"string":"mathmlenclosedAbbr"},{"string":"notation-longdivAbbr"},"a"],
            ["a",{"string":"notation-longdivAbbr"},{"string":"mathmlenclosedAbbr"}]
          ]
        }, {
          accOrElmOrID: "menclose-2",
          expectedUtterance: [
            [{"string":"mathmlenclosed"},{"string":"notation-circle"},"a"],
            ["a",{"string":"notation-circle"},{"string":"mathmlenclosed"}]
          ],
          expectedBraille: [
            [{"string":"mathmlenclosedAbbr"},{"string":"notation-circleAbbr"},"a"],
            ["a",{"string":"notation-circleAbbr"},{"string":"mathmlenclosedAbbr"}]
          ]
        }, {
          accOrElmOrID: "menclose-3",
          expectedUtterance: [
            [{"string":"mathmlenclosed"},{"string":"notation-left"},{"string":"notation-top"},{"string":"notation-bottom"},"a"],
            ["a",{"string":"notation-left"},{"string":"notation-top"},{"string":"notation-bottom"},{"string":"mathmlenclosed"}]
          ],
          expectedBraille: [
            [{"string":"mathmlenclosedAbbr"},{"string":"notation-leftAbbr"},{"string":"notation-topAbbr"},{"string":"notation-bottomAbbr"},"a"],
            ["a",{"string":"notation-leftAbbr"},{"string":"notation-topAbbr"},{"string":"notation-bottomAbbr"},{"string":"mathmlenclosedAbbr"}]
          ]
        }];

      // Test all possible utterance order preference values.
      function testOutputOrder(aOutputOrder) {
        return function() {
          SpecialPowers.pushPrefEnv({
            "set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
          }, function() {
            tests.forEach(function run(test) {
              testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
                test.oldAccOrElmOrID, 1);
              testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
                test.oldAccOrElmOrID, 0);
            });
            AccessFuTest.nextTest();
          });
        };
      }

      AccessFuTest.addFunc(testOutputOrder(0));
      AccessFuTest.addFunc(testOutputOrder(1));
      AccessFuTest.waitForExplicitFinish();
      AccessFuTest.runTests();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>
  <div id="root">
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=1163374"
       title="[AccessFu] MathML Accessibility Support">
      Mozilla Bug 1163374
    </a>
    <p id="display"></p>
    <div id="content" style="display: none"></div>
    <pre id="test"></pre>

    <math id="math-1"><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo></math>

    <math>
      <mfrac id="mfrac-1">
        <mi>a</mi>
        <mi>b</mi>
      </mfrac>
    </math>

    <math>
      <mfrac id="mfrac-2" linethickness="0px">
        <mi>a</mi>
        <mi>b</mi>
      </mfrac>
    </math>

    <math>
      <msub id="msub-1">
        <mi>a</mi>
        <mi>b</mi>
      </msub>
    </math>
    <math>
      <msup id="msup-1">
        <mi>a</mi>
        <mi>b</mi>
      </msup>
    </math>
    <math>
      <msubsup id="msubsup-1">
        <mi>a</mi>
        <mi>b</mi>
        <mi>c</mi>
      </msubsup>
    </math>
    <math>
      <mmultiscripts id="mmultiscripts-1">
        <mi>a</mi>
        <mi>b</mi>
        <mi>c</mi>
        <none/>
        <mi>d</mi>
        <mprescripts/>
        <mi>e</mi>
        <none/>
        <mi>f</mi>
        <mi>g</mi>
      </mmultiscripts>
    </math>

    <math>
      <munder id="munder-1">
        <mi>a</mi>
        <mi>b</mi>
      </munder>
    </math>
    <math>
      <mover id="mover-1">
        <mi>a</mi>
        <mi>b</mi>
      </mover>
    </math>
    <math>
      <munderover id="munderover-1">
        <mi>a</mi>
        <mi>b</mi>
        <mi>c</mi>
      </munderover>
    </math>

    <math>
      <mroot id="mroot-1">
        <mi>a</mi>
        <mi>b</mi>
      </mroot>
    </math>

    <math>
      <mtable id="mtable-1">
        <mtr>
          <mtd><mi>a</mi></mtd>
          <mtd><mi>b</mi></mtd>
          <mtd><mi>c</mi></mtd>
        </mtr>
        <mtr>
          <mtd><mi>d</mi></mtd>
          <mtd><mi>e</mi></mtd>
          <mtd><mi>f</mi></mtd>
        </mtr>
      </mtable>
    </math>

    <math>
      <menclose id="menclose-1"><mi>a</mi></menclose>
    </math>
    <math>
      <menclose id="menclose-2" notation="circle"><mi>a</mi></menclose>
    </math>
    <math>
      <menclose id="menclose-3" notation="left top bottom"><mi>a</mi></menclose>
    </math>

  </div>
</body>
</html>