8218682: [TEST_BUG] DashOffset fails in mach5
authoraivanov
Thu, 14 Feb 2019 20:20:49 +0000
changeset 53799 af2ed7605f8c
parent 53798 fcac457cb2a8
child 53800 76668d618a99
8218682: [TEST_BUG] DashOffset fails in mach5 8198411: [TEST_BUG] Two java2d tests are unstable in mach5 Summary: Skip testing VolatileImage if IndexColorModel is detected Reviewed-by: prr, serb
test/jdk/ProblemList.txt
test/jdk/java/awt/BasicStroke/DashOffset.java
test/jdk/java/awt/BasicStroke/DashScaleMinWidth.java
test/jdk/java/awt/BasicStroke/DashZeroWidth.java
--- a/test/jdk/ProblemList.txt	Wed Feb 13 22:40:08 2019 -0800
+++ b/test/jdk/ProblemList.txt	Thu Feb 14 20:20:49 2019 +0000
@@ -114,8 +114,6 @@
 
 # jdk_awt
 
-java/awt/BasicStroke/DashScaleMinWidth.java 8198411 windows-all
-java/awt/BasicStroke/DashZeroWidth.java 8198411 windows-all
 java/awt/event/MouseEvent/MouseClickTest/MouseClickTest.html 8168389 windows-all,macosx-all
 java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 8168408 windows-all,macosx-all
 java/awt/Focus/FocusOwnerFrameOnClick/FocusOwnerFrameOnClick.java 8081489 generic-all
--- a/test/jdk/java/awt/BasicStroke/DashOffset.java	Wed Feb 13 22:40:08 2019 -0800
+++ b/test/jdk/java/awt/BasicStroke/DashOffset.java	Thu Feb 14 20:20:49 2019 +0000
@@ -29,6 +29,7 @@
 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;
@@ -40,7 +41,8 @@
 
 /*
  * @test
- * @bug 4469881 8217263
+ * @bug 4469881 8217263 8218682
+ * @key headful
  * @summary Verifies that dashed rectangles drawn to the screen line
  *          up with their undashed counterparts
  * @author flar
@@ -79,16 +81,16 @@
             }
         }
 
-        if (GraphicsEnvironment.isHeadless()) {
-            return;
-        }
-
         BufferedImage snapshot = null;
         try {
             final GraphicsConfiguration gc =
                     GraphicsEnvironment.getLocalGraphicsEnvironment()
                                        .getDefaultScreenDevice()
                                        .getDefaultConfiguration();
+            if (gc.getColorModel() instanceof IndexColorModel) {
+                System.err.println("Skipping VolatileImage because of IndexColorModel");
+                return;
+            }
 
             VolatileImage vi = gc.createCompatibleVolatileImage(WIDTH, HEIGHT);
             int attempt = 0;
@@ -102,7 +104,7 @@
             }
             validate(snapshot);
         } finally {
-            if (saveImage) {
+            if (saveImage && snapshot != null) {
                 save(snapshot, "volatileImage.png");
             }
         }
--- a/test/jdk/java/awt/BasicStroke/DashScaleMinWidth.java	Wed Feb 13 22:40:08 2019 -0800
+++ b/test/jdk/java/awt/BasicStroke/DashScaleMinWidth.java	Thu Feb 14 20:20:49 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,15 @@
 import java.awt.Image;
 import java.awt.geom.Line2D;
 import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
 import java.awt.image.VolatileImage;
 
 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
 
 /**
  * @test
- * @bug 4917097 8019816
+ * @bug 4917097 8019816 8198411
+ * @key headful
  * @summary 1.4.1 REGRESSION: BasicStroke Dashes don't show when scale * line width = 1.0
  * @run main/othervm -Dsun.java2d.uiScale=1 DashScaleMinWidth
  */
@@ -46,13 +48,13 @@
         draw(img);
         validate(img);
 
-        if (GraphicsEnvironment.isHeadless()) {
-            return;
-        }
-
         GraphicsConfiguration gc =
                 GraphicsEnvironment.getLocalGraphicsEnvironment()
                         .getDefaultScreenDevice().getDefaultConfiguration();
+        if (gc.getColorModel() instanceof IndexColorModel) {
+            System.err.println("Skipping VolatileImage because of IndexColorModel");
+            return;
+        }
 
         VolatileImage vi = gc.createCompatibleVolatileImage(200, 40);
         BufferedImage snapshot;
--- a/test/jdk/java/awt/BasicStroke/DashZeroWidth.java	Wed Feb 13 22:40:08 2019 -0800
+++ b/test/jdk/java/awt/BasicStroke/DashZeroWidth.java	Thu Feb 14 20:20:49 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,15 @@
 import java.awt.Image;
 import java.awt.geom.Line2D;
 import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
 import java.awt.image.VolatileImage;
 
 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
 
 /**
  * @test
- * @bug 4779211 8019816
+ * @bug 4779211 8019816 8198411
+ * @key headful
  * @summary REGRESSION: 1.4 Dashed lines disappear if BasicStroke width=0.0
  * @run main/othervm -Dsun.java2d.uiScale=1 DashZeroWidth
  */
@@ -46,13 +48,13 @@
         draw(img);
         validate(img);
 
-        if (GraphicsEnvironment.isHeadless()) {
-            return;
-        }
-
         GraphicsConfiguration gc =
                 GraphicsEnvironment.getLocalGraphicsEnvironment()
                         .getDefaultScreenDevice().getDefaultConfiguration();
+        if (gc.getColorModel() instanceof IndexColorModel) {
+            System.err.println("Skipping VolatileImage because of IndexColorModel");
+            return;
+        }
 
         VolatileImage vi = gc.createCompatibleVolatileImage(200, 40);
         BufferedImage snapshot;