Re: Feedback on Philip Taylors Canvas Tests

On 01/04/2011 04:50 AM, Kris Krueger wrote:
> Here is feedback on the rest of Philip Tayor's tests, tests not listed below seem vaild per the spec.
> If other have feedback on Philip tests please send these to the list.
>
> Thanks again for contributing these tests Philip.
>
> -Kris
>
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.imageData.put.wrongtype.html
> Test case doesn't actually test what is stated in the spec...
>> From the spec: "If the first argument to the method is null or not an ImageData object then the putImageData() method must raise a TYPE_MISMATCH_ERR exception."
>

 From the spec:
> If the first argument to the method is null, then the putImageData() method must raise a TYPE_MISMATCH_ERR exception.

However, this can only apply to putImageData(ImageData, ...). WebIDL 
defines that a TypeError is thrown if the JS values don't match those 
given in the interface, and the actual method defined in HTML is never 
called. [1]

I approve this test.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.drawImage.wrongtype.html
> The test description claims that the WebIDL describes that this should throw a TypeError.
> This seems to conflict with the canvas spec - "The image argument is an instance of either HTMLImageElement, HTMLCanvasElement, or HTMLVideoElement. If the image is null, the implementation must raise a TYPE_MISMATCH_ERR exception." and "If the first argument isn't an img, canvas, or video element, throws a TYPE_MISMATCH_ERR exception. If the image has no image data, throws an INVALID_STATE_ERR exception."

This is exactly the same case as above. (Note that the latter quote is 
not normative.)

I approve this test.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/size.attributes.parse.minus.html
> This test seems odd - what is it testing?

The "rules for parsing non-negative integers", and the rules for 
reflecting an unsigned long IDL attribute. [2]

I approve this test.

> I don't believe any UA actually passes IMHO.
>
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/size.attributes.setAttribute.percent.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/size.attributes.parse.percent.html
> These tests description indicates that it's a test for 'Parsing of non-negative integers'.
> Though I see no negative attributes? Test case bug?

The test case is correct, the description isn't.

I approve these tests if the description is fixed.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/context.unrecognised.nullsuffix.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.composite.operation.nullsuffix.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.pattern.repeat.nullsuffix.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.line.cap.invalid.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.line.join.invalid.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.align.invalid.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.baseline.invalid.html
> There is no interoperable consensus among the browsers for how strings should be parsed with a null suffix.

That's why we have tests. If browsers were interoperable on everything, 
we wouldn't be discussing these tests.

> It's also not a part of HTML5 (though seems like a fine test for javascript or webidl, given the interop issues)

It is part of HTML; the specification defines which values are allowed 
for these APIs, and it doesn't allow any trailing garbage, not even NULL 
characters.

> I believe we can test canvas without resorting to using null suffixes.

We certainly can. I don't believe we should.

I approve these tests.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.draw.space.collapse.space.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.draw.space.collapse.other.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.draw.space.collapse.start.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.draw.space.collapse.end.html
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.text.measure.width.space.html
> Spec does not have normative requirements for "space characters" that should be parsed by canvas.
> I'd change these tests to be normative rather than a non-normative css+html5 integration test.

There is a normative dependency on CSS. It is perfectly fine to test the 
specifications that are normatively references, and it seems to be 
necessary to improve interoperability in this case.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/toDataURL.jpeg.quality.basic.html
> This test needs to have its tolerance updated to allow more UA's to pass, if this test gets approved.
> Might be better to change this test in some fashion to not have a tolerance value, since the image format is lossy.
>
> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/toDataURL.jpeg.quality.notnumber.html
> '0.01' should be valid input....
> Canvas Spec (http://www.w3.org/TR/html5/the-canvas-element.html)
>   "For the purposes of these rules, an argument is considered to be a number if it is converted to an IDL double value by the rules for handling arguments of type any in the Web IDL specification. [WEBIDL]".
> The WebIDL for converting an argument to double (http://dev.w3.org/2006/webapi/WebIDL/#es-double) states that the first step is to compute ToNumber on the argument passed in, '0.01', which should be valid."

That's not what the specification refers to. The "rules for handling 
arguments of type any" return a DOMString. [3]

I approve this test.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.missingargs.html
> Test is out of date with the spec, since the spec no longer has normative requirments that states a 'NOT_SUPPORTED_ERR' should be raised.

It doesn't look for a NOT_SUPPORTED_ERR, it looks for a TypeError. The 
test was updated in September. [4]

I approve this test.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.pattern.image.string.html
> Test should check for TYPE_MISMATCH_ERR not TypeError per the canvas spec for createPattern

Exactly the same case as the first two tests mentioned in this email. 
Not that the specification states

> The image argument is an instance of either HTMLImageElement, HTMLCanvasElement, or HTMLVideoElement. If the image is null, the implementation must raise a TYPE_MISMATCH_ERR exception.

I approve this test.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.pattern.image.broken.html
> This is seems incorrect....
> All browsers fail because the image's "complete" attribute actually evaluates to true, but the code expects it to be false.
> The test should find an interoperable way to pass in an image who's "complete" attribute is false

The specification states:

> If the image argument is an HTMLImageElement object that is not fully decodable, ..., then the implementation must return null.

So the test is correct, but the check for img.complete isn't necessary.

I approve this test with that check removed.

> http://test.w3.org/html/tests/submission/PhilipTaylor/canvas/2d.drawImage.outsidesource.html
> Many of the test here are invalid per the latest version of the spec.  The only normative requirements are: "If the numeric arguments don't make sense (e.g. the destination is a 0×0 rectangle), throws an INDEX_SIZE_ERR exception."

That's not a normative requirement. The normative requirement is

> If one of the sw or sh arguments is zero, the implementation must raise an INDEX_SIZE_ERR exception.

However, this test does seem invalid.

HTH
Ms2ger

[1] http://dev.w3.org/2006/webapi/WebIDL/#es-operations
[2] http://www.whatwg.org/html/#reflect
[3] http://dev.w3.org/2006/webapi/WebIDL/#es-any
[4] 
http://dvcs.w3.org/hg/html/annotate/5b059ccfed28/tests/submission/PhilipTaylor/canvas/2d.missingargs.html#l25

Received on Tuesday, 4 January 2011 12:00:07 UTC