mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 22:25:30 +00:00
263 lines
6.4 KiB
HTML
263 lines
6.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=410052
|
|
-->
|
|
<head>
|
|
<title>Table indexes chrome tests</title>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
|
|
const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable;
|
|
|
|
var gAccService = null;
|
|
|
|
function doTest()
|
|
{
|
|
gAccService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
|
getService(nsIAccessibleRetrieval);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// table
|
|
var tRow = new Array(0,0,0,1,1,1,2,2,3,3);
|
|
var tCol = new Array(0,1,2,0,1,2,0,1,1,2);
|
|
|
|
testTable("table", 10, tRow, tCol);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// tableinsane1
|
|
tRow = [0,0,0,1,1,1,2,2,3,3];
|
|
tCol = [0,1,2,0,1,2,0,1,1,2];
|
|
|
|
testTable("tableinsane1", 10, tRow, tCol);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// tableinsane2
|
|
tRow = [0,0,0,1,1,1,2,2,3,3,4,4,4];
|
|
tCol = [0,1,2,0,1,2,0,1,1,2,1,3,4];
|
|
|
|
testTable("tableinsane2", 13, tRow, tCol);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// tableinsane4
|
|
tRow = [0,0,0,1,1,1,2,2,3,4];
|
|
tCol = [0,1,2,0,1,2,0,2,0,0];
|
|
|
|
testTable("tableinsane4", 10, tRow, tCol);
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// tableborder
|
|
tRow = [0,0,0,1,1,1,2,2,3,3];
|
|
tCol = [0,1,2,0,1,2,0,1,1,2];
|
|
|
|
testTable("tableborder", 10, tRow, tCol);
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function testTable(aId, aLen, aRowIdxes, aColIdxes)
|
|
{
|
|
var table = document.getElementById(aId);
|
|
var tableAcc = gAccService.getAccessibleFor(table).
|
|
QueryInterface(nsIAccessibleTable);
|
|
|
|
var row, column, index;
|
|
var cellAcc;
|
|
|
|
for (var i = 0; i < aLen; i++) {
|
|
row = tableAcc.getRowAtIndex(i);
|
|
column = tableAcc.getColumnAtIndex(i);
|
|
index = tableAcc.getIndexAt(aRowIdxes[i], aColIdxes[i]);
|
|
|
|
is(row, aRowIdxes[i], aId + ": row for index " + i +" is nor correct");
|
|
is(column, aColIdxes[i],
|
|
aId + ": column for index " + i +"is nor correct");
|
|
is(index, i,
|
|
aId + ": row " + row + " /column " + column + " and index " + index + " aren't inconsistent.");
|
|
|
|
try {
|
|
cellAcc = null;
|
|
cellAcc = tableAcc.cellRefAt(row, column);
|
|
} catch (e) { }
|
|
|
|
ok(cellAcc,
|
|
aId + ": Can't get cell accessible at row = " + row + ", column = " + column);
|
|
|
|
if (cellAcc) {
|
|
var attrs = cellAcc.attributes;
|
|
is (parseInt(attrs.getStringProperty("table-cell-index")), index,
|
|
aId + ": cell index from object attributes of cell accessible isn't corrent.");
|
|
}
|
|
}
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addLoadEvent(doTest);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
|
|
<!--
|
|
If you change the structure of the table please make sure to change
|
|
the indexes count in 'for' statement in the script above.
|
|
-->
|
|
<table border="1" id="table">
|
|
<caption><strong><b><font size="29">this is a caption for this table</font></b></strong></caption>
|
|
<thead>
|
|
<tr>
|
|
<th>col1</th>
|
|
<th>col2</th>
|
|
<th>col3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan="0">4</td>
|
|
<td colspan="2">5</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6</td>
|
|
<td>7</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table border="1" id="tableborder" style="border-collapse:collapse">
|
|
<caption><strong><b><font size="29">this is a caption for this bc table</font></b></strong></caption>
|
|
<thead>
|
|
<tr>
|
|
<th>col1</th>
|
|
<th>col2</th>
|
|
<th>col3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan="2">4</td>
|
|
<td colspan="2">5</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6</td>
|
|
<td>7</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table border="1" id="tableinsane1">
|
|
<caption>test empty row groups</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>col1</th>
|
|
<th>col2</th>
|
|
<th>col3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
<tbody></tbody>
|
|
<tbody></tbody>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan="2">4</td>
|
|
<td colspan="2">5</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6</td>
|
|
<td>7</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table border="1" id="tableinsane2" >
|
|
<caption>empty rowgroup + empty rows</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>col1</th>
|
|
<th>col2</th>
|
|
<th>col3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr></tr></tbody>
|
|
<tbody></tbody>
|
|
<tbody></tbody>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan="0">4</td>
|
|
<td colspan="0">5</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6</td>
|
|
<td rowspan="0">7</td>
|
|
</tr>
|
|
<tr>
|
|
<td>8</td>
|
|
<td>9</td>
|
|
<td>10</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
<table border="1" id="tableinsane4" >
|
|
<caption>test cellmap holes</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>col1</th>
|
|
<th>col2</th>
|
|
<th>col3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr></tr></tbody>
|
|
<tbody></tbody>
|
|
<tbody></tbody>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">4</td>
|
|
<td rowspan="2">5</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3">7</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
</body>
|
|
</html>
|