changeset 58779:38fbcb6c13a6

8241808: [TESTBUG] The JDK-8039467 bug appeared on macOS Reviewed-by: kizune, pbansal
author serb
date Tue, 31 Mar 2020 19:19:25 -0700
parents 4bb00a5218c0
children 82da85888515
files test/jdk/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java	Mon Mar 30 12:06:06 2020 +0530
+++ b/test/jdk/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java	Tue Mar 31 19:19:25 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2020, 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
@@ -38,10 +38,18 @@
  * summary:
  */
 
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.AWTEvent;
+import java.awt.Choice;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.Window;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
 import test.java.awt.regtesthelpers.AbstractTest;
-import test.java.awt.regtesthelpers.Sysout;
 import test.java.awt.regtesthelpers.Util;
 
 public class UnfocusableToplevel {
@@ -69,6 +77,8 @@
         // disturb the environment. So creating tempFrameToHoldFocus frame,
         // to consume key press events.
         Frame tempFrameToHoldFocus = new Frame();
+        tempFrameToHoldFocus.setSize(300, 300);
+        tempFrameToHoldFocus.setLocationRelativeTo(null);
         tempFrameToHoldFocus.setVisible(true);
         Util.waitForIdle(robot);
 
@@ -93,7 +103,7 @@
                     traceEvent("stateChanged", ie);
                 }
             });
-
+        w.setLocationRelativeTo(null);
         w.setVisible(true);
 
         Util.waitForIdle(robot);