[WPE] run-qt-wpe-minibrowser needlessly expects a --wpe argument
[WebKit-https.git] / LayoutTests / fast / events / touch / ios / iphone7 / force-press-event.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
3 <html>
4 <head>
5     <script>
6         if (window.testRunner) {
7             testRunner.dumpAsText();
8             testRunner.waitUntilDone();
9         }
10
11         function getUIScript()
12         {
13             return `
14             (function() {
15                 var eventStream = {
16                     events : [
17                         {
18                             interpolate : "linear",
19                             timestep: 0.025,
20                             startEvent : {
21                                 inputType : "hand",
22                                 timeOffset : 0,
23                                 touches : [
24                                     {
25                                         inputType : "finger",
26                                         phase : "began",
27                                         id : 1,
28                                         x : 20,
29                                         y : 40,
30                                         pressure : 0
31                                     }
32                                 ]
33                             },
34                             endEvent : {
35                                 inputType : "hand",
36                                 timeOffset : 3.0,
37                                 touches : [
38                                     {
39                                         inputType : "finger",
40                                         phase : "stationary",
41                                         id : 1,
42                                         x : 20,
43                                         y : 40,
44                                         pressure : 500
45                                     }
46                                 ]
47                             }
48                         }
49                     ]
50                 };
51
52                 uiController.sendEventStream(JSON.stringify(eventStream), function() {
53                     uiController.uiScriptComplete();
54                 });
55             })();`
56         }
57
58         function runTest()
59         {
60             if (!testRunner.runUIScript)
61                 return;
62
63             var output = '';
64             var target = document.getElementById('target');
65             var forces = [];
66             
67             target.addEventListener('touchforcechange', function(event) {
68                 forces.push(event.touches[0].force);
69             });
70             
71             target.addEventListener('touchstart', function(event) {
72                 event.preventDefault();
73             });
74             
75             if (testRunner.runUIScript) {
76                 testRunner.runUIScript(getUIScript(), function(result) {
77                     var middleIndex = Math.floor(forces.length/2);
78                 
79                     if ((forces[0] < forces[middleIndex]) && (forces[middleIndex] < forces[forces.length - 1]))
80                         output += 'PASS: Generated increasing force';
81                     
82                     document.getElementById('target').innerHTML = output;
83                     testRunner.notifyDone();
84                });
85             }
86         }
87
88         window.addEventListener('load', runTest, false);
89     </script>
90     <style>
91         #target {
92             height: 100px;
93             width: 200px;
94             background-color: silver;
95         }
96     </style>
97     <meta name="viewport" content="initial-scale=1">
98 </head>
99 <body>
100 <div id="target">
101     This test requires UIScriptController to run.
102 </div>
103 </body>
104 </html>