Mercurial > hg > openjdk > jdk9 > jdk
changeset 16982:5ca3a286b761
8177766: [TEST_BUG] JPopupMenu tests fails intermittently
Reviewed-by: alexsch, yan
author | serb |
---|---|
date | Wed, 29 Mar 2017 17:30:05 +0300 |
parents | b3a70b0fd710 |
children | cdb6fd420176 |
files | test/javax/swing/JPopupMenu/4458079/bug4458079.java test/javax/swing/JPopupMenu/6827786/bug6827786.java |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/test/javax/swing/JPopupMenu/4458079/bug4458079.java Tue Mar 28 09:45:38 2017 -0700 +++ b/test/javax/swing/JPopupMenu/4458079/bug4458079.java Wed Mar 29 17:30:05 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -33,25 +33,26 @@ */ import java.awt.Robot; -import java.awt.Toolkit; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.event.KeyEvent; -import java.util.ArrayList; public class bug4458079 extends JFrame implements PopupMenuListener { public JMenu menu; static volatile boolean itemASelected = false; public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.waitForIdle(); + // move mouse outside menu to prevent auto selection + robot.mouseMove(100,100); + SwingUtilities.invokeAndWait(new Runnable() { public void run() { new bug4458079().createAndShowGUI(); } }); - Robot robot = new Robot(); - robot.waitForIdle(); robot.setAutoDelay(50); @@ -84,6 +85,7 @@ setSize(300, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); + setLocationRelativeTo(null); setVisible(true); }
--- a/test/javax/swing/JPopupMenu/6827786/bug6827786.java Tue Mar 28 09:45:38 2017 -0700 +++ b/test/javax/swing/JPopupMenu/6827786/bug6827786.java Wed Mar 29 17:30:05 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -47,6 +47,8 @@ public static void main(String[] args) throws Exception { Robot robot = new Robot(); robot.setAutoDelay(50); + // move mouse outside menu to prevent auto selection + robot.mouseMove(100,100); SwingUtilities.invokeAndWait(new Runnable() { @@ -147,6 +149,7 @@ focusable = new JButton("Set Focus Here"); frame.add(focusable); frame.pack(); + frame.setLocationRelativeTo(null); frame.setVisible(true); } }