Search in sources :

Example 1 with TextAreaAutoSize

use of net.sf.latexdraw.ui.TextAreaAutoSize in project latexdraw by arnobl.

the class TestCanvasCreation method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    setter = (TextSetter) injectorFactory.call(TextSetter.class);
    when(hand.isActivated()).thenReturn(false);
    when(setter.isActivated()).thenReturn(false);
    textAutoSize = new TextAreaAutoSize();
    when(setter.getTextField()).thenReturn(textAutoSize);
    pencil.setActivated(true);
    drawing = canvas.getDrawing();
    canvas.getMagneticGrid().setMagnetic(false);
    WaitForAsyncUtils.waitForFxEvents(100);
    canvas.toFront();
}
Also used : TextAreaAutoSize(net.sf.latexdraw.ui.TextAreaAutoSize) Before(org.junit.Before)

Example 2 with TextAreaAutoSize

use of net.sf.latexdraw.ui.TextAreaAutoSize in project latexdraw by arnobl.

the class TestEditingSelector method testClickTextCreatesText.

@Test
public void testClickTextCreatesText() {
    final TextAreaAutoSize textfield = Mockito.mock(TextAreaAutoSize.class);
    Mockito.when(textSetter.getTextField()).thenReturn(textfield);
    Mockito.when(textSetter.isActivated()).thenReturn(true);
    Mockito.when(textfield.getText()).thenReturn("foo");
    clickOn(selector.handB);
    waitFXEvents.execute();
    assertEquals(1, drawing.size());
    assertTrue(drawing.getShapeAt(0) instanceof IText);
    assertEquals("foo", ((IText) drawing.getShapeAt(0)).getText());
}
Also used : TextAreaAutoSize(net.sf.latexdraw.ui.TextAreaAutoSize) IText(net.sf.latexdraw.models.interfaces.shape.IText) Test(org.junit.Test)

Example 3 with TextAreaAutoSize

use of net.sf.latexdraw.ui.TextAreaAutoSize in project latexdraw by arnobl.

the class TestEditingSelector method testClickTextNoTextCauseNotActivated.

@Test
public void testClickTextNoTextCauseNotActivated() {
    final TextAreaAutoSize textfield = Mockito.mock(TextAreaAutoSize.class);
    Mockito.when(textSetter.getTextField()).thenReturn(textfield);
    Mockito.when(textSetter.isActivated()).thenReturn(false);
    clickOn(selector.handB);
    waitFXEvents.execute();
    assertTrue(drawing.isEmpty());
}
Also used : TextAreaAutoSize(net.sf.latexdraw.ui.TextAreaAutoSize) Test(org.junit.Test)

Example 4 with TextAreaAutoSize

use of net.sf.latexdraw.ui.TextAreaAutoSize in project latexdraw by arnobl.

the class TestEditingSelector method testClickTextNoTextCauseNoText.

@Test
public void testClickTextNoTextCauseNoText() {
    final TextAreaAutoSize textfield = Mockito.mock(TextAreaAutoSize.class);
    Mockito.when(textSetter.getTextField()).thenReturn(textfield);
    Mockito.when(textSetter.isActivated()).thenReturn(true);
    Mockito.when(textfield.getText()).thenReturn("");
    clickOn(selector.handB);
    waitFXEvents.execute();
    assertTrue(drawing.isEmpty());
}
Also used : TextAreaAutoSize(net.sf.latexdraw.ui.TextAreaAutoSize) Test(org.junit.Test)

Aggregations

TextAreaAutoSize (net.sf.latexdraw.ui.TextAreaAutoSize)4 Test (org.junit.Test)3 IText (net.sf.latexdraw.models.interfaces.shape.IText)1 Before (org.junit.Before)1