author | goetz |
Tue, 14 Jun 2016 10:44:59 +0200 | |
changeset 39056 | d99e63b6d962 |
parent 34800 | 17884b2fdf5c |
permissions | -rw-r--r-- |
34800
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
1 |
/* |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
4 |
* |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
8 |
* |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
13 |
* accompanied this code). |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
14 |
* |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
18 |
* |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
21 |
* questions. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
22 |
*/ |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
23 |
import java.awt.GraphicsConfiguration; |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
24 |
import java.awt.GraphicsEnvironment; |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
25 |
import java.awt.image.VolatileImage; |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
26 |
|
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
27 |
/** |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
28 |
* @test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
34800
diff
changeset
|
29 |
* @key headful |
34800
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
30 |
* @bug 8140530 |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
31 |
* @run main VolatileImageBug |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
32 |
* @summary Creating volatileimage(0,0) should throw IAE |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
33 |
*/ |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
34 |
public class VolatileImageBug { |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
35 |
public static void main(String[] args) { |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
36 |
|
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
37 |
boolean iaeThrown = false; |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
38 |
GraphicsEnvironment ge = GraphicsEnvironment. |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
39 |
getLocalGraphicsEnvironment(); |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
40 |
GraphicsConfiguration gc = ge.getDefaultScreenDevice(). |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
41 |
getDefaultConfiguration(); |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
42 |
try { |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
43 |
VolatileImage volatileImage = gc.createCompatibleVolatileImage(0, 0); |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
44 |
} catch (IllegalArgumentException iae) { |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
45 |
iaeThrown = true; |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
46 |
} |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
47 |
if (!iaeThrown) { |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
48 |
throw new RuntimeException ("IllegalArgumentException not thrown " + |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
49 |
"for createCompatibleVolatileImage(0,0)"); |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
50 |
} |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
51 |
} |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
52 |
} |
17884b2fdf5c
8140530: Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri
psadhukhan
parents:
diff
changeset
|
53 |