3 <script src=
"../resources/js-test.js"></script>
5 #div0 { position: absolute; left:
50px; top:
50px; width:
300px; height:
300px; box-sizing: border-box; }
6 #div1 { position: absolute; left:
50px; top:
50px; width:
200px; height:
100px; box-sizing: border-box; }
7 #div2 { position: absolute; left:
50px; top:
150px; width:
200px; height:
100px; padding:
10px; box-sizing: border-box; }
10 <body onload=
"runTests()">
17 <p id='description'
></p>
18 <div id='console'
></div>
21 function testRoundTouch(x
, y
, radius
)
25 var width
= radius
* 2;
26 var height
= radius
* 2;
27 var zoomableRect
= internals
.bestZoomableAreaForTouchPoint(x
, y
, width
, height
, document
);
31 function testDirectTouches()
33 zoomableArea
= testRoundTouch(130, 130, 10);
34 shouldEvaluateTo('zoomableArea.top', 100);
35 shouldEvaluateTo('zoomableArea.left', 100);
36 shouldEvaluateTo('zoomableArea.width', 200);
37 shouldEvaluateTo('zoomableArea.height', 100);
39 zoomableArea
= testRoundTouch(130, 230, 10);
40 shouldEvaluateTo('zoomableArea.top', 210);
41 shouldEvaluateTo('zoomableArea.left', 110);
42 shouldEvaluateTo('zoomableArea.width', 180);
43 shouldEvaluateTo('zoomableArea.height', 80);
45 zoomableArea
= testRoundTouch(120, 220, 20);
46 shouldEvaluateTo('zoomableArea.top', 200);
47 shouldEvaluateTo('zoomableArea.left', 100);
48 shouldEvaluateTo('zoomableArea.width', 200);
49 shouldEvaluateTo('zoomableArea.height', 100);
51 zoomableArea
= testRoundTouch(80, 100, 20);
52 shouldEvaluateTo('zoomableArea.top', 50);
53 shouldEvaluateTo('zoomableArea.left', 50);
54 shouldEvaluateTo('zoomableArea.width', 300);
55 shouldEvaluateTo('zoomableArea.height',300);
60 if (window
.testRunner
&& window
.internals
&& internals
.bestZoomableAreaForTouchPoint
) {
61 description('Test basic cases of tap-to-zoom mechanics.');
62 testRunner
.dumpAsText();
63 testRunner
.waitUntilDone();
65 isSuccessfullyParsed();
66 testRunner
.notifyDone();