Search in sources :

Example 6 with Rectangle

use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\psframe(10.5,20.5)(35.5,50.5)");
    final Rectangle rec = getShapeAt(0);
    assertEquals(10.5 * Shape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20.5 * -Shape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25d * Shape.PPC, rec.getWidth(), 0.001);
    assertEquals(30d * Shape.PPC, rec.getHeight(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with Rectangle

use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testParse2CoordinatesFloatSigns.

@Test
public void testParse2CoordinatesFloatSigns() {
    parser("\\psframe(-+-.5,+--.5)(+++35.5,--50.5)");
    final Rectangle rec = getShapeAt(0);
    assertEquals(0.5 * Shape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(0.5 * -Shape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, rec.getWidth(), 0.001);
    assertEquals(50d * Shape.PPC, rec.getHeight(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with Rectangle

use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testParse2CoordinatesIntOppositeX.

@Test
public void testParse2CoordinatesIntOppositeX() {
    parser("\\psframe(35,20)(10,50)");
    final Rectangle rec = getShapeAt(0);
    assertEquals(10d * Shape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20d * -Shape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25d * Shape.PPC, rec.getWidth(), 0.001);
    assertEquals(30d * Shape.PPC, rec.getHeight(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with Rectangle

use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testParse2CoordinatesIntOppositeY.

@Test
public void testParse2CoordinatesIntOppositeY() {
    parser("\\psframe(10,50)(35,20)");
    final Rectangle rec = getShapeAt(0);
    assertEquals(10d * Shape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20d * -Shape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25d * Shape.PPC, rec.getWidth(), 0.001);
    assertEquals(30d * Shape.PPC, rec.getHeight(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with Rectangle

use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testCoordinatesMm.

@Test
public void testCoordinatesMm() {
    parser("\\psframe(0,0)(350mm,200mm)");
    final Rectangle rec = getShapeAt(0);
    assertEquals(0d, rec.getPosition().getX(), 0.001);
    assertEquals(0d, rec.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, rec.getWidth(), 0.001);
    assertEquals(20d * Shape.PPC, rec.getHeight(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)39 Test (org.junit.jupiter.api.Test)29 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 Test (org.junit.Test)7 HelperTest (net.sf.latexdraw.HelperTest)5 Grid (net.sf.latexdraw.model.api.shape.Grid)5 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Dot (net.sf.latexdraw.model.api.shape.Dot)2 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)2 Text (net.sf.latexdraw.model.api.shape.Text)2 ValueSource (org.junit.jupiter.params.provider.ValueSource)2 Point2D (javafx.geometry.Point2D)1 LineArcProp (net.sf.latexdraw.model.api.property.LineArcProp)1 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1