< prev index next >

test/jdk/java/awt/MenuBar/8007006/bug8007006.java

Print this page
rev 51542 : 8210039: move OSInfo to top level testlibrary
Reviewed-by: duke


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @key headful
  27  * @bug 8007006
  28  * @summary [macosx] Closing subwindow loses main window menus.
  29  * @author Leonid Romanov
  30  * @library ../../../../lib/testlibrary
  31  * @build ExtendedRobot jdk.testlibrary.OSInfo
  32  * @run main bug8007006
  33  */
  34 
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 
  38 import jdk.testlibrary.OSInfo;
  39 
  40 public class bug8007006 {
  41     private static Frame frame1;
  42     private static Frame frame2;
  43 
  44     public static void main(String[] args) throws Exception {
  45         if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
  46             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
  47             return;
  48         }
  49 
  50         System.setProperty("apple.laf.useScreenMenuBar", "true");
  51 
  52         ExtendedRobot robot = new ExtendedRobot();
  53         robot.setAutoDelay(50);
  54 
  55         createAndShowGUI();
  56         robot.waitForIdle(1500);
  57 
  58         frame2.dispose();
  59 
  60         robot.waitForIdle(1500);
  61 
  62 
  63         // open "Apple" menu (the leftmost one)
  64         robot.keyPress(KeyEvent.VK_META);
  65         robot.keyPress(KeyEvent.VK_SHIFT);




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @key headful
  27  * @bug 8007006
  28  * @summary [macosx] Closing subwindow loses main window menus.
  29  * @author Leonid Romanov
  30  * @library /test/lib
  31  * @build ExtendedRobot jdk.test.lib.Platform
  32  * @run main bug8007006
  33  */
  34 
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 
  38 import jdk.test.lib.Platform;
  39 
  40 public class bug8007006 {
  41     private static Frame frame1;
  42     private static Frame frame2;
  43 
  44     public static void main(String[] args) throws Exception {
  45         if (!Platform.isOSX()) {
  46             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
  47             return;
  48         }
  49 
  50         System.setProperty("apple.laf.useScreenMenuBar", "true");
  51 
  52         ExtendedRobot robot = new ExtendedRobot();
  53         robot.setAutoDelay(50);
  54 
  55         createAndShowGUI();
  56         robot.waitForIdle(1500);
  57 
  58         frame2.dispose();
  59 
  60         robot.waitForIdle(1500);
  61 
  62 
  63         // open "Apple" menu (the leftmost one)
  64         robot.keyPress(KeyEvent.VK_META);
  65         robot.keyPress(KeyEvent.VK_SHIFT);


< prev index next >