4 https://bugzilla.mozilla.org/show_bug.cgi?id=410052
7 <title>Table indexes chrome tests
</title>
8 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css" />
10 <script type=
"application/javascript" src=
"chrome://mochikit/content/MochiKit/packed.js"></script>
11 <script type=
"application/javascript" src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
13 <script type=
"application/javascript">
14 const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
15 const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable;
17 var gAccService = null;
21 gAccService = Components.classes[
"@mozilla.org/accessibleRetrieval;1"].
22 getService(nsIAccessibleRetrieval);
24 //////////////////////////////////////////////////////////////////////////
26 var tRow = new Array(
0,
0,
0,
1,
1,
1,
2,
2,
3,
3);
27 var tCol = new Array(
0,
1,
2,
0,
1,
2,
0,
1,
1,
2);
29 testTable(
"table",
10, tRow, tCol);
31 //////////////////////////////////////////////////////////////////////////
33 tRow = [
0,
0,
0,
1,
1,
1,
2,
2,
3,
3];
34 tCol = [
0,
1,
2,
0,
1,
2,
0,
1,
1,
2];
36 testTable(
"tableinsane1",
10, tRow, tCol);
38 //////////////////////////////////////////////////////////////////////////
40 tRow = [
0,
0,
0,
1,
1,
1,
2,
2,
3,
3,
4,
4,
4];
41 tCol = [
0,
1,
2,
0,
1,
2,
0,
1,
1,
2,
1,
3,
4];
43 testTable(
"tableinsane2",
13, tRow, tCol);
45 //////////////////////////////////////////////////////////////////////////
47 tRow = [
0,
0,
0,
1,
1,
1,
2,
2,
3,
4];
48 tCol = [
0,
1,
2,
0,
1,
2,
0,
2,
0,
0];
50 testTable(
"tableinsane4",
10, tRow, tCol);
52 //////////////////////////////////////////////////////////////////////////
54 tRow = [
0,
0,
0,
1,
1,
1,
2,
2,
3,
3];
55 tCol = [
0,
1,
2,
0,
1,
2,
0,
1,
1,
2];
57 testTable(
"tableborder",
10, tRow, tCol);
62 function testTable(aId, aLen, aRowIdxes, aColIdxes)
64 var table = document.getElementById(aId);
65 var tableAcc = gAccService.getAccessibleFor(table).
66 QueryInterface(nsIAccessibleTable);
68 var row, column, index;
71 for (var i =
0; i < aLen; i++) {
72 row = tableAcc.getRowAtIndex(i);
73 column = tableAcc.getColumnAtIndex(i);
74 index = tableAcc.getIndexAt(aRowIdxes[i], aColIdxes[i]);
76 is(row, aRowIdxes[i], aId +
": row for index " + i +
" is nor correct");
77 is(column, aColIdxes[i],
78 aId +
": column for index " + i +
"is nor correct");
80 aId +
": row " + row +
" /column " + column +
" and index " + index +
" aren't inconsistent.");
84 cellAcc = tableAcc.cellRefAt(row, column);
88 aId +
": Can't get cell accessible at row = " + row +
", column = " + column);
91 var attrs = cellAcc.attributes;
92 is (parseInt(attrs.getStringProperty(
"table-cell-index")), index,
93 aId +
": cell index from object attributes of cell accessible isn't corrent.");
98 SimpleTest.waitForExplicitFinish();
104 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug
410052</a>
106 <div id=
"content" style=
"display: none"></div>
111 If you change the structure of the table please make sure to change
112 the indexes count in 'for' statement in the script above.
114 <table border=
"1" id=
"table">
115 <caption><strong><b><font size=
"29">this is a caption for this table
</font></b></strong></caption>
130 <td rowspan=
"0">4</td>
131 <td colspan=
"2">5</td>
140 <table border=
"1" id=
"tableborder" style=
"border-collapse:collapse">
141 <caption><strong><b><font size=
"29">this is a caption for this bc table
</font></b></strong></caption>
156 <td rowspan=
"2">4</td>
157 <td colspan=
"2">5</td>
166 <table border=
"1" id=
"tableinsane1">
167 <caption>test empty row groups
</caption>
185 <td rowspan=
"2">4</td>
186 <td colspan=
"2">5</td>
195 <table border=
"1" id=
"tableinsane2" >
196 <caption>empty rowgroup + empty rows
</caption>
204 <tbody><tr></tr></tbody>
214 <td rowspan=
"0">4</td>
215 <td colspan=
"0">5</td>
219 <td rowspan=
"0">7</td>
229 <table border=
"1" id=
"tableinsane4" >
230 <caption>test cellmap holes
</caption>
238 <tbody><tr></tr></tbody>
248 <td colspan=
"2">4</td>
249 <td rowspan=
"2">5</td>
255 <td colspan=
"3">7</td>