Skip to content

Commit f010fe0

Browse files
committed
8305825: getBounds API returns wrong value resulting in multiple Regression Test Failures on Ubuntu 23.04
Backport-of: ab84520d73a63601d75e45895663d8216ca20962
1 parent ee370ed commit f010fe0

File tree

7 files changed

+34
-15
lines changed

7 files changed

+34
-15
lines changed

src/java.desktop/unix/classes/sun/awt/X11/XWM.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,9 @@ Insets guessInsets(XDecoratedPeer window) {
13691369
case UNITY_COMPIZ_WM:
13701370
res = new Insets(28, 1, 1, 1);
13711371
break;
1372+
case MUTTER_WM:
1373+
res = new Insets(37, 0, 0, 0);
1374+
break;
13721375
case MOTIF_WM:
13731376
case OPENLOOK_WM:
13741377
default:
@@ -1380,6 +1383,7 @@ Insets guessInsets(XDecoratedPeer window) {
13801383
}
13811384
return res;
13821385
}
1386+
13831387
/*
13841388
* Some buggy WMs ignore window gravity when processing
13851389
* ConfigureRequest and position window as if the gravity is Static.

test/jdk/ProblemList.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ java/awt/Frame/UnfocusableMaximizedFrameResizablity/UnfocusableMaximizedFrameRes
143143
java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java 7080150 macosx-all
144144
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
145145
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java 8198626 macosx-all
146+
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all
146147
java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all
147148
java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 8048171 generic-all
148149
java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java 8159451 linux-all,windows-all,macosx-all
@@ -665,6 +666,7 @@ javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,win
665666
javax/swing/JComponent/7154030/bug7154030.java 7190978 generic-all
666667
javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java 8067986 generic-all
667668
javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all
669+
javax/swing/JFrame/MaximizeWindowTest.java 8321289 linux-all
668670
javax/swing/JComboBox/6236162/bug6236162.java 8028707 windows-all,macosx-all
669671
javax/swing/JButton/8151303/PressedIconTest.java 8198689 macosx-all
670672
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java 8081476 windows-all,macosx-all

test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2023, 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
@@ -54,12 +54,11 @@
5454
import java.awt.event.KeyEvent;
5555

5656
public class NestedModalDialogTest {
57-
private static Frame frame;
57+
private static StartFrame frame;
5858
private static IntermediateDialog interDiag;
5959
private static TextDialog txtDiag;
6060

6161
// Global variables so the robot thread can locate things.
62-
private static Button[] robot_button = new Button[2];
6362
private static TextField robot_text = null;
6463
private static Robot robot = null;
6564

@@ -78,6 +77,9 @@ private static void blockTillDisplayed(Component comp) {
7877
}
7978

8079
private static void clickOnComp(Component comp) {
80+
robot.waitForIdle();
81+
robot.delay(1000);
82+
8183
Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize());
8284
robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
8385
robot.waitForIdle();
@@ -94,11 +96,11 @@ public void testModalDialogs() throws Exception {
9496
// launch first frame with firstButton
9597
frame = new StartFrame();
9698
blockTillDisplayed(frame);
97-
clickOnComp(robot_button[0]);
99+
clickOnComp(frame.button);
98100

99101
// Dialog must be created and onscreen before we proceed.
100102
blockTillDisplayed(interDiag);
101-
clickOnComp(robot_button[1]);
103+
clickOnComp(interDiag.button);
102104

103105
// Again, the Dialog must be created and onscreen before we proceed.
104106
blockTillDisplayed(robot_text);
@@ -144,6 +146,8 @@ public void testModalDialogs() throws Exception {
144146
*/
145147
class StartFrame extends Frame {
146148

149+
public volatile Button button;
150+
147151
/**
148152
* Constructs a new instance.
149153
*/
@@ -168,7 +172,7 @@ public void actionPerformed(ActionEvent e) {
168172
pan.add(but);
169173
add(pan);
170174
setVisible(true);
171-
robot_button[0] = but;
175+
button = but;
172176
}
173177
}
174178

@@ -177,6 +181,7 @@ public void actionPerformed(ActionEvent e) {
177181
class IntermediateDialog extends Dialog {
178182

179183
Dialog m_parent;
184+
public volatile Button button;
180185

181186
public IntermediateDialog(Frame parent) {
182187
super(parent, "Intermediate Modal", true /*Modal*/);
@@ -193,9 +198,7 @@ public void actionPerformed(ActionEvent e) {
193198
pan.add(but);
194199
add(pan);
195200
pack();
196-
197-
// The robot needs to know about us, so set global
198-
robot_button[1] = but;
201+
button = but;
199202
}
200203
}
201204

@@ -215,12 +218,12 @@ public TextDialog(Dialog parent) {
215218
}
216219
}
217220

218-
public static void main(String[] args) throws RuntimeException, Exception {
221+
public static void main(String[] args) throws Exception {
219222
try {
220223
new NestedModalDialogTest().testModalDialogs();
221224
} catch (Exception e) {
222225
throw new RuntimeException("NestedModalDialogTest object creation "
223-
+ "failed");
226+
+ "failed", e);
224227
}
225228
}
226229
}

test/jdk/java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2023, 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
@@ -64,6 +64,7 @@ public void start() {
6464
window.setVisible(true);
6565

6666
Util.waitForIdle(robot);
67+
robot.delay(1000);
6768

6869
test();
6970

test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2023, 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
@@ -120,6 +120,7 @@ static void testSplash(ImageInfo test) throws Exception {
120120
static void testFocus() throws Exception {
121121

122122
Robot robot = new Robot();
123+
robot.setAutoWaitForIdle(true);
123124
robot.setAutoDelay(50);
124125

125126
Frame frame = new Frame();
@@ -130,6 +131,7 @@ static void testFocus() throws Exception {
130131
frame.add(textField);
131132
frame.setVisible(true);
132133
robot.waitForIdle();
134+
robot.delay(1000);
133135

134136
robot.keyPress(KeyEvent.VK_A);
135137
robot.keyRelease(KeyEvent.VK_A);

test/jdk/javax/swing/JRootPane/DefaultButtonTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2023, 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
@@ -83,6 +83,7 @@ private void createUI() {
8383

8484
public void runTest() throws Exception {
8585
Robot robot = new Robot();
86+
robot.setAutoWaitForIdle(true);
8687
robot.setAutoDelay(100);
8788
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
8889
try {
@@ -100,6 +101,8 @@ public void runTest() throws Exception {
100101
createUI();
101102
});
102103
robot.waitForIdle();
104+
robot.delay(1000);
105+
103106
robot.keyPress(KeyEvent.VK_ENTER);
104107
robot.keyRelease(KeyEvent.VK_ENTER);
105108
robot.waitForIdle();

test/jdk/javax/swing/JTree/8003400/Test8003400.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2023, 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
@@ -109,6 +109,10 @@ public void run() {
109109

110110
Robot robot = new Robot();
111111
robot.setAutoDelay(100);
112+
robot.setAutoWaitForIdle(true);
113+
robot.waitForIdle();
114+
robot.delay(500);
115+
112116
SwingUtilities.invokeAndWait(() -> {
113117
point = tree.getLocationOnScreen();
114118
rect = tree.getBounds();

0 commit comments

Comments
 (0)