An easy way to check a drawing is to first make the drawing exactly as you want (therefore TDD). Then do a test that turns the drawing into PNG. Use the #if clause to switch test code between capturing a base PNG and comparing it to that PNG.
Rendering may change slightly in newer versions of the OS. Therefore, stick to one OS to test the original image. Take a new baseline when you need to.
With this kind of testing, you can reorganize your drawing code. If it displays the same image, your recent changes are good. If there is a difference, you must decide whether to accept or not to accept the changes. (And if you do, take a new baseline.)
Edit: Nowadays, instead of doing all this manually, I would use FBSnapshotTestCase . When a test fails, instead of just giving the result βsomething went wrong,β it saves the image. Thus, you can make side-by-side comparisons without having to manually launch the application and move on to the view in question. It also simulates rendering for different devices in different orientations, which is really great for checking auto power off.
Jon reid
source share