23
24 import java.awt.Font;
25 import java.awt.Graphics2D;
26 import java.awt.GraphicsConfiguration;
27 import java.awt.GraphicsEnvironment;
28 import java.awt.Image;
29 import java.awt.Rectangle;
30 import java.awt.RenderingHints;
31 import java.awt.font.FontRenderContext;
32 import java.awt.font.GlyphVector;
33 import java.awt.image.BufferedImage;
34 import java.awt.image.VolatileImage;
35 import java.util.concurrent.ArrayBlockingQueue;
36 import java.util.concurrent.BlockingQueue;
37 import java.util.concurrent.TimeUnit;
38
39 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
40
41 /**
42 * @test
43 * @bug 8158072 7172749
44 */
45 public final class ClassCastExceptionForInvalidSurface {
46
47 static GraphicsEnvironment ge
48 = GraphicsEnvironment.getLocalGraphicsEnvironment();
49
50 static GraphicsConfiguration gc
51 = ge.getDefaultScreenDevice().getDefaultConfiguration();
52
53 static volatile VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
54
55 static volatile Throwable failed;
56
57 static BlockingQueue<VolatileImage> list = new ArrayBlockingQueue<>(50);
58
59 // Will run the test no more than 15 seconds
60 static long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
61
62 public static void main(final String[] args) throws InterruptedException {
|
23
24 import java.awt.Font;
25 import java.awt.Graphics2D;
26 import java.awt.GraphicsConfiguration;
27 import java.awt.GraphicsEnvironment;
28 import java.awt.Image;
29 import java.awt.Rectangle;
30 import java.awt.RenderingHints;
31 import java.awt.font.FontRenderContext;
32 import java.awt.font.GlyphVector;
33 import java.awt.image.BufferedImage;
34 import java.awt.image.VolatileImage;
35 import java.util.concurrent.ArrayBlockingQueue;
36 import java.util.concurrent.BlockingQueue;
37 import java.util.concurrent.TimeUnit;
38
39 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
40
41 /**
42 * @test
43 * @key headful
44 * @bug 8158072 7172749
45 */
46 public final class ClassCastExceptionForInvalidSurface {
47
48 static GraphicsEnvironment ge
49 = GraphicsEnvironment.getLocalGraphicsEnvironment();
50
51 static GraphicsConfiguration gc
52 = ge.getDefaultScreenDevice().getDefaultConfiguration();
53
54 static volatile VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
55
56 static volatile Throwable failed;
57
58 static BlockingQueue<VolatileImage> list = new ArrayBlockingQueue<>(50);
59
60 // Will run the test no more than 15 seconds
61 static long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
62
63 public static void main(final String[] args) throws InterruptedException {
|