Improve tests for images with long filenames.

A minor improvement, but using assertEqual and assertRegex produces
rather nicer error messages in the event of failure.