accessible/tests/mochitest/test_nsIAccessibleTable_1.html
author Jason Evans <jasone@canonware.com>
Fri, 20 Jun 2008 10:29:43 -0700
changeset 15456 38972d94e6312cca26dc09bb1d8ac4a9bec84b1c
parent 12153 9002bf7b7346a300b772c4c7109bf3ce80488d45
child 19497 a0c6bc92e71e6ee834bf4593a3aec5b779df7921
permissions -rw-r--r--
Bug 431743: Upstream jemalloc fixes, r=benjamin Incorporate upstream jemalloc fixes from FreeBSD: * Detect overflow for huge allocations via sbrk(2). * Fix deadlock for base (internal) allocations in OOM case. * Fix bitmap vector initialization for small allocation runs.

<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <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">

function doTest()
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  var table = document.getElementById("table");
  var accService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
                   getService(Components.interfaces.nsIAccessibleRetrieval);
  var accTable   = accService.getAccessibleFor(table).
                   QueryInterface(Components.interfaces.nsIAccessibleTable);
  var caption = accTable.caption;
  is(caption.firstChild.name, "Test Table", "wrong text inside caption");
  const nsIAccessNode = Components.interfaces.nsIAccessible;

  is(caption.children.queryElementAt(0, nsIAccessNode).name, "Test Table",
     "wrong text inside caption");

  is(accTable.summary, "this is a test table for nsIAccessibleTable",
     "wrong summary on table");
  is(accTable.columns, 4,"wrong number of columns");
  is(accTable.rows, 3, "wrong number of rows");

  var s = window.getSelection();
  if (s.rangeCount > 0)
    s.removeAllRanges();

  var cell = document.getElementById("col2b");
  var range = document.createRange();
  range.selectNode(cell);
  s.addRange(range);

  is(accTable.selectedCellsCount, 1,"only one cell selected");
  cell = document.getElementById("col2a");
  range.selectNode(cell);
  s.addRange(range);
  cell = document.getElementById("col2c");
  range.selectNode(cell);
  s.addRange(range);
  is(accTable.selectedColumnsCount, 1, "only one column selected");
  cell = document.getElementById("row2a");
  range.selectNode(cell);
  s.addRange(range);
  cell = document.getElementById("row2b");
  range.selectNode(cell);
  s.addRange(range);
  cell = document.getElementById("row2c");
  range.selectNode(cell);
  s.addRange(range);

  is(accTable.selectedRowsCount, 1, "no cells selected");

  var rowheader;
  var works;
  works = true;
  try {
    rowheader  = accTable.rowHeader;
  }
  catch (e) {
    works = false;
  }
  todo(works, "rowHeader should not throw");

  var columnHeader;
  works = true;
  try {
    columnHeader = accTable.columnHeader;
    columnHeaderIndex =columnHeader.getIndexAt(0,2);
    is(columnHeaderIndex, 2, "columnheaderindex is wrong");
  }
  catch (e) {
    works = false;
  }
  todo(works, "columnHeader should not throw");

  var columnDescription;
  works = true;
  try{
    columnDescription = accTable.getColumnDescription(1);
  }
  catch (e) {
    works = false;
  }
  todo(works, "columnDescription should not throw");

  var rowDescription;
  works = true;
  try {
    rowDescription = accTable.getRowDescription(1);
  }
  catch (e) {
    works = false;
  }
  todo(works, "rowDescription should not throw");
  SimpleTest.finish();
}
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>

  <!-- Test Table -->
  <br><br><b> Testing Table:</b><br><br>
  <center>
   <table id="table" border="1"
          summary="this is a test table for nsIAccessibleTable" >
    <caption>Test Table</caption>
    <thead>
     <tr>
      <th></th>
      <th>columnHeader_1</th>
      <th id ="col2a">columnHeader_2</th>
      <th>columnHeader_3</th>
     </tr>
    </thead>
    <tr>
     <th id="row2a">rowHeader_1</th>
     <td id="row2b">row1_column1</td>
     <td id ="col2b">row1_column2</td>
     <td id="row2c">row1_column3</td>
    </tr>
    <tr>
     <th>rowHeader_2</th>
     <td>row2_column1</td>
     <td id ="col2c">row2_column2</td>
     <td>row2_column3</td>
    </tr>
   </table>
  </center>
 </body>
</html>