test/java/awt/Graphics2D/Test8004859/Test8004859.java

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Graphics2D;
  25 import java.awt.Rectangle;
  26 import java.awt.Shape;
  27 import java.awt.geom.NoninvertibleTransformException;
  28 import java.awt.image.BufferedImage;
  29 
  30 import sun.java2d.SunGraphics2D;
  31 
  32 /**
  33  * @test
  34  * @bug 8004859
  35  * @summary getClipBounds/getClip should return equivalent bounds.
  36  * @author Sergey Bylokhov
  37  */
  38 public final class Test8004859 {
  39 
  40     private static Shape[] clips = {new Rectangle(0, 0, 1, 1), new Rectangle(
  41             100, 100, -100, -100)};
  42 
  43     private static boolean status = true;
  44 
  45     public static void main(final String[] args)
  46             throws NoninvertibleTransformException {
  47         final BufferedImage bi = new BufferedImage(300, 300,
  48                                                    BufferedImage.TYPE_INT_RGB);
  49         final Graphics2D g = (Graphics2D) bi.getGraphics();
  50         test(g);
  51         g.translate(2.0, 2.0);
  52         test(g);
  53         g.translate(-4.0, -4.0);
  54         test(g);
  55         g.scale(2.0, 2.0);
  56         test(g);
  57         g.scale(-4.0, -4.0);
  58         test(g);
  59         g.rotate(Math.toRadians(90));
  60         test(g);




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Graphics2D;
  25 import java.awt.Rectangle;
  26 import java.awt.Shape;
  27 import java.awt.geom.NoninvertibleTransformException;
  28 import java.awt.image.BufferedImage;
  29 
  30 import sun.java2d.SunGraphics2D;
  31 
  32 /**
  33  * @test
  34  * @bug 8004859
  35  * @summary getClipBounds/getClip should return equivalent bounds.
  36  * @author Sergey Bylokhov
  37  */
  38 public final class Test8004859 {
  39 
  40     private static Shape[] clips = {new Rectangle(0, 0, -1, -1), new Rectangle(
  41             100, 100, -100, -100)};
  42 
  43     private static boolean status = true;
  44 
  45     public static void main(final String[] args)
  46             throws NoninvertibleTransformException {
  47         final BufferedImage bi = new BufferedImage(300, 300,
  48                                                    BufferedImage.TYPE_INT_RGB);
  49         final Graphics2D g = (Graphics2D) bi.getGraphics();
  50         test(g);
  51         g.translate(2.0, 2.0);
  52         test(g);
  53         g.translate(-4.0, -4.0);
  54         test(g);
  55         g.scale(2.0, 2.0);
  56         test(g);
  57         g.scale(-4.0, -4.0);
  58         test(g);
  59         g.rotate(Math.toRadians(90));
  60         test(g);