Skip to content

Commit c227c41

Browse files
author
duke
committed
Backport 3b9255eb663b4c90aa5cec89f0d9380ef8eba49e
1 parent bcd0958 commit c227c41

File tree

21 files changed

+124
-228
lines changed

21 files changed

+124
-228
lines changed

test/jdk/java/awt/Frame/DefaultSizeTest.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
import java.awt.EventQueue;
2524
import java.awt.Frame;
2625

2726
/*
@@ -44,25 +43,15 @@ public class DefaultSizeTest {
4443

4544

4645
public static void main(String[] args) throws Exception {
47-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
46+
PassFailJFrame.builder()
4847
.title("DefaultSizeTest Instructions Frame")
4948
.instructions(INSTRUCTIONS)
5049
.testTimeOut(5)
5150
.rows(10)
5251
.columns(45)
52+
.testUI(() -> new Frame("DefaultSize"))
5353
.screenCapture()
54-
.build();
55-
56-
EventQueue.invokeAndWait(() -> {
57-
Frame frame = new Frame("DefaultSize");
58-
59-
PassFailJFrame.addTestWindow(frame);
60-
PassFailJFrame
61-
.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
62-
63-
frame.setVisible(true);
64-
});
65-
66-
passFailJFrame.awaitAndCheck();
54+
.build()
55+
.awaitAndCheck();
6756
}
6857
}

test/jdk/java/awt/Frame/FrameRepackTest.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -77,25 +77,15 @@ repacks the frame, thereby adjusting its size tightly to its panel(s).
7777
""";
7878

7979
public static void main(String[] args) throws Exception {
80-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
80+
PassFailJFrame.builder()
8181
.title("FrameRepackTest Instructions")
8282
.instructions(INSTRUCTIONS)
8383
.testTimeOut(5)
8484
.rows(30)
8585
.columns(45)
86-
.build();
87-
88-
EventQueue.invokeAndWait(() -> {
89-
FrameRepack frame = new FrameRepack();
90-
91-
PassFailJFrame.addTestWindow(frame);
92-
PassFailJFrame.positionTestWindow(frame,
93-
PassFailJFrame.Position.HORIZONTAL);
94-
95-
frame.setVisible(true);
96-
});
97-
98-
passFailJFrame.awaitAndCheck();
86+
.testUI(FrameRepack::new)
87+
.build()
88+
.awaitAndCheck();
9989
}
10090

10191
}

test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
2424
import java.awt.BorderLayout;
2525
import java.awt.Canvas;
2626
import java.awt.Color;
27-
import java.awt.EventQueue;
2827
import java.awt.Frame;
2928

3029
/*
@@ -53,25 +52,15 @@ public class FrameResizeTest_1 {
5352
""";
5453

5554
public static void main(String[] args) throws Exception {
56-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
55+
PassFailJFrame.builder()
5756
.title("FrameResizeTest_1 Instructions")
5857
.instructions(INSTRUCTIONS)
5958
.testTimeOut(5)
6059
.rows(12)
6160
.columns(45)
62-
.build();
63-
64-
EventQueue.invokeAndWait(() -> {
65-
FrameResize_1 frame = new FrameResize_1();
66-
67-
PassFailJFrame.addTestWindow(frame);
68-
PassFailJFrame.positionTestWindow(frame,
69-
PassFailJFrame.Position.HORIZONTAL);
70-
71-
frame.setVisible(true);
72-
});
73-
74-
passFailJFrame.awaitAndCheck();
61+
.testUI(FrameResize_1::new)
62+
.build()
63+
.awaitAndCheck();
7564
}
7665
}
7766

test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
2626
import java.awt.Color;
2727
import java.awt.Container;
2828
import java.awt.Dimension;
29-
import java.awt.EventQueue;
3029
import java.awt.Frame;
3130
import java.awt.Graphics;
3231
import java.awt.GridBagConstraints;
@@ -57,25 +56,15 @@ There is a frame (size 300x300).
5756
""";
5857

5958
public static void main(String[] args) throws Exception {
60-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
59+
PassFailJFrame.builder()
6160
.title("FrameResizeTest_2 Instructions")
6261
.instructions(INSTRUCTIONS)
6362
.testTimeOut(5)
6463
.rows(10)
6564
.columns(45)
66-
.build();
67-
68-
EventQueue.invokeAndWait(() -> {
69-
FrameResize_2 frame = new FrameResize_2();
70-
71-
PassFailJFrame.addTestWindow(frame);
72-
PassFailJFrame.positionTestWindow(frame,
73-
PassFailJFrame.Position.HORIZONTAL);
74-
75-
frame.setVisible(true);
76-
});
77-
78-
passFailJFrame.awaitAndCheck();
65+
.testUI(FrameResize_2::new)
66+
.build()
67+
.awaitAndCheck();
7968
}
8069
}
8170

test/jdk/java/awt/LightweightComponent/LightweightCliprect.java

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
2525
import java.awt.Component;
2626
import java.awt.Container;
2727
import java.awt.Dimension;
28-
import java.awt.EventQueue;
2928
import java.awt.FlowLayout;
3029
import java.awt.Frame;
3130
import java.awt.Graphics;
@@ -49,32 +48,28 @@ public class LightweightCliprect {
4948
""";
5049

5150
public static void main(String[] args) throws Exception {
52-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
51+
PassFailJFrame.builder()
5352
.title("LightweightCliprect Instructions Frame")
5453
.instructions(INSTRUCTIONS)
5554
.testTimeOut(5)
5655
.rows(10)
5756
.columns(45)
58-
.build();
59-
60-
EventQueue.invokeAndWait(() -> {
61-
Frame frame = new Frame("DefaultSize");
62-
63-
Container panel = new MyContainer();
64-
MyComponent c = new MyComponent();
65-
panel.add(c);
57+
.testUI(LightweightCliprect::createUI)
58+
.build()
59+
.awaitAndCheck();
60+
}
6661

67-
frame.add(panel);
68-
frame.setSize(400, 300);
62+
private static Frame createUI() {
63+
Frame frame = new Frame("DefaultSize");
6964

70-
PassFailJFrame.addTestWindow(frame);
71-
PassFailJFrame
72-
.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
65+
Container panel = new MyContainer();
66+
MyComponent c = new MyComponent();
67+
panel.add(c);
7368

74-
frame.setVisible(true);
75-
});
69+
frame.add(panel);
70+
frame.setSize(400, 300);
7671

77-
passFailJFrame.awaitAndCheck();
72+
return frame;
7873
}
7974
}
8075

test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_1.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
2626
import java.awt.MenuBar;
2727
import java.awt.event.MouseAdapter;
2828
import java.awt.event.MouseEvent;
29-
import javax.swing.SwingUtilities;
3029

3130
/*
3231
* @test
@@ -58,25 +57,15 @@ Each menu bar has one (empty) menu, labelled with the
5857
""";
5958

6059
public static void main(String[] args) throws Exception {
61-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
60+
PassFailJFrame.builder()
6261
.title("AddRemoveMenuBarTest_1 Instructions")
6362
.instructions(INSTRUCTIONS)
6463
.testTimeOut(5)
6564
.rows(18)
6665
.columns(45)
67-
.build();
68-
69-
SwingUtilities.invokeAndWait(() -> {
70-
AddRemoveMenuBar_1 frame = new AddRemoveMenuBar_1();
71-
72-
PassFailJFrame.addTestWindow(frame);
73-
PassFailJFrame.positionTestWindow(frame,
74-
PassFailJFrame.Position.HORIZONTAL);
75-
76-
frame.setVisible(true);
77-
});
78-
79-
passFailJFrame.awaitAndCheck();
66+
.testUI(AddRemoveMenuBar_1::new)
67+
.build()
68+
.awaitAndCheck();
8069
}
8170
}
8271

test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_2.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
2626
import java.awt.MenuBar;
2727
import java.awt.event.MouseAdapter;
2828
import java.awt.event.MouseEvent;
29-
import javax.swing.SwingUtilities;
3029

3130
/*
3231
* @test
@@ -54,25 +53,15 @@ Each menu bar has one (empty) menu, 'foo'.
5453
""";
5554

5655
public static void main(String[] args) throws Exception {
57-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
56+
PassFailJFrame.builder()
5857
.title("AddRemoveMenuBarTest_2 Instructions")
5958
.instructions(INSTRUCTIONS)
6059
.testTimeOut(5)
6160
.rows(15)
6261
.columns(45)
63-
.build();
64-
65-
SwingUtilities.invokeAndWait(() -> {
66-
AddRemoveMenuBar_2 frame = new AddRemoveMenuBar_2();
67-
68-
PassFailJFrame.addTestWindow(frame);
69-
PassFailJFrame.positionTestWindow(frame,
70-
PassFailJFrame.Position.HORIZONTAL);
71-
72-
frame.setVisible(true);
73-
});
74-
75-
passFailJFrame.awaitAndCheck();
62+
.testUI(AddRemoveMenuBar_2::new)
63+
.build()
64+
.awaitAndCheck();
7665
}
7766
}
7867

test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_3.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
3434
import java.awt.event.ActionListener;
3535
import java.awt.event.ComponentAdapter;
3636
import java.awt.event.ComponentEvent;
37-
import javax.swing.SwingUtilities;
3837

3938
/*
4039
* @test
@@ -76,25 +75,15 @@ and remove a menu bar containing an (empty) 'Help' menu.
7675
Upon test completion, click Pass or Fail appropriately.
7776
""";
7877
public static void main(String[] args) throws Exception {
79-
PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
78+
PassFailJFrame.builder()
8079
.title("AddRemoveMenuBarTest_3 Instructions")
8180
.instructions(INSTRUCTIONS)
8281
.testTimeOut(5)
8382
.rows(30)
8483
.columns(38)
85-
.build();
86-
87-
SwingUtilities.invokeAndWait(() -> {
88-
AddRemoveMenuBar_3 frame = new AddRemoveMenuBar_3();
89-
90-
PassFailJFrame.addTestWindow(frame);
91-
PassFailJFrame.positionTestWindow(null,
92-
PassFailJFrame.Position.HORIZONTAL);
93-
94-
frame.setVisible(true);
95-
});
96-
97-
passFailJFrame.awaitAndCheck();
84+
.testUI(AddRemoveMenuBar_3::new)
85+
.build()
86+
.awaitAndCheck();
9887
}
9988
}
10089

0 commit comments

Comments
 (0)