The first test compares the number of images in two PDF documents:
<testcase name="haveSameNumberImages"> <assertThat testDocument="test/test.pdf" masterDocument="master/master.pdf" > <haveSameNumberOfImages /> </assertThat> </testcase>
The comparison can be limited to selected pages:
<testcase name="haveSameNumberOfImages_OnPage2"> <assertThat testDocument="test/test.pdf" masterDocument="master/master.pdf" > <haveSameNumberOfImages onPage="2"/> </assertThat> </testcase>
All possibilities to select pages are described in chapter 13.2: “Page Selection”.
The images stored in a test PDF can be compared with those of a master PDF. They are identified as equal when they are equal byte-by-byte.
<!-- The tag <haveSameImages /> does not consider the order of the images. --> <testcase name="haveSameImages"> <assertThat testDocument="test/test.pdf" masterDocument="master/master.pdf" > <haveSameImages /> </assertThat> </testcase>
This test does not care about which pages the images appear on or how often they are used.
You can restrict the comparison of images to individual pages:
<testcase name="haveSameImages_OnPage2"> <assertThat testDocument="test/test.pdf" masterDocument="master/master.pdf" > <haveSameImages onPage="2"/> </assertThat> </testcase>
<testcase name="haveSameImages_BeforePage2"> <assertThat testDocument="test/test.pdf" masterDocument="master/master.pdf" > <haveSameImages onEveryPageBefore="2"/> </assertThat> </testcase>
If there are any doubts about the images in a PDF document all images
can be extracted using the utility ExtractImages
. See chapter
9.7: “Extract Images from PDF”.