< prev index next >

test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java

Print this page
rev 17561 : 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests.
Summary: Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows.
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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 /* @test
  25    @bug 8032078
  26    @summary Frame.setExtendedState throws RuntimeException, if
  27             windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
  28    @author Anton Litvinov
  29 */


  30 
  31 import java.awt.*;
  32 
  33 public class ExceptionOnSetExtendedStateTest {
  34     private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
  35 
  36     private static boolean validatePlatform() {
  37         String osName = System.getProperty("os.name");
  38         if (osName == null) {
  39             throw new RuntimeException("Name of the current OS could not be retrieved.");
  40         }
  41         return osName.startsWith("Mac");
  42     }
  43 
  44     private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
  45         System.out.println(String.format(
  46             "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
  47             oldState, newState, decoratedFrame));
  48 
  49         Frame frame = new Frame("ExceptionOnSetExtendedStateTest");


   1 /*
   2  * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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 8032078
  28  * @summary Frame.setExtendedState throws RuntimeException, if
  29  *          windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
  30  * @author Anton Litvinov
  31  */
  32 
  33 import java.awt.*;
  34 
  35 public class ExceptionOnSetExtendedStateTest {
  36     private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
  37 
  38     private static boolean validatePlatform() {
  39         String osName = System.getProperty("os.name");
  40         if (osName == null) {
  41             throw new RuntimeException("Name of the current OS could not be retrieved.");
  42         }
  43         return osName.startsWith("Mac");
  44     }
  45 
  46     private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
  47         System.out.println(String.format(
  48             "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
  49             oldState, newState, decoratedFrame));
  50 
  51         Frame frame = new Frame("ExceptionOnSetExtendedStateTest");


< prev index next >