Changes between Version 36 and Version 37 of Writing Layout Tests for DumpRenderTree


Ignore:
Timestamp:
May 31, 2012 1:55:58 PM (12 years ago)
Author:
jchaffraix@webkit.org
Comment:

Added a section on ref-tests and added more tips on portable text

Legend:

Unmodified
Added
Removed
Modified
  • Writing Layout Tests for DumpRenderTree

    v36 v37  
    143143As you can see, we did not need the pixels to get the information. The idea is that in this case, we were testing CSS and not the painting part of WebKit so querying the property directly would give us the result we need without having to dump the pixels.
    144144
     145=== Couldn't you do a ref-test? ===
     146
     147Most test cases can be easily transformed into ref-tests and it is the preferred way to add new tests. See the dedicated page: [wiki:"Writing Reftests" Layout Tests: Writing Reftests]
     148
    145149=== How to write portable pixel tests ===
    146150
     
    163167'''Important note:''' For the 2 last points, the text will still be in the text render tree dump! You can however disable the text dump if you don't need it to achieve maximum portability, see below.
    164168
    165 If you test '''really needs to use some fonts''', make sure you use the ''Ahem'' font as it is a very portable font. Make sure to specify the font-height too not to depend on the platform for that (FIXME: not sure if the font-size is really needed but better safe than sorry).
     169If you '''really need visible text in your pixel output''', there is a neat trick to make the output pretty cross-platform:
     170
     171{{{
     172html {
     173    font: Ahem 10px;
     174    -webkit-font-smoothing: none;
     175}
     176}}}
     177
     178(It may be possible to not set the font-size but it's better to do it to ensure consistent behavior across platforms)
     179
     180This ensures that all text in your page uses the Ahem font which renders the same on all platforms. Ahem has other nice properties so make sure you read up about it! Also note that your text will be unreadable so any instructions in the pixel output will be useless.
    166181
    167182==== Native controls ====