WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
177403
Add helper functions to write better selection tests
https://bugs.webkit.org/show_bug.cgi?id=177403
Summary
Add helper functions to write better selection tests
Megan Gardner
Reported
2017-09-22 19:31:23 PDT
Add helper function to write better selection tests
Attachments
Patch
(4.80 KB, patch)
2017-09-22 19:42 PDT
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(2.78 KB, patch)
2017-09-25 18:47 PDT
,
Megan Gardner
thorton
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Megan Gardner
Comment 1
2017-09-22 19:42:40 PDT
Created
attachment 321613
[details]
Patch
Wenson Hsieh
Comment 2
2017-09-24 01:15:51 PDT
Comment on
attachment 321613
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=321613&action=review
> LayoutTests/ChangeLog:9 > + that can assist it the calculation of word location, and in helping debug
"...that can make it easier to calculate word location, and help debug..."?
> LayoutTests/fast/events/touch/ios/resources/text-calculations.js:24 > +function measureLineWidth(string, fontFamily = "monospace", fontSize = "18px")
Hm...did you try using measureText(~).width and find that it wasn't accurate enough for your purpose? I'm a bit curious how/why we would use measureFontHeight and measureLineWidth to help debug layout tests. If it's to try and track down the location of a run of text that we want to select, would it suffice to wrap that text around a span with id="foo", and just use foo.getBoundingClientRect()?
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:1 > +// To double check location of touches or other x,y coordinants
s/coordinants/coordinates/
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:2 > +// WARNING: If you leave this on, it is selectable, as it is an HTML element.
Perhaps you give this debug element the `pointer-events: none` style?
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:3 > +// There is no real way around this. Just be aware when testing, it's presense will likely mess up your test.
s/presense/presence/
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:29 > +// To double check location of word boxes or other x,y coordinants
Ditto on typos/pointer-events: none.
Megan Gardner
Comment 3
2017-09-25 18:47:23 PDT
Created
attachment 321783
[details]
Patch
Megan Gardner
Comment 4
2017-09-25 18:49:10 PDT
Turns out using <span> tags gives me the results I want in being able to determine where selection rects should be, so the measurements functions aren't needed. And setting the pointer-events style makes them invisible to touch, so that helps make them more useful. These are basically debug tools, but having them all written up makes it easier to use them later.
Tim Horton
Comment 5
2017-09-26 12:43:45 PDT
Comment on
attachment 321783
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=321783&action=review
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:18 > + dot.style.left = (x-dotSize/2)+"px";
spaces around math operators!
> LayoutTests/fast/events/touch/ios/resources/ui-debugging.js:46 > + rect.style.top = y+"px";
ditto, etc.
Megan Gardner
Comment 6
2017-09-26 13:24:49 PDT
https://trac.webkit.org/r222517
Radar WebKit Bug Importer
Comment 7
2017-09-27 12:21:38 PDT
<
rdar://problem/34693125
>
Frédéric Wang (:fredw)
Comment 8
2018-01-18 08:55:30 PST
@Megan: Was ui-debugging.js actually used at the end?
Wenson Hsieh
Comment 9
2018-01-18 09:17:05 PST
(In reply to Frédéric Wang (:fredw) from
comment #8
)
> @Megan: Was ui-debugging.js actually used at the end?
I think the intention behind ui-debugging.js is to make it a bit easier to write UI-script-driven tests, especially on iOS. One could use some of the functionality in ui-debugging.js to make it easier to diagnose and triage test failures by adding visual indication of where synthetic events are being dispatched, but would ultimately remove code that inserts these debug elements into the DOM before check-in.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug