Re: choice of javascript DOM methods suitable for use in tests

On Nov 25, 2010, at 2:03 AM, David Carlisle wrote:

> 
> I have pushed
> 
> http://test.w3.org/html/tests/submission/DavidCarlisle/math-render01.html
> 
> not to ask for approval yet, but to ask for policy regarding choice of javascript methods.
> 
> I don't want these mathml tests to be a test of supported javascript but I wanted to add some basic tests that didn't just test parsing.
> 
> The above just checks that the dimensions of (a span containing) an mfrac are the same as the dimensions of the same content with all mathml elements replaced by spans. I.e., it just checks that it does _something_ with the math.
> 
> I used offsetWidth but the specification and implementation of this and related methods like scrollWidth etc seems to have had a somewhat tortuous history. If the above is acceptable, there are of course several other MathML elements that we could test in a similar way, but I wanted to test the water first, to see whether this is an acceptable testing strategy.
> 
> Note the (current) intention here is to keep the mathml-in-html tests to purely automatic javascript tests using the provided test harness.

Although offsetWidth is implemented in all popular browsers, it doesn't always behave exactly the same, and the attempt to specify an interoperable behavior for it is not yet very mature, so I would recommend against it.

Also this particular test seems rather indirect. I think a reftest would be a better way to test layout. There are many ways a browser with the wrong rendering could pass the test, for example by failing to render <math> at all, or by using a different font for math that happens to result in a narrower width. This isn't a very thorough test that stacking actually occurred.

> 
> Implementations of MathML are strongly encouraged to also use the MathML test suite at
> 
> http://www.w3.org/Math/testsuite/
> 
> which is a large collection of mainly visual tests against reference images, but it seems best to keep that separate at this stage.

Perhaps it would be useful to make versions of these tests embedded in HTML (and also XHTML?).

Another alternative that would test the parsing but not rendering aspects is to make sure MathML elements end up in the proper namespace, rather than directly testing their rendering.

Regards,
Maciej

Received on Monday, 29 November 2010 23:18:33 UTC