Sometimes generated PDF documents need to have a particular version number before they can be processed in a workflow. That can be tested using the following tag:
<!-- Tag to verify version: --> <hasVersion matching=".." (One of the three) greaterThan=".." attributes has lessThan=".." is required.) />
The format of a PDF version number is defined by XML Schema as “number point number”. The next example checks for the version “1.4”:
<testcase name="hasVersion_v14"> <assertThat testDocument="version/pdf-version-1.4.pdf"> <hasVersion matching="1.4" /> </assertThat> </testcase>
With the attributes greaterThan
and lessThan
you can
verifiy that the version of a PDF document lies in a given range:
<testcase name="hasVersion_GreaterThanLessThan"> <assertThat testDocument="version/pdf-version-1.6.pdf" > <hasVersion greaterThan="1.3" lessThan="1.7" /> </assertThat> </testcase>
Also upcoming versions can be tested:
<testcase name="hasVersion_LessThanFutureVersion"> <assertThat testDocument="version/pdf-version-1.6.pdf" > <hasVersion lessThan="2.0" /> </assertThat> </testcase>