summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/bounds/test_zoom.html
blob: fc2dee4828e2a42568fe6f3cc1852eb75fef6304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
  <title>Accessible boundaries when page is zoomed</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../role.js"></script>
  <script type="application/javascript"
          src="../events.js"></script>
  <script type="application/javascript"
          src="../layout.js"></script>
  <script type="application/javascript"
          src="../browser.js"></script>

  <script type="application/javascript">
    //gA11yEventDumpToConsole = true;
    //enableLogging("tree,verbose");
    function doPreTest()
    {
      var tabDocument = currentTabDocument();
      var imgMap = tabDocument.getElementById("imgmap");
      waitForImageMap(imgMap, doTest);
    }

    function doTest()
    {
      // Bug 746176: Failure of this whole test file on OS X.
      if (MAC) {
        todo(false, "Fix bug 746176 on Mac");
        closeBrowserWindow();
        SimpleTest.finish();
        return;
      }

      var tabDocument = currentTabDocument();
      var p1 = tabDocument.getElementById("p1");
      var p2 = tabDocument.getElementById("p2");

      var imgMap = tabDocument.getElementById("imgmap");
      var imgMapAcc = getAccessible(imgMap);
      var area = imgMapAcc.firstChild;

      testBounds(p1);
      testBounds(p2);
      testBounds(area);

      zoomDocument(tabDocument, 2.0);

      testBounds(p1);
      testBounds(p2);
      testBounds(area);

      closeBrowserWindow();
      SimpleTest.finish();
    }

    var url = "data:text/html,<html><body>";
    url += "<p id='p1'>para 1</p><p id='p2'>para 2</p>";
    url += "<map name='atoz_map' id='map'>";
    url += "  <area id='area1' href='http%3A%2F%2Fmozilla.org'";
    url += "        coords=17,0,30,14' alt='mozilla.org' shape='rect'>";
    url += "</map>";
    url += "<img id='imgmap' width='447' height='15'";
    url += "     usemap='%23atoz_map'";
    url += "     src='chrome%3A%2F%2Fmochitests%2Fcontent%2Fa11y%2Faccessible%2Fletters.gif'>";
    url += "</body></html>";

    SimpleTest.waitForExplicitFinish();
    openBrowserWindow(doPreTest,
                      url,
                      { left: 0, top: 0, width: 600, height: 600 });
  </script>

</head>
<body>

  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=650241"
     title="Location returned by accessibles incorrect when page zoomed">
    Mozilla Bug 650241
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>
</body>
</html>