tests/touch-events-v1/submissions/Nokia/create-touch-touchlist.html
author Cathy Chan <cathy.chan@nokia.com>
Mon, 26 Nov 2012 15:53:05 -0500
changeset 163 e5a493429528
child 195 de5bcc4200eb
permissions -rw-r--r--
Multi-touch tests submitted by Nokia
163
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     1
<!DOCTYPE HTML>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     2
<html>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     3
<!-- 
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     4
    Test cases for Touch Events v1 Candiate Recommendation
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     5
    http://www.w3.org/TR/2011/CR-touch-events-20111215/
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     6
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     7
	These tests are based on Mozilla-Nokia-Google's single-touch tests. 
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     8
	http://w3c-test.org/webevents/tests/touch-events-v1/submissions/Moz-Nok-Goog/single-touch.html
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
     9
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    10
	The primary purpose of the tests in this document is checking that the createTouch and createTouchList interfaces of the Touch Events APIs are correctly implemented.
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    11
	Other interactions are covered in other test files.
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    12
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    13
    This document references Test Assertions (abbrev TA below) written by Cathy Chan
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    14
    http://www.w3.org/2010/webevents/wiki/TestAssertions
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    15
-->
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    16
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    17
<head>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    18
<title>Touch Events createTouch and createTouchList Interface Tests</title>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    19
<meta name="viewport" content="width=device-width">
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    20
<script src="../../../testharness.js"></script>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    21
<script>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    22
	setup({explicit_done: true});
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    23
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    24
	var hasIdentifiedTouch = true;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    25
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    26
	// Check a Touch object's atttributes for existence and correct type
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    27
	// TA: 1.1.2, 1.1.3
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    28
	function check_Touch_object (t) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    29
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    30
			assert_equals(Object.prototype.toString.call(t), "[object Touch]", "touch is of type Touch");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    31
		}, "touch point is a Touch object");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    32
		[
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    33
			["long", "identifier"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    34
			["EventTarget", "target"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    35
			["long", "screenX"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    36
			["long", "screenY"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    37
			["long", "clientX"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    38
			["long", "clientY"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    39
			["long", "pageX"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    40
			["long", "pageY"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    41
		].forEach(function(attr) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    42
			var type = attr[0];
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    43
			var name = attr[1];
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    44
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    45
			// existence check
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    46
			test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    47
				assert_true(name in t, name + " attribute in Touch object");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    48
			}, "Touch." + name + " attribute exists");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    49
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    50
			// type check
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    51
			switch(type) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    52
			case "long":
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    53
				test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    54
					assert_equals(typeof t[name], "number", name + " attribute of type long");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    55
				}, "Touch." + name + " attribute is of type number (long)");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    56
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    57
			case "EventTarget":
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    58
				// An event target is some type of Element
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    59
				test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    60
					assert_true(t[name] instanceof Element, "EventTarget must be an Element.");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    61
				}, "Touch." + name + " attribute is of type Element");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    62
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    63
			default:
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    64
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    65
			}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    66
		}); 
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    67
	}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    68
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    69
	// Check a TouchList object's attributes and methods for existence and proper type
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    70
	// Also make sure all of the members of the list are Touch objects
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    71
	// TA: 1.2.1, 1.2.2, 1.2.5, 1.2.6
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    72
	function check_TouchList_object (tl) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    73
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    74
			assert_equals(Object.prototype.toString.call(tl), "[object TouchList]", "touch list is of type TouchList");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    75
		}, "touch list is a TouchList object");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    76
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    77
			// A common failure mode (eg. WebKit bug 96294), don't report multiple errors for it
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    78
			hasIdentifiedTouch = 'identifiedTouch' in tl;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    79
			assert_true(hasIdentifiedTouch);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    80
		}, "TouchList contains an identifiedTouch property");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    81
		[
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    82
			["unsigned long", "length"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    83
			["function", "item"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    84
			["function", "identifiedTouch"],
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    85
		].forEach(function(attr) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    86
			var type = attr[0];
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    87
			var name = attr[1];
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    88
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    89
			if (name == "identifiedTouch" && !hasIdentifiedTouch)
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    90
				return;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    91
			  
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    92
			// existence check
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    93
			test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    94
				assert_true(name in tl, name + " attribute in TouchList");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    95
			}, "TouchList." + name + " attribute exists");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    96
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    97
			// type check
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    98
			switch(type) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
    99
			case "unsigned long":
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   100
				test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   101
					assert_equals(typeof tl[name], "number", name + " attribute of type long");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   102
				}, "TouchList." + name + " attribute is of type number (unsigned long)");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   103
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   104
			case "function":
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   105
				test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   106
					assert_equals(typeof tl[name], "function", name + " attribute of type long");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   107
				}, "TouchList." + name + " attribute is of type function");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   108
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   109
			default:
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   110
				break;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   111
			}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   112
		}); 
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   113
		// Each member of tl should be a proper Touch object
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   114
		for (var i=0; i < tl.length; i++) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   115
			check_Touch_object(tl.item(i));
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   116
		}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   117
		// identifiedTouch should return the member Touch object with the specified identifier
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   118
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   119
			if (hasIdentifiedTouch) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   120
				for (var i=0; i < tl.length; i++) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   121
					assert_equals(tl.item(i), tl.identifiedTouch(tl.item(i).identifier), "TouchList.identifiedTouch returns the correct item");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   122
				}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   123
			}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   124
		}, "TouchList.identifiedTouch returns the correct item");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   125
	}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   126
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   127
    function check_touch_clientXY(touch) {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   128
		assert_equals(touch.clientX, touch.pageX - window.pageXOffset, "touch.clientX is touch.pageX - window.pageXOffset.");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   129
		assert_equals(touch.clientY, touch.pageY - window.pageYOffset, "touch.clientY is touch.pageY - window.pageYOffset.");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   130
    }
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   131
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   132
	function run() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   133
		var target0 = document.getElementById("target0");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   134
		var touch1, touch2;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   135
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   136
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   137
			touch1 = document.createTouch(window, target0, 42, 15, 20, 35, 40);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   138
			assert_equals(touch1.target, target0, "touch.target is target0");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   139
			assert_equals(touch1.identifier, 42, "touch.identifier is requested value");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   140
			assert_equals(touch1.pageX, 15, "touch.pageX is requested value");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   141
			assert_equals(touch1.pageY, 20, "touch.pageY is requested value");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   142
			check_touch_clientXY(touch1);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   143
			assert_equals(touch1.screenX, 35, "touch.screenX is requested value");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   144
			assert_equals(touch1.screenY, 40, "touch.screenY is requested value");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   145
		}, "document.createTouch exists and creates a Touch object with requested properties");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   146
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   147
		touch2 = document.createTouch(window, target0, 44, 25, 30, 45, 50);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   148
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   149
		var touchList;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   150
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   151
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   152
			touchList = document.createTouchList(touch1);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   153
			assert_equals(touchList.length, 1, "touchList.length is 1");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   154
			assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   155
		}, "document.createTouchList exists and correctly creates a TouchList from a single Touch");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   156
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   157
		if (touchList)
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   158
			check_TouchList_object(touchList);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   159
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   160
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   161
			touchList = document.createTouchList([touch1]);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   162
			assert_equals(touchList.length, 1, "touchList.length is 1");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   163
			assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   164
			if (touchList)
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   165
				check_TouchList_object(touchList);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   166
		}, "document.createTouchList exists and correctly creates a TouchList from a Touch array of 1 item");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   167
		
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   168
		test(function() {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   169
			touchList = document.createTouchList([touch1, touch2]);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   170
			assert_equals(touchList.length, 2, "touchList.length is 2");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   171
			assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   172
			assert_equals(touchList.item(1), touch2, "touchList.item(1) is input touch2");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   173
			if (touchList)
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   174
				check_TouchList_object(touchList);
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   175
		}, "document.createTouchList exists and correctly creates a TouchList from a Touch array of 2 items");
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   176
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   177
		target0.innerHTML = "Test complete."
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   178
		done();
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   179
	}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   180
</script>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   181
<style>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   182
	div {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   183
		margin: 0em;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   184
		padding: 2em;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   185
	}
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   186
    #target0 {
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   187
		background: yellow;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   188
		border: 1px solid orange;
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   189
    }
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   190
</style>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   191
</head>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   192
<body onload="run()">
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   193
	<h1>Touch Events: createTouch and createTouchList tests</h1>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   194
	<div id="target0">Please wait for test to complete...</div>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   195
	<div id="log"></div>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   196
</body>
e5a493429528 Multi-touch tests submitted by Nokia
Cathy Chan <cathy.chan@nokia.com>
parents:
diff changeset
   197
</html>