use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testPssetunitxunit.
@Test
public void testPssetunitxunit() {
parser("\\psset{unit=2,xunit=3}\\psframe(1,1)(5,5)");
final Rectangle rec = getShapeAt(0);
assertEquals(2d * 3d * Shape.PPC, rec.getX(), 0.000001);
assertEquals(-2d * Shape.PPC, rec.getY(), 0.000001);
assertEquals(2d * 4d * 3d * Shape.PPC, rec.getWidth(), 0.000001);
assertEquals(2d * 4d * Shape.PPC, rec.getHeight(), 0.000001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testCoordinatesPt.
@Test
public void testCoordinatesPt() {
parser("\\psframe(0,0)(35pt,20pt)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC / PSTricksConstants.CM_VAL_PT, rec.getWidth(), 0.001);
assertEquals(20d * Shape.PPC / PSTricksConstants.CM_VAL_PT, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testPssetunityunit.
@Test
public void testPssetunityunit() {
parser("\\psset{unit=2,yunit=3}\\psframe(1,1)(5,5)");
final Rectangle rec = getShapeAt(0);
assertEquals(2d * Shape.PPC, rec.getX(), 0.000001);
assertEquals(-2d * 3d * Shape.PPC, rec.getY(), 0.000001);
assertEquals(2d * 4d * Shape.PPC, rec.getWidth(), 0.000001);
assertEquals(2d * 4d * 3d * Shape.PPC, rec.getHeight(), 0.000001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParamFramearcKO.
@ParameterizedTest
@ValueSource(doubles = { -1d, 2 })
public void testParamFramearcKO(final double arc) {
parser("\\psframe[framearc=" + arc + "](35,20)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getLineArc(), 0.00001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestPSTGeneralFeatures method testBugpssetsetOfShapes.
@Test
void testBugpssetsetOfShapes() {
parser("\\psframe(0.5,0.5)(1.5,1.5)\\psdot[linewidth=1cm,dotsize=1](1,1)\\psset{unit=2}\\psframe(0.5,0.5)(1.5,1.5)\\psdot(2," + "2)");
Rectangle rec = getShapeAt(0);
assertEquals(0.5 * Shape.PPC, rec.getX(), 0.000001);
assertEquals(-0.5 * Shape.PPC, rec.getY(), 0.000001);
assertEquals(Shape.PPC, rec.getWidth(), 0.000001);
assertEquals(Shape.PPC, rec.getHeight(), 0.000001);
Dot dot = getShapeAt(1);
assertEquals(Shape.PPC, dot.getX(), 0.000001);
assertEquals(-Shape.PPC, dot.getY(), 0.000001);
rec = getShapeAt(2);
assertEquals(0.5 * 2d * Shape.PPC, rec.getX(), 0.000001);
assertEquals(-0.5 * 2d * Shape.PPC, rec.getY(), 0.000001);
assertEquals(2d * Shape.PPC, rec.getWidth(), 0.000001);
assertEquals(2d * Shape.PPC, rec.getHeight(), 0.000001);
dot = getShapeAt(3);
assertEquals(2d * 2d * Shape.PPC, dot.getX(), 0.000001);
assertEquals(-2d * 2d * Shape.PPC, dot.getY(), 0.000001);
}
Aggregations