Changeset 287898 in webkit


Ignore:
Timestamp:
Jan 11, 2022, 3:17:02 PM (4 years ago)
Author:
Megan Gardner
Message:

Rewrite touch and drag tests to be more robust.
https://bugs.webkit.org/show_bug.cgi?id=235057
rdar://86035420

Reviewed by Wenson Hsieh.

Rewrite the touch-and-drag tests to check for selection changes, not specific text selections.
Specific selections and subject to small changes in font and layout, and all that is actually important is that
there have been selection changes based off of dragged touches.
The touch-event-radius test has been updated to use the screen size directly, since the radius is scaled by the screen size
internally. The output has been changed to not need to be updated when the test phone changes.

  • fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt:
  • fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html:
  • fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text-expected.txt:
  • fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html:
  • fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html:
  • fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt:
  • fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html:
  • fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt:
  • fast/events/touch/ios/long-press-then-drag-to-select-text.html:
  • fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt:
  • fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html:
  • fast/events/touch/ios/touch-event-radius-expected.txt:
  • fast/events/touch/ios/touch-event-radius.html:
Location:
trunk/LayoutTests
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287893 r287898  
     12022-01-11  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Rewrite touch and drag tests to be more robust.
     4        https://bugs.webkit.org/show_bug.cgi?id=235057
     5        rdar://86035420
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Rewrite the touch-and-drag tests to check for selection changes, not specific text selections.
     10        Specific selections and subject to small changes in font and layout, and all that is actually important is that
     11        there have been selection changes based off of dragged touches.
     12        The touch-event-radius test has been updated to use the screen size directly, since the radius is scaled by the screen size
     13        internally. The output has been changed to not need to be updated when the test phone changes.
     14
     15        * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt:
     16        * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html:
     17        * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text-expected.txt:
     18        * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html:
     19        * fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html:
     20        * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt:
     21        * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html:
     22        * fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt:
     23        * fast/events/touch/ios/long-press-then-drag-to-select-text.html:
     24        * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt:
     25        * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html:
     26        * fast/events/touch/ios/touch-event-radius-expected.txt:
     27        * fast/events/touch/ios/touch-event-radius.html:
     28
    1292022-01-11  Alex Christensen  <achristensen@webkit.org>
    230
  • trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt

    r231188 r287898  
    11PASS: Has Caret Selection
    2 PASS: Correct Selection
    3 PASS: Correct Selection
    4 PASS: Correct Selection
    5 PASS: Correct Selection
    6 PASS: Correct Selection
    7 PASS: Correct Selection
     2PASS: Has Selection
     3PASS: Selection Changed
     4PASS: Selection Changed
     5PASS: Selection Changed
    86
  • trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html

    r281781 r287898  
    11<!DOCTYPE html>
    2 
    32<html>
    43<head>
     
    109            testRunner.waitUntilDone();
    1110        }
    12    
     11
    1312        async function runTest()
    1413        {
    1514            if (!testRunner.runUIScript)
    1615                return;
    17        
     16
    1817            var output = '';
    1918            var editableTargetRect = document.getElementById('editable').getBoundingClientRect();
    20             var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
    21             var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
    22             var thirdTargetRect = document.getElementById('thirdSelection').getBoundingClientRect();
    23             var editableToNoneditableOffset =  document.getElementById('noneditable').getBoundingClientRect().y - document.getElementById('editable').getBoundingClientRect().y;
    24        
     19
    2520            var tapPointX = editableTargetRect.x + editableTargetRect.width / 2;
    2621            var tapPointY = editableTargetRect.y + editableTargetRect.height / 2;
    27             var doubleTapPointX = firstTargetRect.x + firstTargetRect.width / 2;
    28             var doubleTapPointY = firstTargetRect.y + firstTargetRect.height / 2 - editableToNoneditableOffset;
    29             var dragY = firstTargetRect.y + firstTargetRect.height - editableToNoneditableOffset;
    30             var dragX = firstTargetRect.x + firstTargetRect.width;
    31             var dragY2 = secondTargetRect.y + secondTargetRect.height - editableToNoneditableOffset;
    32             var dragY3 = thirdTargetRect.y + thirdTargetRect.height - editableToNoneditableOffset;
    33             var dragY4 = firstTargetRect.y - firstTargetRect.height - editableToNoneditableOffset;
    34        
     22           
     23            var fontHeight = 30;
     24
     25            var selectionChangedCount = 0;
     26            var lastSelectionChangeCount = 0;
     27            document.addEventListener("selectionchange", () => {
     28                selectionChangedCount++;
     29            });
     30
    3531            await UIHelper.tapAt(tapPointX, tapPointY);
    3632            if (document.getSelection().type == "Caret")
     
    4238            await didShowKeyboard();
    4339
    44             await UIHelper.doubleTapAt(doubleTapPointX, doubleTapPointY);
    45             if (document.getSelection().toString() == "sed")
    46                 output += 'PASS: Correct Selection';
     40            await UIHelper.doubleTapAt(tapPointX, tapPointY);
     41            if (document.getSelection().toString() != "")
     42                output += 'PASS: Has Selection';
    4743            else
    48                 output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
     44                output += 'FAIL: failed to select a word as a result of a double tap.';
    4945            output += '<br>';
    5046
    5147            await UIHelper.waitForDoubleTapDelay();
    5248
    53             await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
    54             if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
    55                 output += 'PASS: Correct Selection';
     49            var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     50
     51            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2));
     52
     53            if (selectionChangedCount > lastSelectionChangeCount)
     54                output += 'PASS: Selection Changed </br>';
    5655            else
    57                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    58             output += '<br>';
     56                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    5957
    60             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
    61             if (document.getSelection().toString() == "sed do eiusmod tempor incididunt ut labore et dolore ma")
    62                 output += 'PASS: Correct Selection';
     58            lastSelectionChangeCount = selectionChangedCount;
     59            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     60            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y - (fontHeight));
     61
     62            if (selectionChangedCount > lastSelectionChangeCount)
     63                output += 'PASS: Selection Changed </br>';
    6364            else
    64                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    65             output += '<br>';
     65                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    6666
    67             await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
    68             if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
    69                 output += 'PASS: Correct Selection';
     67            lastSelectionChangeCount = selectionChangedCount;
     68            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     69            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 4));
     70
     71            if (selectionChangedCount > lastSelectionChangeCount)
     72                output += 'PASS: Selection Changed </br>';
    7073            else
    71                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    72             output += '<br>';
     74                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    7375
    74             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
    75             if (document.getSelection().toString() == "sed")
    76                 output += 'PASS: Correct Selection';
    77             else
    78                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    79             output += '<br>';
    80 
    81             var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
    82             if (document.getSelection().toString() == "sed")
    83                 output += 'PASS: Correct Selection';
    84             else
    85                 output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString();
    86             output += '<br>';
    87             output += result;
    88 
    89             var noneditableElement = document.getElementById('noneditable');
    90             noneditableElement.parentNode.removeChild(noneditableElement);
    9176            var editableElement = document.getElementById('editable');
    9277            editableElement.parentNode.removeChild(editableElement);
     
    9479            testRunner.notifyDone();
    9580        }
    96    
     81
    9782        window.addEventListener('load', runTest, false);
    9883    </script>
    9984    <style>
    100         #noneditable {
    101             height: 200px;
    102             width: 300px;
    103             background-color: silver;
    104             font-family: monospace;
    105             font-size: 18px;
    106         }
    107         #editable {
    108             height: 200px;
    109             width: 300px;
    110             background-color: silver;
    111             font-family: monospace;
    112             font-size: 18px;
    113         }
    11485        #target {
    11586            height: 50px;
     
    11990            font-size: 18px;
    12091        }
     92        #editable {
     93            height: 300px;
     94            width: 300px;
     95            background-color: silver;
     96            font-family: monospace;
     97            font-size: 30px;
     98        }
    12199    </style>
    122100    <meta name="viewport" content="width=device-width, initial-scale=1">
    123101</head>
    124102<body>
    125     <div id="editable" contenteditable>
    126         <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.</p>
    127     </div>
    128     <div id="noneditable">
    129         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, <span id="firstSelection">sed</span> do eiusmod tempor incididun<span id="secondSelection"></span>t ut labore et dolore mag<span id="thirdSelection"></span>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    130     </div>
    131103    <div id="target">
    132104        This test requires UIScriptController to run.
    133105    </div>
     106    <div id="editable" contenteditable>
     107        <p>Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.</p>
     108    </div>
    134109</body>
    135110</html>
  • trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text-expected.txt

    r231188 r287898  
    11PASS: Has Caret Selection
    2 PASS: Correct Selection
    3 PASS: Correct Selection
    4 PASS: Correct Selection
    5 PASS: Correct Selection
    6 PASS: Correct Selection
    7 PASS: Correct Selection
     2PASS: Has Selection
     3PASS: Selection Changed
     4PASS: Selection Changed
     5PASS: Selection Changed
    86
  • trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html

    r281781 r287898  
    11<!DOCTYPE html>
    2 
    32<html>
    43<head>
     
    109            testRunner.waitUntilDone();
    1110        }
    12    
     11
    1312        async function runTest()
    1413        {
     
    1817            var output = '';
    1918            var editableTargetRect = document.getElementById('editable').getBoundingClientRect();
    20             var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
    21             var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
    22             var thirdTargetRect = document.getElementById('thirdSelection').getBoundingClientRect();
    23             var editableToNoneditableOffset =  document.getElementById('noneditable').getBoundingClientRect().y - document.getElementById('editable').getBoundingClientRect().y;
    24        
     19
    2520            var tapPointX = editableTargetRect.x + editableTargetRect.width / 2;
    2621            var tapPointY = editableTargetRect.y + editableTargetRect.height / 2;
    27             var doubleTapPointX = firstTargetRect.x + firstTargetRect.width / 2;
    28             var doubleTapPointY = firstTargetRect.y + firstTargetRect.height / 2 - editableToNoneditableOffset;
    29             var dragY = firstTargetRect.y - editableToNoneditableOffset;
    30             var dragX = firstTargetRect.x;
    31             var dragY2 = secondTargetRect.y - editableToNoneditableOffset;
    32             var dragY3 = thirdTargetRect.y - editableToNoneditableOffset;
    33             var dragY4 = firstTargetRect.y + firstTargetRect.height - editableToNoneditableOffset;
    34        
     22           
     23            var fontHeight = 30;
     24
     25            var selectionChangedCount = 0;
     26            var lastSelectionChangeCount = 0;
     27            document.addEventListener("selectionchange", () => {
     28                selectionChangedCount++;
     29            });
     30
    3531            await UIHelper.tapAt(tapPointX, tapPointY);
    3632            if (document.getSelection().type == "Caret")
     
    4238            await didShowKeyboard();
    4339
    44             await UIHelper.doubleTapAt(doubleTapPointX, doubleTapPointY);
    45             if (document.getSelection().toString() == "at")
    46                 output += 'PASS: Correct Selection';
     40            await UIHelper.doubleTapAt(tapPointX, tapPointY);
     41            if (document.getSelection().toString() != "")
     42                output += 'PASS: Has Selection';
    4743            else
    48                 output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
     44                output += 'FAIL: failed to select a word as a result of a double tap.';
    4945            output += '<br>';
    5046
    5147            await UIHelper.waitForDoubleTapDelay();
    5248
    53             await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
    54             if (document.getSelection().toString() == "o eiusmod tempor incididunt at")
    55                 output += 'PASS: Correct Selection';
     49            lastSelectionChangeCount = selectionChangedCount;
     50            var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     51            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 2));
     52
     53            if (selectionChangedCount > lastSelectionChangeCount)
     54                output += 'PASS: Selection Changed </br>';
    5655            else
    57                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    58             output += '<br>';
     56                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    5957
    60             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
    61             if (document.getSelection().toString() == " adipiscing elit, sed do eiusmod tempor incididunt at")
    62                 output += 'PASS: Correct Selection';
     58            lastSelectionChangeCount = selectionChangedCount;
     59            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     60            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 3));
     61            await liftUpAtPoint(grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 3));
     62
     63            if (selectionChangedCount > lastSelectionChangeCount)
     64                output += 'PASS: Selection Changed </br>';
    6365            else
    64                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    65             output += '<br>';
     66                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
     67           
     68            lastSelectionChangeCount = selectionChangedCount;
     69            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     70            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2));
    6671
    67             await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
    68             if (document.getSelection().toString() == "o eiusmod tempor incididunt at")
    69                 output += 'PASS: Correct Selection';
     72            if (selectionChangedCount > lastSelectionChangeCount)
     73                output += 'PASS: Selection Changed </br>';
    7074            else
    71                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    72             output += '<br>';
     75                output += 'FAIL: Selection changed <br>' + selectionChangedCount;
    7376
    74             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
    75             if (document.getSelection().toString() == "at")
    76                 output += 'PASS: Correct Selection';
    77             else
    78                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    79             output += '<br>';
    80 
    81             var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
    82             if (document.getSelection().toString() == "at")
    83                 output += 'PASS: Correct Selection';
    84             else
    85                 output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
    86             output += '<br>';
    87             output += result;
    88 
    89             var noneditableElement = document.getElementById('noneditable');
    90             noneditableElement.parentNode.removeChild(noneditableElement);
    9177            var editableElement = document.getElementById('editable');
    9278            editableElement.parentNode.removeChild(editableElement);
     
    9884    </script>
    9985    <style>
    100         #noneditable {
    101             height: 200px;
    102             width: 300px;
    103             background-color: silver;
    104             font-family: monospace;
    105             font-size: 18px;
    106         }
    107         #editable {
    108             height: 200px;
    109             width: 300px;
    110             background-color: silver;
    111             font-family: monospace;
    112             font-size: 18px;
    113         }
    11486        #target {
    11587            height: 50px;
     
    11991            font-size: 18px;
    12092        }
     93        #editable {
     94            height: 300px;
     95            width: 300px;
     96            background-color: silver;
     97            font-family: monospace;
     98            font-size: 30px;
     99        }
    121100    </style>
    122     <meta name="viewport" content="initial-scale=1">
     101    <meta name="viewport" content="width=device-width, initial-scale=1">
    123102</head>
    124103<body>
    125     <div id="editable" contenteditable>
    126         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt at labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    127     </div>
    128     <div id="noneditable">
    129         <p>Lorem ipsum dolor sit amet, consectetur<span id="thirdSelection"></span> adipiscing elit, sed d<span id="secondSelection"></span>o eiusmod tempor incididunt <span id="firstSelection">at</span> labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    130     </div>
    131104    <div id="target">
    132105        This test requires UIScriptController to run.
    133106    </div>
     107    <div id="editable" contenteditable>
     108        <p>Here's to the crazy ones. The misfits. The rebels. The trouble makers. The round pegs in the square holes.</p>
     109    </div>
    134110</body>
    135111</html>
     112
  • trunk/LayoutTests/fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html

    r285549 r287898  
    3838            output += '<br>';
    3939
     40            lastSelectionChangeCount = selectionChangedCount;
    4041            var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
    4142            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 2));
    4243
    43             if (selectionChangedCount == 3)
     44            if (selectionChangedCount > lastSelectionChangeCount)
    4445                output += 'PASS: Selection Changed </br>';
    4546            else
    4647                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    4748
     49            lastSelectionChangeCount = selectionChangedCount;
    4850            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
    4951            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 3));
    5052            await liftUpAtPoint(grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 3));
    5153
    52             if (selectionChangedCount == 5)
     54            if (selectionChangedCount > lastSelectionChangeCount)
    5355                output += 'PASS: Selection Changed </br>';
    5456            else
    5557                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    5658           
     59            lastSelectionChangeCount = selectionChangedCount;
    5760            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
    5861            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2));
    5962
    60             if (selectionChangedCount == 7)
     63            if (selectionChangedCount > lastSelectionChangeCount)
    6164                output += 'PASS: Selection Changed </br>';
    6265            else
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt

    r208934 r287898  
    1 PASS: Correct Selection
    2 PASS: Correct Selection
    3 PASS: Correct Selection
    4 PASS: Correct Selection
    5 PASS: Correct Selection
    6 PASS: Correct Selection
     1PASS: Has Selection
     2PASS: Selection Changed
     3PASS: Selection Changed
     4PASS: Selection Changed
    75
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html

    r235153 r287898  
    11<!DOCTYPE html>
    2 
    32<html>
    43<head>
    54    <script src="../../../../resources/basic-gestures.js"></script>
     5    <script src="../../../../resources/ui-helper.js"></script>
    66    <script>
    77        if (window.testRunner) {
     
    99            testRunner.waitUntilDone();
    1010        }
    11    
     11
    1212        async function runTest()
    1313        {
    1414            if (!testRunner.runUIScript)
    1515                return;
    16        
     16
    1717            var output = '';
    18             var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
    19             var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
    20             var thirdTargetRect = document.getElementById('thirdSelection').getBoundingClientRect();
    21        
    22             var pressPointX = firstTargetRect.x + firstTargetRect.width / 2;
    23             var pressPointY = firstTargetRect.y + firstTargetRect.height / 2;
    24             var dragY = firstTargetRect.y + firstTargetRect.height;
    25             var dragX = firstTargetRect.x + firstTargetRect.width;
    26             var dragY2 = secondTargetRect.y + secondTargetRect.height;
    27             var dragY3 = thirdTargetRect.y + thirdTargetRect.height;
    28             var dragY4 = firstTargetRect.y - firstTargetRect.height;
    29        
    30             await longPressAtPoint(pressPointX,pressPointY);
    31             if (document.getSelection().toString() == "sed")
    32                 output += 'PASS: Correct Selection';
     18            var targetRect = document.getElementById('target').getBoundingClientRect();
     19
     20            var pressPointX = targetRect.x + targetRect.width / 2;
     21            var pressPointY = targetRect.y + targetRect.height / 2;
     22           
     23            var fontHeight = 30;
     24
     25            var selectionChangedCount = 0;
     26            var lastSelectionChangeCount = 0;
     27            document.addEventListener("selectionchange", () => {
     28                selectionChangedCount++;
     29            });
     30
     31            await longPressAtPoint(pressPointX, pressPointY);
     32
     33            await UIHelper.waitForSelectionToAppear();
     34
     35            if (document.getSelection().toString() != "")
     36                output += 'PASS: Has Selection';
    3337            else
    34                 output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
     38                output += 'FAIL: failed to select a word as a result of a long press.';
    3539            output += '<br>';
    3640
    37             await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
    38             if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
    39                 output += 'PASS: Correct Selection';
     41            lastSelectionChangeCount = selectionChangedCount;
     42            var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     43            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2));
     44
     45            if (selectionChangedCount > lastSelectionChangeCount)
     46                output += 'PASS: Selection Changed </br>';
    4047            else
    41                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    42             output += '<br>';
     48                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    4349
    44             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
    45             if (document.getSelection().toString() == "sed do eiusmod tempor incididunt ut labore et dolore ma")
    46                 output += 'PASS: Correct Selection';
     50            lastSelectionChangeCount = selectionChangedCount;
     51            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     52            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y - (fontHeight));
     53
     54            if (selectionChangedCount > lastSelectionChangeCount)
     55                output += 'PASS: Selection Changed </br>';
    4756            else
    48                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    49             output += '<br>';
     57                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    5058
    51             await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
    52             if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
    53                 output += 'PASS: Correct Selection';
     59            lastSelectionChangeCount = selectionChangedCount;
     60            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
     61            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y, grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 4));
     62
     63            if (selectionChangedCount > lastSelectionChangeCount)
     64                output += 'PASS: Selection Changed </br>';
    5465            else
    55                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    56             output += '<br>';
     66                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    5767
    58             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
    59             if (document.getSelection().toString() == "sed")
    60                 output += 'PASS: Correct Selection';
    61             else
    62                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    63             output += '<br>';
    64 
    65             var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
    66             if (document.getSelection().toString() == "sed")
    67                 output += 'PASS: Correct Selection';
    68             else
    69                 output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString();
    70             output += '<br>';
    71             output += result;
    7268            document.getElementById('target').innerHTML = output;
    7369            testRunner.notifyDone();
    7470        }
    75    
     71
    7672        window.addEventListener('load', runTest, false);
    7773    </script>
    7874    <style>
    7975        #target {
    80             height: 400px;
     76            height: 50px;
    8177            width: 300px;
    8278            background-color: silver;
     
    8480            font-size: 18px;
    8581        }
     82        #editable {
     83            height: 300px;
     84            width: 300px;
     85            background-color: silver;
     86            font-family: monospace;
     87            font-size: 30px;
     88        }
    8689    </style>
    87     <meta name="viewport" content="initial-scale=1">
     90    <meta name="viewport" content="width=device-width, initial-scale=1">
    8891</head>
    8992<body>
    9093    <div id="target">
    91         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, <span id="firstSelection">sed</span> do eiusmod tempor incididun<span id="secondSelection"></span>t ut labore et dolore mag<span id="thirdSelection"></span>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    92        
    93         This test requires UIScriptController to run.
     94        <p>Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.</p>
     95        <p>This test requires UIScriptController to run.</p>
    9496    </div>
    9597</body>
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt

    r222813 r287898  
    1 PASS: Correct Selection
    2 PASS: Correct Selection
     1PASS: Has Selection
     2PASS: Selection Changed
    33
     4
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text.html

    r246582 r287898  
    44<head>
    55    <script src="../../../../resources/basic-gestures.js"></script>
     6    <script src="../../../../resources/ui-helper.js"></script>
    67    <script>
    78        if (window.testRunner) {
     
    1617
    1718            var output = '';
    18             var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
    19             var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
    20        
    21             var pressPointX = firstTargetRect.x + firstTargetRect.width / 2;
    22             var pressPointY = firstTargetRect.y + firstTargetRect.height / 2;
    23             var dragX = secondTargetRect.x + secondTargetRect.width / 2;
    24             var dragY = secondTargetRect.y + secondTargetRect.height / 2;
    25        
    26             await longPressAndHoldAtPoint(pressPointX, pressPointY);
    27             if (document.getSelection().toString() == "magna")
    28                 output += 'PASS: Correct Selection';
     19            var targetRect = document.getElementById('target').getBoundingClientRect();
     20
     21            var pressPointX = targetRect.x + targetRect.width / 2;
     22            var pressPointY = targetRect.y + targetRect.height / 2;
     23           
     24            var fontHeight = 30;
     25
     26            var selectionChangedCount = 0;
     27            var lastSelectionChangeCount = 0;
     28            document.addEventListener("selectionchange", () => {
     29                selectionChangedCount++;
     30            });
     31
     32            await longPressAtPoint(pressPointX, pressPointY);
     33            await UIHelper.waitForSelectionToAppear();
     34            if (document.getSelection().toString() != "")
     35                output += 'PASS: Has Selection';
    2936            else
    30                 output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
     37                output += 'FAIL: failed to select a word as a result of a long press.';
    3138            output += '<br>';
    3239
    33             var result = await continueTouchAndDragFromPointToPoint(pressPointX, pressPointY, dragX, dragY);
    34             if (document.getSelection().toString() == "eiusmod tempor incididunt ut labore et dolore magna")
    35                 output += 'PASS: Correct Selection';
     40            lastSelectionChangeCount = selectionChangedCount;
     41            var result = await continueTouchAndDragFromPointToPoint(pressPointX, pressPointY, pressPointX, pressPointY + (fontHeight * 2));
     42            if (selectionChangedCount > lastSelectionChangeCount)
     43                output += 'PASS: Selection Changed </br>';
    3644            else
    37                 output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
     45                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    3846            output += '<br>';
    3947            output += result;
     
    4654    <style>
    4755        #target {
    48             height: 400px;
     56            height: 50px;
    4957            width: 300px;
    5058            background-color: silver;
     
    5260            font-size: 18px;
    5361        }
     62        #editable {
     63            height: 300px;
     64            width: 300px;
     65            background-color: silver;
     66            font-family: monospace;
     67            font-size: 30px;
     68        }
    5469    </style>
    55     <meta name="viewport" content="initial-scale=1">
     70    <meta name="viewport" content="width=device-width, initial-scale=1">
    5671</head>
    5772<body>
    5873    <div id="target">
    59         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut <span id="secondSelection">labore</span> et dolore <span id="firstSelection">magna</span> 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>
    60        
    61         This test requires UIScriptController to run.
     74        <p>Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.</p>
     75        <p>This test requires UIScriptController to run.</p>
    6276    </div>
    6377</body>
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt

    r208934 r287898  
    1 PASS: Correct Selection
    2 PASS: Correct Selection
    3 PASS: Correct Selection
    4 PASS: Correct Selection
    5 PASS: Correct Selection
    6 PASS: Correct Selection
     1PASS: Has Selection
     2PASS: Selection Changed
     3PASS: Selection Changed
     4PASS: Selection Changed
    75
  • trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html

    r235153 r287898  
    11<!DOCTYPE html>
    2 
    32<html>
    43<head>
    54    <script src="../../../../resources/basic-gestures.js"></script>
     5    <script src="../../../../resources/ui-helper.js"></script>
    66    <script>
    77        if (window.testRunner) {
     
    99            testRunner.waitUntilDone();
    1010        }
    11    
     11
    1212        async function runTest()
    1313        {
     
    1616
    1717            var output = '';
    18             var firstTargetRect = document.getElementById('firstSelection').getBoundingClientRect();
    19             var secondTargetRect = document.getElementById('secondSelection').getBoundingClientRect();
    20             var thirdTargetRect = document.getElementById('thirdSelection').getBoundingClientRect();
    21        
    22             var pressPointX = firstTargetRect.x+firstTargetRect.width / 2;
    23             var pressPointY = firstTargetRect.y+firstTargetRect.height / 2;
    24             var dragY = firstTargetRect.y;
    25             var dragX = firstTargetRect.x;
    26             var dragY2 = secondTargetRect.y;
    27             var dragY3 = thirdTargetRect.y;
    28             var dragY4 = firstTargetRect.y + firstTargetRect.height;
    29        
     18            var targetRect = document.getElementById('target').getBoundingClientRect();
     19
     20            var pressPointX = targetRect.x + targetRect.width / 2;
     21            var pressPointY = targetRect.y + targetRect.height * .65;
     22           
     23            var fontHeight = 30;
     24
     25            var selectionChangedCount = 0;
     26            document.addEventListener("selectionchange", () => {
     27                selectionChangedCount++;
     28            });
     29
    3030            await longPressAtPoint(pressPointX, pressPointY);
    31             if (document.getSelection().toString() == "ut")
    32                 output += 'PASS: Correct Selection';
     31
     32            await UIHelper.waitForSelectionToAppear();
     33
     34            if (document.getSelection().toString() != "")
     35                output += 'PASS: Has Selection';
    3336            else
    34                 output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
     37                output += 'FAIL: failed to select a word as a result of a long press.';
    3538            output += '<br>';
    3639
    37             await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
    38             if (document.getSelection().toString() == "o eiusmod tempor incididunt ut")
    39                 output += 'PASS: Correct Selection';
     40            lastSelectionChangeCount = selectionChangedCount;
     41            var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     42            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 2));
     43
     44            if (selectionChangedCount > lastSelectionChangeCount)
     45                output += 'PASS: Selection Changed </br>';
    4046            else
    41                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    42             output += '<br>';
     47                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
    4348
    44             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
    45             if (document.getSelection().toString() == " adipiscing elit, sed do eiusmod tempor incididunt ut")
    46                 output += 'PASS: Correct Selection';
     49            lastSelectionChangeCount = selectionChangedCount;
     50            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     51            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 3));
     52            await liftUpAtPoint(grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 3));
     53
     54            if (selectionChangedCount > lastSelectionChangeCount)
     55                output += 'PASS: Selection Changed </br>';
    4756            else
    48                 output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    49             output += '<br>';
     57                output += 'FAIL: Selection did not change <br>' + selectionChangedCount;
     58           
     59            lastSelectionChangeCount = selectionChangedCount;
     60            grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect());
     61            await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2));
    5062
    51             await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
    52             if (document.getSelection().toString() == "o eiusmod tempor incididunt ut")
    53                 output += 'PASS: Correct Selection';
     63            if (selectionChangedCount > lastSelectionChangeCount)
     64                output += 'PASS: Selection Changed </br>';
    5465            else
    55                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    56             output += '<br>';
     66                output += 'FAIL: Selection changed <br>' + selectionChangedCount;
    5767
    58             await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
    59             if (document.getSelection().toString() == "ut")
    60                 output += 'PASS: Correct Selection';
    61             else
    62                 output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
    63             output += '<br>';
    64 
    65             var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
    66             if (document.getSelection().toString() == "ut")
    67                 output += 'PASS: Correct Selection';
    68             else
    69                 output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
    70             output += '<br>';
    71             output += result;
    7268            document.getElementById('target').innerHTML = output;
    7369            testRunner.notifyDone();
     
    7874    <style>
    7975        #target {
    80             height: 400px;
     76            height: 50px;
    8177            width: 300px;
    8278            background-color: silver;
     
    8480            font-size: 18px;
    8581        }
     82        #editable {
     83            height: 300px;
     84            width: 300px;
     85            background-color: silver;
     86            font-family: monospace;
     87            font-size: 30px;
     88        }
    8689    </style>
    87     <meta name="viewport" content="initial-scale=1">
     90    <meta name="viewport" content="width=device-width, initial-scale=1">
    8891</head>
    8992<body>
    9093    <div id="target">
    91         <p>Lorem ipsum dolor sit amet, consectetur<span id="thirdSelection"></span> adipiscing elit, sed d<span id="secondSelection"></span>o eiusmod tempor incididunt <span id="firstSelection">ut</span> 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>
    92        
    93         This test requires UIScriptController to run.
     94        <p>Here's to the crazy ones. The misfits. The rebels. The trouble makers. The round pegs in the square holes.</p>
     95        <p>This test requires UIScriptController to run.</p>
    9496    </div>
    9597</body>
    9698</html>
     99
  • trunk/LayoutTests/fast/events/touch/ios/touch-event-radius-expected.txt

    r208447 r287898  
    1 PASS: radiusX is 56.8
    2 PASS: radiusY is 56.8
     1PASS: radiusX is correct.
     2PASS: radiusY is correct.
    33
  • trunk/LayoutTests/fast/events/touch/ios/touch-event-radius.html

    r208447 r287898  
    6464           
    6565            target.addEventListener('touchstart', function(event) {
    66                 var expected = Math.round(0.10 * 568 * 10) / 10;
     66                var expected = Math.round(0.10 * window.screen.height * 10) / 10;
    6767                var radiusX = Math.round(event.touches[0].radiusX * 10) / 10;
    6868                if (radiusX == expected)
    69                     output += 'PASS: radiusX is ' + expected + '<br>';
     69                    output += 'PASS: radiusX is correct.<br>';
    7070                else
    7171                    output += 'FAIL: radiusX should be ' + expected + ', was ' + radiusX + '<br>';
     
    7373                var radiusY = Math.round(event.touches[0].radiusY * 10) / 10;
    7474                if (radiusY == expected)
    75                     output += 'PASS: radiusY is ' + expected + '<br>';
     75                    output += 'PASS: radiusY is correct.<br>';
    7676                else
    7777                    output += 'FAIL: radiusY should be ' + expected + ', was ' + radiusY + '<br>';
Note: See TracChangeset for help on using the changeset viewer.