def TestSuccessful(test_output, test_result):
  """Returns true if the return value of CompareResults is a test success."""
  if test_result.has_key('error'):
    return (False, test_result['error'])
  if not test_output.has_key('image_file'):
    return (False, 'No output image file produced.')
  if not test_result.has_key('expected_image_file'):
    return (False, 'No expected image results file found.  For Steel, all '
            'tests must have associated "*-expected.png" files.')
  if not test_result.has_key('image_diff_file'):
    return (False, 'Could not diff expected/actual images because they had '
            'different dimensions or formats.')
  if test_result['diff_num_non_zero_pixels'] > 0:
    return (False, 'Image diff failed, there is at least one pixel difference')

  return (True, '')