[cairo] Approaches to unit testing?

Ian Britten britten at caris.com
Wed Jan 7 06:39:29 PST 2009


Hi all,
I was wondering if anyone had any thoughts or suggestions about how
I might go about unit-testing my cairo-based rendering code, so
that I know whether or not all my code is producing the output
I expect?

- I'm not looking to do testing *of* cairo, nor whether there may
   be differences between the output from different surfaces.  I
   realize that Cairo has it's own test suite for that, and that
   isn't the code I'm looking to test (Namely, my own code sitting
   on top of Cairo).
   I'd be content (for now) to just work with one surface/format,
   and assume the output from Cairo is consistent for other formats.

- I can see that there are pros and cons to using different surface
   types for testing, but am unsure about how to best detect
   differences between outputs in various formats.  PNG?  PDF?  SVG?

- How consistent is the output between platforms?  And between
   different versions of Cairo?  Would there be subtle differences
   between output created on Windows versus output created on Linux,
   triggering bogus failures?  Or might a new version of Cairo
   change the output, requiring re-certifying all my 'expected'
   results?
   [ All our text is through FT, in case that helps ]

Again, I'm not wondering about testing in general - We already have
a large (CppUnit) test suite.  I'm just wondering about how to best
go about testing that my Cairo output code is actually producing
the output I expect (Positions, scaling/size/rotation, colours/alpha,
caps/joins/etc, etc).

Many thanks for any thoughts/suggestions!
Ian


More information about the cairo mailing list