< prev index next >

test/jdk/java/awt/Window/ShapedAndTranslucentWindows/SetShape.java

Print this page




  24 import java.awt.*;
  25 import java.awt.event.ComponentAdapter;
  26 import java.awt.event.ComponentEvent;
  27 import java.awt.geom.*;
  28 
  29 /*
  30  * @test
  31  * @key headful
  32  * @summary Check if a window set with shape appears in the expected shape
  33  *
  34  * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
  35  *      by the current platform. Proceed if it is supported. Apply different
  36  *      types of shapes on a Window. Make it appear with a known background. Use
  37  *      get pixel color to check whether it appears as expected. Repeat this for
  38  *      Window, Dialog and Frame.
  39  * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, the
  40  *      window should appear with the expected shape.
  41  *
  42  * @author mrkam
  43  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  44  * @library ../../../../lib/testlibrary
  45  * @build Common ExtendedRobot
  46  * @run main SetShape
  47  */
  48 
  49 public class SetShape extends Common {
  50 
  51     static int[][] pointsToCheck;
  52     static Shape shape;
  53 
  54     public static void main(String[] args) throws Exception {
  55         if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT)) {
  56             for (int i = 0; i < 6; i++) {
  57                 System.out.println("Checking shape "+i);
  58                 Area area;
  59                 GeneralPath path;
  60                 switch (i) {
  61                     case 0:
  62                         path = new GeneralPath();
  63                         path.moveTo(0, 40);
  64                         path.lineTo(40, 0);




  24 import java.awt.*;
  25 import java.awt.event.ComponentAdapter;
  26 import java.awt.event.ComponentEvent;
  27 import java.awt.geom.*;
  28 
  29 /*
  30  * @test
  31  * @key headful
  32  * @summary Check if a window set with shape appears in the expected shape
  33  *
  34  * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
  35  *      by the current platform. Proceed if it is supported. Apply different
  36  *      types of shapes on a Window. Make it appear with a known background. Use
  37  *      get pixel color to check whether it appears as expected. Repeat this for
  38  *      Window, Dialog and Frame.
  39  * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, the
  40  *      window should appear with the expected shape.
  41  *
  42  * @author mrkam
  43  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  44  * @library ../../../../lib/client
  45  * @build Common ExtendedRobot
  46  * @run main SetShape
  47  */
  48 
  49 public class SetShape extends Common {
  50 
  51     static int[][] pointsToCheck;
  52     static Shape shape;
  53 
  54     public static void main(String[] args) throws Exception {
  55         if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT)) {
  56             for (int i = 0; i < 6; i++) {
  57                 System.out.println("Checking shape "+i);
  58                 Area area;
  59                 GeneralPath path;
  60                 switch (i) {
  61                     case 0:
  62                         path = new GeneralPath();
  63                         path.moveTo(0, 40);
  64                         path.lineTo(40, 0);


< prev index next >