tests/touch-events-v1/approved/single-touch.html
changeset 179 7cd6d8c1e3bc
parent 177 19c6f3d0eb8a
equal deleted inserted replaced
178:67530967ba81 179:7cd6d8c1e3bc
    11      This document references Test Assertions (abbrev TA below) written by Cathy Chan
    11      This document references Test Assertions (abbrev TA below) written by Cathy Chan
    12      http://www.w3.org/2010/webevents/wiki/TestAssertions
    12      http://www.w3.org/2010/webevents/wiki/TestAssertions
    13 -->
    13 -->
    14 
    14 
    15 <head>
    15 <head>
    16   <title>Touch Events tests (based on Matt Brubeck's single-touch tests)</title>
    16   <title>Touch Events Single Touch Tests</title>
    17   <meta name="viewport" content="width=device-width">
    17   <meta name="viewport" content="width=device-width">
    18   <script src="/resources/testharness.js"></script>
    18   <script src="/resources/testharness.js"></script>
    19   <script>
    19   <script>
    20     setup({explicit_done: true});
    20     setup({explicit_done: true});
    21 
    21 
   171       var touchmove_received = false;
   171       var touchmove_received = false;
   172       var touchend_received = false;
   172       var touchend_received = false;
   173       var invalid_touchmove_received = false;
   173       var invalid_touchmove_received = false;
   174       var touchstart_identifier;
   174       var touchstart_identifier;
   175       
   175       
   176       var touch;
       
   177       test(function() {
       
   178         touch = document.createTouch(window, target0, 42, 15, 20, 35, 40);
       
   179         assert_equals(touch.target, target0, "touch.target is target0");
       
   180         assert_equals(touch.identifier, 42, "touch.identifier is requested value");
       
   181         assert_equals(touch.pageX, 15, "touch.pageX is requested value");
       
   182         assert_equals(touch.pageY, 20, "touch.pageY is requested value");
       
   183         check_touch_clientXY(touch);
       
   184         assert_equals(touch.screenX, 35, "touch.screenX is requested value");
       
   185         assert_equals(touch.screenY, 40, "touch.screenY is requested value");
       
   186       }, "document.createTouch exists and creates a Touch object with requested properties");
       
   187 
       
   188       var touchList;
       
   189       test(function() {
       
   190         touchList = document.createTouchList(touch);
       
   191         assert_equals(touchList.length, 1, "touchList.length is 1");
       
   192         assert_equals(touchList.item(0), touch, "touchList.item(0) is input touch");
       
   193       }, "document.createTouchList exists and correctly creates a TouchList from a single Touch");
       
   194 
       
   195       if (touchList)
       
   196         check_TouchList_object(touchList);
       
   197 
       
   198       test(function() {
       
   199         touchList = document.createTouchList([touch]);
       
   200         assert_equals(touchList.length, 1, "touchList.length is 1");
       
   201         assert_equals(touchList.item(0), touch, "touchList.item(0) is input touch");
       
   202       }, "document.createTouchList exists and correctly creates a TouchList from a Touch array");
       
   203       
       
   204       on_event(target0, "touchstart", function onTouchStart(ev) {
   176       on_event(target0, "touchstart", function onTouchStart(ev) {
   205         ev.preventDefault();
   177         ev.preventDefault();
   206 
   178 
   207         // Check event ordering TA: 1.6.2
   179         // Check event ordering TA: 1.6.2
   208         test_touchstart.step(function() {
   180         test_touchstart.step(function() {