use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestBorder method testScaleSRectangle.
@Test
public void testScaleSRectangle() {
Cmds.of(addRec, selectAllShapes).execute();
final double width = addedRec.getWidth();
final double height = addedRec.getHeight();
final Point bl = addedRec.getBottomLeftPoint();
final CmdFXVoid trCmd = () -> bl.translate(0d, 50d);
Cmds.of(trCmd, () -> drag(border.scaleHandlers.get(6)).dropBy(30d, 50d)).execute();
assertEquals(width, addedRec.getWidth(), 0.001);
assertEquals(height + 50d, addedRec.getHeight(), 3d);
assertEquals(bl.getX(), addedRec.getBottomLeftPoint().getX(), 3d);
assertEquals(bl.getY(), addedRec.getBottomLeftPoint().getY(), 3d);
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestBorder method testScaleNERectangle.
@Test
public void testScaleNERectangle() {
Cmds.of(addRec, selectAllShapes).execute();
final double width = addedRec.getWidth();
final double height = addedRec.getHeight();
final Point tr = addedRec.getTopRightPoint();
final CmdFXVoid trCmd = () -> tr.translate(50d, -40d);
Cmds.of(trCmd, () -> drag(border.scaleHandlers.get(2)).dropBy(50d, -40d)).execute();
assertEquals(width + 50d, addedRec.getWidth(), 3d);
assertEquals(height + 40d, addedRec.getHeight(), 3d);
assertEquals(tr.getX(), addedRec.getTopRightPoint().getX(), 3d);
assertEquals(tr.getY(), addedRec.getTopRightPoint().getY(), 3d);
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestBorder method testMovePtHandlerMovePt.
@Test
public void testMovePtHandlerMovePt() {
Cmds.of(addLines, selectAllShapes).execute();
final Point point = ShapeFactory.INST.createPoint(addedPolyline.getPtAt(1));
point.translate(100d, 20d);
Cmds.of(() -> drag(border.mvPtHandlers.get(1)).dropBy(100d, 20d)).execute();
assertEquals(point.getX(), addedPolyline.getPtAt(1).getX(), 1d);
assertEquals(point.getY(), addedPolyline.getPtAt(1).getY(), 1d);
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestBorder method testScaleWRectangle.
@Test
public void testScaleWRectangle() {
Cmds.of(addRec, selectAllShapes).execute();
final double width = addedRec.getWidth();
final double height = addedRec.getHeight();
final Point tl = addedRec.getTopLeftPoint();
final CmdFXVoid tr = () -> tl.translate(50d, 0d);
Cmds.of(tr, () -> drag(border.scaleHandlers.get(3)).dropBy(50d, 10d)).execute();
assertEquals(height, addedRec.getHeight(), 0.001);
assertEquals(width - 50d, addedRec.getWidth(), 3d);
assertEquals(tl.getX(), addedRec.getTopLeftPoint().getX(), 2d);
assertEquals(tl.getY(), addedRec.getTopLeftPoint().getY(), 2d);
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestBorder method testScaleSERectangle.
@Test
public void testScaleSERectangle() {
Cmds.of(addRec, selectAllShapes).execute();
final double width = addedRec.getWidth();
final double height = addedRec.getHeight();
final Point br = addedRec.getBottomRightPoint();
final CmdFXVoid trCmd = () -> br.translate(-55d, 45d);
Cmds.of(trCmd, () -> drag(border.scaleHandlers.get(7)).dropBy(-55d, 45d)).execute();
assertEquals(width - 55d, addedRec.getWidth(), 3d);
assertEquals(height + 45d, addedRec.getHeight(), 3d);
assertEquals(br.getX(), addedRec.getBottomRightPoint().getX(), 3d);
assertEquals(br.getY(), addedRec.getBottomRightPoint().getY(), 3d);
}
Aggregations