- From: Simon Sapin <simon.sapin@exyr.org>
- Date: Mon, 12 Aug 2013 08:27:49 +0100
- To: Tobie Langel <tobie@w3.org>
- CC: "public-css-testsuite@w3.org mailing list" <public-css-testsuite@w3.org>
Le 12/08/2013 07:55, Tobie Langel a écrit : > On Saturday, August 10, 2013 at 10:58 AM, Simon Sapin wrote: >> Hi, >> >> A few months ago I wrote[1] about JSON-based CSS tokenization tests. The >> conclusion is that they are not useful for W3C because tokens are (at >> the moment) an implementation detail not exposed to the platform. >> >> These tests are now in a dedicated repository[2]. But more importantly, >> I add tests for parsing <color> from CSS Color Level 3, and <An+B>[3] >> from CSS Syntax Level 3 (ED). The latter is equivalent to what Selectors >> Level 3 defines for :nth-child() and related selectors, except for >> escaping in some cases[5]. >> >> These can be mechanically converted into reftests, testharness.js or >> some other form of automated testing, which IMO is much more useful than >> the current Color tests[5] that require visual inspection. > > This is awesome. What's your strategy for automating those? Also, > messages that describe what the assertions are testing would be > useful in some cases (when it's not obvious). I suppose there are many ways to use these tests, depending on what kind of testing you want. The way I use them is by unit-testing parsing functions internally, but that’s specific to one engine and not appropriate for W3C. If one wants, say, reftests for <color>, one could parse the JSON files and generate tests like this: body { background-color: [input] } And corresponding references like this: body { background-image: url("data:image/png;base64,[generated solid-color image]"); } (Make sure if possible that gamma-correction does not get in the way.) Although for tests with alpha != 1 it might be better to have another non-solid image underneath. For JavaScript-based tests, I would have to check this is always the case but getComputedStyle().color seems to be in rgb() or rgba() format, which is easy enough to parse into four numbers and compare to the reference. -- Simon Sapin
Received on Monday, 12 August 2013 07:28:12 UTC