OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <link rel="stylesheet" href="../../../js/resources/js-test-style.css"> |
| 5 <script src="../../../js/resources/js-test-pre.js"></script> |
| 6 <script src="resources/gesture-helpers.js"></script> |
| 7 </head> |
| 8 |
| 9 <body id="body" style="margin:0" onload="runTest()"> |
| 10 <form> |
| 11 <input id="textfield" style="height: 200px; font-size:xx-large" type="text
" value="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"> |
| 12 </form> |
| 13 <div style="background: green; height:100px; width: 3000px"></div> |
| 14 |
| 15 <p id="description"></p> |
| 16 <div id="console"></div> |
| 17 <script type="text/javascript"> |
| 18 |
| 19 var box; |
| 20 var body; |
| 21 |
| 22 function testScroll() |
| 23 { |
| 24 debug("Testing gesture scroll on text field"); |
| 25 eventSender.gestureScrollBegin(100, 30); |
| 26 eventSender.gestureScrollUpdate(-10, 0); |
| 27 eventSender.gestureScrollUpdate(-10, 0); |
| 28 eventSender.gestureScrollUpdate(-10, 0); |
| 29 eventSender.gestureScrollUpdate(-10, 0); |
| 30 eventSender.gestureScrollEnd(0, 0); |
| 31 |
| 32 shouldBe('box.scrollLeft', '40'); |
| 33 } |
| 34 |
| 35 function testFling() |
| 36 { |
| 37 debug("Testing fling gesture scroll on text field"); |
| 38 |
| 39 eventSender.gestureScrollBegin(100, 30); |
| 40 eventSender.gestureScrollUpdate(-10, 0); |
| 41 eventSender.gestureScrollUpdateWithoutPropagation(-500, 0); |
| 42 eventSender.gestureScrollUpdateWithoutPropagation(-300, 0); |
| 43 eventSender.gestureScrollUpdateWithoutPropagation(-200, 0); |
| 44 eventSender.gestureScrollUpdateWithoutPropagation(-200, 0); |
| 45 eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
| 46 eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
| 47 eventSender.gestureScrollEnd(0, 0); |
| 48 |
| 49 // The text box should be fully scrolled now |
| 50 shouldBe('box.scrollWidth - box.scrollLeft', 'box.clientWidth'); |
| 51 |
| 52 // Make sure the fling doesn't propagate to the body element |
| 53 shouldBe('body.scrollLeft', '0'); |
| 54 } |
| 55 |
| 56 function testFullyScrolledFling() |
| 57 { |
| 58 debug("Testing fling gesture scroll on fully scrolled text field scrolls
parent"); |
| 59 |
| 60 // The text box should still be fully scrolled |
| 61 shouldBe('textfield.scrollWidth - textfield.scrollLeft', 'textfield.clie
ntWidth'); |
| 62 |
| 63 eventSender.gestureScrollBegin(100, 30); |
| 64 eventSender.gestureScrollUpdate(-10, 0); |
| 65 eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
| 66 eventSender.gestureScrollEnd(0, 0); |
| 67 |
| 68 // Make sure the scroll occured on the body element |
| 69 shouldBe('body.scrollLeft', '110'); |
| 70 } |
| 71 |
| 72 if (window.testRunner) |
| 73 testRunner.waitUntilDone(); |
| 74 |
| 75 function runTest() |
| 76 { |
| 77 box = document.getElementById("textfield"); |
| 78 body = document.getElementById("body"); |
| 79 |
| 80 if (window.eventSender) { |
| 81 description('This tests that input text fields can be touch scrolled
'); |
| 82 if (checkTestDependencies() && window.eventSender.gestureScrollUpdat
eWithoutPropagation) { |
| 83 testScroll(); |
| 84 testFling(); |
| 85 testFullyScrolledFling(); |
| 86 |
| 87 successfullyParsed = true; |
| 88 isSuccessfullyParsed(); |
| 89 if (window.testRunner) |
| 90 testRunner.notifyDone(); |
| 91 |
| 92 } else { |
| 93 exitIfNecessary(); |
| 94 } |
| 95 } else { |
| 96 debug("This test requires DumpRenderTree. Gesture-scroll the page t
o validate the implementation."); |
| 97 } |
| 98 } |
| 99 </script> |
| 100 </body> |
| 101 </html> |
OLD | NEW |