Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/braille/liblouis_test.extjs

Issue 2954413003: Support rich line output in both speech and braille (Closed)
Patch Set: Fix browser test Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }); 62 });
63 } 63 }
64 }.bind(this); 64 }.bind(this);
65 checkNextTable(); 65 checkNextTable();
66 }.bind(this))); 66 }.bind(this)));
67 }); 67 });
68 68
69 TEST_F('CvoxLibLouisTest', 'testTranslateComputerBraille', function() { 69 TEST_F('CvoxLibLouisTest', 'testTranslateComputerBraille', function() {
70 var liblouis = this.createAndAttachLiblouis(); 70 var liblouis = this.createAndAttachLiblouis();
71 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) { 71 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) {
72 translator.translate('Hello!', this.newCallback( 72 translator.translate('Hello!', [], this.newCallback(
73 function(cells, textToBraille, brailleToText) { 73 function(cells, textToBraille, brailleToText) {
74 assertEqualsUint8Array([0x53, 0x11, 0x07, 0x07, 0x15, 0x2e], cells); 74 assertEqualsUint8Array([0x53, 0x11, 0x07, 0x07, 0x15, 0x2e], cells);
75 assertEqualsJSON([0, 1, 2, 3, 4, 5], textToBraille); 75 assertEqualsJSON([0, 1, 2, 3, 4, 5], textToBraille);
76 assertEqualsJSON([0, 1, 2, 3, 4, 5], brailleToText); 76 assertEqualsJSON([0, 1, 2, 3, 4, 5], brailleToText);
77 })); 77 }));
78 }); 78 });
79 }); 79 });
80 80
81 TEST_F('CvoxLibLouisTest', 'testBackTranslateComputerBraille', function() { 81 TEST_F('CvoxLibLouisTest', 'testBackTranslateComputerBraille', function() {
82 var liblouis = this.createAndAttachLiblouis(); 82 var liblouis = this.createAndAttachLiblouis();
83 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) { 83 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) {
84 var cells = new Uint8Array([0x53, 0x11, 0x07, 0x07, 0x15, 0x2e]); 84 var cells = new Uint8Array([0x53, 0x11, 0x07, 0x07, 0x15, 0x2e]);
85 translator.backTranslate(cells.buffer, this.newCallback(function(text) { 85 translator.backTranslate(cells.buffer, this.newCallback(function(text) {
86 assertEquals('Hello!', text); 86 assertEquals('Hello!', text);
87 })); 87 }));
88 }); 88 });
89 }); 89 });
90 90
91 TEST_F('CvoxLibLouisTest', 'testTranslateGermanGrade2Braille', function() { 91 TEST_F('CvoxLibLouisTest', 'testTranslateGermanGrade2Braille', function() {
92 var liblouis = this.createAndAttachLiblouis(); 92 var liblouis = this.createAndAttachLiblouis();
93 // This is one of the moderately large tables. 93 // This is one of the moderately large tables.
94 this.withTranslator(liblouis, 'de-de-g2.ctb', function(translator) { 94 this.withTranslator(liblouis, 'de-de-g2.ctb', function(translator) {
95 translator.translate('München', this.newCallback( 95 translator.translate('München', [], this.newCallback(
96 function(cells, textToBraille, brailleToText) { 96 function(cells, textToBraille, brailleToText) {
97 assertEqualsUint8Array([0x0d, 0x33, 0x1d, 0x39, 0x09], cells); 97 assertEqualsUint8Array([0x0d, 0x33, 0x1d, 0x39, 0x09], cells);
98 assertEqualsJSON([0, 1, 2, 3, 3, 4, 4], textToBraille); 98 assertEqualsJSON([0, 1, 2, 3, 3, 4, 4], textToBraille);
99 assertEqualsJSON([0, 1, 2, 3, 5], brailleToText); 99 assertEqualsJSON([0, 1, 2, 3, 5], brailleToText);
100 })); 100 }));
101 }); 101 });
102 }); 102 });
103 103
104 TEST_F('CvoxLibLouisTest', 'testBackTranslateGermanComputerBraille', function() { 104 TEST_F('CvoxLibLouisTest', 'testBackTranslateGermanComputerBraille', function() {
105 var liblouis = this.createAndAttachLiblouis(); 105 var liblouis = this.createAndAttachLiblouis();
(...skipping 29 matching lines...) Expand all
135 var liblouis = this.createAndAttachLiblouis(); 135 var liblouis = this.createAndAttachLiblouis();
136 this.withTranslator(liblouis, 'nonexistant-table', function(translator) { 136 this.withTranslator(liblouis, 'nonexistant-table', function(translator) {
137 assertEquals(null, translator); 137 assertEquals(null, translator);
138 }); 138 });
139 }); 139 });
140 140
141 TEST_F('CvoxLibLouisTest', 'testTranslateAfterDetach', function() { 141 TEST_F('CvoxLibLouisTest', 'testTranslateAfterDetach', function() {
142 var liblouis = this.createAndAttachLiblouis(); 142 var liblouis = this.createAndAttachLiblouis();
143 this.withTranslator(liblouis, 'de-de-comp8.ctb', function(translator) { 143 this.withTranslator(liblouis, 'de-de-comp8.ctb', function(translator) {
144 liblouis.detach(); 144 liblouis.detach();
145 translator.translate('Hamburg', this.newCallback( 145 translator.translate('Hamburg', [], this.newCallback(
146 function(cells, textToBraille, brailleToText) { 146 function(cells, textToBraille, brailleToText) {
147 assertEquals(null, cells); 147 assertEquals(null, cells);
148 assertEquals(null, textToBraille); 148 assertEquals(null, textToBraille);
149 assertEquals(null, brailleToText); 149 assertEquals(null, brailleToText);
150 })); 150 }));
151 }); 151 });
152 }); 152 });
153 153
154 TEST_F('CvoxLibLouisTest', 'testDetachWithOutstandingCallbacks', function() { 154 TEST_F('CvoxLibLouisTest', 'testDetachWithOutstandingCallbacks', function() {
155 var liblouis = this.createAndAttachLiblouis(); 155 var liblouis = this.createAndAttachLiblouis();
156 this.withTranslator(liblouis, 'de-de-comp8.ctb', function(translator) { 156 this.withTranslator(liblouis, 'de-de-comp8.ctb', function(translator) {
157 var called = false; 157 var called = false;
158 translator.translate('Berlin', this.newCallback( 158 translator.translate('Berlin', [], this.newCallback(
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 169
170 TEST_F('CvoxLibLouisTest', 'testKeyEventStaticData', function() { 170 TEST_F('CvoxLibLouisTest', 'testKeyEventStaticData', function() {
171 var liblouis = this.createAndAttachLiblouis(); 171 var liblouis = this.createAndAttachLiblouis();
172 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) { 172 this.withTranslator(liblouis, 'en-us-comp8.ctb', function(translator) {
173 translator.translate('abcdefghijklmnopqrstuvwxyz 0123456789', 173 translator.translate('abcdefghijklmnopqrstuvwxyz 0123456789', [],
174 this.newCallback( 174 this.newCallback(
175 function(cells, textToBraille, brailleToText) { 175 function(cells, textToBraille, brailleToText) {
176 // A-Z. 176 // A-Z.
177 var view = new Uint8Array(cells); 177 var view = new Uint8Array(cells);
178 for (var i = 0; i < 26; i++) { 178 for (var i = 0; i < 26; i++) {
179 assertEquals(String.fromCharCode(i + 65), 179 assertEquals(String.fromCharCode(i + 65),
180 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]); 180 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]);
181 } 181 }
182 182
183 // 0-9. 183 // 0-9.
184 for (var i = 27; i < 37; i++) { 184 for (var i = 27; i < 37; i++) {
185 assertEquals(String.fromCharCode(i + 21), 185 assertEquals(String.fromCharCode(i + 21),
186 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]); 186 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[view[i]]);
187 } 187 }
188 })); 188 }));
189 }); 189 });
190 }); 190 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698