RFR: 8359687: Use PassFailJFrame for java/awt/print/Dialog/DialogType.java [v2]

Abhishek Kumar abhiscxk at openjdk.org
Wed Jun 18 05:55:29 UTC 2025


On Tue, 17 Jun 2025 09:09:42 GMT, Srinivas Mandalika <smandalika at openjdk.org> wrote:

>> Use PassFailJFrame to streamline the test java/awt/print/Dialog/DialogType.java, as is for several of the manual tests.
>> 
>> Modified Manual Test Passed when run using jtreg.
>
> Srinivas Mandalika has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added SkippedException when Printer is unavailable.

test/jdk/java/awt/print/Dialog/DialogType.java line 47:

> 45: 
> 46:     private static final String INSTRUCTIONS = """
> 47:         This test assumes and requires that you have a printer installed

Suggestion:

        This test assumes and requires that you have a printer installed.

test/jdk/java/awt/print/Dialog/DialogType.java line 53:

> 51:         The test passes as long as no exceptions are thrown, *AND*
> 52:         if running on Windows only, the first dialog is a native windows
> 53:         control which differs in appearance from the second dialog

Suggestion:

        The test passes as long as no exceptions are thrown.

Platform specific instructions can be added as a NOTE. It would be better if it is mentioned at the start of instruction.

The first and second dialog differs on MacOS as well. Not checked on Linux.

Current instruction says only about Windows, better to verify and modify the instruction.

test/jdk/java/awt/print/Dialog/DialogType.java line 59:

> 57:         job = PrinterJob.getPrinterJob();
> 58:         if (job.getPrintService() == null) {
> 59:             throw new SkippedException("Printer not configured or not available");

Suggestion:

            throw new SkippedException("Test Skipped, Printer not configured or not available");

test/jdk/java/awt/print/Dialog/DialogType.java line 62:

> 60:         }
> 61:         PassFailJFrame passFailJFrame = PassFailJFrame.builder()
> 62:             .title("DialogType Test Instructions")

Default title is : "File name" followed by " - Test Instructions"
Title can be removed.

test/jdk/java/awt/print/Dialog/DialogType.java line 64:

> 62:             .title("DialogType Test Instructions")
> 63:             .instructions(INSTRUCTIONS)
> 64:             .rows((int)INSTRUCTIONS.lines().count() + 2)

No need to set `rows` explicitly.

test/jdk/java/awt/print/Dialog/DialogType.java line 84:

> 82:         for (int i = 0; i < attrs.length; i++) {
> 83:             System.out.println(attrs[i]);
> 84:         }

Move the duplicate code to helper method

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153688263
PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153692463
PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153692940
PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153694549
PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153696026
PR Review Comment: https://git.openjdk.org/jdk/pull/25842#discussion_r2153701206


More information about the client-libs-dev mailing list