gecko-dev/accessible/tests/mochitest/test_table_2.html
Marco Zehe 0da5e23f4f bug 481435 - Refactor the test_nsiAccessibleTable*.html files, r=surkov
--HG--
rename : accessible/tests/mochitest/test_nsIAccessibleTable_1.html => accessible/tests/mochitest/test_table_1.html
rename : accessible/tests/mochitest/test_nsIAccessibleTable_2.html => accessible/tests/mochitest/test_table_2.html
rename : accessible/tests/mochitest/test_nsIAccessibleTable_3.html => accessible/tests/mochitest/test_table_3.html
rename : accessible/tests/mochitest/test_nsIAccessibleTable_4.html => accessible/tests/mochitest/test_table_4.html
2009-03-05 13:55:54 +01:00

125 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> nsIAccessibleTable Interface Test Case </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"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="text/javascript">
function doTest()
{
// bug 410052
var accTable = getAccessible("table", [nsIAccessibleTable]);
is(accTable.getIndexAt(2,4), 17, "wrong index returned");
is(accTable.getColumnAtIndex(18), 5, "got wrong column");
is(accTable.getRowAtIndex(10), 1, "wrong row");
is(accTable.getColumnExtentAt(2,2), 2, "colspan wrong");
is(accTable.getColumnExtentAt(0,3), 2, "colspan wrong");
is(accTable.getColumnExtentAt(3,5), 1, "colspan");
is(accTable.getRowExtentAt(0,7), 4, "rowspan wrong");
is(accTable.getRowExtentAt(2,7), 4,"rowspan wrong");
is(accTable.getColumnExtentAt(2,3), 1, "colspan wrong");
is(accTable.cellRefAt(2,1).firstChild.name, "c1", "wrong cell");
// bug 417912
var accTable2 = getAccessible("table2", [nsIAccessibleTable]);
testCellAt(accTable2, 0, 0, true);
testCellAt(accTable2, 0, 1, true);
testCellAt(accTable2, 0, 2, true);
testCellAt(accTable2, 1, 0, true);
testCellAt(accTable2, 1, 1, false);
testCellAt(accTable2, 1, 2, true);
testCellAt(accTable2, 2, 0, true);
testCellAt(accTable2, 2, 1, true);
testCellAt(accTable2, 2, 2, true);
SimpleTest.finish();
}
function testCellAt(aTable, aRow, aColumn, aSucceeded)
{
try {
aTable.cellRefAt(aRow, aColumn);
ok(aSucceeded, "cell is available at (" + aRow + ", " + aColumn + ").");
} catch (e) {
ok(!aSucceeded, "cell is not available at (" + aRow + ", " + aColumn + ").");
}
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912"
title="GetCellDataAt callers that expect an error if no cell is found are wrong">
Mozilla Bug 417912
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- Test Table -->
<br><br><b> Testing Table:</b><br><br>
<center>
<table cellpadding="2" cellspacing="2" border="1" width="50%" id="table">
<tbody>
<tr>
<td><br></td>
<td><br></td>
<td rowspan="1" colspan="2"><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td rowspan="4" colspan="1"><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td rowspan="2" colspan="2">c1</td>
<td><br></td>
<td><br></td>
<td rowspan="2" colspan="1"><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
</tbody>
</table>
</center>
<br><br><b>Testing Table 2:</b><br><br>
<center>
<table cellpadding="2" cellspacing="2" border="1" width="50%" id="table2">
<tr><td>1</td><td>2</td><td rowspan=3>3</td>
<tr><td>4</td>
<tr><td>5</td><td>6</td>
</table>
</center>
</body>
</html>