Package com.joshondesign.xml

Examples of com.joshondesign.xml.Doc.xpathString()


    @Test
    public void testRectangle() throws Exception {
        page.clear();
        page.add(new SRect(0, 0, 20, 20).setFillPaint(FlatColor.RED));
        Doc xdoc = saveAndReadback(doc);
        assertTrue("0.0".equals(xdoc.xpathString("/svg/rect/@x")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/rect/@stroke-width")));
    }

    @Test public void testOval() throws Exception {
        page.clear();
View Full Code Here


    public void testRectangle() throws Exception {
        page.clear();
        page.add(new SRect(0, 0, 20, 20).setFillPaint(FlatColor.RED));
        Doc xdoc = saveAndReadback(doc);
        assertTrue("0.0".equals(xdoc.xpathString("/svg/rect/@x")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/rect/@stroke-width")));
    }

    @Test public void testOval() throws Exception {
        page.clear();
        page.add(new SOval(0, 0, 20, 20).setFillPaint(FlatColor.RED));
View Full Code Here

    @Test public void testOval() throws Exception {
        page.clear();
        page.add(new SOval(0, 0, 20, 20).setFillPaint(FlatColor.RED));
        Doc xdoc = saveAndReadback(doc);
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@cx")));
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@ry")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/ellipse/@stroke-width")));
    }

    @Test public void testPolygon() throws Exception {
View Full Code Here

    @Test public void testOval() throws Exception {
        page.clear();
        page.add(new SOval(0, 0, 20, 20).setFillPaint(FlatColor.RED));
        Doc xdoc = saveAndReadback(doc);
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@cx")));
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@ry")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/ellipse/@stroke-width")));
    }

    @Test public void testPolygon() throws Exception {
        //test a polygon
View Full Code Here

        page.clear();
        page.add(new SOval(0, 0, 20, 20).setFillPaint(FlatColor.RED));
        Doc xdoc = saveAndReadback(doc);
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@cx")));
        assertTrue("10.0".equals(xdoc.xpathString("/svg/ellipse/@ry")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/ellipse/@stroke-width")));
    }

    @Test public void testPolygon() throws Exception {
        //test a polygon
        SPoly poly = new SPoly();
View Full Code Here

        poly.addPoint(new Point(0,10));
        poly.setClosed(true);
        page.clear();
        page.add(poly);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("0.0,0.0 10.0,0.0 0.0,10.0 ".equals(xdoc.xpathString("/svg/polygon/@points")));       
    }

    @Test public void testNGon() throws Exception {
        NGon ngon = new NGon();
        ngon.setRadius(20);
View Full Code Here

        ngon.setTranslateX(100);
        ngon.setTranslateY(100);
        page.clear();
        page.add(ngon);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("120.0,100.0 106.0,119.0 84.0,112.0 84.0,88.0 106.0,81.0 ".equals(xdoc.xpathString("/svg/polygon/@points")));       
    }

    @Test public void testPath() throws Exception {
        SPath path = new SPath();
        path.setFillPaint(FlatColor.RED);
View Full Code Here

        path.addPoint(new SPath.PathPoint(0,205,20, 0,15));
        path.close();
        page.clear();
        page.add(path);
        Doc xdoc = saveAndReadback(doc);
        assertTrue(" M 0.0 0.0  C 5.0 0.0 10.0 5.0 10.0 10.0   C 10.0 15.0 5.0 20.0 0.0 20.0   z".equals(xdoc.xpathString("/svg/path/@d")));
    }
   
    @Test public void testText() throws Exception {
        SText text = new SText();
        text.setText("ABC");
View Full Code Here

        text.setFontSize(100);
        text.setFillPaint(FlatColor.GREEN);
        page.clear();
        page.add(text);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("ABC".equals(xdoc.xpathString("/svg/text/text()")));
    }


    @Test public void testImage() throws IOException {
View Full Code Here

        SRect rect2 = new SRect(0,0,150,150);
        rect2.setFillPaint(FlatColor.GREEN);
        page.add(rect2);
       
        Doc xdoc = saveAndReadback(doc);
        assertTrue("translate(50.0,50.0)".equals(xdoc.xpathString("/svg/g/@transform")));
        assertTrue("10.0".equals(xdoc.xpathString("/svg/g/rect/@width")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/g/ellipse/@stroke-width")));
        assertTrue("150.0".equals(xdoc.xpathString("/svg/rect/@width")));
    }
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.