OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Tests for the liblouis Native Client wrapper, as seen from | 6 * @fileoverview Tests for the liblouis Native Client wrapper, as seen from |
7 * the JavaScript interface. | 7 * the JavaScript interface. |
8 */ | 8 */ |
9 | 9 |
10 // Include test fixture. | 10 // Include test fixture. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 function(cells, textToBraille, brailleToText) { | 159 function(cells, textToBraille, brailleToText) { |
160 assertEquals(null, cells); | 160 assertEquals(null, cells); |
161 assertEquals(null, textToBraille); | 161 assertEquals(null, textToBraille); |
162 assertEquals(null, brailleToText); | 162 assertEquals(null, brailleToText); |
163 called = true; | 163 called = true; |
164 })); | 164 })); |
165 assertFalse(called); | 165 assertFalse(called); |
166 liblouis.detach(); | 166 liblouis.detach(); |
167 }); | 167 }); |
168 }); | 168 }); |
| 169 |
| 170 TEST_F('CvoxLibLouisTest', 'testKeyEventStaticData', function() { |
| 171 var liblouis = this.createAndAttachLiblouis(); |
| 172 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) { |
| 173 translator.translate('abcdefghijklmnopqrstuvwxyz 0123456789', |
| 174 this.newCallback( |
| 175 function(cells, textToBraille, brailleToText) { |
| 176 // A-Z. |
| 177 var view = new Uint8Array(cells); |
| 178 for (var i = 0; i < 26; i++) { |
| 179 assertEquals(String.fromCharCode(i + 65), |
| 180 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]); |
| 181 } |
| 182 |
| 183 // 0-9. |
| 184 for (var i = 27; i < 37; i++) { |
| 185 assertEquals(String.fromCharCode(i + 21), |
| 186 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]); |
| 187 } |
| 188 })); |
| 189 }); |
| 190 }); |
OLD | NEW |