Skip to content

Commit ed057aa

Browse files
committed
fast/events/touch/ios/selection-handles-after-touch-end.html is not robust against inflated (yet valid) selection handle views
https://bugs.webkit.org/show_bug.cgi?id=263295 rdar://116418780 Reviewed by Wenson Hsieh. The fast/events/touch/ios/selection-handles-after-touch-end.html test makes exact assertions about the width of the text selection handle view corresponding to the start grabber and the end grabber of a selection. This means that the test is not robust against the case where the grabberRect may visibly still have the correct width (2 px), but with a view that has imperceptible inflated bounds. We make the test robust to this case by asserting that the startGrabberRect and endGrabberRect are roughly located around the left edge and the right edge of the corresponding selection rect instead. * LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end-expected.txt: * LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end.html: Canonical link: https://commits.webkit.org/269476@main
1 parent df3d039 commit ed057aa

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end-expected.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ PASS Math.round(selectionRects[0].width) is 250
1212
PASS Math.round(selectionRects[0].height) is 167
1313
PASS Math.round(startGrabberRect.left) is 0
1414
PASS Math.round(startGrabberRect.top) is 3
15-
PASS Math.round(startGrabberRect.width) is 2
15+
PASS Math.round(startGrabberRect) is <= Math.round(selectionRects[0].left)
16+
PASS Math.round(startGrabberRect.left + startGrabberRect.width) is > Math.round(selectionRects[0].left)
1617
PASS Math.round(startGrabberRect.height) is 167
1718
PASS Math.round(endGrabberRect.left) is 249
1819
PASS Math.round(endGrabberRect.top) is 3
19-
PASS Math.round(endGrabberRect.width) is 2
20+
PASS Math.round(endGrabberRect.left) is <= Math.round(selectionRects[0].left + selectionRects[0].width)
21+
PASS Math.round(endGrabberRect.left + endGrabberRect.width) is > Math.round(selectionRects[0].left + selectionRects[0].width)
2022
PASS Math.round(endGrabberRect.height) is 167
2123
PASS observedTouchEnd became true
2224
PASS successfullyParsed is true

LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
startGrabberRect = await UIHelper.getSelectionStartGrabberViewRect();
3636
shouldBe("Math.round(startGrabberRect.left)", "0");
3737
shouldBe("Math.round(startGrabberRect.top)", "3");
38-
shouldBe("Math.round(startGrabberRect.width)", "2");
38+
shouldBeLessThanOrEqual("Math.round(startGrabberRect)", "Math.round(selectionRects[0].left)");
39+
shouldBeGreaterThan("Math.round(startGrabberRect.left + startGrabberRect.width)", "Math.round(selectionRects[0].left)");
3940
shouldBe("Math.round(startGrabberRect.height)", "167");
4041

4142
endGrabberRect = await UIHelper.getSelectionEndGrabberViewRect();
4243
shouldBe("Math.round(endGrabberRect.left)", "249");
4344
shouldBe("Math.round(endGrabberRect.top)", "3");
44-
shouldBe("Math.round(endGrabberRect.width)", "2");
45+
shouldBeLessThanOrEqual("Math.round(endGrabberRect.left)", "Math.round(selectionRects[0].left + selectionRects[0].width)");
46+
shouldBeGreaterThan("Math.round(endGrabberRect.left + endGrabberRect.width)", "Math.round(selectionRects[0].left + selectionRects[0].width)");
4547
shouldBe("Math.round(endGrabberRect.height)", "167");
4648

4749
observedTouchEnd = true;

0 commit comments

Comments
 (0)