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 import sun.awt.SunToolkit; 34 35 public class ExceptionOnSetExtendedStateTest { 36 private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH }; 37 private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); 38 39 private static boolean validatePlatform() { 40 String osName = System.getProperty("os.name"); 41 if (osName == null) { 42 throw new RuntimeException("Name of the current OS could not be retrieved."); 43 } 44 return osName.startsWith("Mac"); 45 } 46 47 private static void testStateChange(int oldState, int newState, boolean decoratedFrame) { 48 System.out.println(String.format( 49 "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'", | 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 import sun.awt.SunToolkit; 36 37 public class ExceptionOnSetExtendedStateTest { 38 private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH }; 39 private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); 40 41 private static boolean validatePlatform() { 42 String osName = System.getProperty("os.name"); 43 if (osName == null) { 44 throw new RuntimeException("Name of the current OS could not be retrieved."); 45 } 46 return osName.startsWith("Mac"); 47 } 48 49 private static void testStateChange(int oldState, int newState, boolean decoratedFrame) { 50 System.out.println(String.format( 51 "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'", |