Examples of SVGImageElement


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

public class TestSVGImageElement extends AbstractTestSVGElement {
  @SuppressWarnings("unused")
  @Test
  public void testContructor() throws MalformedSVGDocument {
    try {
      new SVGImageElement(null, ""); //$NON-NLS-1$
      fail();
    }
    catch(Exception e){/**/}

    try {
      new SVGImageElement(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 SVGImageElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

    try {
      node.setAttribute(SVGAttributes.SVG_WIDTH, "1"); //$NON-NLS-1$
      new SVGImageElement(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 SVGImageElement(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 SVGImageElement(node, null);
      fail();
    }
    catch(MalformedSVGDocument e){/**/}

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

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

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

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

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

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

  @Test
  public void testGetURI() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
    node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
    SVGImageElement e = new SVGImageElement(node, null);
    assertNull(e.getURI());

    node.setAttribute("xlink:href", "/dir/file"); //$NON-NLS-1$ //$NON-NLS-2$
    e = new SVGImageElement(node, null);
    assertEquals(e.getURI(), "/dir/file"); //$NON-NLS-1$
  }
View Full Code Here

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

  @Test
  public void testEnableRendering() {
    try {
      node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); //$NON-NLS-1$
      node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); //$NON-NLS-1$
      SVGImageElement e = new SVGImageElement(node, null);
      assertFalse(e.enableRendering());

      node.setAttribute("xlink:href", "/rerzerojcsf/dsqdsdfgdre"); //$NON-NLS-1$ //$NON-NLS-2$
      e = new SVGImageElement(node, null);
      assertFalse(e.enableRendering());

      node.setAttribute("xlink:href", "build.xml"); //$NON-NLS-1$ //$NON-NLS-2$
      e = new SVGImageElement(node, null);
      assertFalse(e.enableRendering());

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

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

      node.setAttribute(SVGAttributes.SVG_WIDTH, "20"); //$NON-NLS-1$
      e = new SVGImageElement(node, null);
      assertFalse(e.enableRendering());
    }
    catch(MalformedSVGDocument e) { fail(); }
  }
View Full Code Here

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

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

      node.setAttribute(SVGAttributes.SVG_Y, "1"); //$NON-NLS-1$
      e = new SVGImageElement(node, null);
      assertEquals(1., e.getY(), 0.0001);
    }
    catch(MalformedSVGDocument e) { fail(); }
  }
View Full Code Here

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

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

      node.setAttribute(SVGAttributes.SVG_X, "1"); //$NON-NLS-1$
      e = new SVGImageElement(node, null);
      assertEquals(1., e.getX(), 0.0001);
    }
    catch(MalformedSVGDocument e) { fail(); }
  }
View Full Code Here

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

    final SVGElement elt2 = getLaTeXDrawElement(elt, null);

    if(elt==null || !(elt2 instanceof SVGImageElement))
      throw new IllegalArgumentException();

    final SVGImageElement main = (SVGImageElement)elt2;

    shape.setPathSource(main.getURI());
    shape.setPosition(main.getX(), main.getY());

    if(withTransformation)
      applyTransformations(elt);
  }
View Full Code Here

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

        final SVGElement img;

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

    img = new SVGImageElement(doc, shape.getPathSource());
    img.setAttribute(SVGAttributes.SVG_X, String.valueOf(shape.getPosition().getX()));
    img.setAttribute(SVGAttributes.SVG_Y, String.valueOf(shape.getPosition().getY()));
    img.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf(shape.getImage().getHeight(null)));
    img.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf(shape.getImage().getWidth(null)));
    setSVGRotationAttribute(root);
View Full Code Here

Examples of org.w3c.dom.svg.SVGImageElement

     *  pointed by the reference
     */
    protected GraphicsNode buildImageGraphicsNode
        (BridgeContext ctx, Element e){

        SVGImageElement ie = (SVGImageElement) e;

        // 'xlink:href' attribute - required
        String uriStr = ie.getHref().getAnimVal();
        if (uriStr.length() == 0) {
            throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {"xlink:href"});
        }
        if (uriStr.indexOf('#') != -1) {
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.