< prev index next >
test/jdk/java/awt/BasicStroke/DashOffset.java
Print this page
@@ -27,10 +27,11 @@
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
import java.awt.image.VolatileImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Collectors;
@@ -38,11 +39,11 @@
import static java.awt.image.BufferedImage.TYPE_INT_RGB;
/*
* @test
- * @bug 4469881 8217263
+ * @bug 4469881 8217263 8218682
* @summary Verifies that dashed rectangles drawn to the screen line
* up with their undashed counterparts
* @author flar
* @run main/othervm -Dsun.java2d.uiScale=1 DashOffset
*/
@@ -87,10 +88,13 @@
try {
final GraphicsConfiguration gc =
GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.getDefaultConfiguration();
+ if (gc.getColorModel() instanceof IndexColorModel) {
+ return;
+ }
VolatileImage vi = gc.createCompatibleVolatileImage(WIDTH, HEIGHT);
int attempt = 0;
do {
vi.validate(gc);
@@ -100,11 +104,11 @@
if (attempt > 10) {
throw new RuntimeException("Too many attempts: " + attempt);
}
validate(snapshot);
} finally {
- if (saveImage) {
+ if (saveImage && snapshot != null) {
save(snapshot, "volatileImage.png");
}
}
}
< prev index next >