c88708c4554a492be4d3edbd509d168a4d4a535e
[WebKit-https.git] / LayoutTests / fast / events / touch / ios / long-press-on-image.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2 <meta charset="utf-8">
3
4 <html>
5 <head>
6     <script>
7         if (window.testRunner) {
8             testRunner.dumpAsText();
9             testRunner.waitUntilDone();
10         }
11
12         function getUIScript()
13         {
14             return `
15             (function() {
16                 uiController.longPressAtPoint(30, 20, function() {
17                     uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('actionSheet')));
18                 });
19              })();`
20         }
21
22         function runTest()
23         {
24             if (!testRunner.runUIScript)
25                 return;
26
27             var target = document.getElementById('target');
28             if (testRunner.runUIScript) {
29                 testRunner.runUIScript(getUIScript(), function(result) {
30                     var actionDictionary = JSON.parse(result);
31                     var actionStrings = actionDictionary.actionSheet;
32                     var output = '';
33                     if (actionStrings[0] == 'Share…' && actionStrings[1] == 'Add to Photos' && actionStrings[2] == 'Copy' && actionStrings[3] == 'Cancel') {
34                         output += 'Available Actions: <br>';
35                         output +=  actionStrings.join('<br>');
36                         output += '<br>';
37                         output += 'PASS';
38                     }
39                     else {
40                         output += 'Available Actions: <br>';
41                         output += actionStrings.join('<br>');
42                         output += '<br>';
43                         output += 'FAIL'
44                     }
45
46                     document.getElementById('target').innerHTML = output;
47                     testRunner.notifyDone();
48                 });
49             }
50         }
51
52         window.addEventListener('load', runTest, false);
53     </script>
54     <style>
55         #target {
56             height: 100px;
57             width: 200px;
58             background-color: silver;
59         }
60     </style>
61     <meta name="viewport" content="initial-scale=1">
62 </head>
63 <body>
64 <div id="target">
65     <img src="../../../images/resources/dice.png" width="320" height="240" alt="Dice">
66     This test requires UIScriptController to run.
67 </div>
68 </body>
69 </html>