On Thu, 19 Feb 2026 20:04:13 GMT, Alexey Ivanov <[email protected]> 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>
>
> Alexey Ivanov has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Use the first page of the rage in the filename

I spent some time testing this on both macOS and Windows. Here are my 
observations:

- On macOS, the PDF files generated by the test open successfully in Preview as 
well as in browsers (Firefox/Chrome in my case).
- On Windows, the files generated by the test cannot be opened by browsers 
(Firefox/Edge) or by Adobe Reader.
- On Windows, the format of the generated output appears to depend on the 
system’s default printer settings—I observed different output file types after 
changing the default printer.

Overall, the test looks good to me. However, I agree with Prasanta that we 
should avoid generating .pdf files when the test passes to prevent confusion 
when interpreting results on Windows.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/29660#issuecomment-3971962375

Reply via email to