Open Bug 1224498 Opened 9 years ago Updated 2 years ago

textattr test assumes fontconfig lookup of 'cursive' fails

Categories

(Core :: Disability Access APIs, defect)

Unspecified
Linux
defect

Tracking

()

Tracking Status
firefox45 --- affected

People

(Reporter: jtd, Unassigned)

References

Details

The text attribute tests in accessible/tests/mochitest/textattrs/test_general.html and the associated code in accessible//tests/mochitest/attributes.js make the assumption on Linux that the lookup of 'cursive' fails:

  const kCursiveFontFamily = LINUX ? "DejaVu Serif" : "Comic Sans MS";

Here, 'DejaVu Serif' is the fallback font in the fontlist. The patches on bug 1173260 will query fontconfig for a font for 'cursive' so this won't fallback to the serif face.

For now, I'm simply going to conditionalize the test to workaround the test failure.

In general, the fontsets on Linux are quite variable so it's not such a good idea to hardcode font name checks in code like this.
jtd, if you have a good idea to solve this and make the test reliable across Linux distributions, feel free to suggest or submit a patch! :-) These tests were implemented a few years ago, so it is very possible the assumptions are no longer correct.
Flags: needinfo?(jdaggett)
Right, I'm aware it's not a bright idea to hardcode fontsets but I didn't come with anything better. Accessibility APIs expose a fontset that was used for an element on a web page and that should be covered by mochitest somehow. If it's safer to operate on a list of possible values then we can have a function for that like we do for kMonospaceFontFamily http://mxr.mozilla.org/mozilla-central/source/accessible/tests/mochitest/attributes.js#233
(In reply to alexander :surkov from comment #2)
> Right, I'm aware it's not a bright idea to hardcode fontsets but I didn't
> come with anything better. Accessibility APIs expose a fontset that was used
> for an element on a web page and that should be covered by mochitest
> somehow. If it's safer to operate on a list of possible values then we can
> have a function for that like we do for kMonospaceFontFamily
> http://mxr.mozilla.org/mozilla-central/source/accessible/tests/mochitest/
> attributes.js#233

The real problem here is that Linux distros don't typically ship with a cursive font, so fontconfig will simply return the default font if one hasn't been set up. I think it would be just easier to omit this part of the test under Linux, unless you want to make the test condition more complex. Without a font set up you probably won't be testing anything related the text attributes of an element related to the use of the 'cursive' keywords. Other parts of this same test will test the API's for other generics.
Flags: needinfo?(jdaggett)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.