Changes between Version 26 and Version 27 of Writing Layout Tests for DumpRenderTree


Ignore:
Timestamp:
Oct 27, 2011 5:06:22 PM (12 years ago)
Author:
jchaffraix@webkit.org
Comment:

How to write good test case (edit 2), pixel tests

Legend:

Unmodified
Added
Removed
Modified
  • Writing Layout Tests for DumpRenderTree

    v26 v27  
    142142=== How to write portable pixel tests ===
    143143
    144  * Do not use fonts other than those bundled with Mac OS X (usually there's no need to specify font families in a test). The only exception to this is the ''Ahem'' font.
    145 
    146 
     144The problem with a pixel dump is that it '''can be''' highly depend on the platform on which you run it. To be avoided to have more portable tests cases are the following:
     145 * fonts
     146 * native controls
     147
     148==== Fonts ====
     149
     150Fonts are very dependent on the platform and the source of a lot of differences in our tests. That's because not all platform share the same fonts and in this case, the fallback mechanism is pretty much defined per machine as it depends on the OS and the available fonts!
     151
     152The golden rule is that '''if you can avoid text, you should'''.
     153
     154This seems against the previous section about writing understandable test cases and it is. However there are a couple of ways to put the information you need while keeping the portability of the no-text mantra:
     155
     156  * put your information as comments into the HTML
     157  * put your text outside of the dumped area: by default DumpRenderTree dumps a viewport of 600 * 800 pixels (FIXME: not 100% sure about those numbers). This means that anything outside this range would not be dumped in DRT but will appear in a browser opening the test.
     158  * add a 0 opacity to your text.
     159
     160'''Important note:''' For the 2 last points, the text will still be on the text render tree dump!
     161
     162If 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 (FIXME: not sure if this is really needed but better safe than sorry).
     163
     164==== Native controls ====
     165
     166Native controls cover anything that is painted by the OS. In WebKit, this means buttons, scroll bars, media players, ...
     167
     168You can use the previous tips for text here to hide your button if you don't need.
     169
     170For scroll bars, you just have to use the following rule in your CSS to disable them:
     171
     172{{{
     173overflow: hidden;
     174}}}
    147175
    148176= Writing JavaScript-based DOM-only Test Cases =