Skip to content

Commit 58059ee

Browse files
committed
8079786: [macosx] Test java/awt/Frame/DisposeParentGC/DisposeParentGC.java fails for Mac only
Backport-of: f67ec19e236e3b4d2d4d4993a7d64b8de052d241
1 parent 5772eee commit 58059ee

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ java/awt/Mouse/MouseClickCount.java 8017182 macosx-all
448448
java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java 6847163 linux-all
449449
java/awt/xembed/server/RunTestXEmbed.java 7034201 linux-all
450450
java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java 8164473 linux-all
451-
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786 macosx-all
452451

453452
java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java 7099223,8274106 macosx-aarch64,linux-all,windows-all
454453
java/awt/keyboard/AllKeyCode/AllKeyCode.java 8242930 macosx-all

test/jdk/java/awt/Frame/DisposeParentGC/DisposeParentGC.java

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 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,25 @@
2121
* questions.
2222
*/
2323

24-
import java.awt.*;
24+
import java.awt.Button;
25+
import java.awt.Canvas;
26+
import java.awt.Checkbox;
27+
import java.awt.CheckboxGroup;
28+
import java.awt.Choice;
29+
import java.awt.Color;
30+
import java.awt.Cursor;
31+
import java.awt.Dialog;
32+
import java.awt.Dimension;
33+
import java.awt.EventQueue;
34+
import java.awt.Label;
35+
import java.awt.List;
36+
import java.awt.Point;
37+
import java.awt.Scrollbar;
38+
import java.awt.TextArea;
39+
import java.awt.TextField;
40+
import java.awt.Toolkit;
41+
import java.awt.Frame;
42+
import java.awt.FlowLayout;
2543
import java.awt.image.BufferedImage;
2644
import java.lang.ref.PhantomReference;
2745
import java.lang.ref.ReferenceQueue;
@@ -34,7 +52,6 @@
3452
* @summary Display a dialog with a parent, the dialog contains all awt components
3553
* added to it & each components are setted with different cursors types.
3654
* Dispose the parent & collect GC. Garbage collection should happen
37-
* @author Dmitriy Ermashov ([email protected])
3855
* @library /lib/client
3956
* @build ExtendedRobot
4057
* @run main/othervm -Xmx20m DisposeParentGC
@@ -100,7 +117,7 @@ public void createDialog(int number) {
100117
child.setLocation(20, 140 * number);
101118

102119
Button button = new Button("Press Me") ;
103-
TextArea textArea = new TextArea(5,5);
120+
TextArea textArea = new TextArea(5, 5);
104121
TextField textField = new TextField(10);
105122
Choice choice = new Choice();
106123
choice.add("One");
@@ -115,15 +132,15 @@ public void createDialog(int number) {
115132
list.add("Four");
116133
list.add("Five");
117134
Checkbox checkBox = new Checkbox("Hai");
118-
Scrollbar scrollBar = new Scrollbar(Scrollbar.VERTICAL,0,1,0,200);
135+
Scrollbar scrollBar = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 200);
119136
CheckboxGroup checkboxGroup = new CheckboxGroup();
120-
Checkbox radioButton = new Checkbox("Hello" ,true, checkboxGroup);
137+
Checkbox radioButton = new Checkbox("Hello", true, checkboxGroup);
121138
Canvas canvas = new Canvas();
122139
Label label = new Label("I am label!");
123140
Cursor customCursor = null;
124141

125142
child.setLayout(new FlowLayout());
126-
canvas.setSize(100,100);
143+
canvas.setSize(100, 100);
127144
canvas.setBackground(Color.red);
128145

129146
button.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
@@ -138,13 +155,17 @@ public void createDialog(int number) {
138155

139156
/* create a custom cursor */
140157
Toolkit toolkit = Toolkit.getDefaultToolkit();
141-
Dimension d = toolkit.getBestCursorSize(32,32);
158+
Dimension d = toolkit.getBestCursorSize(32, 32);
142159
int color = toolkit.getMaximumCursorColors();
143160

144-
if(!d.equals(new Dimension(0,0)) && color != 0 )
145-
customCursor = toolkit.createCustomCursor(new BufferedImage( 16, 16, BufferedImage.TYPE_INT_RGB ), new Point(10, 10), "custom cursor.");
146-
else
161+
if (!d.equals(new Dimension(0,0)) && color != 0) {
162+
customCursor = toolkit.createCustomCursor(
163+
new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB),
164+
new Point(10, 10), "custom cursor.");
165+
}
166+
else {
147167
System.err.println("Platform doesn't support to create a custom cursor.");
168+
}
148169

149170
textArea.setCursor(customCursor);
150171
child.add(label);

0 commit comments

Comments
 (0)