views:

93

answers:

1

Based on my previous question here my new concern is how do I unit test my drawing code?

+1  A: 

This is not the ultimate answer but basically, you can test you drawing code by splitting it into small chunk functions, some of which probably have a testable results (not an image).

For the functions that work directly on rendering, there is not much choice to write them and check their output visually the first time.

Once you have a reference output, you can use it as input to your tests, and check that your functions continues to produce your reference output as your function evolves. Of course, the simpler your function, the better you can check its output and see what's wrong.

It's not really UnitTesting, but that's good testing anyway.

Bluebird75