Package net.sf.latexdraw.parsers.svg

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


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

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

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

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

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

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

    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    new SVGRectElement(node, null);
  }
View Full Code Here


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

    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); //$NON-NLS-1$
    e = new SVGRectElement(node, null);
    assertFalse(e.enableRendering());

    node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); //$NON-NLS-1$
    e = new SVGRectElement(node, null);
    assertFalse(e.enableRendering());

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

  @Test
  public void testGetHeight() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getHeight(), 20., 0.0001);
  }
View Full Code Here

  @Test
  public void testGetWidth() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getWidth(), 10., 0.0001);
  }
View Full Code Here

  @Test
  public void testGetRy() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getRy(), 0., 0.0001);

    node.setAttribute(SVGAttributes.SVG_RY, "1"); //$NON-NLS-1$
    r = new SVGRectElement(node, null);
    assertEquals(1., r.getRy(), 0.0001);
  }
View Full Code Here

  @Test
  public void testGetRx() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getRx(), 0., 0.0001);

    node.setAttribute(SVGAttributes.SVG_RX, "1"); //$NON-NLS-1$
    r = new SVGRectElement(node, null);
    assertEquals(1., r.getRx(), 0.0001);
  }
View Full Code Here

  @Test
  public void testGetY() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getY(), 0., 0.0001);

    node.setAttribute(SVGAttributes.SVG_Y, "1"); //$NON-NLS-1$
    r = new SVGRectElement(node, null);
    assertEquals(1., r.getY(), 0.0001);
  }
View Full Code Here

  @Test
  public void testGetX() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGRectElement r = new SVGRectElement(node, null);
    assertEquals(r.getX(), 0., 0.0001);

    node.setAttribute(SVGAttributes.SVG_X, "1"); //$NON-NLS-1$
    r = new SVGRectElement(node, null);
    assertEquals(1., r.getX(), 0.0001);
  }
View Full Code Here

    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_SQUARE);
        root.setAttribute(SVGAttributes.SVG_ID, getSVGID());

        if(shape.hasShadow()) {
          elt = new SVGRectElement(x, y, width, width, document);
          setSVGShadowAttributes(elt, true);
          root.appendChild(elt);
          setSVGRoundCorner(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 SVGRectElement(x, y, width, width, document);
          setSVGBorderBackground(elt, root);
          setSVGRoundCorner(elt);
        }

        elt = new SVGRectElement(x, y, width, width, document);
        root.appendChild(elt);
        setSVGAttributes(document, elt, true);
        setSVGRoundCorner(elt);

        if(shape.hasDbleBord()) {
          elt = new SVGRectElement(x, y, width, width, document);
          setSVGDoubleBordersAttributes(elt);
          setSVGRoundCorner(elt);
          root.appendChild(elt);
        }
View Full Code Here

        root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_RECT);
        root.setAttribute(SVGAttributes.SVG_ID, getSVGID());

        if(shape.hasShadow()) {
          elt = new SVGRectElement(x, y, width, height, document);
          setSVGShadowAttributes(elt, true);
          root.appendChild(elt);
          setSVGRoundCorner(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 SVGRectElement(x, y, width, height, document);
          setSVGBorderBackground(elt, root);
          setSVGRoundCorner(elt);
        }

        elt = new SVGRectElement(x, y, width, height, document);
        root.appendChild(elt);
        setSVGAttributes(document, elt, true);
        setSVGRoundCorner(elt);

        if(shape.hasDbleBord()) {
          elt = new SVGRectElement(x, y, width, height, document);
          setSVGDoubleBordersAttributes(elt);
          setSVGRoundCorner(elt);
          root.appendChild(elt);
        }
View Full Code Here

TOP

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

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.