Search in sources :

Example 1 with MutationContext

use of org.kie.workbench.common.stunner.core.client.shape.MutationContext in project kie-wb-common by kiegroup.

the class SessionPreviewCanvasHandlerProxyTest method checkApplyElementMutationDelegatesToWrapped.

@Test
public void checkApplyElementMutationDelegatesToWrapped() {
    final Shape shape = mock(Shape.class);
    final Element candidate = mock(Element.class);
    final boolean applyPosition = true;
    final boolean applyProperties = false;
    final MutationContext mutationContext = mock(MutationContext.class);
    proxy.applyElementMutation(shape, candidate, applyPosition, applyProperties, mutationContext);
    verify(wrapped).applyElementMutation(eq(shape), eq(candidate), eq(applyPosition), eq(applyProperties), eq(mutationContext));
    proxy.applyElementMutation(candidate, mutationContext);
    verify(wrapped).applyElementMutation(eq(candidate), eq(mutationContext));
    proxy.applyElementMutation(candidate, applyPosition, applyProperties, mutationContext);
    verify(wrapped).applyElementMutation(eq(candidate), eq(applyPosition), eq(applyProperties), eq(mutationContext));
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) Element(org.kie.workbench.common.stunner.core.graph.Element) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 2 with MutationContext

use of org.kie.workbench.common.stunner.core.client.shape.MutationContext in project kie-wb-common by kiegroup.

the class CaseManagementCanvasHandlerTest method checkApplyElementMutationRenderableShapes.

@Test
@SuppressWarnings("unchecked")
public void checkApplyElementMutationRenderableShapes() {
    final ActivityShape shape = spy(makeShape());
    final Node<View<BPMNViewDefinition>, Edge> node = makeNode("uuid", shape);
    final MutationContext mutationContext = mock(MutationContext.class);
    doNothing().when(shape).applyPosition(eq(node), eq(mutationContext));
    doNothing().when(shape).applyProperties(eq(node), eq(mutationContext));
    doNothing().when(shape).applyTitle(anyString(), any(Node.class), eq(mutationContext));
    handler.applyElementMutation(shape, node, true, true, mutationContext);
    verify(shape, times(1)).applyPosition(eq(node), eq(mutationContext));
    verify(shape, times(1)).applyProperties(eq(node), eq(mutationContext));
    verify(canvas, times(1)).draw();
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 3 with MutationContext

use of org.kie.workbench.common.stunner.core.client.shape.MutationContext in project kie-wb-common by kiegroup.

the class CaseManagementCanvasHandlerTest method checkApplyShapeElementMutationRenderableShapes.

@Test
@SuppressWarnings("unchecked")
public void checkApplyShapeElementMutationRenderableShapes() {
    final ActivityShape shape = spy(makeShape());
    final Node<View<BPMNViewDefinition>, Edge> node = makeNode("uuid", shape);
    final MutationContext mutationContext = mock(MutationContext.class);
    doNothing().when(shape).applyPosition(eq(node), eq(mutationContext));
    doNothing().when(shape).applyProperties(eq(node), eq(mutationContext));
    doNothing().when(shape).applyTitle(anyString(), any(Node.class), eq(mutationContext));
    handler.register(shape, node, true);
    verify(canvas, times(1)).draw();
    handler.applyElementMutation(node, true, true, mutationContext);
    verify(shape, times(1)).applyPosition(eq(node), eq(mutationContext));
    verify(shape, times(1)).applyProperties(eq(node), eq(mutationContext));
    verify(canvas, times(2)).draw();
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 4 with MutationContext

use of org.kie.workbench.common.stunner.core.client.shape.MutationContext in project kie-wb-common by kiegroup.

the class BaseCanvasHandlerTest method testApplyMutation.

@Test
@SuppressWarnings("unchecked")
public void testApplyMutation() {
    final MutationContext mutationContext = MutationContext.STATIC;
    tested.applyElementMutation(shape, candidate, true, true, mutationContext);
    verify(shape, times(1)).applyPosition(eq(candidate), eq(mutationContext));
    verify(shape, times(1)).applyProperties(eq(candidate), eq(mutationContext));
    verify(canvas, times(1)).draw();
}
Also used : MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 5 with MutationContext

use of org.kie.workbench.common.stunner.core.client.shape.MutationContext in project kie-wb-common by kiegroup.

the class SessionPreviewCanvasHandlerProxyTest method updateElementPropertiesDelegatesToWrapped.

@Test
public void updateElementPropertiesDelegatesToWrapped() {
    final Element candidate = mock(Element.class);
    final MutationContext mutationContext = mock(MutationContext.class);
    proxy.updateElementProperties(candidate, mutationContext);
    verify(wrapped).updateElementProperties(eq(candidate), eq(mutationContext));
}
Also used : Element(org.kie.workbench.common.stunner.core.graph.Element) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 MutationContext (org.kie.workbench.common.stunner.core.client.shape.MutationContext)6 Element (org.kie.workbench.common.stunner.core.graph.Element)3 ActivityShape (org.kie.workbench.common.stunner.cm.client.shape.ActivityShape)2 ActivityView (org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)2 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)1