Skip to content

Commit

Permalink
8325851: Hide PassFailJFrame.Builder constructor
Browse files Browse the repository at this point in the history
Backport-of: 3b9255eb663b4c90aa5cec89f0d9380ef8eba49e
  • Loading branch information
GoeLin committed Oct 31, 2024
1 parent c3cb940 commit 86a7bab
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

1 comment on commit 86a7bab

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.