test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.WindowAdapter;
  26 import java.awt.event.WindowEvent;
  27 import java.awt.event.WindowFocusListener;
  28 import java.awt.geom.Area;
  29 import java.awt.geom.GeneralPath;
  30 import java.awt.geom.Rectangle2D;
  31 import java.util.HashMap;
  32 
  33 /*
  34  * @test
  35  * @bug 8013450
  36  * @summary Check if the window events (Focus and Activation) are triggered correctly
  37  *          when clicked on visible and clipped areas.













  38  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  39  * @library ../../../../lib/testlibrary
  40  * @build Common ExtendedRobot
  41  * @run main FocusAWTTest
  42  */
  43 
  44 public class FocusAWTTest extends Common {
  45 
  46     ExtendedRobot robot;
  47     int dx;
  48     int dy;
  49     static final int x = 20;
  50     static final int y = 400;
  51 
  52     static volatile HashMap<String, Boolean> flags = new HashMap<String, Boolean>();
  53     static {
  54         flags.put("backgroundWindowActivated", false);
  55         flags.put("backgroundWindowDeactivated", false);
  56         flags.put("backgroundWindowGotFocus", false);
  57         flags.put("backgroundWindowLostFocus", false);




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.WindowAdapter;
  26 import java.awt.event.WindowEvent;
  27 import java.awt.event.WindowFocusListener;
  28 import java.awt.geom.Area;
  29 import java.awt.geom.GeneralPath;
  30 import java.awt.geom.Rectangle2D;
  31 import java.util.HashMap;
  32 
  33 /*
  34  * @test
  35  * @bug 8013450
  36  * @summary     Check if the window events (Focus and Activation) are triggered correctly
  37  *          when clicked on visible and clipped areas.
  38  *
  39  * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
  40  *      by the current platform. Proceed if it is supported. Apply different
  41  *      types of shapes on a Window. Make it appear with a known background.
  42  *      Check if mouse events which result in window-activated events are
  43  *      triggered only within the window's shape and not outside. Repeat this
  44  *      for Window, Dialog and Frame.
  45  * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, window should
  46  *      gain focus and should trigger activated events only when it is clicked on the
  47  *      visible areas. Events should be delivered to the background window if clicked
  48  *      on the clipped areas.
  49  *
  50  * @author mrkam
  51  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  52  * @library ../../../../lib/testlibrary
  53  * @build Common ExtendedRobot
  54  * @run main FocusAWTTest
  55  */
  56 
  57 public class FocusAWTTest extends Common {
  58 
  59     ExtendedRobot robot;
  60     int dx;
  61     int dy;
  62     static final int x = 20;
  63     static final int y = 400;
  64 
  65     static volatile HashMap<String, Boolean> flags = new HashMap<String, Boolean>();
  66     static {
  67         flags.put("backgroundWindowActivated", false);
  68         flags.put("backgroundWindowDeactivated", false);
  69         flags.put("backgroundWindowGotFocus", false);
  70         flags.put("backgroundWindowLostFocus", false);