Add more conformance tests.
authorMatt Brubeck <mbrubeck@mozilla.com>
Sun, 24 Apr 2011 21:58:39 -0700
changeset 44 ad7715ddbcda
parent 43 fc6abcf8b74c
child 45 283f47a9b963
Add more conformance tests.
test/touchevents/single-touch.html
--- a/test/touchevents/single-touch.html	Sun Apr 24 21:29:55 2011 -0700
+++ b/test/touchevents/single-touch.html	Sun Apr 24 21:58:39 2011 -0700
@@ -22,19 +22,45 @@
         }, "TouchEvent target attributes are correct.");
 
         test(function() {
+          var attrs = ["altKey", "metaKey", "ctrlKey", "shiftKey"];
+          for (var i = 0; i < attrs.length; i++) {
+            assert_true(attrs[i] in ev);
+          }
+        }, "TouchEvent modifier key attributes are present.");
+
+        test(function() {
           assert_equals(ev.touches.length, 1, "One touch point.");
           assert_equals(ev.changedTouches.length, 1, "One changed touch point.");
           assert_equals(ev.targetTouches.length, 1, "One target touch point.");
         }, "TouchList lengths are correct.");
 
+        var t = ev.touches[0];
+        var ct = ev.changedTouches[0];
+        var tt = ev.targetTouches[0];
+
         test(function() {
-          var t = ev.touches[0];
+          assert_equals(t.identifier, ct.identifier, "touches and changedTouches match.");
+          assert_equals(t.identifier, tt.identifier, "touches and targetTouches match.");
+        }, "TouchLists contain the same TouchPoint.");
+
+        test(function() {
           assert_true(t.rotationAngle >= 0, "rotationAngle must be >= 0.");
           assert_true(t.rotationAngle < 90, "rotationAngle must be > 90.");
 
           assert_true(t.radiusX > 0, "radiusX is positive.");
           assert_true(t.radiusY > 0, "radiusY is positive.");
-        }, "TouchPoint area attributes are correct");
+
+          assert_true(t.force >= 0, "force >= 0.");
+          assert_true(t.force <= 1, "force <= 1.");
+        }, "TouchPoint attribute values are valid");
+
+        test(function() {
+          var attrs = ["screenX", "screenY", "clientX", "clientY",
+                       "pageX", "pageY"];
+          for (var i = 0; i < attrs.length; i++) {
+            assert_true(attrs[i] in t);
+          }
+        }, "TouchPoint location attributes are present.");
 
         done();
       });