kopia lustrzana https://github.com/jameshball/osci-render
Pass lineToGeneratesALineShape
rodzic
797f1fe425
commit
4ff80b2ad0
|
@ -114,4 +114,12 @@ public final class Line extends Shape {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Line{" +
|
||||
"a=" + a +
|
||||
", b=" + b +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,4 +114,12 @@ public final class Vector2 extends Shape {
|
|||
|
||||
return (double) Math.round(value) / factor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vector2{" +
|
||||
"x=" + x +
|
||||
", y=" + y +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,13 @@ import shapes.Vector2;
|
|||
public class SvgParserTest {
|
||||
|
||||
@Test
|
||||
public void lineToGeneratesALineShape() {
|
||||
|
||||
public void lineToGeneratesALineShape()
|
||||
throws ParserConfigurationException, SAXException, IOException {
|
||||
SvgParser svgParser = new SvgParser("test/images/line-to.svg");
|
||||
List<Shape> shapes = svgParser.getShapes();
|
||||
assertEquals(shapes.get(0), new Line(new Vector2(0.5, 0.5), new Vector2(0.75, 1)));
|
||||
assertEquals(shapes.get(1), new Line(new Vector2(0.75, 1), new Vector2(0, 0)));
|
||||
assertEquals(shapes.get(2), new Line(new Vector2(0, 0), new Vector2(0.5, 0.5)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 1 1"><path d="
|
||||
M0.5,0.5
|
||||
l0.25,0.5
|
||||
L0,0
|
||||
L0.5,0.5" /></svg>
|
Po Szerokość: | Wysokość: | Rozmiar: 330 B |
Ładowanie…
Reference in New Issue