RFR: 8377602: Create automated test for PageRange
Alexey Ivanov
aivanov at openjdk.org
Thu Feb 19 20:01:09 UTC 2026
On Thu, 19 Feb 2026 19:39:12 GMT, Phil Race <prr at openjdk.org> wrote:
>> As I [mentioned](https://github.com/openjdk/jdk/pull/11266#issuecomment-3577688690) in #11266, I wrote an automatic test `PageRangesAuto.java` that verifies if page range is printed correctly. I used this test to validate the fix for [JDK-8297191](https://bugs.openjdk.org/browse/JDK-8297191) in addition to the existing one, `java/awt/print/PrinterJob/PageRanges.java`.
>>
>> With this PR, I'm contributing the test to OpenJDK.
>>
>> Without the fix for JDK-8297191, the test fails with the following error messages:
>>
>> <details>
>> <summary>test log</summary>
>>
>>
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [2, 3]: {2}
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [3, 6]: {4, 5}
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [4, 7]: {6}
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [7, 7]: {}
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [9, 10]: {}
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [10, 10]: {}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [2, 3]: {2}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [3, 6]: {4, 5}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [4, 7]: {6}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [7, 7]: {}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [9, 10]: {}
>> java.lang.Error: Not all pages printed in PAGEABLE within the range [10, 10]: {}
>> Exception in thread "main" java.lang.RuntimeException: Errors detected: 12. -
>> java.lang.Error: Not all pages printed in PRINTABLE within the range [2, 3]: {2}
>> at PageRangesAuto.main(PageRangesAuto.java:146)
>>
>> </details>
>
> test/jdk/java/awt/print/PrinterJob/PageRangesAuto.java line 99:
>
>> 97: : String.format("%s-%d-%d.pdf",
>> 98: baseName,
>> 99: pageRange.getMembers()[0][1],
>
> are these both supposed to be [0][1] ?
No, the first one has to be `[0][0]`.
Thanks!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29660#discussion_r2829877123
More information about the client-libs-dev
mailing list