Title: [208934] trunk/LayoutTests
Revision
208934
Author
[email protected]
Date
2016-11-20 16:57:27 -0800 (Sun, 20 Nov 2016)

Log Message

Add iOS text selection tests - long press clear and multi line selection tests
https://bugs.webkit.org/show_bug.cgi?id=164899

Patch by Megan Gardner <[email protected]> on 2016-11-20
Reviewed by Darin Adler.

Test for clearing a selection after a long press.
Test for checking multi-line select, both increasing and decreasing, using the left selection.
Test for checking multi-line select, both increasing and decreasing, using the right selection.

* fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt: Added.
* fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: Added.
* fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt: Added.
* fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: Added.
* fast/events/touch/ios/long-press-to-select-and-tap-to-clear-expected.txt: Added.
* fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208933 => 208934)


--- trunk/LayoutTests/ChangeLog	2016-11-20 08:58:05 UTC (rev 208933)
+++ trunk/LayoutTests/ChangeLog	2016-11-21 00:57:27 UTC (rev 208934)
@@ -1,3 +1,21 @@
+2016-11-20  Megan Gardner  <[email protected]>
+
+        Add iOS text selection tests - long press clear and multi line selection tests
+        https://bugs.webkit.org/show_bug.cgi?id=164899
+
+        Reviewed by Darin Adler.
+
+        Test for clearing a selection after a long press.
+        Test for checking multi-line select, both increasing and decreasing, using the left selection.
+        Test for checking multi-line select, both increasing and decreasing, using the right selection.
+
+        * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt: Added.
+        * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: Added.
+        * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt: Added.
+        * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: Added.
+        * fast/events/touch/ios/long-press-to-select-and-tap-to-clear-expected.txt: Added.
+        * fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html: Added.
+
 2016-11-19  Chris Dumez  <[email protected]>
 
         Update HTML form validation messages

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,7 @@
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,318 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getInitalPressScript()
+        {
+            return `
+            (function() {
+                uiController.longPressAtPoint(65, 100, function() {
+                        uiController.uiScriptComplete();
+                });
+            })();`
+        }
+    
+        function getDragDownOneScript()
+        {
+            return `
+            (function() {
+            var eventStream = {
+            events : [
+                {
+                interpolate : "linear",
+                timestep: 0.1,
+                startEvent : {
+                    inputType : "hand",
+                    timeOffset : 0,
+                    touches : [
+                        {
+                        inputType : "finger",
+                        phase : "began",
+                        id : 1,
+                        x : 72,
+                        y : 140,
+                        pressure : 0
+                        }
+                    ]
+                },
+                endEvent : {
+                    inputType : "hand",
+                    timeOffset : 0.5,
+                    touches : [
+                        {
+                        inputType : "finger",
+                        phase : "moved",
+                        id : 1,
+                        x : 72,
+                        y : 150,
+                        pressure : 0
+                        }
+                    ]
+                }
+            }]};
+             
+            uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                uiController.uiScriptComplete();
+            })();`
+        }
+    
+        function getDragDownTwoScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 72,
+                         y : 150,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 72,
+                         y : 170,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragUpOneScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 72,
+                         y : 170,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 72,
+                         y : 150,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragUpTwoScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 72,
+                         y : 150,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 72,
+                         y : 135,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragUpPastScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 72,
+                         y : 140,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 72,
+                         y : 100,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getInitalPressScript(), function(result) {
+                    if (document.getSelection().toString() == "Ut")
+                        output += 'PASS: Correct Selection';
+                    else
+                        output += 'FAIL: failed to select a word as a result of a long press';
+                    output += '<br>';
+
+                    testRunner.runUIScript(getDragDownOneScript(), function(result) {
+                        if (document.getSelection().toString() == "Ut enim ad minim veniam, q")
+                            output += 'PASS: Correct Selection';
+                        else
+                            output += 'FAIL: failed to select additional line after a drag.'
+                        output += '<br>';
+                                          
+                        testRunner.runUIScript(getDragDownTwoScript(), function(result) {
+                            if (document.getSelection().toString() == "Ut enim ad minim veniam, quis nostrud exercitati")
+                                output += 'PASS: Correct Selection';
+                            else
+                                output += 'FAIL: failed to select additional line after a drag.'
+                            output += '<br>';
+
+                            testRunner.runUIScript(getDragUpOneScript(), function(result) {
+                                if (document.getSelection().toString() == "Ut enim ad minim veniam, q")
+                                    output += 'PASS: Correct Selection';
+                                else
+                                    output += 'FAIL: failed to deselect line after a drag.'
+                                output += '<br>';
+
+                                testRunner.runUIScript(getDragUpTwoScript(), function(result) {
+                                    if (document.getSelection().toString() == "Ut")
+                                        output += 'PASS: Correct Selection';
+                                    else
+                                        output += 'FAIL: failed to deselect line after a drag.'
+                                    output += '<br>';
+                            
+                                    testRunner.runUIScript(getDragUpPastScript(), function(result) {
+                                        if (document.getSelection().toString() == "U")
+                                            output += 'PASS: Correct Selection';
+                                        else
+                                            output += 'FAIL: failed to reduce selection to a single character by dragging up.'
+                                        output += '<br>';
+                                        output += result;
+                                        document.getElementById('target').innerHTML = output;
+                                        testRunner.notifyDone();
+                                    });
+                                });
+                            });
+                        });
+                    });
+                });
+            }
+        }
+
+        window.addEventListener('load', runTest, false);
+    </script>
+    <style>
+        #target {
+            height: 400px;
+            width: 200px;
+            background-color: silver;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+<div id="target">
+    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+
+    This test requires UIScriptController to run.
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,7 @@
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+PASS: Correct Selection
+

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,318 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getInitalPressScript()
+        {
+            return `
+            (function() {
+                uiController.longPressAtPoint(65, 100, function() {
+                        uiController.uiScriptComplete();
+                });
+            })();`
+        }
+    
+        function getDragUpOneScript()
+        {
+            return `
+            (function() {
+            var eventStream = {
+            events : [
+                {
+                interpolate : "linear",
+                timestep: 0.1,
+                startEvent : {
+                    inputType : "hand",
+                    timeOffset : 0,
+                    touches : [
+                        {
+                        inputType : "finger",
+                        phase : "began",
+                        id : 1,
+                        x : 56,
+                        y : 109,
+                        pressure : 0
+                        }
+                    ]
+                },
+                endEvent : {
+                    inputType : "hand",
+                    timeOffset : 0.5,
+                    touches : [
+                        {
+                        inputType : "finger",
+                        phase : "moved",
+                        id : 1,
+                        x : 56,
+                        y : 103,
+                        pressure : 0
+                        }
+                    ]
+                }
+            }]};
+             
+            uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                uiController.uiScriptComplete();
+            })();`
+        }
+    
+        function getDragUpTwoScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 56,
+                         y : 103,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 56,
+                         y : 84,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragDownOneScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 56,
+                         y : 84,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 56,
+                         y : 103,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragDownTwoScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 56,
+                         y : 103,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 56,
+                         y : 112,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+        function getDragDownPastScript()
+        {
+            return `
+            (function() {
+             var eventStream = {
+             events : [
+                 {
+                 interpolate : "linear",
+                 timestep: 0.1,
+                 startEvent : {
+                     inputType : "hand",
+                     timeOffset : 0,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "began",
+                         id : 1,
+                         x : 56,
+                         y : 112,
+                         pressure : 0
+                         }
+                     ]
+                 },
+                 endEvent : {
+                     inputType : "hand",
+                     timeOffset : 0.5,
+                     touches : [
+                         {
+                         inputType : "finger",
+                         phase : "moved",
+                         id : 1,
+                         x : 56,
+                         y : 140,
+                         pressure : 0
+                         }
+                     ]
+                 }
+             }]};
+             
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`
+        }
+
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getInitalPressScript(), function(result) {
+                    if (document.getSelection().toString() == "Ut")
+                        output += 'PASS: Correct Selection';
+                    else
+                        output += 'FAIL: failed to select a word as a result of a long press';
+                    output += '<br>';
+
+                    testRunner.runUIScript(getDragUpOneScript(), function(result) {
+                        if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
+                            output += 'PASS: Correct Selection';
+                        else
+                            output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
+                        output += '<br>';
+                                          
+                        testRunner.runUIScript(getDragUpTwoScript(), function(result) {
+                            if (document.getSelection().toString() == "mod tempor incididunt ut labore et dolore magna aliqua. Ut")
+                                output += 'PASS: Correct Selection';
+                            else
+                                output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
+                            output += '<br>';
+
+                            testRunner.runUIScript(getDragDownOneScript(), function(result) {
+                                if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
+                                    output += 'PASS: Correct Selection';
+                                else
+                                    output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                output += '<br>';
+
+                                testRunner.runUIScript(getDragDownTwoScript(), function(result) {
+                                    if (document.getSelection().toString() == "Ut")
+                                        output += 'PASS: Correct Selection';
+                                    else
+                                        output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                    output += '<br>';
+                            
+                                    testRunner.runUIScript(getDragDownPastScript(), function(result) {
+                                        if (document.getSelection().toString() == "t")
+                                            output += 'PASS: Correct Selection';
+                                        else
+                                            output += 'FAIL: failed to reduce selection to a single character by dragging up.'
+                                        output += '<br>';
+                                        output += result;
+                                        document.getElementById('target').innerHTML = output;
+                                        //testRunner.notifyDone();
+                                    });
+                                });
+                            });
+                        });
+                    });
+                });
+            }
+        }
+
+        window.addEventListener('load', runTest, false);
+    </script>
+    <style>
+        #target {
+            height: 400px;
+            width: 200px;
+            background-color: silver;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+<div id="target">
+    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+
+    This test requires UIScriptController to run.
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear-expected.txt (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear-expected.txt	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,3 @@
+PASS: Selected: PressMe
+PASS: Cleared selection
+

Added: trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html (0 => 208934)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html	2016-11-21 00:57:27 UTC (rev 208934)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getPressScript()
+        {
+            return `
+            (function() {
+                uiController.longPressAtPoint(30, 20, function() {
+                    uiController.uiScriptComplete();
+                });
+            })();`
+        }
+    
+        function getTapScript()
+        {
+            return `
+            (function() {
+             uiController.singleTapAtPoint(30, 20, function() {
+                 uiController.uiScriptComplete();
+                });
+             })();`
+        }
+    
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getPressScript(), function(result) {
+                    var selectionText = document.getSelection().toString();
+                    if (selectionText == "PressMe")
+                        output += 'PASS: Selected: ' + selectionText;
+                    else
+                        output += 'FAIL: failed to select a word as a result of a long press';
+                    output += '<br>';
+                    testRunner.runUIScript(getTapScript(), function(result) {
+                      var secondSelectionText = document.getSelection().toString();
+                      if (secondSelectionText == "")
+                            output += 'PASS: Cleared selection';
+                      else
+                            output += 'FAIL: failed to clear selection after tap.'
+                      output += '<br>';
+                      document.getElementById('target').innerHTML = output;
+                      testRunner.notifyDone();
+                    });
+                });
+            }
+        }
+
+        window.addEventListener('load', runTest, false);
+    </script>
+    <style>
+        #target {
+            height: 100px;
+            width: 200px;
+            background-color: silver;
+        }
+    </style>
+    <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+<div id="target">
+	<p>PressMe</p>
+    This test requires UIScriptController to run.
+</div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to