RFR: 8328370: Convert java/awt/print/Dialog/PrintApplet.java applet test to main

Harshitha Onkar honkar at openjdk.org
Tue Mar 19 00:44:29 UTC 2024


On Mon, 18 Mar 2024 20:50:59 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

> Convert java/awt/print/Dialog/PrintApplet.java applet test to main using PassFailJFrame. Also rename the test to PrintModalDialog.java since this is no longer an applet. Added test instructions related to the linked JBS issue.

Changes requested by honkar (Reviewer).

test/jdk/java/awt/print/Dialog/PrintModalDialog.java line 70:

> 68:                 .rows(10)
> 69:                 .columns(40)
> 70:                 .testUI(PrintModalDialog::createAndShowGUI)

Since the testUI is a simple "Print" button PassFailJFrame's spiltUIBottom() can be used with just a JButton to simplify the UI.

test/jdk/java/awt/print/Dialog/PrintModalDialog.java line 127:

> 125:                 }
> 126:                 catch (java.awt.print.PrinterException ex) {
> 127:                     ex.printStackTrace();

It is better to use PassFailJFrame.forceFail() when a printer exception occurs else the timer keeps running and the error is swallowed even after a printer exception has occurred.

Suggestion:

                catch (java.awt.print.PrinterException ex) {
                    ex.printStackTrace();
                    String msg = "PrinterException: " + ex.getMessage();
                    PassFailJFrame.forceFail(msg);

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

PR Review: https://git.openjdk.org/jdk/pull/18362#pullrequestreview-1944665869
PR Review Comment: https://git.openjdk.org/jdk/pull/18362#discussion_r1529515985
PR Review Comment: https://git.openjdk.org/jdk/pull/18362#discussion_r1529524710


More information about the client-libs-dev mailing list