layout/base/tests/test_border_radius_hit_testing.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_border_radius_hit_testing.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,106 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=595652
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 595652</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body onload="run()">
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595652">Mozilla Bug 595652</a>
    1.16 +<iframe src="border_radius_hit_testing_iframe.html" id="iframe" height="600" width="500" style="border:none"></iframe>
    1.17 +<pre id="test">
    1.18 +<script type="application/javascript">
    1.19 +
    1.20 +/** Test for Bug 595652 **/
    1.21 +
    1.22 +SimpleTest.waitForExplicitFinish();
    1.23 +
    1.24 +function run() {
    1.25 +  var iframe = document.getElementById("iframe");
    1.26 +  
    1.27 +  var doc = iframe.contentDocument;
    1.28 +
    1.29 +  var container = doc.body;
    1.30 +  var one = doc.getElementById("one");
    1.31 +  var two = doc.getElementById("two").firstChild;
    1.32 +
    1.33 +  //container.addEventListener("click", function(event) { alert(event.clientX + "," + event.clientY) }, false);
    1.34 +
    1.35 +  function check(x, y, expected_element, description)
    1.36 +  {
    1.37 +	is(doc.elementFromPoint(x, y), expected_element,
    1.38 +	   "point (" + x + ", " + y + "): " + description);
    1.39 +  }
    1.40 +
    1.41 +  check(42, 6, container, "outside top left corner of #one");
    1.42 +  check(11, 21, container, "outside top left corner of #one");
    1.43 +  check(476, 10, container, "outside top right corner of #one");
    1.44 +  check(495, 28, container, "outside top right corner of #one");
    1.45 +  check(483, 197, container, "outside bottom right corner of #one");
    1.46 +  check(497, 175, container, "outside bottom right corner of #one");
    1.47 +  check(29, 182, container, "outside bottom left corner of #one");
    1.48 +  check(73, 198, container, "outside bottom left corner of #one");
    1.49 +
    1.50 +  check(95, 2, one, "inside top left corner of #one (curved quadrant)");
    1.51 +  check(16, 27, one, "inside top left corner of #one (curved quadrant)");
    1.52 +  check(87, 37, one, "inside top left corner of #one (curved quadrant)");
    1.53 +  check(465, 10, one, "inside top right corner of #one (curved quadrant)");
    1.54 +  check(489, 33, one, "inside top right corner of #one (curved quadrant)");
    1.55 +  check(443, 56, one, "inside top right corner of #one (curved quadrant)");
    1.56 +  check(493, 167, one, "inside bottom right corner of #one (curved quadrant)");
    1.57 +  check(476, 188, one, "inside bottom right corner of #one (curved quadrant)");
    1.58 +  check(462, 144, one, "inside bottom right corner of #one (curved quadrant)");
    1.59 +  check(74, 186, one, "inside bottom left corner of #one (curved quadrant)");
    1.60 +  check(16, 153, one, "inside bottom left corner of #one (curved quadrant)");
    1.61 +  check(112, 124, one, "inside bottom left corner of #one (curved quadrant)");
    1.62 +
    1.63 +  check(250, 1, one, "along top edge of #one");
    1.64 +  check(250, 199, one, "along bottom edge of #one");
    1.65 +  check(1, 100, one, "along left edge of #one");
    1.66 +  check(499, 100, one, "along right edge of #one");
    1.67 +  check(250, 100, one, "in center of #one");
    1.68 +
    1.69 +  check(2, 52, one, "inside top left corner of #one (left edge, outside ellipse)");
    1.70 +  check(82, 52, one, "inside top left corner of #one (left edge, inside ellipse)");
    1.71 +
    1.72 +  check(42, 306, container, "outside top left corner of #two");
    1.73 +  check(11, 321, container, "outside top left corner of #two");
    1.74 +  check(476, 310, container, "outside top right corner of #two");
    1.75 +  check(495, 328, container, "outside top right corner of #two");
    1.76 +  check(483, 497, container, "outside bottom right corner of #two");
    1.77 +  check(497, 475, container, "outside bottom right corner of #two");
    1.78 +  check(29, 482, container, "outside bottom left corner of #two");
    1.79 +  check(73, 498, container, "outside bottom left corner of #two");
    1.80 +
    1.81 +  check(95, 302, two, "inside top left corner of #two (curved quadrant)");
    1.82 +  check(16, 327, two, "inside top left corner of #two (curved quadrant)");
    1.83 +  check(87, 337, two, "inside top left corner of #two (curved quadrant)");
    1.84 +  check(465, 310, two, "inside top right corner of #two (curved quadrant)");
    1.85 +  check(489, 333, two, "inside top right corner of #two (curved quadrant)");
    1.86 +  check(443, 356, two, "inside top right corner of #two (curved quadrant)");
    1.87 +  check(493, 467, two, "inside bottom right corner of #two (curved quadrant)");
    1.88 +  check(476, 488, two, "inside bottom right corner of #two (curved quadrant)");
    1.89 +  check(462, 444, two, "inside bottom right corner of #two (curved quadrant)");
    1.90 +  check(74, 486, two, "inside bottom left corner of #two (curved quadrant)");
    1.91 +  check(16, 453, two, "inside bottom left corner of #two (curved quadrant)");
    1.92 +  check(112, 424, two, "inside bottom left corner of #two (curved quadrant)");
    1.93 +
    1.94 +  check(250, 301, two, "along top edge of #two");
    1.95 +  check(250, 499, two, "along bottom edge of #two");
    1.96 +  check(1, 400, two, "along left edge of #two");
    1.97 +  check(499, 400, two, "along right edge of #two");
    1.98 +  check(250, 400, two, "in center of #two");
    1.99 +
   1.100 +  check(2, 352, two, "inside top left corner of #two (left edge, outside ellipse)");
   1.101 +  check(82, 352, two, "inside top left corner of #two (left edge, inside ellipse)");
   1.102 +
   1.103 +  SimpleTest.finish();
   1.104 +}
   1.105 +
   1.106 +</script>
   1.107 +</pre>
   1.108 +</body>
   1.109 +</html>

mercurial