bug 474261 - Test remaining implementations in nsHypertextAccessible::GetRole, r=surkov
authorMarco Zehe <marco.zehe@googlemail.com>
Mon, 19 Jan 2009 22:25:55 +0100
changeset 23956 1e72b268d05eb8cc0633a67390dc53e494c21035
parent 23955 cc3b3a8f35cbb972afcf4827044e5f0e557554af
child 23957 fae62c15f9a0892c77274ec2a4f22a775ab468ad
push id4805
push usermzehe@mozilla.com
push dateMon, 19 Jan 2009 21:26:12 +0000
treeherdermozilla-central@1e72b268d05e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs474261
milestone1.9.2a1pre
bug 474261 - Test remaining implementations in nsHypertextAccessible::GetRole, r=surkov
accessible/tests/mochitest/common.js
accessible/tests/mochitest/test_nsHyperTextAcc_roles.html
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -41,21 +41,24 @@ const nsIPropertyElement = Components.in
 
 const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
 const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
 const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
 const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
 const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT;
 const ROLE_ENTRY = nsIAccessibleRole.ROLE_ENTRY;
 const ROLE_FLAT_EQUATION = nsIAccessibleRole.ROLE_FLAT_EQUATION;
+const ROLE_FORM = nsIAccessibleRole.ROLE_FORM;
+const ROLE_HEADING = nsIAccessibleRole.ROLE_HEADING;
 const ROLE_LABEL = nsIAccessibleRole.ROLE_LABEL;
 const ROLE_LIST = nsIAccessibleRole.ROLE_LIST;
 const ROLE_OPTION = nsIAccessibleRole.ROLE_OPTION;
 const ROLE_PARAGRAPH = nsIAccessibleRole.ROLE_PARAGRAPH;
 const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT;
+const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION;
 const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
 const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
 const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
 
 ////////////////////////////////////////////////////////////////////////////////
 // States
 
 const STATE_CHECKED = nsIAccessibleStates.STATE_CHECKED;
--- a/accessible/tests/mochitest/test_nsHyperTextAcc_roles.html
+++ b/accessible/tests/mochitest/test_nsHyperTextAcc_roles.html
@@ -11,48 +11,84 @@ https://bugzilla.mozilla.org/show_bug.cg
           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="application/javascript">
+    function testRole(aID, aRole)
+    {
+      var acc = getAccessible(aID);
+      if (!acc)
+        return;
+
+      try {
+        is(acc.role, aRole, "Wrong role for " + aID + "!");
+      } catch(e) {
+        ok(false, "Error getting role for " + aID + "!");
+      }
+    }
+
     function doTests()
     {
+      // Test html:form.
+      testRole("frm", ROLE_FORM);
+
+      // test html:div
+      testRole("sec", ROLE_SECTION);
+
+      // Test html:blockquote
+      testRole("quote", ROLE_SECTION);
+
+      // Test html:h, all levels
+      testRole("head1", ROLE_HEADING);
+      testRole("head2", ROLE_HEADING);
+      testRole("head3", ROLE_HEADING);
+      testRole("head4", ROLE_HEADING);
+      testRole("head5", ROLE_HEADING);
+      testRole("head6", ROLE_HEADING);
+
       // Test that an html:input @type="file" is exposed as ROLE_TEXT_CONTAINER.
       // After fix for bug 471356, it was temporarily exposed as a paragraph,
       // breaking JAWS compatibility.
-      fileUploadAcc = getAccessible("data");
-      if (fileUploadAcc)
-        is(fileUploadAcc.role, ROLE_TEXT_CONTAINER,
-           "Wrong role for file upload textbox!");
+      testRole("data", ROLE_TEXT_CONTAINER);
 
       // Test regular paragraph by comparison to make sure exposure does not
       // get broken.
-      var paraAcc = getAccessible("p");
-      if (paraAcc)
-        is(paraAcc.role, ROLE_PARAGRAPH, "Wrong role for paragraph!");
+      testRole("p", ROLE_PARAGRAPH);
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addLoadEvent(doTests);
   </script>
 </head>
 <body>
 
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472326"
      title="html:input of type "file" no longer rendered to screen readers">
-     Mozilla Bug 472326
+     Mozilla Bug 472326</a>
+  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=474261"
+      title="Test remaining implementations in nsHypertextAccessible::GetRole">
+      bug 474261</a>
   </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
-  <form action="submit.php" method="post">
+  <form id="frm" action="submit.php" method="post">
     <label for="data">File</label>:
     <input type="file" id="data" name="data" size="50"/>
   </form>
   <p id="p">A paragraph for comparison.</p>
+  <div id="sec">A normal div</div>
+  <blockquote id="quote">A citation</blockquote>
+  <h1 id="head1">A heading level 1</h1>
+  <h2 id="head2">A heading level 2</h2>
+  <h3 id="head3">A heading level 3</h3>
+  <h4 id="head4">A heading level 4</h4>
+  <h5 id="head5">A heading level 5</h5>
+  <h6 id="head6">A heading level 6</h6>
 </body>
 </html>