Skip to content

Commit

Permalink
8325851: Hide PassFailJFrame.Builder constructor
Browse files Browse the repository at this point in the history
Reviewed-by: honkar, prr
  • Loading branch information
aivanov-jdk committed Mar 14, 2024
1 parent ad0f329 commit 3b9255e
Show file tree
Hide file tree
Showing 21 changed files with 124 additions and 228 deletions.
21 changes: 5 additions & 16 deletions test/jdk/java/awt/Frame/DefaultSizeTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,7 +21,6 @@
* questions.
*/

import java.awt.EventQueue;
import java.awt.Frame;

/*
Expand All @@ -44,25 +43,15 @@ public class DefaultSizeTest {


public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("DefaultSizeTest Instructions Frame")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
.testUI(() -> new Frame("DefaultSize"))
.screenCapture()
.build();

EventQueue.invokeAndWait(() -> {
Frame frame = new Frame("DefaultSize");

PassFailJFrame.addTestWindow(frame);
PassFailJFrame
.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.build()
.awaitAndCheck();
}
}
20 changes: 5 additions & 15 deletions test/jdk/java/awt/Frame/FrameRepackTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -77,25 +77,15 @@ repacks the frame, thereby adjusting its size tightly to its panel(s).
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("FrameRepackTest Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(30)
.columns(45)
.build();

EventQueue.invokeAndWait(() -> {
FrameRepack frame = new FrameRepack();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(FrameRepack::new)
.build()
.awaitAndCheck();
}

}
Expand Down
21 changes: 5 additions & 16 deletions test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Frame;

/*
Expand Down Expand Up @@ -53,25 +52,15 @@ public class FrameResizeTest_1 {
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("FrameResizeTest_1 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(12)
.columns(45)
.build();

EventQueue.invokeAndWait(() -> {
FrameResize_1 frame = new FrameResize_1();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(FrameResize_1::new)
.build()
.awaitAndCheck();
}
}

Expand Down
21 changes: 5 additions & 16 deletions test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,6 @@
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
Expand Down Expand Up @@ -57,25 +56,15 @@ There is a frame (size 300x300).
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("FrameResizeTest_2 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
.build();

EventQueue.invokeAndWait(() -> {
FrameResize_2 frame = new FrameResize_2();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(FrameResize_2::new)
.build()
.awaitAndCheck();
}
}

Expand Down
33 changes: 14 additions & 19 deletions test/jdk/java/awt/LightweightComponent/LightweightCliprect.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,7 +25,6 @@
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Graphics;
Expand All @@ -49,32 +48,28 @@ public class LightweightCliprect {
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("LightweightCliprect Instructions Frame")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
.build();

EventQueue.invokeAndWait(() -> {
Frame frame = new Frame("DefaultSize");

Container panel = new MyContainer();
MyComponent c = new MyComponent();
panel.add(c);
.testUI(LightweightCliprect::createUI)
.build()
.awaitAndCheck();
}

frame.add(panel);
frame.setSize(400, 300);
private static Frame createUI() {
Frame frame = new Frame("DefaultSize");

PassFailJFrame.addTestWindow(frame);
PassFailJFrame
.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
Container panel = new MyContainer();
MyComponent c = new MyComponent();
panel.add(c);

frame.setVisible(true);
});
frame.add(panel);
frame.setSize(400, 300);

passFailJFrame.awaitAndCheck();
return frame;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,6 @@
import java.awt.MenuBar;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;

/*
* @test
Expand Down Expand Up @@ -58,25 +57,15 @@ Each menu bar has one (empty) menu, labelled with the
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_1 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(18)
.columns(45)
.build();

SwingUtilities.invokeAndWait(() -> {
AddRemoveMenuBar_1 frame = new AddRemoveMenuBar_1();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(AddRemoveMenuBar_1::new)
.build()
.awaitAndCheck();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,6 @@
import java.awt.MenuBar;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;

/*
* @test
Expand Down Expand Up @@ -54,25 +53,15 @@ Each menu bar has one (empty) menu, 'foo'.
""";

public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_2 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(15)
.columns(45)
.build();

SwingUtilities.invokeAndWait(() -> {
AddRemoveMenuBar_2 frame = new AddRemoveMenuBar_2();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(AddRemoveMenuBar_2::new)
.build()
.awaitAndCheck();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -34,7 +34,6 @@
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.SwingUtilities;

/*
* @test
Expand Down Expand Up @@ -76,25 +75,15 @@ and remove a menu bar containing an (empty) 'Help' menu.
Upon test completion, click Pass or Fail appropriately.
""";
public static void main(String[] args) throws Exception {
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_3 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(30)
.columns(38)
.build();

SwingUtilities.invokeAndWait(() -> {
AddRemoveMenuBar_3 frame = new AddRemoveMenuBar_3();

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(null,
PassFailJFrame.Position.HORIZONTAL);

frame.setVisible(true);
});

passFailJFrame.awaitAndCheck();
.testUI(AddRemoveMenuBar_3::new)
.build()
.awaitAndCheck();
}
}

Expand Down
Loading

3 comments on commit 3b9255e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 3b9255e Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 3b9255e Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-3b9255eb-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 3b9255eb from the openjdk/jdk repository.

The commit being backported was authored by Alexey Ivanov on 14 Mar 2024 and was reviewed by Harshitha Onkar and Phil Race.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-3b9255eb-master:backport-GoeLin-3b9255eb-master
$ git checkout backport-GoeLin-3b9255eb-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-3b9255eb-master

Please sign in to comment.