accessible/tests/mochitest/test_nsIAccessibleTable_3.html
author Jason Evans <jasone@canonware.com>
Fri, 20 Jun 2008 10:29:43 -0700
changeset 15456 38972d94e6312cca26dc09bb1d8ac4a9bec84b1c
parent 12153 9002bf7b7346a300b772c4c7109bf3ce80488d45
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">
  <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="text/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);
    
  is(accTable.getSelectedCells({}).length, 0, "no cell selected");
  for (var i = 0; i < 4; i++) {
    accTable.selectRow(i);
    for (var j = 0; j < 4; j++) {
      if (i == j) {
        ok(accTable.isRowSelected(i),"row not selected");
      }
      else {
        todo(!accTable.isRowSelected(i),"row selected");
      }
    }
  }
  todo_is(accTable.selectedRowsCount, 1, "only one row should be selected");
  todo_is(accTable.getSelectedRows({}).length, 1,
         "only one row should be selected");

  for (var i = 0; i < 4; i++) {
    accTable.unselectRow(i);
    ok(!accTable.isRowSelected(i), "row still selected");
  }
  todo_is(accTable.getSelectedCells({}).length, 0, "no cell selected");
  todo_is(accTable.selectedCellsCount, 0, "no cell selected");
  var s = window.getSelection();
  if (s.rangeCount > 0)
    s.removeAllRanges();

  is(accTable.getSelectedCells({}).length, 0, "no cell selected");
  is(accTable.selectedCellsCount, 0, "no cell selected");
  for (var i = 0; i < 8; i++) {
    accTable.selectColumn(i);
    for (var j = 0; j < 8; j++) {
      if (i ==j) {
        ok(accTable.isColumnSelected(i),"column not selected");
      }
      else {
        todo(!accTable.isColumnSelected(i),"column is selected");
      }
    }
  }
  todo_is(accTable.selectedColumnsCount, 1,
          "only one column should be selected");
  todo_is(accTable.getSelectedColumns({}).length, 1,
          "only one column should be selected");
  for (var i = 0; i < 8; i++) {
    accTable.unselectColumn(i);
    ok(!accTable.isColumnSelected(i),"column still selected");
  }
  is(accTable.selectedColumnsCount, 0, "no column should be selected");
  ok(!accTable.isProbablyForLayout(), "table is not for layout");
  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 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>
 </body>
</html>