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 */
33 import java.awt.GraphicsEnvironment;
34 import java.awt.HeadlessException;
35 import java.awt.Rectangle;
36 import java.awt.Robot;
37 import java.awt.Toolkit;
38 import java.awt.event.WindowAdapter;
39 import java.awt.event.WindowEvent;
40 import java.awt.image.BufferedImage;
41 import java.awt.image.VolatileImage;
42 import java.io.File;
43 import java.io.IOException;
44 import java.util.HashSet;
45 import javax.imageio.ImageIO;
46 import sun.awt.ConstrainableGraphics;
47
48 /**
49 * @test
50 * @bug 6335200 6419610
51 * @summary Tests that we don't render anything if specific empty clip is set
52 * @author Dmitri.Trembovetski@Sun.COM: area=Graphics
53 * @run main EmptyClipRenderingTest
54 * @run main/othervm -Dsun.java2d.noddraw=true EmptyClipRenderingTest
55 * @run main/othervm -Dsun.java2d.pmoffscreen=true EmptyClipRenderingTest
56 * @run main/othervm -Dsun.java2d.opengl=true EmptyClipRenderingTest
57 */
58 public class EmptyClipRenderingTest {
59 static final int IMG_W = 400;
60 static final int IMG_H = 400;
61
62 // generated rectangles
63 static HashSet<Rectangle> rects;
64
65 volatile boolean isActivated = false;
66 volatile boolean isPainted;
67 private static boolean showErrors = false;
68
69 public EmptyClipRenderingTest() {
70 // initialize clip/render region rectangles
71 initClips();
72
|
1 /*
2 * Copyright (c) 2014, 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 */
33 import java.awt.GraphicsEnvironment;
34 import java.awt.HeadlessException;
35 import java.awt.Rectangle;
36 import java.awt.Robot;
37 import java.awt.Toolkit;
38 import java.awt.event.WindowAdapter;
39 import java.awt.event.WindowEvent;
40 import java.awt.image.BufferedImage;
41 import java.awt.image.VolatileImage;
42 import java.io.File;
43 import java.io.IOException;
44 import java.util.HashSet;
45 import javax.imageio.ImageIO;
46 import sun.awt.ConstrainableGraphics;
47
48 /**
49 * @test
50 * @bug 6335200 6419610
51 * @summary Tests that we don't render anything if specific empty clip is set
52 * @author Dmitri.Trembovetski@Sun.COM: area=Graphics
53 * @modules java.desktop/sun.awt
54 * @run main EmptyClipRenderingTest
55 * @run main/othervm -Dsun.java2d.noddraw=true EmptyClipRenderingTest
56 * @run main/othervm -Dsun.java2d.pmoffscreen=true EmptyClipRenderingTest
57 * @run main/othervm -Dsun.java2d.opengl=true EmptyClipRenderingTest
58 */
59 public class EmptyClipRenderingTest {
60 static final int IMG_W = 400;
61 static final int IMG_H = 400;
62
63 // generated rectangles
64 static HashSet<Rectangle> rects;
65
66 volatile boolean isActivated = false;
67 volatile boolean isPainted;
68 private static boolean showErrors = false;
69
70 public EmptyClipRenderingTest() {
71 // initialize clip/render region rectangles
72 initClips();
73
|