loge.hixie.ch

Hixie's Natural Log

2002-10-26 12:01 UTC Lots of prodding around the rules that govern nothingness

I've been writing lots of web standards test cases recently, including a bunch of CSS tests. This is partly for Mozilla's benefit, and partly in preparation for CSS2.1, which is going to need a whole bunch of them if we are ever going to exit CR without either cutting out features (we've decided that features without enough tests will be cut, since no tests means interoperability can't be tested) or having poor implementations.

Some of my more evil recently written tests include:

  1. This 'white-space' and ':hover' test, which took me a good four hours to write (and which may yet prove to be invalid, depending on the outcome of working group discussion regarding the issues it raises).
  2. This 'white-space:normal' test, which surprisingly many user agents pass.
  3. This supposedly simple margin collapsing test, which surprisingly few user agents pass.

Writing tests like this is fun. The challenge is to make tests whose results are very easy to interpret — is it green or is it red? are the two boxes identical? — while still testing a big enough cross section of the spec(s) in question to catch as many potentional bugs at once. I wrote a document about this last year. It contains some of the more commonly used tricks and conventions (red is bad, green is good, blue means "read carefully"). Finding more and more devious ways in which to get the tests to go red at the slightest error is where the difficulty arises. Tools like the Ahem font are invaluable (you'll need this font installed in order to properly view the first two tests mentioned above).

Of course these tests are useless for actually tracking bugs down; once a page like this has highlighted a problem, you then have to break down the file into the smallest possible file which still shows the bug, which is what then gets attached to the bug system (in Mozilla's case, Bugzilla).

Anyway. Sets of tests I've been working on over the past few days: the HTML <pre> element, HTML parsing and white space rules, the CSS 'white-space' property, and CSS margin collapsing rules.