• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

testing images and PDFs

 
Thad Humphries
Greenhorn
Posts: 20
Google Web Toolkit Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have an advice on automated testing for images and PDFs? I must generate TIFF, JPEG, PDF, etc. by merging database records, text files, format files, and other images. All the JUnit testing I can think to are things like size, depth, and dpi, things that are done by the 3rd party libraries and not by me. I have to check my code's results manually: Is the right font used? Is the text or image correctly placed? Are things scaled correctly on the page? Any ideas or libraries for automating more of that would be appreciated.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thad Humphries wrote:Do you have an advice on automated testing for images and PDFs? I must generate TIFF, JPEG, PDF, etc. by merging database records, text files, format files, and other images. All the JUnit testing I can think to are things like size, depth, and dpi, things that are done by the 3rd party libraries and not by me. I have to check my code's results manually: Is the right font used? Is the text or image correctly placed? Are things scaled correctly on the page? Any ideas or libraries for automating more of that would be appreciated.

What I'd look at doing would be to detect each aspect individually by, for example, looking for specific shapes in the resulting bitmap to detect the correct font being used and checking the position of a known image in the resulting bitmap. Some of these tests would make heavy use of image processing algorithms (which likely means you wouldn't implement them just for one or two tests' needs) and while some tests can be made simpler with smart setup (e.g. using a solid red image that's easy to look for in the resulting bitmap), these tests will certainly look and feel quite different from the kind of tests you'd write for typical application logic.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic