Search in sources :

Example 1 with OptionalBounds

use of com.ait.lienzo.client.core.shape.wires.OptionalBounds in project kie-wb-common by kiegroup.

the class WiresShapeViewTest method testSetDragBounds.

@Test
public void testSetDragBounds() {
    tested.setDragBounds(Bounds.create(1.5d, 6.4d, 564.78d, 543.84d));
    ArgumentCaptor<OptionalBounds> bbCaptor = ArgumentCaptor.forClass(OptionalBounds.class);
    verify(control, times(1)).setLocationBounds(bbCaptor.capture());
    final OptionalBounds bb = bbCaptor.getValue();
    assertEquals(1.5d, bb.getMinX(), 0d);
    assertEquals(6.4d, bb.getMinY(), 0d);
    assertEquals(564.78d, bb.getMaxX(), 0d);
    assertEquals(543.84d, bb.getMaxY(), 0d);
}
Also used : OptionalBounds(com.ait.lienzo.client.core.shape.wires.OptionalBounds) Test(org.junit.Test)

Example 2 with OptionalBounds

use of com.ait.lienzo.client.core.shape.wires.OptionalBounds in project kie-wb-common by kiegroup.

the class LienzoShapeUtilsTest method testTranslateBounds.

@Test
public void testTranslateBounds() {
    Bounds bounds = Bounds.create(1.1d, 2.2d, 3.3d, 4.4d);
    OptionalBounds lienzoBounds = LienzoShapeUtils.translateBounds(bounds);
    assertTrue(lienzoBounds.hasMinX());
    assertEquals(1.1d, lienzoBounds.getMinX(), 0d);
    assertTrue(lienzoBounds.hasMinY());
    assertEquals(2.2d, lienzoBounds.getMinY(), 0d);
    assertTrue(lienzoBounds.hasMaxX());
    assertEquals(3.3d, lienzoBounds.getMaxX(), 0d);
    assertTrue(lienzoBounds.hasMaxY());
    assertEquals(4.4d, lienzoBounds.getMaxY(), 0d);
    Bounds minBounds = Bounds.createMinBounds(0d, 0d);
    OptionalBounds lienzoMinBounds = LienzoShapeUtils.translateBounds(minBounds);
    assertTrue(lienzoMinBounds.hasMinX());
    assertEquals(0d, lienzoMinBounds.getMinX(), 0d);
    assertTrue(lienzoMinBounds.hasMinY());
    assertEquals(0d, lienzoMinBounds.getMinY(), 0d);
    assertFalse(lienzoMinBounds.hasMaxX());
    assertNull(lienzoMinBounds.getMaxX());
    assertFalse(lienzoMinBounds.hasMaxY());
    assertNull(lienzoMinBounds.getMaxY());
}
Also used : OptionalBounds(com.ait.lienzo.client.core.shape.wires.OptionalBounds) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) OptionalBounds(com.ait.lienzo.client.core.shape.wires.OptionalBounds) Test(org.junit.Test)

Aggregations

OptionalBounds (com.ait.lienzo.client.core.shape.wires.OptionalBounds)2 Test (org.junit.Test)2 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)1