Examples of Arc2D


Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    double[] c = new double[6];
    Arc2D arc1 = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 0.0, 90.0, Arc2D.PIE);
    PathIterator iterator = arc1.getPathIterator(null);
    harness.check(!iterator.isDone());
    int segType = iterator.currentSegment(c);
    harness.check(segType == PathIterator.SEG_MOVETO);
    harness.check(c[0], 4.0);
    harness.check(c[1], 4.0);
View Full Code Here

Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // setAngles(double, double, double, double)
    Arc2D arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.PIE);
    arc.setAngles(1.0, -1.0, -1.0, -1.0);
    harness.check(arc.getAngleStart(), 45.0);
    harness.check(arc.getAngleExtent(), 90.0);
  
    // setAngleStart(Point2D, Point2D)
    arc.setAngles(new Point2D.Double(1.0, 1.0), new Point2D.Double(-1.0, 1.0));
    harness.check(arc.getAngleStart(), -45.0);
    harness.check(arc.getAngleExtent(), 270.0);
   
    boolean pass = false;
    try
    {
      arc.setAngles(null, new Point2D.Double(-1.0, 1.0));
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
    harness.check(pass);
   
    pass = false;
    try
    {
      arc.setAngles(new Point2D.Double(-1.0, 1.0), null);
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
View Full Code Here

Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // setAngleExtent(double)
    Arc2D arc = new Arc2D.Double(0.0, 0.0, 1.0, 1.0, 0.0, 90.0, Arc2D.PIE);
    arc.setAngleExtent(85.0);
    harness.check(arc.getAngleExtent(), 85.0);
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // setArc(Arc2D)
    Arc2D arc1 = new Arc2D.Double();
    Arc2D arc2 = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.PIE);
    arc1.setArc(arc2);
    harness.check(arc1.getX(), 1.0);
    harness.check(arc1.getY(), 2.0);
    harness.check(arc1.getWidth(), 3.0);
    harness.check(arc1.getHeight(), 4.0);
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    Arc2D arc = new Arc2D.Double();
    harness.check(arc.isEmpty());
     
    arc = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.CHORD);
    harness.check(!arc.isEmpty());
    arc = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.PIE);
    harness.check(!arc.isEmpty());
    arc = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.OPEN);
    harness.check(!arc.isEmpty());
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    Arc2D arc = new Arc2D.Double();
    harness.check(!arc.containsAngle(0.0));   // check 1

    arc = new Arc2D.Double(
      new Rectangle2D.Double(0.0, 0.0, 1.0, 1.0), 90.0, 90.0, Arc2D.PIE
    );
    harness.check(!arc.containsAngle(0.0));   // check 2
    harness.check(!arc.containsAngle(45.0))// check 3
    harness.check(arc.containsAngle(90.0));   // check 4
    harness.check(arc.containsAngle(135.0))// check 5
    harness.check(!arc.containsAngle(180.0)); // check 6
    harness.check(!arc.containsAngle(225.0)); // check 7
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // contains(double, double)
    Arc2D arc = new Arc2D.Double();
    harness.check(!arc.contains(0.0, 0.0))// check 1
   
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.CHORD);
    harness.check(!arc.contains(0.0, 0.0))// check 2
    harness.check(!arc.contains(1.0, 0.0))// check 3
    harness.check(!arc.contains(0.0, 1.0))// check 4
    harness.check(!arc.contains(0.5, 0.5))// check 5
    harness.check(!arc.contains(0.5, -0.5)); // check 6

    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.PIE);
    harness.check(arc.contains(0.0, 0.0));   // check 7
    harness.check(!arc.contains(1.0, 0.0))// check 8
    harness.check(!arc.contains(0.0, 1.0))// check 9
    harness.check(!arc.contains(0.5, 0.5))// check 10
    harness.check(arc.contains(0.5, -0.5))// check 11
   
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.OPEN);
    harness.check(!arc.contains(0.0, 0.0))// check 12
    harness.check(!arc.contains(1.0, 0.0))// check 13
    harness.check(!arc.contains(0.0, 1.0))// check 14
    harness.check(!arc.contains(0.5, 0.5))// check 15
    harness.check(!arc.contains(0.5, -0.5)); // check 16
   
    // contains(double, double, double, double)
    arc = new Arc2D.Double();
    harness.check(!arc.contains(0.0, 0.0, 0.0, 0.0))// check 17
   
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.CHORD);
    harness.check(!arc.contains(0.45, -0.55, 0.1, 0.1))// check 18
  
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.PIE);
    harness.check(arc.contains(0.45, -0.55, 0.1, 0.1));   // check 19
  
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.OPEN);
    harness.check(!arc.contains(0.45, -0.55, 0.1, 0.1))// check 20
   
    // contains(Rectangle2D)
    arc = new Arc2D.Double();
    harness.check(                                       // check 21
      !arc.contains(new Rectangle2D.Double(0.0, 0.0, 0.0, 0.0))
    );
   
    Rectangle2D r = new Rectangle2D.Double(0.45, -0.55, 0.1, 0.1);
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.CHORD);
    harness.check(!arc.contains(r));                     // check 22
  
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.PIE);
    harness.check(arc.contains(r));                      // check 23
  
    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.OPEN);
    harness.check(!arc.contains(r));                     // check 24
    
    boolean pass = false;
    try
    {
      arc.contains((Rectangle2D) null);
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    Arc2D arc = new Arc2D.Double();
    arc.setArcByTangent(
      new Point2D.Double(10.0, 0.0),
      new Point2D.Double(0.0, 0.0),
      new Point2D.Double(0.0, 10.0),
      1.0
    );
    harness.check(arc.getAngleStart(), 90.0);
    harness.check(arc.getAngleExtent(), 90.0);
   
    harness.checkPoint("Null arguments");
    testNullArguments(harness);
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

  }
 
  private void testNullArguments(TestHarness harness)
  {
    boolean pass = false;
    Arc2D arc = new Arc2D.Double();
    try
    {
      arc.setArcByTangent(
        null,
        new Point2D.Double(0.0, 0.0),
        new Point2D.Double(0.0, 10.0),
        1.0
      );
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
    harness.check(pass);
   
    pass = false;
    try
    {
      arc.setArcByTangent(
        new Point2D.Double(10.0, 0.0),
        null,
        new Point2D.Double(0.0, 10.0),
        1.0
      );
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
    harness.check(pass);

    pass = false;
    try
    {
      arc.setArcByTangent(
        new Point2D.Double(10.0, 0.0),
        new Point2D.Double(0.0, 10.0),
        null,
        1.0
      );
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    Arc2D arc1 = new Arc2D.Double(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, Arc2D.CHORD);
    Arc2D arc2 = null;
    arc2 = (Arc2D) arc1.clone();
    harness.check(arc1.getX() == arc2.getX());
    harness.check(arc1.getY() == arc2.getY());
    harness.check(arc1.getWidth() == arc2.getWidth());
    harness.check(arc1.getHeight() == arc2.getHeight());
    harness.check(arc1.getAngleStart(), arc2.getAngleStart());
    harness.check(arc1.getAngleExtent(), arc2.getAngleExtent());
    harness.check(arc1.getArcType() == arc2.getArcType());
    harness.check(arc1.getClass() == arc2.getClass());
    harness.check(arc1 != arc2);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.