1 /*
2 * Copyright (c) 2013, 2015, 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 import java.awt.*;
26 import java.awt.Frame;
27 import java.awt.datatransfer.Clipboard;
28 import java.awt.font.TextAttribute;
29 import java.awt.im.InputMethodHighlight;
30 import java.awt.image.ColorModel;
31 import java.awt.image.ImageObserver;
32 import java.awt.image.ImageProducer;
33 import java.net.URL;
34 import java.util.Map;
35 import java.util.Properties;
36
37
38 /**
39 * @test
40 * @bug 7172833
41 * @summary java.awt.Toolkit methods is/setDynamicLayout() should be consistent.
42 * @author Sergey Bylokhov
43 */
44 public final class bug7172833 {
45
46 public static void main(final String[] args) throws Exception {
47 final StubbedToolkit t = new StubbedToolkit();
48 final Boolean dynamicLayoutSupported
49 = (Boolean) t.getDesktopProperty("awt.dynamicLayoutSupported");
50 t.setDynamicLayout(true);
51 if(!t.isDynamicLayoutSet()){
52 throw new RuntimeException("'true' expected but 'false' returned");
53 }
54 if (dynamicLayoutSupported) {
55 if (!t.isDynamicLayoutActive()) {
56 throw new RuntimeException("is inactive but set+supported");
57 }
58 } else {
59 if (t.isDynamicLayoutActive()) {
|
1 /*
2 * Copyright (c) 2013, 2016, 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 import java.awt.*;
26 import java.awt.Frame;
27 import java.awt.datatransfer.Clipboard;
28 import java.awt.font.TextAttribute;
29 import java.awt.im.InputMethodHighlight;
30 import java.awt.image.ColorModel;
31 import java.awt.image.ImageObserver;
32 import java.awt.image.ImageProducer;
33 import java.net.URL;
34 import java.util.Map;
35 import java.util.Properties;
36
37
38 /**
39 * @test
40 * @key headful
41 * @bug 7172833
42 * @summary java.awt.Toolkit methods is/setDynamicLayout() should be consistent.
43 * @author Sergey Bylokhov
44 */
45 public final class bug7172833 {
46
47 public static void main(final String[] args) throws Exception {
48 final StubbedToolkit t = new StubbedToolkit();
49 final Boolean dynamicLayoutSupported
50 = (Boolean) t.getDesktopProperty("awt.dynamicLayoutSupported");
51 t.setDynamicLayout(true);
52 if(!t.isDynamicLayoutSet()){
53 throw new RuntimeException("'true' expected but 'false' returned");
54 }
55 if (dynamicLayoutSupported) {
56 if (!t.isDynamicLayoutActive()) {
57 throw new RuntimeException("is inactive but set+supported");
58 }
59 } else {
60 if (t.isDynamicLayoutActive()) {
|