You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter <pc...@gmail.com> on 2007/01/16 17:15:15 UTC

PDF comparison for regression testing

Fop fans,

 

I am writing some regression tests for an application that uses fop to
generate PDF files. I am trying to figure out how to compare the pdf output
with the master pdf files.

 

Seems the pdf spec requires e.g. an ID in the trailer that is file instance
specific which makes (dumb) binary comparison with a master file impossible.

 

I guess I could check the fop input iso the fop output, but I'd rather check
the actual pdf if possible.

 

How this is typically solved?

 

Thanks,

 

Peter


RE: PDF comparison for regression testing

Posted by Peter <pc...@gmail.com>.
Thanks (for the pointer) Jeremias. For now I have added a bit of regexp
mumbo jumbo in the compare code to get rid of the variable sections in the
pdf file. Not very elegant but it works, can be automated and will in the
worst case scenario only give rise to false negatives I think.

Peter
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Sent: Tuesday, January 16, 2007 9:53 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: PDF comparison for regression testing
> 
> What we do in FOP is calling GhostScript to convert the PDF to a bitmap
> which can then be either put side-to-side with a reference or visually
> "diffed" against a reference. This process isn't automated, yet.
> 
> See here:
> http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fo
> p/visual/
> 
> Of course, that doesn't test the non-visual features of PDF. But for
> that you can use any PDF library and some JUnit test cases.
> 
> On 16.01.2007 17:15:15 Peter wrote:
> > Fop fans,
> >
> >
> >
> > I am writing some regression tests for an application that uses fop to
> > generate PDF files. I am trying to figure out how to compare the pdf
> output
> > with the master pdf files.
> >
> >
> >
> > Seems the pdf spec requires e.g. an ID in the trailer that is file
> instance
> > specific which makes (dumb) binary comparison with a master file
> impossible.
> >
> >
> >
> > I guess I could check the fop input iso the fop output, but I'd rather
> check
> > the actual pdf if possible.
> >
> >
> >
> > How this is typically solved?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Peter
> >
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: PDF comparison for regression testing

Posted by John Cavalieri <jo...@gmail.com>.
Once you get the PDF to bitmap you can compare the bitmaps
programmattically.  Get the difference of each channel of each pixel.  A bit
intensive.

Not only can you tell if there is a difference progammatically, but you can
also take the result of the pixel differences and produce a "difference"
bitmap.  If there is no difference it should be a pure black image.

-John


On 1/16/07, Jeremias Maerki <de...@jeremias-maerki.ch> wrote:
>
> What we do in FOP is calling GhostScript to convert the PDF to a bitmap
> which can then be either put side-to-side with a reference or visually
> "diffed" against a reference. This process isn't automated, yet.
>
> See here:
>
> http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/
>
> Of course, that doesn't test the non-visual features of PDF. But for
> that you can use any PDF library and some JUnit test cases.
>
> On 16.01.2007 17:15:15 Peter wrote:
> > Fop fans,
> >
> >
> >
> > I am writing some regression tests for an application that uses fop to
> > generate PDF files. I am trying to figure out how to compare the pdf
> output
> > with the master pdf files.
> >
> >
> >
> > Seems the pdf spec requires e.g. an ID in the trailer that is file
> instance
> > specific which makes (dumb) binary comparison with a master file
> impossible.
> >
> >
> >
> > I guess I could check the fop input iso the fop output, but I'd rather
> check
> > the actual pdf if possible.
> >
> >
> >
> > How this is typically solved?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Peter
> >
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


-- 
John Cavalieri

Re: PDF comparison for regression testing

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
What we do in FOP is calling GhostScript to convert the PDF to a bitmap
which can then be either put side-to-side with a reference or visually
"diffed" against a reference. This process isn't automated, yet.

See here:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/visual/

Of course, that doesn't test the non-visual features of PDF. But for
that you can use any PDF library and some JUnit test cases.

On 16.01.2007 17:15:15 Peter wrote:
> Fop fans,
> 
>  
> 
> I am writing some regression tests for an application that uses fop to
> generate PDF files. I am trying to figure out how to compare the pdf output
> with the master pdf files.
> 
>  
> 
> Seems the pdf spec requires e.g. an ID in the trailer that is file instance
> specific which makes (dumb) binary comparison with a master file impossible.
> 
>  
> 
> I guess I could check the fop input iso the fop output, but I'd rather check
> the actual pdf if possible.
> 
>  
> 
> How this is typically solved?
> 
>  
> 
> Thanks,
> 
>  
> 
> Peter
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org