Title: [210941] trunk
Revision
210941
Author
[email protected]
Date
2017-01-19 15:30:33 -0800 (Thu, 19 Jan 2017)

Log Message

Additional selection tests and interpolation fix
https://bugs.webkit.org/show_bug.cgi?id=167171

Reviewed by Simon Fraser.

Tools:

We weren't adding the final event when interpolating event streams.

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator interpolatedEvents:]):

LayoutTests:

Selections tests for dragging left and right.
Factored out common functions used across tests.

* fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text-expected.txt: Added.
* fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html: Added.
* fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text-expected.txt: Added.
* fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html: Added.
* fast/events/touch/ios/resources: Added.
* fast/events/touch/ios/resources/basic-gestures.js: Added.
(pressAtPoint):
(dragFromPointToPoint):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210940 => 210941)


--- trunk/LayoutTests/ChangeLog	2017-01-19 23:09:38 UTC (rev 210940)
+++ trunk/LayoutTests/ChangeLog	2017-01-19 23:30:33 UTC (rev 210941)
@@ -1,3 +1,22 @@
+2017-01-19  Megan Gardner  <[email protected]>
+
+        Additional selection tests and interpolation fix
+        https://bugs.webkit.org/show_bug.cgi?id=167171
+
+        Reviewed by Simon Fraser.
+
+        Selections tests for dragging left and right.
+        Factored out common functions used across tests.
+
+        * fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text-expected.txt: Added.
+        * fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html: Added.
+        * fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text-expected.txt: Added.
+        * fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html: Added.
+        * fast/events/touch/ios/resources: Added.
+        * fast/events/touch/ios/resources/basic-gestures.js: Added.
+        (pressAtPoint):
+        (dragFromPointToPoint):
+
 2017-01-19  Chris Dumez  <[email protected]>
 
         Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached

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


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text-expected.txt	2017-01-19 23:30:33 UTC (rev 210941)
@@ -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-left-to-change-selected-text.html (0 => 210941)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html	2017-01-19 23:30:33 UTC (rev 210941)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script src=""
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+    
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(pressAtPoint(181, 104), function(result) {
+                    if (document.getSelection().toString() == "aliqua")
+                        output += 'PASS: Correct Selection';
+                    else
+                        output += 'FAIL: failed to select a word as a result of a long press';
+                    output += '<br>';
+
+                    testRunner.runUIScript(dragFromPointToPoint(149,90,84,90), function(result) {
+                        if (document.getSelection().toString() == "magna aliqua")
+                            output += 'PASS: Correct Selection';
+                        else
+                            output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
+                        output += '<br>';
+                                          
+                        testRunner.runUIScript(dragFromPointToPoint(84,90,8,90), function(result) {
+                            if (document.getSelection().toString() == "dolore magna aliqua")
+                                output += 'PASS: Correct Selection';
+                            else
+                                output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
+                            output += '<br>';
+
+                            testRunner.runUIScript(dragFromPointToPoint(8,90,84,90), function(result) {
+                                if (document.getSelection().toString() == "magna aliqua")
+                                    output += 'PASS: Correct Selection';
+                                else
+                                    output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                output += '<br>';
+
+                                testRunner.runUIScript(dragFromPointToPoint(84,90,149,90), function(result) {
+                                    if (document.getSelection().toString() == "aliqua")
+                                        output += 'PASS: Correct Selection';
+                                    else
+                                        output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                    output += '<br>';
+                            
+                                    testRunner.runUIScript(dragFromPointToPoint(149,90,250,90), function(result) {
+                                        if (document.getSelection().toString() == "a")
+                                            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: 300px;
+            background-color: silver;
+            font-family: monospace;
+            font-size: 18px;
+        }
+    </style>
+</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-right-to-change-selected-text-expected.txt (0 => 210941)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text-expected.txt	2017-01-19 23:30:33 UTC (rev 210941)
@@ -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-right-to-change-selected-text.html (0 => 210941)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html	2017-01-19 23:30:33 UTC (rev 210941)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script src=""
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+    
+        function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            var output = '';
+            var target = document.getElementById('target');
+            
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(pressAtPoint(110, 104), function(result) {
+                    if (document.getSelection().toString() == "magna")
+                        output += 'PASS: Correct Selection';
+                    else
+                        output += 'FAIL: failed to select a word as a result of a long press';
+                    output += '<br>';
+
+                    testRunner.runUIScript(dragFromPointToPoint(139,120,224,120), function(result) {
+                        if (document.getSelection().toString() == "magna aliqua.")
+                            output += 'PASS: Correct Selection';
+                        else
+                            output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
+                        output += '<br>';
+                                          
+                        testRunner.runUIScript(dragFromPointToPoint(224,120,255,120), function(result) {
+                            if (document.getSelection().toString() == "magna aliqua. Ut ")
+                                output += 'PASS: Correct Selection';
+                            else
+                                output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()+'/end'
+                            output += '<br>';
+
+                            testRunner.runUIScript(dragFromPointToPoint(255,120,224,120), function(result) {
+                                if (document.getSelection().toString() == "magna aliqua.")
+                                    output += 'PASS: Correct Selection';
+                                else
+                                    output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                output += '<br>';
+
+                                testRunner.runUIScript(dragFromPointToPoint(224,120,139,120), function(result) {
+                                    if (document.getSelection().toString() == "magna")
+                                        output += 'PASS: Correct Selection';
+                                    else
+                                        output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
+                                    output += '<br>';
+                            
+                                    testRunner.runUIScript(dragFromPointToPoint(139,120,40,120), function(result) {
+                                        if (document.getSelection().toString() == "m")
+                                            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: 300px;
+            background-color: silver;
+            font-family: monospace;
+            font-size: 18px;
+        }
+    </style>
+</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.</p>
+
+    This test requires UIScriptController to run.
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js (0 => 210941)


--- trunk/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js	2017-01-19 23:30:33 UTC (rev 210941)
@@ -0,0 +1,54 @@
+function pressAtPoint(x, y)
+{
+    return `
+    (function() {
+        uiController.longPressAtPoint(${x}, ${y}, function() {
+            uiController.uiScriptComplete();
+        });
+    })();`
+}
+
+function dragFromPointToPoint(startX, startY, endX, endY)
+{
+    return `
+    (function() {
+    var eventStream = {
+    events : [
+        {
+            interpolate : "linear",
+            timestep: 0.1,
+            coordinateSpace : "content",
+            startEvent : {
+                inputType : "hand",
+                timeOffset : 0,
+                touches : [
+                    {
+                        inputType : "finger",
+                        phase : "began",
+                        id : 1,
+                        x : ${startX},
+                        y : ${startY},
+                        pressure : 0
+                    }
+                ]
+            },
+            endEvent : {
+                inputType : "hand",
+                timeOffset : 0.5,
+                touches : [
+                    {
+                        inputType : "finger",
+                        phase : "moved",
+                        id : 1,
+                        x : ${endX},
+                        y : ${endY},
+                        pressure : 0
+                    }
+                ]
+            }
+    }]};
+    
+    uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+        uiController.uiScriptComplete();
+    })();`
+}

Modified: trunk/Tools/ChangeLog (210940 => 210941)


--- trunk/Tools/ChangeLog	2017-01-19 23:09:38 UTC (rev 210940)
+++ trunk/Tools/ChangeLog	2017-01-19 23:30:33 UTC (rev 210941)
@@ -1,3 +1,15 @@
+2017-01-19  Megan Gardner  <[email protected]>
+
+        Additional selection tests and interpolation fix
+        https://bugs.webkit.org/show_bug.cgi?id=167171
+
+        Reviewed by Simon Fraser.
+
+        We weren't adding the final event when interpolating event streams.
+
+        * WebKitTestRunner/ios/HIDEventGenerator.mm:
+        (-[HIDEventGenerator interpolatedEvents:]):
+
 2017-01-19  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Variation fonts are erroneously disabled on iOS

Modified: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (210940 => 210941)


--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm	2017-01-19 23:09:38 UTC (rev 210940)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm	2017-01-19 23:30:33 UTC (rev 210941)
@@ -1031,6 +1031,8 @@
         [newEvent release];
         time += timeStep;
     }
+    
+    [interpolatedEvents addObject:endEvent];
 
     return interpolatedEvents;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to