Package net.sf.latexdraw.parsers.svg

Examples of net.sf.latexdraw.parsers.svg.SVGEllipseElement


public class TestSVGEllipseElement extends AbstractTestSVGElement {
  @SuppressWarnings("unused")
  @Test
  public void testContructor() {
    try {
      new SVGEllipseElement(null, null);
      fail();
    }
    catch(Exception e){/**/}

    try {
      new SVGEllipseElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_RX, "dsd"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "dsd"); //$NON-NLS-1$
      new SVGEllipseElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_RX, "1"); //$NON-NLS-1$
      new SVGEllipseElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_RX, "-1"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "10"); //$NON-NLS-1$
      new SVGEllipseElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "-1"); //$NON-NLS-1$
      new SVGEllipseElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "20"); //$NON-NLS-1$
      new SVGEllipseElement(node, null);
    }
    catch(MalformedSVGDocument e) { fail(); }
  }
View Full Code Here


  @Test
  public void testGetCy() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "20"); //$NON-NLS-1$
    SVGEllipseElement e = new SVGEllipseElement(node, null);
    assertEquals(e.getCy(), 0., 0.0001);

    node.setAttribute(SVGAttributes.SVG_CY, "40"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertEquals(e.getCy(), 40., 0.0001);

    node.setAttribute(SVGAttributes.SVG_CY, "40px"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertEquals(e.getCy(), 40., 0.0001);

    node.setAttribute(SVGAttributes.SVG_CY, "40 cm"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertEquals(e.getCy(), UnitProcessor.INSTANCE.toUserUnit(40, SVGLength.LengthType.CM), 0.0001);
  }
View Full Code Here

  @Test
  public void testGetCx() throws MalformedSVGDocument {
      node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "20"); //$NON-NLS-1$
      SVGEllipseElement e = new SVGEllipseElement(node, null);
      assertEquals(e.getCx(), 0., 0.0001);

      node.setAttribute(SVGAttributes.SVG_CX, "30"); //$NON-NLS-1$
      e = new SVGEllipseElement(node, null);
      assertEquals(e.getCx(), 30., 0.0001);

      node.setAttribute(SVGAttributes.SVG_CX, "40px"); //$NON-NLS-1$
      e = new SVGEllipseElement(node, null);
      assertEquals(e.getCx(), 40., 0.0001);

      node.setAttribute(SVGAttributes.SVG_CX, "40 cm"); //$NON-NLS-1$
      e = new SVGEllipseElement(node, null);
      assertEquals(e.getCx(), UnitProcessor.INSTANCE.toUserUnit(40, SVGLength.LengthType.CM), 0.0001);
  }
View Full Code Here

  @Test
  public void testEnableRendering() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_RX, "0"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "0"); //$NON-NLS-1$
    SVGEllipseElement e = new SVGEllipseElement(node, null);
    assertFalse(e.enableRendering());

    node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "0"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertFalse(e.enableRendering());

    node.setAttribute(SVGAttributes.SVG_RX, "0"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "10"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertFalse(e.enableRendering());

    node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "10"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertTrue(e.enableRendering());
  }
View Full Code Here

  @Test
  public void testGetRy() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_RY, "20"); //$NON-NLS-1$
    SVGEllipseElement e = new SVGEllipseElement(node, null);
    assertEquals(e.getRy(), 20., 0.0001);
    node.setAttribute(SVGAttributes.SVG_RY, "20 pt"); //$NON-NLS-1$
    e = new SVGEllipseElement(node, null);
    assertEquals(e.getRy(), UnitProcessor.INSTANCE.toUserUnit(20, SVGLength.LengthType.PT), 0.0001);
  }
View Full Code Here

  @Test
  public void testGetRx() throws MalformedSVGDocument {
      node.setAttribute(SVGAttributes.SVG_RX, "10"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_RY, "20"); //$NON-NLS-1$
      SVGEllipseElement e = new SVGEllipseElement(node, null);
      assertEquals(e.getRx(), 10., 0.0001);
      node.setAttribute(SVGAttributes.SVG_RX, "10mm"); //$NON-NLS-1$
      e = new SVGEllipseElement(node, null);
      assertEquals(e.getRx(), UnitProcessor.INSTANCE.toUserUnit(10, SVGLength.LengthType.MM), 0.0001);
  }
View Full Code Here

        final double height = Math.max(1., (bry-tly+gap)/2.);
        final double x    = (brx+tlx)/2.;
        final double y    = (bry+tly)/2.;

        if(shape.hasShadow()) {
          elt = new SVGEllipseElement(x, y, width, height, doc);
          setSVGShadowAttributes(elt, true);
          root.appendChild(elt);
        }

        if(shape.hasShadow() && !shape.getLineStyle().getLatexToken().equals(PSTricksConstants.LINE_NONE_STYLE)) {
          // The background of the borders must be filled is there is a shadow.
          elt = new SVGEllipseElement(x, y, width, height, doc);
          setSVGBorderBackground(elt, root);
        }

        elt = new SVGEllipseElement(x, y, width, height, doc);
        setSVGAttributes(doc, elt, true);
        root.appendChild(elt);

        if(shape.hasDbleBord())  {
          elt = new SVGEllipseElement(x, y, width, height, doc);
          setSVGDoubleBordersAttributes(elt);
          root.appendChild(elt);
        }

        setSVGRotationAttribute(root);
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.parsers.svg.SVGEllipseElement

Copyright © 2018 www.massapicom. 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.