use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.
the class TestText method testConstructorsOK4.
@Test
public void testConstructorsOK4() {
final Text txt = ShapeFactory.INST.createText(ShapeFactory.INST.createPoint(0, Double.NEGATIVE_INFINITY), "aa");
assertEquals(ShapeFactory.INST.createPoint(), txt.getPosition());
}
use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.
the class TestText method testCopy.
@Test
public void testCopy() {
final Text s2 = ShapeFactory.INST.createText();
shape.setText("foo");
shape.setTextPosition(TextPosition.BOT_RIGHT);
s2.copy(shape);
assertEquals(shape.getText(), s2.getText());
assertEquals(shape.getTextPosition(), s2.getTextPosition());
}
use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.
the class TestText method testConstructorsOK2.
@Test
public void testConstructorsOK2() {
final Text txt = ShapeFactory.INST.createText(ShapeFactory.INST.createPoint(), "coucou");
assertNotNull(txt.getText());
assertFalse(txt.getText().isEmpty());
}
use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.
the class PolymorphTextTest method testTextPosition.
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#createDiversifiedText")
default void testTextPosition(final Text sh) {
final Text s2 = produceOutputShapeFrom(sh);
CompareShapeMatcher.INST.assertEqualsText(sh, s2);
}
use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.
the class TestCanvasCreation method testDrawText.
@Test
public void testDrawText() {
final Point2D pos = point(canvas).query();
when(setter.isActivated()).thenReturn(true);
when(setter.getPosition()).thenReturn(ShapeFactory.INST.createPoint(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), -Canvas.getMargins() + canvas.screenToLocal(pos).getY()));
Cmds.of(CmdFXVoid.of(() -> {
editing.setCurrentChoice(EditionChoice.TEXT);
textAutoSize.setText("gridGapProp");
}), () -> moveTo(pos).clickOn(MouseButton.PRIMARY)).execute();
assertEquals(1, drawing.size());
assertTrue(drawing.getShapeAt(0).orElseThrow() instanceof Text);
final Text sh = (Text) drawing.getShapeAt(0).orElseThrow();
assertEquals("gridGapProp", sh.getText());
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), sh.getPosition().getX(), 1d);
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getY(), sh.getPosition().getY(), 1d);
}
Aggregations