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 */
30 import java.awt.Graphics;
31 import java.awt.Graphics2D;
32 import java.awt.GraphicsConfiguration;
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
|
1 /*
2 * Copyright (c) 2014, 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 */
30 import java.awt.Graphics;
31 import java.awt.Graphics2D;
32 import java.awt.GraphicsConfiguration;
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 * @key headful
51 * @bug 6335200 6419610
52 * @summary Tests that we don't render anything if specific empty clip is set
53 * @author Dmitri.Trembovetski@Sun.COM: area=Graphics
54 * @modules java.desktop/sun.awt
55 * @run main EmptyClipRenderingTest
56 * @run main/othervm -Dsun.java2d.noddraw=true EmptyClipRenderingTest
57 * @run main/othervm -Dsun.java2d.pmoffscreen=true EmptyClipRenderingTest
58 * @run main/othervm -Dsun.java2d.opengl=true EmptyClipRenderingTest
59 */
60 public class EmptyClipRenderingTest {
61 static final int IMG_W = 400;
62 static final int IMG_H = 400;
63
64 // generated rectangles
65 static HashSet<Rectangle> rects;
66
67 volatile boolean isActivated = false;
68 volatile boolean isPainted;
69 private static boolean showErrors = false;
70
|