8159906: [TEST_BUG] javax/swing/JDialog/Transparency/TransparencyTest.java
authoryan
Mon, 05 Dec 2016 18:09:05 +0300
changeset 42733 fcda8c58dc5b
parent 42732 93c50fe10c2a
child 42734 b9a2deda98ef
8159906: [TEST_BUG] javax/swing/JDialog/Transparency/TransparencyTest.java Reviewed-by: psadhukhan, yan Contributed-by: Maksim Khramov <maksim.khramov@oracle.com>
jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java
--- a/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java	Fri Dec 02 15:22:35 2016 +0530
+++ b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java	Mon Dec 05 18:09:05 2016 +0300
@@ -24,10 +24,12 @@
  /*
  @test
  @key headful
- @bug 8062946
+ @bug 8062946 8159906
  @summary Verify Transparency upon iconify/deiconify sequence
  @run main TransparencyTest
  */
+import java.awt.GraphicsEnvironment;
+import java.awt.GraphicsDevice;
 import java.awt.Color;
 import java.awt.Point;
 import java.awt.Robot;
@@ -43,7 +45,7 @@
     private static final int WIDTH = 250;
     private static final int HEIGHT = 250;
     private static final float OPACITY = 0.60f;
-    private static Point dlgPos;
+    private static volatile Point dlgPos;
 
     public static void createAndShowGUI() {
         frame = new JFrame("JFrame");
@@ -67,6 +69,14 @@
 
     public static void main(String[] args) throws Exception {
 
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice gd = ge.getDefaultScreenDevice();
+        GraphicsDevice.WindowTranslucency mode = GraphicsDevice.WindowTranslucency.TRANSLUCENT;
+        boolean translucencyCheck = gd.isWindowTranslucencySupported(mode);
+        if(!translucencyCheck) {
+            return;
+    }
+
         Robot robot = new Robot();
         // create a GUI
         SwingUtilities.invokeAndWait(new Runnable() {