зеркало из https://github.com/mozilla/gecko-dev.git
Bug 886846 - [AccessFu] added tests for non-default output order for tables and cells. r=eeejay, marcoz
This commit is contained in:
Родитель
bd384832bd
Коммит
e017b78eb7
|
@ -16,143 +16,184 @@
|
|||
// Test the following accOrElmOrID.
|
||||
var tests = [{
|
||||
accOrElmOrID: "table1",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
expectedUtterance: [["table with 2 columns and 2 rows",
|
||||
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2",
|
||||
"Column 1 Row 2 col1", "cell1", "Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["tbl 2c 2r", "c1r1", "col1", "c2r1", "col2",
|
||||
"c1r2 col1", "cell1", "c2r2 col2", "cell2"]
|
||||
"Column 1 Row 2 col1", "cell1", "Column 2 Row 2 col2", "cell2"], [
|
||||
"col1", "Column 1 Row 1", "col2", "Column 2 Row 1", "cell1",
|
||||
"Column 1 Row 2 col1", "cell2", "Column 2 Row 2 col2",
|
||||
"table with 2 columns and 2 rows"]],
|
||||
expectedBraille: [["tbl 2c 2r", "c1r1", "col1", "c2r1", "col2",
|
||||
"c1r2 col1", "cell1", "c2r2 col2", "cell2"], ["col1", "c1r1", "col2",
|
||||
"c2r1", "cell1", "c1r2 col1", "cell2", "c2r2 col2", "tbl 2c 2r"]]
|
||||
}, {
|
||||
accOrElmOrID: "table2",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
expectedUtterance: [["table with 2 columns and 2 rows",
|
||||
"Column 1 Row 1 col1", "cell1", "Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader",
|
||||
"Column 1 Row 2 colheader", "bla", "Column 1 Row 2", "col1",
|
||||
"Column 2 Row 2", "col2"],
|
||||
expectedBraille: ["tbl 2c 2r", "c1r1 col1", "cell1", "c2r1 col2",
|
||||
"Column 2 Row 2", "col2"], ["cell1", "Column 1 Row 1 col1",
|
||||
"colheader", "Column 1 Row 1", "bla", "Column 1 Row 2 colheader",
|
||||
"table with 1 column and 2 rows", "Column 2 Row 1 col2", "col1",
|
||||
"Column 1 Row 2", "col2", "Column 2 Row 2",
|
||||
"table with 2 columns and 2 rows"]],
|
||||
expectedBraille: [["tbl 2c 2r", "c1r1 col1", "cell1", "c2r1 col2",
|
||||
"tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader", "bla", "c1r2",
|
||||
"col1", "c2r2", "col2"]
|
||||
"col1", "c2r2", "col2"], ["cell1", "c1r1 col1", "colheader", "c1r1",
|
||||
"bla", "c1r2 colheader", "tbl 1c 2r", "c2r1 col2", "col1", "c1r2",
|
||||
"col2", "c2r2", "tbl 2c 2r"]]
|
||||
}, {
|
||||
accOrElmOrID: "table3",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
expectedUtterance: [["table with 2 columns and 2 rows",
|
||||
"Column 2 Row 1 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 1", "colheader", "Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader",
|
||||
"bla"]
|
||||
"Column 1 Row 1", "colheader", "Column 1 Row 2 colheader", "bla"], [
|
||||
"colheader", "Column 1 Row 1", "bla", "Column 1 Row 2 colheader",
|
||||
"table with 1 column and 2 rows", "Column 2 Row 1 col2",
|
||||
"table with 2 columns and 2 rows"]],
|
||||
expectedBraille: [["tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader",
|
||||
"bla"], ["colheader", "c1r1", "bla", "c1r2 colheader", "tbl 1c 2r"]]
|
||||
}, {
|
||||
accOrElmOrID: "table4",
|
||||
expectedUtterance: ["table with 4 columns and 3 rows",
|
||||
expectedUtterance: [["table with 4 columns and 3 rows",
|
||||
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2", "Column 3 Row 1",
|
||||
"col3", "Column 1 Row 2 spans 2 columns col1", "row1",
|
||||
"Column 3 Row 2 col3 row1", "cell1",
|
||||
"Column 4 Row 2 spans 2 rows row1", "cell2", "Column 1 Row 3 col1",
|
||||
"row2", "Column 2 Row 3 col2 row2", "cell3",
|
||||
"Column 3 Row 3 col3 row2", "cell4"],
|
||||
expectedBraille: ["tbl 4c 3r", "c1r1", "col1", "c2r1", "col2", "c3r1",
|
||||
"Column 3 Row 3 col3 row2", "cell4"], ["col1", "Column 1 Row 1",
|
||||
"col2", "Column 2 Row 1", "col3", "Column 3 Row 1", "row1",
|
||||
"Column 1 Row 2 spans 2 columns col1", "cell1",
|
||||
"Column 3 Row 2 col3 row1", "cell2",
|
||||
"Column 4 Row 2 spans 2 rows row1", "row2", "Column 1 Row 3 col1",
|
||||
"cell3", "Column 2 Row 3 col2 row2", "cell4",
|
||||
"Column 3 Row 3 col3 row2", "table with 4 columns and 3 rows"]],
|
||||
expectedBraille: [["tbl 4c 3r", "c1r1", "col1", "c2r1", "col2", "c3r1",
|
||||
"col3", "c1r2 col1", "row1", "c3r2 col3 row1", "cell1", "c4r2 row1",
|
||||
"cell2", "c1r3 col1", "row2", "c2r3 col2 row2", "cell3",
|
||||
"c3r3 col3 row2", "cell4"]
|
||||
"c3r3 col3 row2", "cell4"], ["col1", "c1r1", "col2", "c2r1", "col3",
|
||||
"c3r1", "row1", "c1r2 col1", "cell1", "c3r2 col3 row1", "cell2",
|
||||
"c4r2 row1", "row2", "c1r3 col1", "cell3", "c2r3 col2 row2", "cell4",
|
||||
"c3r3 col3 row2", "tbl 4c 3r"]]
|
||||
}, {
|
||||
accOrElmOrID: "table5",
|
||||
expectedUtterance: ["Row1", "Row2"],
|
||||
expectedBraille: ["Row1", "Row2"]
|
||||
expectedUtterance: [["Row1", "Row2"], ["Row1", "Row2"]],
|
||||
expectedBraille: [["Row1", "Row2"], ["Row1", "Row2"]]
|
||||
}, {
|
||||
// Test pivot to table1_th1 from table1.
|
||||
accOrElmOrID: "table1_th1",
|
||||
oldAccOrElmOrID: "table1",
|
||||
expectedUtterance: ["Column 1 Row 1", "col1"],
|
||||
expectedBraille: ["c1r1", "col1"]
|
||||
expectedUtterance: [["Column 1 Row 1", "col1"], ["col1",
|
||||
"Column 1 Row 1"]],
|
||||
expectedBraille: [["c1r1", "col1"], ["col1", "c1r1"]]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1",
|
||||
expectedUtterance: ["Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
expectedUtterance: [["Column 2 Row 2 col2", "cell2"], ["cell2",
|
||||
"Column 2 Row 2 col2"]],
|
||||
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1_th1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1_th1",
|
||||
expectedUtterance: ["Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
expectedUtterance: [["Column 2 Row 2 col2", "cell2"], ["cell2",
|
||||
"Column 2 Row 2 col2"]],
|
||||
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1_td1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1_td1",
|
||||
expectedUtterance: ["Column 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
expectedUtterance: [["Column 2 col2", "cell2"], ["cell2",
|
||||
"Column 2 col2"]],
|
||||
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]]
|
||||
}, {
|
||||
// Test pivot to table2_cell_1 from table2.
|
||||
accOrElmOrID: "table2_cell_1",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 1 Row 1 col1", "cell1"],
|
||||
expectedBraille: ["c1r1 col1", "cell1"]
|
||||
expectedUtterance: [["Column 1 Row 1 col1", "cell1"], ["cell1",
|
||||
"Column 1 Row 1 col1"]],
|
||||
expectedBraille: [["c1r1 col1", "cell1"], ["cell1", "c1r1 col1"]]
|
||||
}, {
|
||||
// Test pivot to table2_cell_2 from table2.
|
||||
accOrElmOrID: "table2_cell_2",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 2 Row 1 col2",
|
||||
expectedUtterance: [["Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c2r1 col2", "tbl 1c 2r", "c1r1", "colheader",
|
||||
"c1r2 colheader", "bla"]
|
||||
"Column 1 Row 2 colheader", "bla"], ["colheader", "Column 1 Row 1",
|
||||
"bla", "Column 1 Row 2 colheader", "table with 1 column and 2 rows",
|
||||
"Column 2 Row 1 col2"]],
|
||||
expectedBraille: [["c2r1 col2", "tbl 1c 2r", "c1r1", "colheader",
|
||||
"c1r2 colheader", "bla"], ["colheader", "c1r1", "bla",
|
||||
"c1r2 colheader", "tbl 1c 2r", "c2r1 col2"]]
|
||||
}, {
|
||||
// Test pivot to table2_cell_1 from table2_cell_2.
|
||||
accOrElmOrID: "table2_cell_1",
|
||||
oldAccOrElmOrID: "table2_cell_2",
|
||||
expectedUtterance: ["Column 1 col1", "cell1"],
|
||||
expectedBraille: ["c1r1 col1", "cell1"]
|
||||
expectedUtterance: [["Column 1 col1", "cell1"], ["cell1",
|
||||
"Column 1 col1"]],
|
||||
expectedBraille: [["c1r1 col1", "cell1"], ["cell1", "c1r1 col1"]]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table2.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 2 Row 1 col2",
|
||||
expectedUtterance: [["Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 2 colheader",
|
||||
"bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
"bla"], ["bla", "Column 1 Row 2 colheader",
|
||||
"table with 1 column and 2 rows", "Column 2 Row 1 col2"]],
|
||||
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table2_cell_1.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table2_cell_1",
|
||||
expectedUtterance: ["Column 2 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
expectedUtterance: [["Column 2 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 2 colheader", "bla"], ["bla",
|
||||
"Column 1 Row 2 colheader", "table with 1 column and 2 rows",
|
||||
"Column 2 Row 1 col2"]],
|
||||
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table3_ch.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table3_ch",
|
||||
expectedUtterance: ["Row 2", "bla"],
|
||||
expectedBraille: ["c1r2", "bla"]
|
||||
expectedUtterance: [["Row 2", "bla"], ["bla", "Row 2"]],
|
||||
expectedBraille: [["c1r2", "bla"], ["bla", "c1r2"]]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table1_td1.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table1_td1",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
expectedUtterance: [["table with 2 columns and 2 rows",
|
||||
"Column 2 Row 1 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
"Column 1 Row 2 colheader", "bla"], ["bla",
|
||||
"Column 1 Row 2 colheader", "table with 1 column and 2 rows",
|
||||
"Column 2 Row 1 col2", "table with 2 columns and 2 rows"]],
|
||||
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]]
|
||||
}, {
|
||||
// Test pivot to table4_ch_3 from table4.
|
||||
accOrElmOrID: "table4_ch_3",
|
||||
oldAccOrElmOrID: "table4",
|
||||
expectedUtterance: ["Column 3 Row 1", "col3"],
|
||||
expectedBraille: ["c3r1", "col3"]
|
||||
expectedUtterance: [["Column 3 Row 1", "col3"], ["col3",
|
||||
"Column 3 Row 1"]],
|
||||
expectedBraille: [["c3r1", "col3"], ["col3", "c3r1"]]
|
||||
}, {
|
||||
// Test pivot to table4_rh_1 from table4_ch_3.
|
||||
accOrElmOrID: "table4_rh_1",
|
||||
oldAccOrElmOrID: "table4_ch_3",
|
||||
expectedUtterance: ["Column 1 Row 2 spans 2 columns col1", "row1"],
|
||||
expectedBraille: ["c1r2 col1", "row1"]
|
||||
expectedUtterance: [["Column 1 Row 2 spans 2 columns col1", "row1"], [
|
||||
"row1", "Column 1 Row 2 spans 2 columns col1"]],
|
||||
expectedBraille: [["c1r2 col1", "row1"], ["row1", "c1r2 col1"]]
|
||||
}, {
|
||||
// Test pivot to table4_cell_3 from table4_rh_1.
|
||||
accOrElmOrID: "table4_cell_3",
|
||||
oldAccOrElmOrID: "table4_rh_1",
|
||||
expectedUtterance: ["Column 4 spans 2 rows", "cell2"],
|
||||
expectedBraille: ["c4r2", "cell2"]
|
||||
expectedUtterance: [["Column 4 spans 2 rows", "cell2"], ["cell2",
|
||||
"Column 4 spans 2 rows"]],
|
||||
expectedBraille: [["c4r2", "cell2"], ["cell2", "c4r2"]]
|
||||
}, {
|
||||
// Test pivot to table4_cell_5 from table4_cell_3.
|
||||
accOrElmOrID: "table4_cell_5",
|
||||
oldAccOrElmOrID: "table4_cell_3",
|
||||
expectedUtterance: ["Column 2 Row 3 col2 row2", "cell3"],
|
||||
expectedBraille: ["c2r3 col2 row2", "cell3"]
|
||||
expectedUtterance: [["Column 2 Row 3 col2 row2", "cell3"], ["cell3",
|
||||
"Column 2 Row 3 col2 row2"]],
|
||||
expectedBraille: [["c2r3 col2 row2", "cell3"], ["cell3",
|
||||
"c2r3 col2 row2"]]
|
||||
}];
|
||||
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
|
||||
|
@ -160,12 +201,17 @@
|
|||
// Test outputs (utterance and braille) for tables including their
|
||||
// headers and cells.
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance, test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille, test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
var outputOrderValues = [0, 1];
|
||||
outputOrderValues.forEach(function testOutputOrder(outputOrder) {
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
|
||||
testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
});
|
||||
|
||||
// If there was an original utterance order preference, revert to it.
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче