test/touchevents/single-touch.html
author Matt Brubeck <mbrubeck@mozilla.com>
Tue, 26 Apr 2011 17:12:37 -0700
changeset 52 a3bdd103c7d9
parent 50 c030af565635
child 55 7df98116715b
permissions -rw-r--r--
Add tests for the touchend event
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     1
<!DOCTYPE HTML>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     2
<html>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     3
<head>
48
a217ab1b3f14 Use a stricter test for the "identifier" attribute.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 46
diff changeset
     4
  <title>Touch Events: Single-touch tests</title>
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     5
  <meta name="viewport" content="width=device-width">
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     6
  <script src="../testharness.js"></script>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     7
  <script>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     8
    setup({explicit_done: true});
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
     9
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    10
    function run() {
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    11
      var target = document.getElementById("target");
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    12
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    13
      var test_click = async_test("Interaction with mouse events");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    14
      var test_touchstart = async_test("touchstart event received");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    15
      var test_touchend = async_test("touchend event received");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    16
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
    17
      var touchstart_received = false;
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
    18
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    19
      on_event(target, "touchstart", function onTouchStart(ev) {
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
    20
        touchstart_received = true;
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    21
        test_touchstart.done();
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    22
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    23
        test(function() {
43
fc6abcf8b74c ISSUE-10: Add a relatedTarget attribute to the TouchEvent interface.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 42
diff changeset
    24
          assert_true(ev.target instanceof Element, "target must be an Element.");
fc6abcf8b74c ISSUE-10: Add a relatedTarget attribute to the TouchEvent interface.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 42
diff changeset
    25
          assert_equals(ev.relatedTarget, null, "relatedTarget must be null for touchstart event.");
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    26
        }, "touchstart TouchEvent target attributes are correct.");
43
fc6abcf8b74c ISSUE-10: Add a relatedTarget attribute to the TouchEvent interface.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 42
diff changeset
    27
fc6abcf8b74c ISSUE-10: Add a relatedTarget attribute to the TouchEvent interface.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 42
diff changeset
    28
        test(function() {
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    29
          var attrs = ["altKey", "metaKey", "ctrlKey", "shiftKey"];
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    30
          for (var i = 0; i < attrs.length; i++) {
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    31
            assert_true(attrs[i] in ev);
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    32
          }
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    33
        }, "touchstart TouchEvent modifier key attributes are present.");
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    34
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    35
        test(function() {
41
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    36
          assert_equals(ev.touches.length, 1, "One touch point.");
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    37
          assert_equals(ev.changedTouches.length, 1, "One changed touch point.");
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    38
          assert_equals(ev.targetTouches.length, 1, "One target touch point.");
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    39
        }, "touchstart TouchList lengths are correct.");
41
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    40
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    41
        var t = ev.touches[0];
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    42
        var ct = ev.changedTouches[0];
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    43
        var tt = ev.targetTouches[0];
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    44
42
49296bde5e04 radiusX and radiusY must be positive.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 41
diff changeset
    45
        test(function() {
50
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    46
          assert_true(ev instanceof TouchEvent, "Event is a TouchEvent.");
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    47
          assert_true(ev.touches instanceof TouchList, "touches is a TouchList");
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    48
          assert_true(t instanceof Touch, "touches[0] is a Touch");
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    49
        }, "Interface names are correct.");
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    50
c030af565635 Add a test for interface names.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 48
diff changeset
    51
        test(function() {
48
a217ab1b3f14 Use a stricter test for the "identifier" attribute.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 46
diff changeset
    52
          assert_equals(t.identifier, 0, "touches identifier is 0.");
a217ab1b3f14 Use a stricter test for the "identifier" attribute.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 46
diff changeset
    53
          assert_equals(ct.identifier, 0, "changedTouches identifier is 0.");
a217ab1b3f14 Use a stricter test for the "identifier" attribute.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 46
diff changeset
    54
          assert_equals(tt.identifier, 0, "targetTouches identifier is 0.");
a217ab1b3f14 Use a stricter test for the "identifier" attribute.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 46
diff changeset
    55
        }, "Touch identifiers are correct.");
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    56
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    57
        test(function() {
41
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    58
          assert_true(t.rotationAngle >= 0, "rotationAngle must be >= 0.");
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    59
          assert_true(t.rotationAngle < 90, "rotationAngle must be > 90.");
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
    60
42
49296bde5e04 radiusX and radiusY must be positive.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 41
diff changeset
    61
          assert_true(t.radiusX > 0, "radiusX is positive.");
49296bde5e04 radiusX and radiusY must be positive.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 41
diff changeset
    62
          assert_true(t.radiusY > 0, "radiusY is positive.");
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    63
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    64
          assert_true(t.force >= 0, "force >= 0.");
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    65
          assert_true(t.force <= 1, "force <= 1.");
46
e761aa494278 ISSUE-11: Rename TouchPoint to Touch
Matt Brubeck <mbrubeck@mozilla.com>
parents: 44
diff changeset
    66
        }, "Touch attribute values are valid");
44
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    67
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    68
        test(function() {
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    69
          var attrs = ["screenX", "screenY", "clientX", "clientY",
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    70
                       "pageX", "pageY"];
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    71
          for (var i = 0; i < attrs.length; i++) {
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    72
            assert_true(attrs[i] in t);
ad7715ddbcda Add more conformance tests.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 43
diff changeset
    73
          }
46
e761aa494278 ISSUE-11: Rename TouchPoint to Touch
Matt Brubeck <mbrubeck@mozilla.com>
parents: 44
diff changeset
    74
        }, "Touch location attributes are present.");
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
    75
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    76
      });
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    77
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    78
      on_event(target, "touchend", function onTouchStart(ev) {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    79
        test_touchend.step(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    80
          assert_true(touchstart_received, "touchend follows touchstart");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    81
        });
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    82
        test_touchend.done();
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    83
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    84
        test(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    85
          var attrs = ["altKey", "metaKey", "ctrlKey", "shiftKey"];
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    86
          for (var i = 0; i < attrs.length; i++) {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    87
            assert_true(attrs[i] in ev);
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    88
          }
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    89
        }, "touchend TouchEvent modifier key attributes are present.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    90
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    91
        test(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    92
          assert_equals(ev.touches.length, 0, "Zero touch points.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    93
          assert_equals(ev.changedTouches.length, 1, "One changed touch point.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    94
          assert_equals(ev.targetTouches.length, 0, "Zero target touch points.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    95
        }, "touchend TouchList lengths are correct.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    96
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    97
        var t = ev.changedTouches[0];
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    98
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
    99
        test(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   100
          assert_equals(t.identifier, 0, "changedTouches identifier is 0.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   101
        }, "Touch identifier is correct.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   102
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   103
        test(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   104
          assert_true(t.rotationAngle >= 0, "rotationAngle must be >= 0.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   105
          assert_true(t.rotationAngle < 90, "rotationAngle must be > 90.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   106
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   107
          assert_true(t.radiusX > 0, "radiusX is positive.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   108
          assert_true(t.radiusY > 0, "radiusY is positive.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   109
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   110
          assert_true(t.force >= 0, "force >= 0.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   111
          assert_true(t.force <= 1, "force <= 1.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   112
        }, "Touch attribute values are valid");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   113
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   114
        test(function() {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   115
          var attrs = ["screenX", "screenY", "clientX", "clientY",
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   116
                       "pageX", "pageY"];
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   117
          for (var i = 0; i < attrs.length; i++) {
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   118
            assert_true(attrs[i] in t);
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   119
          }
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   120
        }, "Touch location attributes are present.");
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   121
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   122
        done();
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   123
      });
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   124
52
a3bdd103c7d9 Add tests for the touchend event
Matt Brubeck <mbrubeck@mozilla.com>
parents: 50
diff changeset
   125
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   126
      on_event(target, "click", function onClick(ev) {
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   127
        test_click.step(function() {
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   128
          assert_true(touchstart_received,
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   129
            "The touchstart event must be dispatched before any mouse " +
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   130
            "events. (If this fails, it might mean that the user agent does " +
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   131
            "not implement W3C touch events at all.)"
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   132
          );
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   133
        });
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   134
        test_click.done();
41
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   135
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   136
        if (!touchstart_received) {
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   137
          // Abort the tests.  If touch events are not supported, then most of
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   138
          // the other event handlers will never be called, and the test will
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   139
          // time out with misleading results.
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   140
          done();
d4970c8cc39c Expand the touch-area test into a general single-touch test.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 40
diff changeset
   141
        }
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   142
      });
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   143
    }
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   144
  </script>
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   145
  <style>
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   146
    #target {
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   147
      background: yellow;
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   148
      border: 1px solid orange;
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   149
      padding: 2em;
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   150
    }
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   151
  </style>
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   152
</head>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   153
<body onload="run()">
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   154
  <h1>Touch area tests</h1>
40
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   155
  <p id="target">
8b932f6d4ec8 Abort the test if a click is received without any touchstart event.
Matt Brubeck <mbrubeck@mozilla.com>
parents: 33
diff changeset
   156
    Tap this element with one finger (or other pointing device).
26
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   157
  </p>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   158
  <div id="log"></div>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   159
</body>
9b69cee6dfb8 Add a test harness and a simple conformance test.
Matt Brubeck <mbrubeck@mozilla.com>
parents:
diff changeset
   160
</html>