Package com.joshondesign.xml

Examples of com.joshondesign.xml.Doc


    @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")));
    }
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")));
    }
View Full Code Here

        poly.addPoint(new Point(10,0));
        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")));       
    }
View Full Code Here

        ngon.setSides(5);
        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")));       
    }
View Full Code Here

        path.addPoint(new SPath.PathPoint(10,10, 10,5, 10,15));
        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")));
    }
View Full Code Here

        text.setText("ABC");
        text.setFontSize(100);
        text.setFillPaint(FlatColor.GREEN);
        page.clear();
        page.add(text);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("ABC".equals(xdoc.xpathString("/svg/text/text()")));
    }
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

    private List<File> loadRecentDocs(File file) {
        List<File> files = new ArrayList<File>();
        if(file.exists()) {
            try {
                Doc doc = XMLParser.parse(file);
                for(Elem e : doc.xpath("//file")) {
                    File f = new File(e.attr("filepath"));
                    //files.add(new File(e.attr("filepath")));
                    if(f.exists()) {
                        files.add(f);
                    }
View Full Code Here

        sarea.setTranslateX(10);
        sarea.setTranslateY(10);
        sarea.setFillPaint(FlatColor.GREEN);
        page.clear();
        page.add(sarea);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("translate(10.0,10.0)".equals(xdoc.xpathString("/svg/path/@transform")));
    }
View Full Code Here

        SRect rect = new SRect(0,0,100,100);
        rect.setFillPaint(grad);
        rect.setStrokeWidth(0);
        page.clear();
        page.add(rect);
        Doc xdoc = saveAndReadback(doc);
        Elem e = xdoc.xpath("/svg/linearGradient/stop").iterator().next();
        assertTrue("0.0".equals(e.attr("offset")));
    }
View Full Code Here

TOP

Related Classes of com.joshondesign.xml.Doc

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.