4.13.  Comparing Named Destinations

Named Destinations are seldom a test goal, because until now no test tool is been available which could compare named destinations. With PDFUnit you can verify that two documents have the same named destinations.

Quantity

A simple test is to compare the number of Named Destinations in two documents:

<testcase name="compareNumberOfNamedDestinations">
  <assertThat testDocument="test/test.pdf"
              masterDocument="master/master.pdf"
  >
    <haveSameNumberOfNamedDestinations />
  </assertThat>
</testcase>

Names and Internal Position

If the names of Named Destinations and their PDF-internal positions have to be equal for two documents, the following test can be used:

<testcase name="compareNamedDestinations">
  <assertThat testDocument="test/test.pdf"
              masterDocument="master/master.pdf"
  >
    <haveSameNamedDestinations />
  </assertThat>
</testcase>