RFR: 8328368: Convert java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java applet test to main

Alexander Zvegintsev azvegint at openjdk.org
Thu Mar 21 14:27:24 UTC 2024


On Mon, 18 Mar 2024 17:31:07 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

> Convert java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java applet test to main using PassFailJFrame

test/jdk/java/awt/image/multiresolution/MultiDisplayTest.java line 33:

> 31:  *         on HiDPI + non-HiDPI display pair.
> 32:  * @run main MultiDisplayTest
> 33:  */

We usually move this block just before a class declaration, for better readability.

test/jdk/java/awt/image/multiresolution/MultiDisplayTest.java line 58:

> 56:             """
> 57:              This test is for OS X or Windows only.
> 58:              For other OSes please simply push "Pass".

`please simply push "Pass"` usually means that it can be replaced with `PassFailJFrame.forcePass()`, but in this case the `@requires (os.family...` can be used to avoid running the test on unwanted platforms.

test/jdk/java/awt/image/multiresolution/MultiDisplayTest.java line 93:

> 91:         generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});
> 92: 
> 93:     public static void main(String[] args) throws Exception {

While the `@requires (os.family...` should be enough, we can add something like

if (!checkOS()) {
    throw new SkippedException("..."); //jtreg.SkippedException
}

test/jdk/java/awt/image/multiresolution/MultiDisplayTest.java line 109:

> 107:         frame.setLayout(new BorderLayout());
> 108:         Button b = new Button("Start");
> 109:         b.setEnabled(checkOS());

With the changes mentioned above, this will become obsolete.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18354#discussion_r1533996928
PR Review Comment: https://git.openjdk.org/jdk/pull/18354#discussion_r1533994910
PR Review Comment: https://git.openjdk.org/jdk/pull/18354#discussion_r1534013542
PR Review Comment: https://git.openjdk.org/jdk/pull/18354#discussion_r1534012450


More information about the client-libs-dev mailing list