title: How to test a method that draws to the canvas?
body: <p>How do I test a method that draws something to the canvas. For example, for an android app, I have the following code:</p>
  
  <pre><code>@Override
  public void draw(Canvas canvas) {
      canvas.drawRect(rect, paint);
  }
  </code></pre>
  
  <p>This of course is a very simple example, but still: how would I test that the correct <code>Rect</code> has been drawn? In other words, how to check if the UI is displaying the correct things.</p>
  
  <p>I suppose I could check all my pixels on my screen to see if they have the right properties, but I guess that is a very naive approach :)</p>