Changeset 287898 in webkit
- Timestamp:
- Jan 11, 2022, 3:17:02 PM (4 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287893 r287898 1 2022-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 1 29 2022-01-11 Alex Christensen <achristensen@webkit.org> 2 30 -
trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt
r231188 r287898 1 1 PASS: 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 2 PASS: Has Selection 3 PASS: Selection Changed 4 PASS: Selection Changed 5 PASS: Selection Changed 8 6 -
trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html
r281781 r287898 1 1 <!DOCTYPE html> 2 3 2 <html> 4 3 <head> … … 10 9 testRunner.waitUntilDone(); 11 10 } 12 11 13 12 async function runTest() 14 13 { 15 14 if (!testRunner.runUIScript) 16 15 return; 17 16 18 17 var output = ''; 19 18 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 25 20 var tapPointX = editableTargetRect.x + editableTargetRect.width / 2; 26 21 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 35 31 await UIHelper.tapAt(tapPointX, tapPointY); 36 32 if (document.getSelection().type == "Caret") … … 42 38 await didShowKeyboard(); 43 39 44 await UIHelper.doubleTapAt( doubleTapPointX, doubleTapPointY);45 if (document.getSelection().toString() == "sed")46 output += 'PASS: CorrectSelection';40 await UIHelper.doubleTapAt(tapPointX, tapPointY); 41 if (document.getSelection().toString() != "") 42 output += 'PASS: Has Selection'; 47 43 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.'; 49 45 output += '<br>'; 50 46 51 47 await UIHelper.waitForDoubleTapDelay(); 52 48 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>'; 56 55 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; 59 57 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>'; 63 64 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; 66 66 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>'; 70 73 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; 73 75 74 await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);75 if (document.getSelection().toString() == "sed")76 output += 'PASS: Correct Selection';77 else78 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 else85 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);91 76 var editableElement = document.getElementById('editable'); 92 77 editableElement.parentNode.removeChild(editableElement); … … 94 79 testRunner.notifyDone(); 95 80 } 96 81 97 82 window.addEventListener('load', runTest, false); 98 83 </script> 99 84 <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 }114 85 #target { 115 86 height: 50px; … … 119 90 font-size: 18px; 120 91 } 92 #editable { 93 height: 300px; 94 width: 300px; 95 background-color: silver; 96 font-family: monospace; 97 font-size: 30px; 98 } 121 99 </style> 122 100 <meta name="viewport" content="width=device-width, initial-scale=1"> 123 101 </head> 124 102 <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>131 103 <div id="target"> 132 104 This test requires UIScriptController to run. 133 105 </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> 134 109 </body> 135 110 </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 1 1 PASS: 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 2 PASS: Has Selection 3 PASS: Selection Changed 4 PASS: Selection Changed 5 PASS: Selection Changed 8 6 -
trunk/LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html
r281781 r287898 1 1 <!DOCTYPE html> 2 3 2 <html> 4 3 <head> … … 10 9 testRunner.waitUntilDone(); 11 10 } 12 11 13 12 async function runTest() 14 13 { … … 18 17 var output = ''; 19 18 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 25 20 var tapPointX = editableTargetRect.x + editableTargetRect.width / 2; 26 21 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 35 31 await UIHelper.tapAt(tapPointX, tapPointY); 36 32 if (document.getSelection().type == "Caret") … … 42 38 await didShowKeyboard(); 43 39 44 await UIHelper.doubleTapAt( doubleTapPointX, doubleTapPointY);45 if (document.getSelection().toString() == "at")46 output += 'PASS: CorrectSelection';40 await UIHelper.doubleTapAt(tapPointX, tapPointY); 41 if (document.getSelection().toString() != "") 42 output += 'PASS: Has Selection'; 47 43 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.'; 49 45 output += '<br>'; 50 46 51 47 await UIHelper.waitForDoubleTapDelay(); 52 48 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>'; 56 55 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; 59 57 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>'; 63 65 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)); 66 71 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>'; 70 74 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; 73 76 74 await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);75 if (document.getSelection().toString() == "at")76 output += 'PASS: Correct Selection';77 else78 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 else85 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);91 77 var editableElement = document.getElementById('editable'); 92 78 editableElement.parentNode.removeChild(editableElement); … … 98 84 </script> 99 85 <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 }114 86 #target { 115 87 height: 50px; … … 119 91 font-size: 18px; 120 92 } 93 #editable { 94 height: 300px; 95 width: 300px; 96 background-color: silver; 97 font-family: monospace; 98 font-size: 30px; 99 } 121 100 </style> 122 <meta name="viewport" content=" initial-scale=1">101 <meta name="viewport" content="width=device-width, initial-scale=1"> 123 102 </head> 124 103 <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>131 104 <div id="target"> 132 105 This test requires UIScriptController to run. 133 106 </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> 134 110 </body> 135 111 </html> 112 -
trunk/LayoutTests/fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html
r285549 r287898 38 38 output += '<br>'; 39 39 40 lastSelectionChangeCount = selectionChangedCount; 40 41 var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect()); 41 42 await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 2)); 42 43 43 if (selectionChangedCount == 3)44 if (selectionChangedCount > lastSelectionChangeCount) 44 45 output += 'PASS: Selection Changed </br>'; 45 46 else 46 47 output += 'FAIL: Selection did not change <br>' + selectionChangedCount; 47 48 49 lastSelectionChangeCount = selectionChangedCount; 48 50 grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect()); 49 51 await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 3)); 50 52 await liftUpAtPoint(grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 3)); 51 53 52 if (selectionChangedCount == 5)54 if (selectionChangedCount > lastSelectionChangeCount) 53 55 output += 'PASS: Selection Changed </br>'; 54 56 else 55 57 output += 'FAIL: Selection did not change <br>' + selectionChangedCount; 56 58 59 lastSelectionChangeCount = selectionChangedCount; 57 60 grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionStartGrabberViewRect()); 58 61 await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y + (fontHeight * 2)); 59 62 60 if (selectionChangedCount == 7)63 if (selectionChangedCount > lastSelectionChangeCount) 61 64 output += 'PASS: Selection Changed </br>'; 62 65 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 1 PASS: Has Selection 2 PASS: Selection Changed 3 PASS: Selection Changed 4 PASS: Selection Changed 7 5 -
trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html
r235153 r287898 1 1 <!DOCTYPE html> 2 3 2 <html> 4 3 <head> 5 4 <script src="../../../../resources/basic-gestures.js"></script> 5 <script src="../../../../resources/ui-helper.js"></script> 6 6 <script> 7 7 if (window.testRunner) { … … 9 9 testRunner.waitUntilDone(); 10 10 } 11 11 12 12 async function runTest() 13 13 { 14 14 if (!testRunner.runUIScript) 15 15 return; 16 16 17 17 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'; 33 37 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.'; 35 39 output += '<br>'; 36 40 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>'; 40 47 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; 43 49 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>'; 47 56 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; 50 58 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>'; 54 65 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; 57 67 58 await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);59 if (document.getSelection().toString() == "sed")60 output += 'PASS: Correct Selection';61 else62 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 else69 output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString();70 output += '<br>';71 output += result;72 68 document.getElementById('target').innerHTML = output; 73 69 testRunner.notifyDone(); 74 70 } 75 71 76 72 window.addEventListener('load', runTest, false); 77 73 </script> 78 74 <style> 79 75 #target { 80 height: 400px;76 height: 50px; 81 77 width: 300px; 82 78 background-color: silver; … … 84 80 font-size: 18px; 85 81 } 82 #editable { 83 height: 300px; 84 width: 300px; 85 background-color: silver; 86 font-family: monospace; 87 font-size: 30px; 88 } 86 89 </style> 87 <meta name="viewport" content=" initial-scale=1">90 <meta name="viewport" content="width=device-width, initial-scale=1"> 88 91 </head> 89 92 <body> 90 93 <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> 94 96 </div> 95 97 </body> -
trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt
r222813 r287898 1 PASS: CorrectSelection2 PASS: Correct Selection1 PASS: Has Selection 2 PASS: Selection Changed 3 3 4 -
trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text.html
r246582 r287898 4 4 <head> 5 5 <script src="../../../../resources/basic-gestures.js"></script> 6 <script src="../../../../resources/ui-helper.js"></script> 6 7 <script> 7 8 if (window.testRunner) { … … 16 17 17 18 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'; 29 36 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.'; 31 38 output += '<br>'; 32 39 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>'; 36 44 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; 38 46 output += '<br>'; 39 47 output += result; … … 46 54 <style> 47 55 #target { 48 height: 400px;56 height: 50px; 49 57 width: 300px; 50 58 background-color: silver; … … 52 60 font-size: 18px; 53 61 } 62 #editable { 63 height: 300px; 64 width: 300px; 65 background-color: silver; 66 font-family: monospace; 67 font-size: 30px; 68 } 54 69 </style> 55 <meta name="viewport" content=" initial-scale=1">70 <meta name="viewport" content="width=device-width, initial-scale=1"> 56 71 </head> 57 72 <body> 58 73 <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> 62 76 </div> 63 77 </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 1 PASS: Has Selection 2 PASS: Selection Changed 3 PASS: Selection Changed 4 PASS: Selection Changed 7 5 -
trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html
r235153 r287898 1 1 <!DOCTYPE html> 2 3 2 <html> 4 3 <head> 5 4 <script src="../../../../resources/basic-gestures.js"></script> 5 <script src="../../../../resources/ui-helper.js"></script> 6 6 <script> 7 7 if (window.testRunner) { … … 9 9 testRunner.waitUntilDone(); 10 10 } 11 11 12 12 async function runTest() 13 13 { … … 16 16 17 17 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 30 30 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'; 33 36 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.'; 35 38 output += '<br>'; 36 39 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>'; 40 46 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; 43 48 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>'; 47 56 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)); 50 62 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>'; 54 65 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; 57 67 58 await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);59 if (document.getSelection().toString() == "ut")60 output += 'PASS: Correct Selection';61 else62 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 else69 output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();70 output += '<br>';71 output += result;72 68 document.getElementById('target').innerHTML = output; 73 69 testRunner.notifyDone(); … … 78 74 <style> 79 75 #target { 80 height: 400px;76 height: 50px; 81 77 width: 300px; 82 78 background-color: silver; … … 84 80 font-size: 18px; 85 81 } 82 #editable { 83 height: 300px; 84 width: 300px; 85 background-color: silver; 86 font-family: monospace; 87 font-size: 30px; 88 } 86 89 </style> 87 <meta name="viewport" content=" initial-scale=1">90 <meta name="viewport" content="width=device-width, initial-scale=1"> 88 91 </head> 89 92 <body> 90 93 <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> 94 96 </div> 95 97 </body> 96 98 </html> 99 -
trunk/LayoutTests/fast/events/touch/ios/touch-event-radius-expected.txt
r208447 r287898 1 PASS: radiusX is 56.82 PASS: radiusY is 56.81 PASS: radiusX is correct. 2 PASS: radiusY is correct. 3 3 -
trunk/LayoutTests/fast/events/touch/ios/touch-event-radius.html
r208447 r287898 64 64 65 65 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; 67 67 var radiusX = Math.round(event.touches[0].radiusX * 10) / 10; 68 68 if (radiusX == expected) 69 output += 'PASS: radiusX is ' + expected + '<br>';69 output += 'PASS: radiusX is correct.<br>'; 70 70 else 71 71 output += 'FAIL: radiusX should be ' + expected + ', was ' + radiusX + '<br>'; … … 73 73 var radiusY = Math.round(event.touches[0].radiusY * 10) / 10; 74 74 if (radiusY == expected) 75 output += 'PASS: radiusY is ' + expected + '<br>';75 output += 'PASS: radiusY is correct.<br>'; 76 76 else 77 77 output += 'FAIL: radiusY should be ' + expected + ', was ' + radiusY + '<br>';
Note:
See TracChangeset
for help on using the changeset viewer.