Re: [css3-ui] cursor image format tests

Hello Florian,

Monday, March 23, 2015, 6:10:53 PM, you wrote:

>> On 23 Mar 2015, at 17:01, Chris Lilley <> wrote:
>> Hello Public-css-testsuite,

> Hello Chris,

>> Spurred on by recent discussions around mandated image formats for the
>> CSS cursor property, I have submitted some tests.

> We're always short on tests, so thanks a lot for stepping up. Really appreciated.


> Comments that apply to all tests:

> 1) Since you're testing for various image formats, I'll first note
> we haven't yet added anything to the specification regarding
> formats. (Rossen should get back to us this Wednesday, and we'll know more then).

Yes, I know. And this had previously hindered writing such tests.

The point of making the tests was to allow an informed, test-based decision as to
what the spec should actually require in terms of image formats. I
would then update the tests for those formats which are not mandatory.

> 2) you're using a UTF-8 BOM. This is valid, but I think it is nicer
> to use <meta charset="UTF-8">, because it is visible without
> specialized tools, and less at risk of being mangled when copying or
> opening and saving the file in various editors.

OK, I thought that since the Encoding spec says that UTF-8 BOM
overrides everything this was the best way. I hadn't considered that
people might still be using non-Unicode-enabled editors in 2015.

I will add the redundant meta element to improve resiliency.

> 3) All your tests except 005 007 008 and 009 use an bitmap image.
> You should include "image" in <meta name="flags" content=


> 4) the assertion (<meta name="assert") in tests 001 to 009 is the
> same, but they test slightly different things. The text you have in
> the last paragraph of each test is a sufficient clarification.

I will update the assertions to be more specific.

> 5) Rather than "<p class="test"> </p>", I'd suggest marking this
> part up as "<div class="test"> </div>". This is not a paragraph.


>> A) cursor-image-001.html to cursor-image-009.html are basic tests just to
>> have a quick look at image format support for cursors:

>> 001   PNG image with css-supplied hotspot, relative URL.
>> 002   PNG image with css-supplied hotspot, absolute URL.
>> 003   ICO cursor with its own hotspot, relative URL.
>> 004   CUR cursor with its own hotspot, relative URL.

> No comments other than the generic ones above.

>> 005   SVG cursor with CSS-supplied hotspot, relative URL.

> You should include "svg" in <meta name="flags" content=


>> 006   ANI cursor with its own hotspot, relative URL.

> You should include "animated" in <meta name="flags" content=


>> 007   Compressed (SVGZ) cursor with CSS-supplied hotspot, relative URL.
> You should include "svg" in <meta name="flags" content=


>> 008   Non-existent image with CSS-supplied hotspot, relative URL, and help cursor fallback
> No comments other than the generic ones above.

>> 009   PNG image with css-supplied hotspot, relative URL, no fallback.

> This test is incorrect. Per the spec's grammar, a fallback is
> required. You should change the description of the test to: "The
> test passes if, when moved inside the pale green rectangle, the
> cursor does not change", include "invalid" in <meta name="flags"
> content, and change the assertion to "Test checks that a fallback cursor is required."

My bad. I thought that fallback was optional (I think it used to be,
for the cursor property). Your suggested change is a good one.

>> B) One test is exploratory, an SVG cursor where the SVG has a viewBox but
>> no hardcoded width and height. CSS3-UI does not say what to expect in
>> this case.

> Aren't you covered by this (found in
>, under the definition of the <url> value):

> "The default object size for cursor images is a UA-defined size
> that should be based on the size of a typical cursor on the UA’s operating system.

Yes, agreed that makes it UA-dependent not undefined.

> The concrete object size is determined using the default sizing
> algorithm. If an operating system is incapable of rendering a cursor
> above a given size, cursors larger than that size must be shrunk to
> within the OS-supported size bounds, while maintaining the cursor image’s intrinsic ratio, if any."

Hmm, the default sizing algorithm is that wierd 150 x 300 px thing?
Which is then shrunk down to "typical" cursor size?

> This definition makes it UA dependent, but it shouldn't be undefined.

>> Unlike most other places where images are used in CSS,
>> there is no way to say in the CSS what size is wanted.

> That's correct. If your cursor image doesn't have an intrinsic
> size, you end up with "the size of a typical cursor on the UA’s operating system".

OK. That does make it testable, with some weaselling in the pass

>> C) A larger set of tests extensively checks PNG cursor support in
>> depth (no need to run these if 001 and 002 fail). All possible color
>> types (greyscale, RGB, grey+A, RGBA, indexed) are tested with both
>> interlaced and non-interlaced images, at various bit depths.
>> PNG alpha and transparency (tRNS) are tested, also gamma correction.
>> Lastly there are some tests with invalid PNG images, to check the
>> fallback is used.
>> All images are from the PNG test suite, and the images were verified
>> for correctness to the PNG spec using pngcheck -v.
>> cursor-image-png-001.html to cursor-image-png-043.html
>> D) Similar tests will be needed for other cursor formats, some of which
>> (such as .cur) do not have adequate documentation.

> Both for C and D, I agree this it is useful to write such tests
> (when we can). I do not know if this kind of tests should be
> considered part of the css-ui test suite.

I think it should.

> If a browser has deficient
> support for some variants of PNG (or .cur, or whatever), it is
> useful to know and to get it fixed, but do we want to hold it
> against them in the context of the css3-ui spec?

As examples, Firefox correctly renders the PNG images when used on the
HTML img element and when included with css :before content, but
renders some of them incorrectly (double gamma correction or no gamma
correction, depending on color type) when used as cursors.

I was previously unaware of this flaw and it would not be exposed by
just testing image formats, only by testing image cursors as well. So
for interop, clearly these tests have value. Once they are reviewed
and show up in the CSS3 UI testsuite, I can raise a bug on Firefox,
pointing to the ones that fail.

>> E) I have not yet written tests for hotspot position (apart from
>> merely parsing the values in the CSS), but plan to.

> That would be very useful, especially with regards to clamping.

Yes, agreed.

> Again, thanks.

>  - Florian

Best regards,
 Chris Lilley, Technical Director, W3C Interaction Domain

Received on Tuesday, 24 March 2015 11:45:04 UTC