src_fm_fc_ms_ff
stringlengths 43
86.8k
| target
stringlengths 20
276k
|
|---|---|
ConnectionAcceptorControlImpl extends AbstractAcceptorControl implements ConnectionAcceptorControl<AbstractCanvasHandler> { @Override @SuppressWarnings("unchecked") public boolean allowTarget(final Node target, final Edge<ViewConnector<?>, Node> connector, final Connection connection) { if (isTargetConnectionChanged(connector, connection)) { final CommandResult<CanvasViolation> violations = getCommandManager().allow(getCanvasHandler(), canvasCommandFactory.setTargetNode(target, connector, connection)); final boolean accepts = isAccept(violations); if (isTargetChanged(target, connector)) { highlight(target, connector, accepts); } return accepts; } return true; } @Inject ConnectionAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override @SuppressWarnings("unchecked") boolean allowSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean allowTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); static Connection createConnection(final WiresConnection wiresConnection,
final WiresMagnet wiresMagnet); @SuppressWarnings("unchecked") static MagnetConnection createConnection(final Element element); }
|
@Test public void testAllowTarget() { tested.init(canvasHandler); final boolean allow = tested.allowTarget(node, edge, connection); assertTrue(allow); verify(commandManager, times(1)).allow(eq(canvasHandler), eq(setConnectionTargetNodeCommand)); verify(commandManager, never()).execute(any(AbstractCanvasHandler.class), any(SetConnectionTargetNodeCommand.class)); assertEquals(node, setConnectionTargetNodeCommand.getNode()); assertEquals(edge, setConnectionTargetNodeCommand.getEdge()); assertEquals(connection, setConnectionTargetNodeCommand.getConnection()); verify(highlight, times(1)).unhighLight(); }
|
ConnectionAcceptorControlImpl extends AbstractAcceptorControl implements ConnectionAcceptorControl<AbstractCanvasHandler> { @Override @SuppressWarnings("unchecked") public boolean acceptSource(final Node source, final Edge<ViewConnector<?>, Node> connector, final Connection connection) { ensureUnHighLight(); if (isSourceChanged(source, connector)) { final CommandResult<CanvasViolation> violations = getCommandManager().execute(getCanvasHandler(), canvasCommandFactory.setSourceNode(source, connector, connection)); return isAccept(violations); } return true; } @Inject ConnectionAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override @SuppressWarnings("unchecked") boolean allowSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean allowTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); static Connection createConnection(final WiresConnection wiresConnection,
final WiresMagnet wiresMagnet); @SuppressWarnings("unchecked") static MagnetConnection createConnection(final Element element); }
|
@Test public void testAcceptSource() { tested.init(canvasHandler); final boolean allow = tested.acceptSource(node, edge, connection); assertTrue(allow); verify(commandManager, times(1)).execute(eq(canvasHandler), eq(setConnectionSourceNodeCommand)); verify(commandManager, never()).allow(any(AbstractCanvasHandler.class), any(SetConnectionSourceNodeCommand.class)); assertEquals(node, setConnectionSourceNodeCommand.getNode()); assertEquals(edge, setConnectionSourceNodeCommand.getEdge()); assertEquals(connection, setConnectionSourceNodeCommand.getConnection()); verify(highlight, times(1)).unhighLight(); }
|
ConnectionAcceptorControlImpl extends AbstractAcceptorControl implements ConnectionAcceptorControl<AbstractCanvasHandler> { @Override @SuppressWarnings("unchecked") public boolean acceptTarget(final Node target, final Edge<ViewConnector<?>, Node> connector, final Connection connection) { ensureUnHighLight(); if (isTargetChanged(target, connector)) { final CommandResult<CanvasViolation> violations = getCommandManager().execute(getCanvasHandler(), canvasCommandFactory.setTargetNode(target, connector, connection)); return isAccept(violations); } return true; } @Inject ConnectionAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override @SuppressWarnings("unchecked") boolean allowSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean allowTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); static Connection createConnection(final WiresConnection wiresConnection,
final WiresMagnet wiresMagnet); @SuppressWarnings("unchecked") static MagnetConnection createConnection(final Element element); }
|
@Test public void testAcceptTarget() { tested.init(canvasHandler); final boolean allow = tested.acceptTarget(node, edge, connection); assertTrue(allow); verify(commandManager, times(1)).execute(eq(canvasHandler), eq(setConnectionTargetNodeCommand)); verify(commandManager, never()).allow(any(AbstractCanvasHandler.class), any(SetConnectionSourceNodeCommand.class)); assertEquals(node, setConnectionTargetNodeCommand.getNode()); assertEquals(edge, setConnectionTargetNodeCommand.getEdge()); assertEquals(connection, setConnectionTargetNodeCommand.getConnection()); verify(highlight, times(1)).unhighLight(); }
@Test public void testAcceptTargetNotNewConnection() { when(edge.getTargetNode()).thenReturn(node); tested.init(canvasHandler); final boolean allow = tested.acceptTarget(node, edge, connection); assertTrue(allow); verify(commandManager, never()).allow(any(AbstractCanvasHandler.class), any(SetConnectionTargetNodeCommand.class)); verify(highlight, times(1)).unhighLight(); }
|
ConnectionAcceptorControlImpl extends AbstractAcceptorControl implements ConnectionAcceptorControl<AbstractCanvasHandler> { public static Connection createConnection(final WiresConnection wiresConnection, final WiresMagnet wiresMagnet) { if (null == wiresMagnet && null == wiresConnection) { return null; } if (null == wiresMagnet) { return Point2DConnection.at(Point2D.create(wiresConnection.getPoint().getX(), wiresConnection.getPoint().getY())); } return new MagnetConnection.Builder() .atX(wiresMagnet.getX()) .atY(wiresMagnet.getY()) .auto(null != wiresConnection && wiresConnection.isAutoConnection()) .magnet(wiresMagnet.getIndex()) .build(); } @Inject ConnectionAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override @SuppressWarnings("unchecked") boolean allowSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean allowTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptSource(final Node source,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); @Override @SuppressWarnings("unchecked") boolean acceptTarget(final Node target,
final Edge<ViewConnector<?>, Node> connector,
final Connection connection); static Connection createConnection(final WiresConnection wiresConnection,
final WiresMagnet wiresMagnet); @SuppressWarnings("unchecked") static MagnetConnection createConnection(final Element element); }
|
@Test public void testCreateConnections() { Element element = mock(Element.class); View<?> content = mock(View.class); Bounds bounds = Bounds.create(0d, 0d, 10d, 20d); when(element.getContent()).thenReturn(content); when(content.getBounds()).thenReturn(bounds); MagnetConnection c1 = ConnectionAcceptorControlImpl.createConnection(element); assertEquals(5, c1.getLocation().getX(), 0); assertEquals(10, c1.getLocation().getY(), 0); assertEquals(MagnetConnection.MAGNET_CENTER, c1.getMagnetIndex().getAsInt()); assertFalse(c1.isAuto()); WiresConnection wiresConnection = mock(WiresConnection.class); when(wiresConnection.isAutoConnection()).thenReturn(true); WiresMagnet wiresMagnet = mock(WiresMagnet.class); when(wiresMagnet.getX()).thenReturn(122d); when(wiresMagnet.getY()).thenReturn(543d); when(wiresMagnet.getIndex()).thenReturn(7); MagnetConnection c2 = (MagnetConnection) ConnectionAcceptorControlImpl.createConnection(wiresConnection, wiresMagnet); assertEquals(122, c2.getLocation().getX(), 0); assertEquals(543, c2.getLocation().getY(), 0); assertEquals(7, c2.getMagnetIndex().getAsInt()); assertTrue(c2.isAuto()); when(wiresConnection.getPoint()).thenReturn(new Point2D(122d, 543d)); final Connection pointConnection = ConnectionAcceptorControlImpl.createConnection(wiresConnection, null); assertEquals(122d, pointConnection.getLocation().getX(), 0); assertEquals(543d, pointConnection.getLocation().getY(), 0); assertNull(ConnectionAcceptorControlImpl.createConnection(null)); assertNull(ConnectionAcceptorControlImpl.createConnection(null, null)); }
|
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); } @Inject ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<CanvasSelectionEvent> selectionEvent); @Override void register(final Element element); @Override void addControlPoint(final Edge candidate,
final ControlPoint controlPoint,
final int index); @Override void updateControlPoints(final Edge candidate,
final ControlPoint[] controlPoints); @Override void deleteControlPoint(final Edge candidate,
final int index); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test @SuppressWarnings("unchecked") public void testAddControlPoint() { final int index = 1; final ControlPoint controlPoint = ControlPoint.build(2, 2); CanvasCommand<AbstractCanvasHandler> addControlPointCommand = mock(CanvasCommand.class); doReturn(addControlPointCommand).when(canvasCommandFactory).addControlPoint(eq(edge), eq(controlPoint), eq(index)); tested.init(canvasHandler); tested.addControlPoint(edge, controlPoint, index); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture()); Command<AbstractCanvasHandler, CanvasViolation> command = commandArgumentCaptor.getValue(); assertEquals(addControlPointCommand, command); }
@Test public void testStunnerControlPointsAcceptorAdd() { final HandlerRegistration mouseUpHandlerRegistration = mock(HandlerRegistration.class); final NodeMouseUpHandler[] mouseUpHandlerCaptured = new NodeMouseUpHandler[1]; doAnswer(invocationOnMock -> { mouseUpHandlerCaptured[0] = (NodeMouseUpHandler) invocationOnMock.getArguments()[0]; mouseUpHandlerCaptured[0].onNodeMouseUp(mock(NodeMouseUpEvent.class)); return mouseUpHandlerRegistration; }).when(layer).addNodeMouseUpHandler(any(NodeMouseUpHandler.class)); ControlPointControl control = mock(ControlPointControl.class); ControlPointControlImpl.StunnerControlPointsAcceptor acceptor = createStunnerControlPointsAcceptor(control); boolean addResult = acceptor.add(connector, 1, new com.ait.lienzo.client.core.types.Point2D(2, 2)); assertTrue(addResult); verify(connector, times(1)).addControlPoint(eq(2d), eq(2d), eq(1)); verify(control, times(1)).addControlPoint(eq(edge), eq(ControlPoint.build(2, 2)), eq(0)); }
|
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void deleteControlPoint(final Edge candidate, final int index) { execute(canvasCommandFactory.deleteControlPoint(candidate, index)); } @Inject ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<CanvasSelectionEvent> selectionEvent); @Override void register(final Element element); @Override void addControlPoint(final Edge candidate,
final ControlPoint controlPoint,
final int index); @Override void updateControlPoints(final Edge candidate,
final ControlPoint[] controlPoints); @Override void deleteControlPoint(final Edge candidate,
final int index); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test @SuppressWarnings("unchecked") public void testDeleteControlPoint() { CanvasCommand<AbstractCanvasHandler> deleteControlPointCommand = mock(CanvasCommand.class); doReturn(deleteControlPointCommand).when(canvasCommandFactory).deleteControlPoint(eq(edge), eq(0)); tested.init(canvasHandler); tested.deleteControlPoint(edge, 0); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture()); Command<AbstractCanvasHandler, CanvasViolation> command = commandArgumentCaptor.getValue(); assertEquals(deleteControlPointCommand, command); }
@Test public void testStunnerControlPointsAcceptorDelete() { ControlPointControl control = mock(ControlPointControl.class); ControlPointControlImpl.StunnerControlPointsAcceptor acceptor = createStunnerControlPointsAcceptor(control); final boolean deleteResult = acceptor.delete(connector, 1); assertTrue(deleteResult); verify(control, times(1)).deleteControlPoint(eq(edge), eq(0)); }
|
PreviewDiagramScreen { @WorkbenchPartView @SuppressWarnings("unused") public IsWidget getWidget() { return view; } protected PreviewDiagramScreen(); @Inject PreviewDiagramScreen(final SessionManager clientSessionManager,
final @Any @DMNEditor ManagedInstance<SessionDiagramPreview<AbstractSession>> sessionPreviews,
final View view,
final DMNDiagramsSession session); @OnStartup @SuppressWarnings("unused") void onStartup(final PlaceRequest placeRequest); @OnOpen @SuppressWarnings("unused") void onOpen(); @OnClose @SuppressWarnings("unused") void onClose(); @WorkbenchPartTitle @SuppressWarnings("unused") String getTitle(); @WorkbenchPartView @SuppressWarnings("unused") IsWidget getWidget(); @WorkbenchContextId @SuppressWarnings("unused") String getMyContextRef(); static final String SCREEN_ID; }
|
@Test public void testView() { assertEquals(view, tested.getWidget()); }
|
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void updateControlPoints(final Edge candidate, final ControlPoint[] controlPoints) { execute(canvasCommandFactory.updateControlPointPosition(candidate, controlPoints)); } @Inject ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<CanvasSelectionEvent> selectionEvent); @Override void register(final Element element); @Override void addControlPoint(final Edge candidate,
final ControlPoint controlPoint,
final int index); @Override void updateControlPoints(final Edge candidate,
final ControlPoint[] controlPoints); @Override void deleteControlPoint(final Edge candidate,
final int index); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test public void testStunnerControlPointsAcceptorMove() { ControlPointControl control = mock(ControlPointControl.class); ControlPointControlImpl.StunnerControlPointsAcceptor acceptor = createStunnerControlPointsAcceptor(control); Point2DArray locationArray = new Point2DArray(new com.ait.lienzo.client.core.types.Point2D(0, 0), new com.ait.lienzo.client.core.types.Point2D(5, 5), new com.ait.lienzo.client.core.types.Point2D(10, 10)); final boolean moveResult = acceptor.move(connector, locationArray); assertTrue(moveResult); ArgumentCaptor<ControlPoint[]> controlPointsExpected = ArgumentCaptor.forClass(ControlPoint[].class); verify(control, times(1)).updateControlPoints(eq(edge), controlPointsExpected.capture()); ControlPoint[] cps = controlPointsExpected.getValue(); assertNotNull(cps); assertEquals(1, cps.length); assertEquals(ControlPoint.build(5, 5), cps[0]); }
|
LocationControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements LocationControl<AbstractCanvasHandler, Element>,
CanvasControl.SessionAware<EditorSession> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (null != element.asNode() && checkNotRegistered(element)) { final AbstractCanvas<?> canvas = canvasHandler.getAbstractCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); final ShapeView shapeView = shape.getShapeView(); shapeView.setDragEnabled(true); ensureDragConstraints(canvas, shapeView); if (shape.getShapeView() instanceof HasEventHandlers) { final HasEventHandlers hasEventHandlers = (HasEventHandlers) shapeView; if (supportsMouseEnter(hasEventHandlers) && supportsMouseExit(hasEventHandlers)) { final MouseEnterHandler overHandler = new MouseEnterHandler() { @Override public void handle(MouseEnterEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.MOVE); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_ENTER, overHandler); registerHandler(shape.getUUID(), overHandler); final MouseExitHandler outHandler = new MouseExitHandler() { @Override public void handle(MouseExitEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.DEFAULT); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_EXIT, outHandler); registerHandler(shape.getUUID(), outHandler); final DragHandler dragHandler = new DragHandler() { @Override public void start(DragEvent event) { } @Override public void end(DragEvent event) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, shape.getUUID())); } @Override public void handle(DragEvent event) { } }; hasEventHandlers.addHandler(ViewEventType.DRAG, dragHandler); registerHandler(shape.getUUID(), dragHandler); } } } } protected LocationControlImpl(); @Inject LocationControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<ShapeLocationsChangedEvent> shapeLocationsChangedEvent,
final Event<CanvasSelectionEvent> selectionEvent); Collection<String> getSelectedIDs(); @Override void bind(final EditorSession session); void handleArrowKeys(final Key... keys); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> move(final Element[] elements,
final Point2D[] locations); }
|
@Test public void testRegisterAndSetBounds() { tested.init(canvasHandler); assertFalse(tested.isRegistered(element)); tested.register(element); assertTrue(tested.isRegistered(element)); verify(shapeView, times(1)).setDragEnabled(eq(true)); verify(shapeEventHandler, times(1)).supports(eq(ViewEventType.MOUSE_ENTER)); verify(shapeEventHandler, times(1)).addHandler(eq(ViewEventType.MOUSE_ENTER), any(MouseEnterHandler.class)); verify(shapeEventHandler, times(1)).supports(eq(ViewEventType.MOUSE_EXIT)); verify(shapeEventHandler, times(1)).addHandler(eq(ViewEventType.MOUSE_EXIT), any(MouseEnterHandler.class)); ArgumentCaptor<DragHandler> dragHandlerArgumentCaptor = forClass(DragHandler.class); verify(shapeEventHandler).addHandler(eq(ViewEventType.DRAG), dragHandlerArgumentCaptor.capture()); dragHandlerArgumentCaptor.getValue().start(mock(DragEvent.class)); dragHandlerArgumentCaptor.getValue().end(mock(DragEvent.class)); ArgumentCaptor<CanvasSelectionEvent> canvasSelectionEventArgumentCaptor = forClass(CanvasSelectionEvent.class); verify(canvasSelectionEvent).fire(canvasSelectionEventArgumentCaptor.capture()); assertTrue(canvasSelectionEventArgumentCaptor.getValue().getIdentifiers().contains(element.getUUID())); }
@Test @SuppressWarnings("unchecked") public void testLocationAcceptor() { tested.init(canvasHandler); tested.register(element); ArgumentCaptor<ILocationAcceptor> locationAcceptorArgumentCaptor = ArgumentCaptor.forClass(ILocationAcceptor.class); verify(wiresManager, times(1)).setLocationAcceptor(locationAcceptorArgumentCaptor.capture()); final ILocationAcceptor locationAcceptor = locationAcceptorArgumentCaptor.getValue(); final WiresShapeView wiresContainer = mock(WiresShapeView.class); when(wiresContainer.getUUID()).thenReturn(ELEMENT_UUID); final com.ait.lienzo.client.core.types.Point2D point = new com.ait.lienzo.client.core.types.Point2D(40d, 50d); locationAcceptor.accept(new WiresContainer[]{wiresContainer}, new com.ait.lienzo.client.core.types.Point2D[]{point}); ArgumentCaptor<CanvasCommand> commandArgumentCaptor = forClass(CanvasCommand.class); verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture()); final CompositeCommand command = (CompositeCommand) commandArgumentCaptor.getValue(); UpdateElementPositionCommand updateElementPositionCommand = (UpdateElementPositionCommand) command.getCommands().get(0); assertEquals(element, updateElementPositionCommand.getElement()); assertEquals(new Point2D(40d, 50d), updateElementPositionCommand.getLocation()); }
@Test @SuppressWarnings("unchecked") public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, atLeastOnce()).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }
|
LocationControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements LocationControl<AbstractCanvasHandler, Element>,
CanvasControl.SessionAware<EditorSession> { @Override @SuppressWarnings("unchecked") public CommandResult<CanvasViolation> move(final Element[] elements, final Point2D[] locations) { if (elements.length != locations.length) { throw new IllegalArgumentException("The length for the elements to move " + "does not match the locations provided."); } final CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation> builder = new CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation>() .forward(); for (int i = 0; i < elements.length; i++) { final Element element = elements[i]; builder.addCommand(createMoveCommand(element, locations[i])); } final Command<AbstractCanvasHandler, CanvasViolation> command = builder.build(); CommandResult<CanvasViolation> result = getCommandManager().allow(canvasHandler, command); if (!CommandUtils.isError(result)) { result = getCommandManager().execute(canvasHandler, command); if (!CommandUtils.isError(result)) { List<String> uuids = Arrays.stream(elements).map(Element::getUUID).collect(Collectors.toList()); shapeLocationsChangedEvent.fire(new ShapeLocationsChangedEvent(uuids, canvasHandler)); } } return result; } protected LocationControlImpl(); @Inject LocationControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<ShapeLocationsChangedEvent> shapeLocationsChangedEvent,
final Event<CanvasSelectionEvent> selectionEvent); Collection<String> getSelectedIDs(); @Override void bind(final EditorSession session); void handleArrowKeys(final Key... keys); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> move(final Element[] elements,
final Point2D[] locations); }
|
@Test @SuppressWarnings("unchecked") public void testMove() throws Exception { final WiresShapeView wiresShape = mock(WiresShapeView.class); final WiresShapeView childWiresShape = mock(WiresShapeView.class); final MagnetManager.Magnets magnets = mock(MagnetManager.Magnets.class); final WiresMagnet magnet = mock(WiresMagnet.class); final WiresConnection connection = mock(WiresConnection.class); final NFastArrayList<WiresConnection> connections = new NFastArrayList<>(connection); final WiresConnector connector = mock(WiresConnector.class); final String connectorUUID = UUID.uuid(); final NFastArrayList<WiresShape> children = new NFastArrayList<>(childWiresShape); final Group connectorGroup = mock(Group.class); final Edge connectorEdge = mock(Edge.class); final com.ait.lienzo.client.core.types.Point2D controlPointLienzo = new com.ait.lienzo.client.core.types.Point2D(100, 100); final Point2DArray controlPointsLienzo = new Point2DArray(controlPointLienzo); final ViewConnector viewConnector = mock(ViewConnector.class); Group parentGroup = mock(Group.class); BoundingBox parentBB = new BoundingBox(0, 0, 200, 200); MultiPath head = mock(MultiPath.class); MultiPath tail = mock(MultiPath.class); when(childWiresShape.getMagnets()).thenReturn(magnets); when(childWiresShape.getParent()).thenReturn(wiresShape); when(wiresShape.getGroup()).thenReturn(parentGroup); when(parentGroup.getBoundingBox()).thenReturn(parentBB); when(wiresShape.getX()).thenReturn(0d); when(wiresShape.getY()).thenReturn(0d); when(magnets.size()).thenReturn(1); when(magnets.getMagnet(0)).thenReturn(magnet); when(magnet.getConnectionsSize()).thenReturn(connections.size()); when(magnet.getConnections()).thenReturn(connections); when(connection.getConnector()).thenReturn(connector); when(connector.getGroup()).thenReturn(connectorGroup); when(connectorGroup.uuid()).thenReturn(connectorUUID); when(connector.getControlPoints()).thenReturn(controlPointsLienzo); when(connector.getHead()).thenReturn(head); when(connector.getTail()).thenReturn(tail); when(head.getLocation()).thenReturn(new com.ait.lienzo.client.core.types.Point2D(1, 1)); when(tail.getLocation()).thenReturn(new com.ait.lienzo.client.core.types.Point2D(2, 2)); when(wiresShape.getChildShapes()).thenReturn(children); when(shape.getShapeView()).thenReturn(wiresShape); when(graphIndex.getEdge(connectorUUID)).thenReturn(connectorEdge); when(connectorEdge.getContent()).thenReturn(viewConnector); when(connectorGroup.getUserData()).thenReturn(new WiresUtils.UserData(connectorUUID, "")); tested.init(canvasHandler); tested.register(element); Point2D location = new Point2D(45d, 65.5d); tested.move(new Element[]{element}, new Point2D[]{location}); ArgumentCaptor<CanvasCommand> commandArgumentCaptor = forClass(CanvasCommand.class); verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture()); ArgumentCaptor<ShapeLocationsChangedEvent> shapeLocationsChangedEventCaptor = forClass(ShapeLocationsChangedEvent.class); verify(shapeLocationsChangedEvent, times(1)).fire(shapeLocationsChangedEventCaptor.capture()); assertTrue(shapeLocationsChangedEventCaptor.getValue() instanceof ShapeLocationsChangedEvent); final CompositeCommand command = (CompositeCommand) commandArgumentCaptor.getValue(); UpdateElementPositionCommand updateElementPositionCommand = (UpdateElementPositionCommand) command.getCommands().get(0); assertEquals(element, updateElementPositionCommand.getElement()); assertEquals(location, updateElementPositionCommand.getLocation()); }
|
LocationControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements LocationControl<AbstractCanvasHandler, Element>,
CanvasControl.SessionAware<EditorSession> { @SuppressWarnings("unchecked") private static void ensureDragConstraints(final AbstractCanvas<?> canvas, final ShapeView shapeView) { final Bounds bounds = canvas.getView().getPanel().getLocationConstraints(); ShapeUtils.enforceLocationConstraints(shapeView, bounds); } protected LocationControlImpl(); @Inject LocationControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final Event<ShapeLocationsChangedEvent> shapeLocationsChangedEvent,
final Event<CanvasSelectionEvent> selectionEvent); Collection<String> getSelectedIDs(); @Override void bind(final EditorSession session); void handleArrowKeys(final Key... keys); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> move(final Element[] elements,
final Point2D[] locations); }
|
@Test public void testEnsureDragConstraints() throws Exception { tested.init(canvasHandler); Bounds bounds = Bounds.create(0d, 0d, 600d, 600d); when(canvasPanel.getLocationConstraints()).thenReturn(bounds); tested.register(element); verify(shapeView, times(1)).setDragBounds(eq(bounds)); }
|
DockingAcceptorControlImpl extends AbstractAcceptorControl implements DockingAcceptorControl<AbstractCanvasHandler> { @Override public boolean allow(final Node parent, final Node child) { return evaluate(parent, child, command -> getCommandManager().allow(getCanvasHandler(), command)); } @Inject DockingAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override boolean allow(final Node parent,
final Node child); @Override boolean accept(final Node parent,
final Node child); }
|
@Test public void testAllow() { tested.init(canvasHandler); final boolean allow = tested.allow(source, docked); assertTrue(allow); verify(commandManager, times(1)).allow(eq(canvasHandler), eq(updateDockNodeCommand)); assertEquals(source, updateDockNodeCommand.getParent()); assertEquals(docked, updateDockNodeCommand.getCandidate()); }
@Test public void testAllowNoParent() { tested.init(canvasHandler); final boolean allow = tested.allow(null, docked); assertFalse(allow); verify(commandManager, times(0)).allow(any(AbstractCanvasHandler.class), any(UpdateDockNodeCommand.class)); }
|
DockingAcceptorControlImpl extends AbstractAcceptorControl implements DockingAcceptorControl<AbstractCanvasHandler> { @Override public boolean accept(final Node parent, final Node child) { return evaluate(parent, child, command -> getCommandManager().execute(getCanvasHandler(), command)); } @Inject DockingAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override boolean allow(final Node parent,
final Node child); @Override boolean accept(final Node parent,
final Node child); }
|
@Test public void testAccept() { tested.init(canvasHandler); final boolean accept = tested.accept(source, docked); assertTrue(accept); verify(commandManager, times(1)).execute(eq(canvasHandler), eq(updateDockNodeCommand)); assertEquals(source, updateDockNodeCommand.getParent()); assertEquals(docked, updateDockNodeCommand.getCandidate()); }
@Test public void testAceeptNoParent() { tested.init(canvasHandler); final boolean accept = tested.accept(null, docked); assertFalse(accept); verify(commandManager, times(0)).execute(any(AbstractCanvasHandler.class), any(UpdateDockNodeCommand.class)); }
|
PreviewDiagramScreen { void showPreview(final ClientSession session) { if (Objects.isNull(session)) { return; } if (session instanceof AbstractSession) { if (Objects.nonNull(previewWidget)) { closePreview(); } previewWidget = sessionPreviews.get(); previewWidget.open((AbstractSession) session, PREVIEW_WIDTH, PREVIEW_HEIGHT, new SessionViewer.SessionViewerCallback<Diagram>() { @Override public void afterCanvasInitialized() { } @Override public void onSuccess() { view.setPreviewWidget(previewWidget.getView()); } @Override public void onError(final ClientRuntimeError error) { LOGGER.log(Level.SEVERE, error.getMessage()); } }); } } protected PreviewDiagramScreen(); @Inject PreviewDiagramScreen(final SessionManager clientSessionManager,
final @Any @DMNEditor ManagedInstance<SessionDiagramPreview<AbstractSession>> sessionPreviews,
final View view,
final DMNDiagramsSession session); @OnStartup @SuppressWarnings("unused") void onStartup(final PlaceRequest placeRequest); @OnOpen @SuppressWarnings("unused") void onOpen(); @OnClose @SuppressWarnings("unused") void onClose(); @WorkbenchPartTitle @SuppressWarnings("unused") String getTitle(); @WorkbenchPartView @SuppressWarnings("unused") IsWidget getWidget(); @WorkbenchContextId @SuppressWarnings("unused") String getMyContextRef(); static final String SCREEN_ID; }
|
@Test @SuppressWarnings("unchecked") public void testShowPreview() { tested.showPreview(session); verify(sessionPreview).open(eq(session), anyInt(), anyInt(), sessionViewerCallbackArgumentCaptor.capture()); final SessionViewer.SessionViewerCallback sessionViewerCallback = sessionViewerCallbackArgumentCaptor.getValue(); sessionViewerCallback.onSuccess(); verify(sessionPreview, never()).clear(); verify(view).setPreviewWidget(previewWidget); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { @Override public MediatorsControl<C> setMinScale(final double minScale) { mediators.setMinScale(minScale); return this; } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testSetMinScale() { tested.setMinScale(0.4d); verify(mediators, times(1)).setMinScale(eq(0.4d)); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { @Override public MediatorsControl<C> setMaxScale(final double maxScale) { mediators.setMaxScale(maxScale); return this; } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testSetMaxScale() { tested.setMaxScale(0.4d); verify(mediators, times(1)).setMaxScale(eq(0.4d)); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { @Override public MediatorsControl<C> setZoomFactor(final double factor) { mediators.setZoomFactor(factor); return this; } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testSetZoomFactor() { tested.setZoomFactor(0.4d); verify(mediators, times(1)).setZoomFactor(eq(0.4d)); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { @Override public MediatorsControl<C> scale(final double factor) { getLayer().scale(factor); return this; } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testScale() { tested.scale(0.2d, 0.4d); verify(layer, times(1)).scale(0.2d, 0.4d); tested.scale(0.5d); verify(layer, times(1)).scale(0.5d); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { @Override public MediatorsControl<C> translate(final double tx, final double ty) { getLayer().translate(tx, ty); return this; } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testTranslate() { tested.translate(0.2d, 0.4d); verify(layer, times(1)).translate(0.2d, 0.4d); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { void onCanvasFocusedEvent(final @Observes CanvasFocusedEvent focusedEvent) { if (null != canvas && canvas.equals(focusedEvent.getCanvas())) { mediators.enable(); } } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testOnCanvasFocusedEvent() { CanvasFocusedEvent event = new CanvasFocusedEvent(canvas); tested.onCanvasFocusedEvent(event); verify(mediators, times(1)).enable(); verify(mediators, never()).disable(); }
|
LienzoMediatorsControl extends AbstractCanvasControl<C> implements MediatorsControl<C> { void onCanvasLostFocusEvent(final @Observes CanvasLostFocusEvent lostFocusEvent) { if (null != canvas && canvas.equals(lostFocusEvent.getCanvas())) { mediators.disable(); } } @Inject LienzoMediatorsControl(final LienzoPanelMediators mediators); @Override MediatorsControl<C> setMinScale(final double minScale); @Override MediatorsControl<C> setMaxScale(final double maxScale); @Override MediatorsControl<C> setZoomFactor(final double factor); @Override MediatorsControl<C> scale(final double factor); @Override MediatorsControl<C> scale(final double sx,
final double sy); @Override MediatorsControl<C> translate(final double tx,
final double ty); }
|
@Test public void testOnCanvasLostFocusEvent() { CanvasLostFocusEvent event = new CanvasLostFocusEvent(canvas); tested.onCanvasLostFocusEvent(event); verify(mediators, times(1)).disable(); verify(mediators, never()).enable(); }
|
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { void onCanvasSelection(final @Observes CanvasSelectionEvent event) { checkNotNull("event", event); if (Objects.equals(getCanvasHandler(), event.getCanvasHandler())) { if (event.getIdentifiers().size() == 1) { onClearSelection(); } selectionShapeProvider.moveShapeToTop(); } } @Inject LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent,
final CursoredSelectionShapeProvider selectionShapeProvider); }
|
@Test public void testGroupSelectionWithMultipleItems() { final SelectionManager.SelectedItems selectedItems = mock(SelectionManager.SelectedItems.class); final LienzoMultipleSelectionControl.CursoredSelectionShapeProvider ssp = mock(LienzoMultipleSelectionControl.CursoredSelectionShapeProvider.class); tested = new LienzoMultipleSelectionControl<>(selectionControl, canvasSelectionEvent, clearSelectionEvent, ssp); tested.init(canvasHandler); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectionManager.getSelectedItems().isSelectionGroup()).thenReturn(true); tested.onCanvasSelection(new CanvasSelectionEvent(canvasHandler, Arrays.asList(ELEMENT_UUID, ELEMENT_UUID_2, ELEMENT_UUID_3, ELEMENT_UUID_4, ELEMENT_UUID_5))); verify(selectionControl, never()).clearSelection(); verify(selectionManager, never()).clearSelection(); }
@Test public void testSingleSelectionFromGroupSelection() { final SelectionManager.SelectedItems selectedItems = mock(SelectionManager.SelectedItems.class); final LienzoMultipleSelectionControl.CursoredSelectionShapeProvider ssp = mock(LienzoMultipleSelectionControl.CursoredSelectionShapeProvider.class); tested = new LienzoMultipleSelectionControl<>(selectionControl, canvasSelectionEvent, clearSelectionEvent, ssp); tested.init(canvasHandler); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectionManager.getSelectedItems().isSelectionGroup()).thenReturn(true); tested.onCanvasSelection(new CanvasSelectionEvent(canvasHandler, Arrays.asList(ELEMENT_UUID))); verify(selectionControl, never()).clearSelection(); verify(selectionManager, times(1)).clearSelection(); }
@Test public void testMoveSelectionShapeToTop() { final LienzoMultipleSelectionControl.CursoredSelectionShapeProvider ssp = mock(LienzoMultipleSelectionControl.CursoredSelectionShapeProvider.class); tested = new LienzoMultipleSelectionControl<>(selectionControl, canvasSelectionEvent, clearSelectionEvent, ssp); tested.init(canvasHandler); tested.onCanvasSelection(new CanvasSelectionEvent(canvasHandler, Collections.emptyList())); verify(ssp, times(1)).moveShapeToTop(); }
|
ImportConverter { public static Import wbFromDMN(final JSITImport dmn, final JSITDefinitions definitions, final PMMLDocumentMetadata pmmlDocument) { final Import result = createWBImport(dmn, definitions, pmmlDocument); final Map<QName, String> additionalAttributes = new HashMap<>(); final Map<javax.xml.namespace.QName, String> otherAttributes = JSITUnaryTests.getOtherAttributesMap(dmn); for (Map.Entry<javax.xml.namespace.QName, String> entry : otherAttributes.entrySet()) { additionalAttributes.put(QNamePropertyConverter.wbFromDMN(entry.getKey().toString()), entry.getValue()); } result.setAdditionalAttributes(additionalAttributes); final String name = dmn.getName(); final String description = dmn.getDescription(); result.setId(IdPropertyConverter.wbFromDMN(dmn.getId())); result.setName(new Name(name)); result.setDescription(DescriptionPropertyConverter.wbFromDMN(description)); NameSpaceUtils.extractNamespacesKeyedByPrefix(dmn).forEach((key, value) -> result.getNsContext().put(key, value)); return result; } static Import wbFromDMN(final JSITImport dmn,
final JSITDefinitions definitions,
final PMMLDocumentMetadata pmmlDocument); }
|
@Test public void wbFromDMN_DMNImport() { when(jsitImportMock.getImportType()).thenReturn(DMN_IMPORT_TYPE); when(jsitDefinitionsMock.getDrgElement()).thenReturn(new ArrayList<>(Arrays.asList(mock(JSITDRGElement.class), mock(JSITDRGElement.class)))); when(jsitDefinitionsMock.getItemDefinition()).thenReturn(new ArrayList<>(Arrays.asList(mock(JSITItemDefinition.class)))); Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, jsitDefinitionsMock, null); assertTrue(resultImport instanceof ImportDMN); assertEquals(NAMESPACE, resultImport.getNamespace()); assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue()); assertEquals(DESCRIPTION, resultImport.getDescription().getValue()); assertEquals(NAME, resultImport.getName().getValue()); assertEquals(DMN_IMPORT_TYPE, resultImport.getImportType()); assertEquals(2, ((ImportDMN) resultImport).getDrgElementsCount()); assertEquals(1, ((ImportDMN) resultImport).getItemDefinitionsCount()); }
@Test public void wbFromDMN_DMNImportNoDefinition() { when(jsitImportMock.getImportType()).thenReturn(DMN_IMPORT_TYPE); when(jsitDefinitionsMock.getDrgElement()).thenReturn(new ArrayList<>(Arrays.asList(mock(JSITDRGElement.class), mock(JSITDRGElement.class)))); when(jsitDefinitionsMock.getItemDefinition()).thenReturn(new ArrayList<>(Arrays.asList(mock(JSITItemDefinition.class)))); Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, null); assertTrue(resultImport instanceof ImportDMN); assertEquals(NAMESPACE, resultImport.getNamespace()); assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue()); assertEquals(DESCRIPTION, resultImport.getDescription().getValue()); assertEquals(NAME, resultImport.getName().getValue()); assertEquals(DMN_IMPORT_TYPE, resultImport.getImportType()); assertEquals(0, ((ImportDMN) resultImport).getDrgElementsCount()); assertEquals(0, ((ImportDMN) resultImport).getItemDefinitionsCount()); }
@Test public void wbFromDMN_PMMLImportNoModels() { when(jsitImportMock.getImportType()).thenReturn(PMML_IMPORT_TYPE); Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, pmmlDocumentMetadata); assertTrue(resultImport instanceof ImportPMML); assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue()); assertEquals(NAME, resultImport.getNamespace()); assertEquals(DESCRIPTION, resultImport.getDescription().getValue()); assertEquals(NAME, resultImport.getName().getValue()); assertEquals(PMML_IMPORT_TYPE, resultImport.getImportType()); assertNotNull(resultImport.getId().getValue()); assertEquals(0, ((ImportPMML) resultImport).getModelCount()); }
@Test public void wbFromDMN_PMMLImportWithModels() { when(jsitImportMock.getImportType()).thenReturn(PMML_IMPORT_TYPE); pmmlDocumentMetadata.getModels().add(new PMMLModelMetadata("modelName", null)); Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, pmmlDocumentMetadata); assertTrue(resultImport instanceof ImportPMML); assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue()); assertEquals(NAME, resultImport.getNamespace()); assertEquals(DESCRIPTION, resultImport.getDescription().getValue()); assertEquals(NAME, resultImport.getName().getValue()); assertEquals(PMML_IMPORT_TYPE, resultImport.getImportType()); assertNotNull(resultImport.getId().getValue()); assertEquals(1, ((ImportPMML) resultImport).getModelCount()); }
@Test public void wbFromDMN_PMMLImportNoPmmlModelMetadata() { when(jsitImportMock.getImportType()).thenReturn(PMML_IMPORT_TYPE); pmmlDocumentMetadata.getModels().add(new PMMLModelMetadata("modelName", null)); Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, null); assertTrue(resultImport instanceof ImportPMML); assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue()); assertEquals(NAME, resultImport.getNamespace()); assertEquals(DESCRIPTION, resultImport.getDescription().getValue()); assertEquals(NAME, resultImport.getName().getValue()); assertEquals(PMML_IMPORT_TYPE, resultImport.getImportType()); assertNotNull(resultImport.getId().getValue()); assertEquals(0, ((ImportPMML) resultImport).getModelCount()); }
|
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { @Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); } @Inject LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent,
final CursoredSelectionShapeProvider selectionShapeProvider); }
|
@Test public void testOnSelectEvent() { final SelectionManager.SelectedItems selectedItems = mock(SelectionManager.SelectedItems.class); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); tested.init(canvasHandler); tested.register(element); tested.onSelect(Collections.singletonList(ELEMENT_UUID)); verify(selectedItems, times(1)).add(eq(shapeView)); verify(selectionControl, never()).clearSelection(); }
|
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } } @Inject LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent,
final CursoredSelectionShapeProvider selectionShapeProvider); }
|
@Test public void testOnShapeLocationsChanged() { when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(mock(CanvasHandler.class)); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); when(shapeLocationsChangedEvent.getUuids()).thenReturn(new ArrayList<>()); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); List<String> selectedUUIds = new ArrayList<>(); selectedUUIds.add("ELEMENT"); when(shapeLocationsChangedEvent.getUuids()).thenReturn(selectedUUIds); when(tested.getSelectedItems()).thenReturn(selectedUUIds); when(delegateShapeProvider.getShape()).thenReturn(mock(com.ait.lienzo.client.core.shape.Shape.class)); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectedItems.getBoundingBox()).thenReturn(new BoundingBox(MIN_WIDTH, MIN_HEIGHT, MAX_WIDTH, MAX_HEIGHT)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, times(1)).rebuildBoundingBox(); verify(selectionManager, times(1)).drawSelectionShapeForSelection(); }
|
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { @Override protected void onClearSelection() { super.onClearSelection(); if (Objects.nonNull(getSelectionControl().getCanvasHandler())) { getSelectionManager().clearSelection(); } } @Inject LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent,
final CursoredSelectionShapeProvider selectionShapeProvider); }
|
@Test public void testOnClearSelectionEvent() { tested.init(canvasHandler); tested.onClearSelection(); verify(selectionControl, never()).clearSelection(); verify(selectionManager, times(1)).clearSelection(); }
|
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { @Override protected void onDestroy() { getSelectionManager().destroy(); selectionShapeProvider.destroy(); super.onDestroy(); } @Inject LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent,
final CursoredSelectionShapeProvider selectionShapeProvider); }
|
@Test public void testDestroy() { tested.destroy(); verify(tested).onDestroy(); verify(selectionManager).destroy(); verify(selectionShapeProvider).destroy(); }
|
ContainmentAcceptorControlImpl extends AbstractAcceptorControl implements ContainmentAcceptorControl<AbstractCanvasHandler> { @Override public boolean allow(final Element parent, final Node[] children) { return evaluate(parent, children, command -> getCommandManager().allow(getCanvasHandler(), command), true); } @Inject ContainmentAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override boolean allow(final Element parent,
final Node[] children); @Override boolean accept(final Element parent,
final Node[] children); }
|
@Test public void testAllow() { tested.init(canvasHandler); final boolean allow = tested.allow(parent, new Node[]{candidate}); assertTrue(allow); verify(commandManager, times(1)).allow(eq(canvasHandler), eq(updateChildrenCommand)); assertEquals(parent, updateChildrenCommand.getParent()); assertEquals(candidate, updateChildrenCommand.getCandidates().iterator().next()); verify(highlight, times(1)).unhighLight(); }
|
ContainmentAcceptorControlImpl extends AbstractAcceptorControl implements ContainmentAcceptorControl<AbstractCanvasHandler> { @Override public boolean accept(final Element parent, final Node[] children) { return evaluate(parent, children, command -> getCommandManager().execute(getCanvasHandler(), command), false); } @Inject ContainmentAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override boolean allow(final Element parent,
final Node[] children); @Override boolean accept(final Element parent,
final Node[] children); }
|
@Test public void testAccept() { tested.init(canvasHandler); final boolean accept = tested.accept(parent, new Node[]{candidate}); assertTrue(accept); verify(commandManager, times(1)).execute(eq(canvasHandler), eq(updateChildrenCommand)); assertEquals(parent, updateChildrenCommand.getParent()); assertEquals(candidate, updateChildrenCommand.getCandidates().iterator().next()); verify(highlight, times(1)).unhighLight(); }
|
ContainmentAcceptorControlImpl extends AbstractAcceptorControl implements ContainmentAcceptorControl<AbstractCanvasHandler> { static boolean areInSameParent(final Element parent, final Node[] children) { return Stream.of(children) .map(GraphUtils::getParent) .noneMatch(childParent -> !Objects.equals(parent, childParent)); } @Inject ContainmentAcceptorControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
final CanvasHighlight canvasHighlight); @Override boolean allow(final Element parent,
final Node[] children); @Override boolean accept(final Element parent,
final Node[] children); }
|
@Test public void testIsSameParent() { Node parent = new NodeImpl<>("parentUUID"); Node child1 = new NodeImpl<>("child1"); setAsChild(parent, child1); Node child2 = new NodeImpl<>("child2"); setAsChild(parent, child2); Node[] children = {child1, child2}; boolean isSameParent = ContainmentAcceptorControlImpl.areInSameParent(parent, children); assertTrue(isSameParent); }
@Test public void testIsNotSameParent1() { Node parent = new NodeImpl<>("parentUUID"); Node child1 = new NodeImpl<>("child1"); Node child2 = new NodeImpl<>("child2"); setAsChild(parent, child2); Node[] children = {child1, child2}; boolean isSameParent = ContainmentAcceptorControlImpl.areInSameParent(parent, children); assertFalse(isSameParent); }
@Test public void testIsNotSameParent2() { Node parent = new NodeImpl<>("parentUUID"); Node child1 = new NodeImpl<>("child1"); setAsChild(parent, child1); Node child2 = new NodeImpl<>("child2"); Node[] children = {child1, child2}; boolean isSameParent = ContainmentAcceptorControlImpl.areInSameParent(parent, children); assertFalse(isSameParent); }
@Test public void testIsNotSameParentAll() { Node parent = new NodeImpl<>("parentUUID"); Node child1 = new NodeImpl<>("child1"); Node child2 = new NodeImpl<>("child2"); Node[] children = {child1, child2}; boolean isSameParent = ContainmentAcceptorControlImpl.areInSameParent(parent, children); assertFalse(isSameParent); }
@Test public void testIsNotSameParentNull() { Node parent = new NodeImpl<>("parentUUID"); Node child1 = new NodeImpl<>("child1"); setAsChild(parent, child1); Node child2 = new NodeImpl<>("child2"); setAsChild(parent, child2); Node[] children = {child1, child2}; boolean isSameParent = ContainmentAcceptorControlImpl.areInSameParent(null, children); assertFalse(isSameParent); }
|
ResizeControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ResizeControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element)) { final Canvas<?> canvas = canvasHandler.getCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); if (supportsResize(shape)) { registerResizeHandlers(element, shape); } } } protected ResizeControlImpl(); @Inject ResizeControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> resize(final Element element,
final double width,
final double height); @Override void setCommandManagerProvider(final RequiresCommandManager.CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test public void testRegister() { tested.init(canvasHandler); assertFalse(tested.isRegistered(element)); tested.register(element); verify(shapeView, times(1)).supports(eq(ViewEventType.RESIZE)); verify(shapeView, times(1)).addHandler(eq(ViewEventType.RESIZE), any(ResizeHandler.class)); assertTrue(tested.isRegistered(element)); }
@Test @SuppressWarnings("unchecked") public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeView, times(1)).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }
|
ResizeControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ResizeControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public CommandResult<CanvasViolation> resize(final Element element, final double width, final double height) { return doResize(element, width, height); } protected ResizeControlImpl(); @Inject ResizeControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> resize(final Element element,
final double width,
final double height); @Override void setCommandManagerProvider(final RequiresCommandManager.CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test @SuppressWarnings("unchecked") public void testResize() { tested.init(canvasHandler); assertFalse(tested.isRegistered(element)); tested.register(element); verify(shapeView, times(1)).supports(eq(ViewEventType.RESIZE)); ArgumentCaptor<ResizeHandler> resizeHandlerArgumentCaptor = ArgumentCaptor.forClass(ResizeHandler.class); verify(shapeView, times(1)).addHandler(eq(ViewEventType.RESIZE), resizeHandlerArgumentCaptor.capture()); final CanvasCommand expectedCommand = mock(CanvasCommand.class); doAnswer(invocationOnMock -> expectedCommand).when(canvasCommandFactory).resize(eq(element), any(BoundingBox.class)); ResizeHandler resizeHandler = resizeHandlerArgumentCaptor.getValue(); double x = 121.45d; double y = 23.456d; double width = 100d; double height = 200d; ResizeEvent event = new ResizeEvent(x, y, x, y, width, height); resizeHandler.end(event); ArgumentCaptor<CanvasCommand> commandArgumentCaptor = ArgumentCaptor.forClass(CanvasCommand.class); verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture()); CanvasCommand command = commandArgumentCaptor.getValue(); assertNotNull(command); assertEquals(expectedCommand, command); }
|
ResizeControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ResizeControl<AbstractCanvasHandler, Element> { @SuppressWarnings("unchecked") protected void onCanvasSelectionEvent(@Observes CanvasSelectionEvent event) { checkNotNull("event", event); if (event.getIdentifiers().size() == 1) { final String uuid = event.getIdentifiers().iterator().next(); if (isSameCanvas(event) && isRegistered(uuid)) { hideALLCPs(); final HasControlPoints<?> hasControlPoints = getControlPointsInstance(uuid); if (!hasControlPoints.areControlsVisible()) { showCPs(hasControlPoints); } } } else if (event.getIdentifiers().size() > 1){ hideALLCPs(); } } protected ResizeControlImpl(); @Inject ResizeControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> resize(final Element element,
final double width,
final double height); @Override void setCommandManagerProvider(final RequiresCommandManager.CommandManagerProvider<AbstractCanvasHandler> provider); }
|
@Test public void testOnCanvasSelectionEvent() { tested.onCanvasSelectionEvent(elementsSelectedEvent); verify(elementsSelectedEvent, times(2)).getIdentifiers(); }
|
LienzoSelectionControl extends AbstractSelectionControl<H> { Map<String, ViewHandler<?>> getHandlers() { return handlers; } @Inject LienzoSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); }
|
@Test public void testRegisterAndClick() { tested.init(canvasHandler); tested.register(element); verify(selectionControl, times(1)).register(eq(element)); ArgumentCaptor<MouseClickHandler> clickHandlerCaptor = ArgumentCaptor.forClass(MouseClickHandler.class); verify(shapeViewHandlers, times(1)).supports(eq(ViewEventType.MOUSE_CLICK)); verify(shapeViewHandlers, times(1)).addHandler(eq(ViewEventType.MOUSE_CLICK), clickHandlerCaptor.capture()); final MouseClickHandler clickHandler = clickHandlerCaptor.getValue(); assertEquals(clickHandler, tested.getHandlers().get(ELEMENT_UUID)); MouseClickEvent event = mock(MouseClickEvent.class); when(event.isButtonLeft()).thenReturn(true); clickHandler.handle(event); verify(selectionControl, times(1)).select(eq(element.getUUID())); }
|
LienzoSelectionControl extends AbstractSelectionControl<H> { void singleSelect(final Element element) { if (!getSelectedItems().isEmpty()) { clearSelection(); } select(element.getUUID()); } @Inject LienzoSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); }
|
@Test public void testSelectionIsSingle() { when(selectionControl.getSelectedItems()).thenReturn(Collections.singletonList(ELEMENT_UUID)); tested.init(canvasHandler); tested.register(element); tested.singleSelect(element); verify(selectionControl, times(1)).clearSelection(); verify(selectionControl, times(1)).select(eq(element.getUUID())); }
@Test public void testClearSelection() { tested.init(canvasHandler); tested.register(element); tested.singleSelect(element); tested.clearSelection(); verify(selectionControl, times(1)).clearSelection(); }
|
LienzoSelectionControl extends AbstractSelectionControl<H> { protected void deregister(final String uuid) { final Shape shape = getSelectionControl().getCanvas().getShape(uuid); final ViewHandler<?> handler = handlers.get(uuid); doDeregisterHandler(shape, handler); } @Inject LienzoSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); LienzoSelectionControl(final MapSelectionControl<H> selectionControl,
final Event<CanvasSelectionEvent> canvasSelectionEvent,
final Event<CanvasClearSelectionEvent> clearSelectionEvent); }
|
@Test @SuppressWarnings("unchecked") public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(selectionControl, times(1)).deregister(eq(element)); verify(shapeViewHandlers, times(1)).removeHandler(any(ViewHandler.class)); assertTrue(tested.getHandlers().isEmpty()); }
|
LienzoCanvas extends AbstractCanvas<V> { public AbstractCanvas<V> initialize(final CanvasPanel panel, final CanvasSettings settings) { eventHandlerManager = new ViewEventHandlerManager(getView().getLayer().getLienzoLayer(), SUPPORTED_EVENT_TYPES); return initialize(panel, settings, eventHandlerManager); } protected LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
|
@Test public void testInitialize() { CanvasPanel panel = mock(CanvasPanel.class); CanvasSettings settings = mock(CanvasSettings.class); when(settings.isHiDPIEnabled()).thenReturn(true); assertEquals(tested, tested.initialize(panel, settings)); assertTrue(LienzoCore.get().isHidpiEnabled()); assertNotNull(tested.getEventHandlerManager()); verify(view, times(1)).initialize(eq(panel), eq(settings)); }
|
LienzoCanvas extends AbstractCanvas<V> { @Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); } protected LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
|
@Test @SuppressWarnings("unchecked") public void testGetShapeAt() { double x = 10; double y = 33; com.ait.lienzo.client.core.shape.Shape lienzoShape = mock(com.ait.lienzo.client.core.shape.Shape.class); WiresUtils.UserData userData = new WiresUtils.UserData("uuid1", "group1"); when(lienzoShape.getUserData()).thenReturn(userData); when(layer.findShapeAtPoint(eq(10), eq(33))).thenReturn(lienzoShape); Shape stunnerShape = mock(Shape.class); when(tested.getShape(eq("uuid1"))).thenReturn(stunnerShape); Optional<Shape> shape = tested.getShapeAt(x, y); assertTrue(shape.isPresent()); assertEquals(stunnerShape, shape.get()); }
|
LienzoCanvas extends AbstractCanvas<V> { @Override public void onAfterDraw(final Command callback) { getView().getLayer().onAfterDraw(callback); } protected LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
|
@Test public void testOnAfterDraw() { Command callback = mock(Command.class); tested.onAfterDraw(callback); verify(lienzoLayer, times(1)).onAfterDraw(eq(callback)); }
|
LienzoCanvas extends AbstractCanvas<V> { @Override public void focus() { getView().getLienzoPanel().focus(); } protected LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
|
@Test public void testFocus() { LienzoPanel panel = mock(LienzoPanel.class); when(view.getLienzoPanel()).thenReturn(panel); tested.focus(); verify(panel, times(1)).focus(); }
|
LienzoCanvas extends AbstractCanvas<V> { @Override public void destroy() { if (null != eventHandlerManager) { eventHandlerManager.destroy(); eventHandlerManager = null; } super.destroy(); } protected LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
|
@Test public void testDestroy() { CanvasPanel panel = mock(CanvasPanel.class); CanvasSettings settings = mock(CanvasSettings.class); ViewEventHandlerManager eventHandler = mock(ViewEventHandlerManager.class); tested.initialize(panel, settings, eventHandler); tested.destroy(); verify(eventHandler, times(1)).destroy(); verify(view, times(1)).destroy(); }
|
LienzoCanvasCommandFactory extends DefaultCanvasCommandFactory { @Override public CanvasCommand<AbstractCanvasHandler> resize(final Element<? extends View<?>> element, final BoundingBox boundingBox) { return new LienzoResizeNodeCommand(element, boundingBox); } protected LienzoCanvasCommandFactory(); @Inject LienzoCanvasCommandFactory(final @Any ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessors,
final @Any ManagedInstance<ViewTraverseProcessor> viewTraverseProcessors); @Override CanvasCommand<AbstractCanvasHandler> resize(final Element<? extends View<?>> element,
final BoundingBox boundingBox); }
|
@Test @SuppressWarnings("unchecked") public void testCreateResizeCommand() { Element element = mock(Element.class); BoundingBox boundingBox = new BoundingBox(0, 0, 1, 2); final CanvasCommand<AbstractCanvasHandler> command = tested.resize(element, boundingBox); assertNotNull(command); assertTrue(command instanceof LienzoResizeNodeCommand); LienzoResizeNodeCommand lienzoCommand = (LienzoResizeNodeCommand) command; assertEquals(element, lienzoCommand.getCandidate()); assertEquals(boundingBox, lienzoCommand.getBoundingBox()); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { public void use(final WiresManager wiresManager) { layer.use(wiresManager); } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testUseWiresManager() { WiresManager wiresManager = mock(WiresManager.class); tested.use(wiresManager); verify(wiresLayer, times(1)).use(eq(wiresManager)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape) { if (WiresUtils.isWiresShape(shape)) { layer.add((WiresShape) shape); } else if (WiresUtils.isWiresConnector(shape)) { layer.add((WiresConnector) shape); } else { return super.add(shape); } return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testAdd() { WiresShapeView shapeView = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.add(shapeView); verify(wiresLayer, times(1)).add(eq(shapeView)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape) { if (WiresUtils.isWiresShape(shape)) { layer.delete((WiresShape) shape); } else if (WiresUtils.isWiresConnector(shape)) { layer.delete((WiresConnector) shape); } else { return super.delete(shape); } return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testDelete() { WiresShapeView shapeView = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.delete(shapeView); verify(wiresLayer, times(1)).delete(eq(shapeView)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { public LienzoCanvasView addRoot(final ShapeView<?> shape) { if (WiresUtils.isWiresShape(shape)) { layer.add(((WiresShape) shape).getGroup()); } else if (WiresUtils.isWiresConnector(shape)) { layer.add(((WiresConnector) shape).getGroup()); } else { return super.add(shape); } return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testAddRoot() { WiresShapeView shapeView = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.addRoot(shapeView); verify(wiresLayer, times(1)).add(eq(shapeView.getGroup())); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { public LienzoCanvasView deleteRoot(final ShapeView<?> shape) { if (WiresUtils.isWiresShape(shape)) { layer.delete(((WiresShape) shape).getGroup()); } else if (WiresUtils.isWiresConnector(shape)) { layer.delete(((WiresConnector) shape).getGroup()); } else { return super.delete(shape); } return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testDeleteRoot() { WiresShapeView shapeView = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.deleteRoot(shapeView); verify(wiresLayer, times(1)).delete(eq(shapeView.getGroup())); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView addChild(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.addChild(parentShape, childShape); childShape.shapeMoved(); return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testAddChild() { WiresShapeView parent = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); WiresShapeView child = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.addChild(parent, child); verify(wiresLayer, times(1)).addChild(eq(parent), eq(child)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView deleteChild(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.deleteChild(parentShape, childShape); childShape.shapeMoved(); return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testDeleteChild() { WiresShapeView parent = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); WiresShapeView child = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.deleteChild(parent, child); verify(wiresLayer, times(1)).deleteChild(eq(parent), eq(child)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView dock(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.dock(parentShape, childShape); childShape.shapeMoved(); return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testDock() { WiresShapeView parent = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); WiresShapeView child = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.dock(parent, child); verify(wiresLayer, times(1)).dock(eq(parent), eq(child)); }
|
WiresCanvasView extends LienzoCanvasView<WiresLayer> { @Override public LienzoCanvasView undock(final ShapeView<?> childParent, final ShapeView<?> child) { final WiresShape childShape = (WiresShape) child; layer.undock(childShape); childShape.shapeMoved(); return this; } @Inject WiresCanvasView(final WiresLayer layer); void use(final WiresManager wiresManager); @Override LienzoCanvasView<WiresLayer> add(final ShapeView<?> shape); LienzoCanvasView addRoot(final ShapeView<?> shape); @Override LienzoCanvasView<WiresLayer> delete(final ShapeView<?> shape); LienzoCanvasView deleteRoot(final ShapeView<?> shape); @Override LienzoCanvasView addChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView deleteChild(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView dock(final ShapeView<?> parent,
final ShapeView<?> child); @Override LienzoCanvasView undock(final ShapeView<?> childParent,
final ShapeView<?> child); @Override WiresLayer getLayer(); }
|
@Test public void testUnDock() { WiresShapeView parent = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); WiresShapeView child = new WiresShapeView(new MultiPath().rect(0, 0, 50, 50)); tested.undock(parent, child); verify(wiresLayer, times(1)).undock(eq(child)); }
|
WiresCanvas extends LienzoCanvas<WiresCanvasView> { @Override public WiresCanvasView getView() { return view; } @Inject WiresCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent,
final @Default WiresManagerFactory wiresManagerFactory,
final WiresCanvasView view); @Override AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override WiresCanvasView getView(); WiresManager getWiresManager(); static final String WIRES_CANVAS_GROUP_ID; }
|
@Test public void testGetView() { assertEquals(view, tested.getView()); }
|
WiresCanvas extends LienzoCanvas<WiresCanvasView> { @Override public AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel, final CanvasSettings settings) { super.initialize(panel, settings); final WiresLayer layer = getView().getLayer(); wiresManager = wiresManagerFactory.newWiresManager(layer.getLienzoLayer()); wiresManager.setSpliceEnabled(false); wiresManager.setLocationAcceptor(ILocationAcceptor.NONE); wiresManager.setContainmentAcceptor(IContainmentAcceptor.NONE); wiresManager.setDockingAcceptor(IDockingAcceptor.NONE); wiresManager.setConnectionAcceptor(IConnectionAcceptor.NONE); wiresManager.setControlPointsAcceptor(IControlPointsAcceptor.NONE); view.use(wiresManager); return this; } @Inject WiresCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent,
final @Default WiresManagerFactory wiresManagerFactory,
final WiresCanvasView view); @Override AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override WiresCanvasView getView(); WiresManager getWiresManager(); static final String WIRES_CANVAS_GROUP_ID; }
|
@Test public void testInitialize() { CanvasPanel panel = mock(CanvasPanel.class); CanvasSettings settings = mock(CanvasSettings.class); assertEquals(tested, tested.initialize(panel, settings)); verify(wiresManager, times(1)).setSpliceEnabled(eq(false)); verify(wiresManager, times(1)).setLocationAcceptor(eq(ILocationAcceptor.NONE)); verify(wiresManager, times(1)).setContainmentAcceptor(eq(IContainmentAcceptor.NONE)); verify(wiresManager, times(1)).setDockingAcceptor(eq(IDockingAcceptor.NONE)); verify(wiresManager, times(1)).setConnectionAcceptor(eq(IConnectionAcceptor.NONE)); verify(wiresManager, times(1)).setControlPointsAcceptor(eq(IControlPointsAcceptor.NONE)); verify(view, times(1)).use(eq(wiresManager)); verify(view, times(1)).initialize(eq(panel), eq(settings)); assertEquals(wiresManager, tested.getWiresManager()); }
|
WiresCanvas extends LienzoCanvas<WiresCanvasView> { @Override protected void addChild(final Shape shape) { getView().addRoot(shape.getShapeView()); } @Inject WiresCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent,
final @Default WiresManagerFactory wiresManagerFactory,
final WiresCanvasView view); @Override AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override WiresCanvasView getView(); WiresManager getWiresManager(); static final String WIRES_CANVAS_GROUP_ID; }
|
@Test public void testAddChild() { Shape shape = mock(Shape.class); ShapeView shapeView = mock(ShapeView.class); when(shape.getShapeView()).thenReturn(shapeView); tested.addChild(shape); verify(view, times(1)).addRoot(eq(shapeView)); }
|
WiresCanvas extends LienzoCanvas<WiresCanvasView> { @Override protected void deleteChild(final Shape shape) { getView().deleteRoot(shape.getShapeView()); } @Inject WiresCanvas(final Event<CanvasClearEvent> canvasClearEvent,
final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
final Event<CanvasDrawnEvent> canvasDrawnEvent,
final Event<CanvasFocusedEvent> canvasFocusedEvent,
final @Default WiresManagerFactory wiresManagerFactory,
final WiresCanvasView view); @Override AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel,
final CanvasSettings settings); @Override WiresCanvasView getView(); WiresManager getWiresManager(); static final String WIRES_CANVAS_GROUP_ID; }
|
@Test public void testDeleteChild() { Shape shape = mock(Shape.class); ShapeView shapeView = mock(ShapeView.class); when(shape.getShapeView()).thenReturn(shapeView); tested.deleteChild(shape); verify(view, times(1)).deleteRoot(eq(shapeView)); }
|
WiresLayer extends LienzoLayer { public LienzoLayer add(final WiresShape wiresShape) { if (contains(wiresShape)) { LOGGER.log(Level.WARNING, "Cannot add a WiresShape into the WiresLayer twice!"); } else { wiresManager.register(wiresShape); wiresManager.getMagnetManager().createMagnets(wiresShape, MAGNET_CARDINALS); WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID); } return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testAddShape() { tested.add(shape); verify(wiresManager, times(1)).register(eq(shape)); verify(magnetManager, times(1)).createMagnets(eq(shape), eq(WiresLayer.MAGNET_CARDINALS)); }
@Test public void testAddShapeTwice() { when(wiresManager.getShape(eq(SHAPE_UUID))).thenReturn(shape); tested.add(shape); verify(wiresManager, never()).register(eq(shape)); verify(magnetManager, never()).createMagnets(eq(shape), eq(WiresLayer.MAGNET_CARDINALS)); }
@Test public void testAddconnector() { tested.add(connector); verify(wiresManager, times(1)).register(eq(connector)); }
|
WiresLayer extends LienzoLayer { public LienzoLayer delete(final WiresShape wiresShape) { wiresManager.deregister(wiresShape); return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testDeleteShape() { tested.delete(shape); verify(wiresManager, times(1)).deregister(eq(shape)); }
@Test public void testDeleteConnector() { tested.delete(connector); verify(wiresManager, times(1)).deregister(eq(connector)); }
|
WiresLayer extends LienzoLayer { public WiresLayer addChild(final WiresContainer parent, final WiresShape child) { parent.add(child); return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testAddChild() { WiresShape parent = mock(WiresShape.class); tested.addChild(parent, shape); verify(parent, times(1)).add(eq(shape)); }
|
WiresLayer extends LienzoLayer { public WiresLayer deleteChild(final WiresContainer parent, final WiresShape child) { parent.remove(child); return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testDeleteChild() { WiresShape parent = mock(WiresShape.class); tested.deleteChild(parent, shape); verify(parent, times(1)).remove(eq(shape)); }
|
WiresLayer extends LienzoLayer { public WiresLayer dock(final WiresContainer parent, final WiresShape child) { final WiresDockingControl dockingControl = child.getControl().getDockingControl(); dockingControl.dock(parent); final Point2D candidateLocation = dockingControl.getCandidateLocation(); if (null != candidateLocation) { child.setLocation(candidateLocation); } return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testDock() { WiresShapeControl control = mock(WiresShapeControl.class); WiresDockingControl dockingControl = mock(WiresDockingControl.class); when(control.getDockingControl()).thenReturn(dockingControl); when(shape.getControl()).thenReturn(control); Point2D location = new Point2D(1, 1); when(dockingControl.getCandidateLocation()).thenReturn(location); WiresShape parent = mock(WiresShape.class); tested.dock(parent, shape); verify(dockingControl, times(1)).dock(eq(parent)); verify(shape, times(1)).setLocation(eq(location)); }
@Test public void testDockButNoContext() { WiresShapeControl control = mock(WiresShapeControl.class); WiresDockingControl dockingControl = mock(WiresDockingControl.class); when(control.getDockingControl()).thenReturn(dockingControl); when(shape.getControl()).thenReturn(control); when(dockingControl.getCandidateLocation()).thenReturn(null); WiresShape parent = mock(WiresShape.class); tested.dock(parent, shape); verify(dockingControl, times(1)).dock(eq(parent)); verify(shape, never()).setLocation(any(Point2D.class)); }
|
WiresLayer extends LienzoLayer { public WiresLayer undock(final WiresShape child) { child.getControl().getDockingControl().undock(); return this; } WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
final WiresShape child); WiresLayer dock(final WiresContainer parent,
final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy(); }
|
@Test public void testUnDock() { WiresShape child = mock(WiresShape.class); WiresShapeControl control = mock(WiresShapeControl.class); WiresDockingControl dockingControl = mock(WiresDockingControl.class); when(control.getDockingControl()).thenReturn(dockingControl); when(child.getControl()).thenReturn(control); tested.undock(child); verify(dockingControl, times(1)).undock(); }
|
WiresUtils { public static boolean isWiresLayer(final WiresContainer wiresShape) { return null != wiresShape && wiresShape instanceof WiresLayer; } static Point2D getAbsolute(final IDrawable<?> shape); static Node getNode(final AbstractCanvasHandler canvasHandler,
final WiresContainer shape); static Node getNode(final AbstractCanvasHandler canvasHandler,
final WiresMagnet magnet); static Edge getEdge(final AbstractCanvasHandler canvasHandler,
final WiresConnector connector); static boolean isWiresShape(final ShapeView<?> shapeView); static boolean isWiresContainer(final ShapeView<?> shapeView); static boolean isWiresConnector(final ShapeView<?> shapeView); static boolean isWiresShape(final WiresContainer wiresShape); static boolean isWiresLayer(final WiresContainer wiresShape); static void assertShapeUUID(final IDrawable<?> shape,
final String uuid); static String getShapeUUID(final IDrawable<?> shape); static void assertShapeGroup(final IDrawable<?> shape,
final String group); static String getShapeGroup(final IDrawable<?> shape); }
|
@Test public void isWiresLayerWhenWiresLayer() { final Layer l = new Layer(); final WiresLayer wl = new WiresLayer(l); assertTrue(WiresUtils.isWiresLayer(wl)); }
@Test public void isWiresLayerWhenWiresShape() { final WiresShape ws = new WiresShape(new MultiPath()); assertFalse(WiresUtils.isWiresLayer(ws)); }
|
DecisionTablePropertyConverter { public static DecisionTable wbFromDMN(final JSITDecisionTable dmn) { final Id id = IdPropertyConverter.wbFromDMN(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); final DecisionTable result = new DecisionTable(); result.setId(id); result.setDescription(description); result.setTypeRef(typeRef); final List<JSITRuleAnnotationClause> jsiRuleAnnotationClauses = dmn.getAnnotation(); if (jsiRuleAnnotationClauses.isEmpty()) { final RuleAnnotationClause ruleAnnotationClause = new RuleAnnotationClause(); ruleAnnotationClause.setParent(result); result.getAnnotations().add(ruleAnnotationClause); } else { for (int i = 0; i < jsiRuleAnnotationClauses.size(); i++) { final JSITRuleAnnotationClause ruleAnnotationClause = Js.uncheckedCast(jsiRuleAnnotationClauses.get(i)); final RuleAnnotationClause converted = RuleAnnotationClausePropertyConverter.wbFromDMN(ruleAnnotationClause); if (Objects.nonNull(converted)) { converted.setParent(result); result.getAnnotations().add(converted); } } } final List<JSITInputClause> jsiInputClauses = dmn.getInput(); for (int i = 0; i < jsiInputClauses.size(); i++) { final JSITInputClause input = Js.uncheckedCast(jsiInputClauses.get(i)); final InputClause inputClauseConverted = InputClausePropertyConverter.wbFromDMN(input); if (Objects.nonNull(inputClauseConverted)) { inputClauseConverted.setParent(result); result.getInput().add(inputClauseConverted); } } final List<JSITOutputClause> jsiOutputClauses = dmn.getOutput(); for (int i = 0; i < jsiOutputClauses.size(); i++) { final JSITOutputClause output = Js.uncheckedCast(jsiOutputClauses.get(i)); final OutputClause outputClauseConverted = OutputClausePropertyConverter.wbFromDMN(output); if (Objects.nonNull(outputClauseConverted)) { outputClauseConverted.setParent(result); result.getOutput().add(outputClauseConverted); } } if (result.getOutput().size() == 1) { final OutputClause outputClause = result.getOutput().get(0); outputClause.setName(null); outputClause.setTypeRef(BuiltInType.UNDEFINED.asQName()); } final List<JSITDecisionRule> jsiDecisionRules = dmn.getRule(); for (int i = 0; i < jsiDecisionRules.size(); i++) { final JSITDecisionRule dr = Js.uncheckedCast(jsiDecisionRules.get(i)); final DecisionRule decisionRuleConverted = DecisionRulePropertyConverter.wbFromDMN(dr); if (Objects.nonNull(decisionRuleConverted)) { decisionRuleConverted.setParent(result); } result.getRule().add(decisionRuleConverted); } final String hitPolicy = Js.uncheckedCast(dmn.getHitPolicy()); if (Objects.nonNull(hitPolicy)) { result.setHitPolicy(HitPolicy.fromValue(hitPolicy)); } final String aggregation = Js.uncheckedCast(dmn.getAggregation()); if (Objects.nonNull(aggregation)) { result.setAggregation(BuiltinAggregator.fromValue(aggregation)); } final String orientation = Js.uncheckedCast(dmn.getPreferredOrientation()); if (Objects.nonNull(orientation)) { result.setPreferredOrientation(DecisionTableOrientation.fromValue(orientation)); } result.setOutputLabel(dmn.getOutputLabel()); return result; } static DecisionTable wbFromDMN(final JSITDecisionTable dmn); static JSITDecisionTable dmnFromWB(final DecisionTable wb); }
|
@Test public void testConverterWhenJSITOutputTypeRefIsNullThenDecisionTableOutputTypeRefIsUndefined() { when(jsitDecisionTable.getOutput()).thenReturn(jsitOutput); when(jsitOutput.size()).thenReturn(1); when(jsitOutput.get(0)).thenReturn(jsitOutputItem); final DecisionTable decisionTable = DecisionTablePropertyConverter.wbFromDMN(jsitDecisionTable); assertNotNull(decisionTable); assertNotNull(decisionTable.getOutput()); assertEquals(1, decisionTable.getOutput().size()); assertEquals(BuiltInType.UNDEFINED.asQName(), decisionTable.getOutput().get(0).getTypeRef()); }
|
DataObjectsServiceImpl implements DataObjectsService { @Override public List<DataObject> loadDataObjects(final WorkspaceProject workspaceProject) { final KieModule module = moduleService.resolveModule(workspaceProject.getRootPath()); final ClassLoader classLoader = moduleClassLoaderHelper.getModuleClassLoader(module); final ModuleDataModelOracle dmo = dataModelService.getModuleDataModel(workspaceProject.getRootPath()); final String[] types = DataModelOracleUtilities.getFactTypes(dmo); final Map<String, ModelField[]> typesModelFields = dmo.getModuleModelFields(); final Map<String, String> parametersType = dmo.getModuleFieldParametersType(); final List<DataObject> dataObjects = Arrays.stream(types).map(DataObject::new).collect(Collectors.toList()); dataObjects.forEach(dataObject -> convertProperties(dataObject, dataObjects, typesModelFields, classLoader, parametersType)); return dataObjects; } protected DataObjectsServiceImpl(); @Inject DataObjectsServiceImpl(final DataModelService dataModelService,
final ModuleClassLoaderHelper moduleClassLoaderHelper,
final KieModuleService moduleService); @Override List<DataObject> loadDataObjects(final WorkspaceProject workspaceProject); }
|
@Test public void testLoadDataObjects_NoProperties() { final Maps.Builder<String, ModelField[]> modelFieldsBuilder = new Maps.Builder<>(); modelFieldsBuilder.put(BPet.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, BPet.class.getName(), BPet.class.getSimpleName()) }); final Map<String, ModelField[]> modelFields = modelFieldsBuilder.build(); dataModelOracle.addModuleModelFields(modelFields); final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isNotEmpty(); assertThat(dataObjects).hasSize(1); assertThat(dataObjects.get(0).getClassType()).isEqualTo(BPet.class.getName()); assertThat(dataObjects.get(0).getProperties()).isEmpty(); }
@Test public void testLoadDataObjects_ResolvedJavaPrimitiveProperties() { final Maps.Builder<String, ModelField[]> modelFieldsBuilder = new Maps.Builder<>(); modelFieldsBuilder.put(APerson.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, APerson.class.getName(), APerson.class.getSimpleName()), newModelField("booleanField", "boolean", DataType.TYPE_BOOLEAN), newModelField("byteField", "byte", DataType.TYPE_NUMERIC_BYTE), newModelField("charField", "char", DataType.TYPE_STRING), newModelField("floatField", "float", DataType.TYPE_NUMERIC_FLOAT), newModelField("intField", "int", DataType.TYPE_NUMERIC_INTEGER), newModelField("longField", "long", DataType.TYPE_NUMERIC_LONG), newModelField("shortField", "short", DataType.TYPE_NUMERIC_SHORT), newModelField("doubleField", "double", DataType.TYPE_NUMERIC_DOUBLE) }); final Map<String, ModelField[]> modelFields = modelFieldsBuilder.build(); dataModelOracle.addModuleModelFields(modelFields); final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isNotEmpty(); assertThat(dataObjects).hasSize(1); assertThat(dataObjects.get(0).getClassType()).isEqualTo(APerson.class.getName()); assertThat(dataObjects.get(0).getProperties()).hasSize(8); assertThat(dataObjects.get(0).getProperties().get(0).getProperty()).isEqualTo("booleanField"); assertThat(dataObjects.get(0).getProperties().get(0).getType()).isEqualTo(BuiltInType.BOOLEAN.getName()); assertThat(dataObjects.get(0).getProperties().get(1).getProperty()).isEqualTo("byteField"); assertThat(dataObjects.get(0).getProperties().get(1).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(2).getProperty()).isEqualTo("charField"); assertThat(dataObjects.get(0).getProperties().get(2).getType()).isEqualTo(BuiltInType.STRING.getName()); assertThat(dataObjects.get(0).getProperties().get(3).getProperty()).isEqualTo("floatField"); assertThat(dataObjects.get(0).getProperties().get(3).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(4).getProperty()).isEqualTo("intField"); assertThat(dataObjects.get(0).getProperties().get(4).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(5).getProperty()).isEqualTo("longField"); assertThat(dataObjects.get(0).getProperties().get(5).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(6).getProperty()).isEqualTo("shortField"); assertThat(dataObjects.get(0).getProperties().get(6).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(7).getProperty()).isEqualTo("doubleField"); assertThat(dataObjects.get(0).getProperties().get(7).getType()).isEqualTo(BuiltInType.NUMBER.getName()); }
@Test public void testLoadDataObjects_ResolvedJavaBoxedProperties() { final Maps.Builder<String, ModelField[]> modelFieldsBuilder = new Maps.Builder<>(); modelFieldsBuilder.put(APerson.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, APerson.class.getName(), APerson.class.getSimpleName()), newModelField("booleanField", Boolean.class.getName(), DataType.TYPE_BOOLEAN), newModelField("byteField", Byte.class.getName(), DataType.TYPE_NUMERIC_BYTE), newModelField("charField", Character.class.getName(), DataType.TYPE_STRING), newModelField("floatField", Float.class.getName(), DataType.TYPE_NUMERIC_FLOAT), newModelField("intField", Integer.class.getName(), DataType.TYPE_NUMERIC_INTEGER), newModelField("longField", Long.class.getName(), DataType.TYPE_NUMERIC_LONG), newModelField("shortField", Short.class.getName(), DataType.TYPE_NUMERIC_SHORT), newModelField("doubleField", Double.class.getName(), DataType.TYPE_NUMERIC_DOUBLE) }); final Map<String, ModelField[]> modelFields = modelFieldsBuilder.build(); dataModelOracle.addModuleModelFields(modelFields); final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isNotEmpty(); assertThat(dataObjects).hasSize(1); assertThat(dataObjects.get(0).getClassType()).isEqualTo(APerson.class.getName()); assertThat(dataObjects.get(0).getProperties()).hasSize(8); assertThat(dataObjects.get(0).getProperties().get(0).getProperty()).isEqualTo("booleanField"); assertThat(dataObjects.get(0).getProperties().get(0).getType()).isEqualTo(BuiltInType.BOOLEAN.getName()); assertThat(dataObjects.get(0).getProperties().get(1).getProperty()).isEqualTo("byteField"); assertThat(dataObjects.get(0).getProperties().get(1).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(2).getProperty()).isEqualTo("charField"); assertThat(dataObjects.get(0).getProperties().get(2).getType()).isEqualTo(BuiltInType.STRING.getName()); assertThat(dataObjects.get(0).getProperties().get(3).getProperty()).isEqualTo("floatField"); assertThat(dataObjects.get(0).getProperties().get(3).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(4).getProperty()).isEqualTo("intField"); assertThat(dataObjects.get(0).getProperties().get(4).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(5).getProperty()).isEqualTo("longField"); assertThat(dataObjects.get(0).getProperties().get(5).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(6).getProperty()).isEqualTo("shortField"); assertThat(dataObjects.get(0).getProperties().get(6).getType()).isEqualTo(BuiltInType.NUMBER.getName()); assertThat(dataObjects.get(0).getProperties().get(7).getProperty()).isEqualTo("doubleField"); assertThat(dataObjects.get(0).getProperties().get(7).getType()).isEqualTo(BuiltInType.NUMBER.getName()); }
@Test public void testLoadDataObjects_ResolvedCustomProperty() { final Maps.Builder<String, ModelField[]> modelFieldsBuilder = new Maps.Builder<>(); modelFieldsBuilder.put(APerson.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, APerson.class.getName(), APerson.class.getSimpleName()) }); modelFieldsBuilder.put(CFamily.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, CFamily.class.getName(), CFamily.class.getSimpleName()), newModelField("mother", APerson.class.getName(), APerson.class.getSimpleName()) }); final Map<String, ModelField[]> modelFields = modelFieldsBuilder.build(); dataModelOracle.addModuleModelFields(modelFields); final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isNotEmpty(); assertThat(dataObjects).hasSize(2); assertThat(dataObjects.get(0).getClassType()).isEqualTo(APerson.class.getName()); assertThat(dataObjects.get(0).getProperties()).isEmpty(); assertThat(dataObjects.get(1).getClassType()).isEqualTo(CFamily.class.getName()); assertThat(dataObjects.get(1).getProperties()).hasSize(1); assertThat(dataObjects.get(1).getProperties().get(0).getProperty()).isEqualTo("mother"); assertThat(dataObjects.get(1).getProperties().get(0).getType()).isEqualTo(APerson.class.getName()); }
@Test public void testLoadDataObjects_UnknownCustomProperty() { final Maps.Builder<String, ModelField[]> modelFieldsBuilder = new Maps.Builder<>(); modelFieldsBuilder.put(CFamily.class.getName(), new ModelField[]{ newModelField(DataType.TYPE_THIS, CFamily.class.getName(), CFamily.class.getSimpleName()), newModelField("mother", APerson.class.getName(), APerson.class.getSimpleName()) }); final Map<String, ModelField[]> modelFields = modelFieldsBuilder.build(); dataModelOracle.addModuleModelFields(modelFields); final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isNotEmpty(); assertThat(dataObjects).hasSize(1); assertThat(dataObjects.get(0).getClassType()).isEqualTo(CFamily.class.getName()); assertThat(dataObjects.get(0).getProperties()).hasSize(1); assertThat(dataObjects.get(0).getProperties().get(0).getProperty()).isEqualTo("mother"); assertThat(dataObjects.get(0).getProperties().get(0).getType()).isEqualTo(BuiltInType.ANY.getName()); }
@Test public void testLoadDataObjects_NoJavaFilesAvailable() { final List<DataObject> dataObjects = service.loadDataObjects(workspaceProject); assertThat(dataObjects).isEmpty(); }
|
WiresUtils { public static boolean isWiresShape(final ShapeView<?> shapeView) { return shapeView instanceof WiresShape; } static Point2D getAbsolute(final IDrawable<?> shape); static Node getNode(final AbstractCanvasHandler canvasHandler,
final WiresContainer shape); static Node getNode(final AbstractCanvasHandler canvasHandler,
final WiresMagnet magnet); static Edge getEdge(final AbstractCanvasHandler canvasHandler,
final WiresConnector connector); static boolean isWiresShape(final ShapeView<?> shapeView); static boolean isWiresContainer(final ShapeView<?> shapeView); static boolean isWiresConnector(final ShapeView<?> shapeView); static boolean isWiresShape(final WiresContainer wiresShape); static boolean isWiresLayer(final WiresContainer wiresShape); static void assertShapeUUID(final IDrawable<?> shape,
final String uuid); static String getShapeUUID(final IDrawable<?> shape); static void assertShapeGroup(final IDrawable<?> shape,
final String group); static String getShapeGroup(final IDrawable<?> shape); }
|
@Test public void isWiresShapeWhenWiresContainer() { final WiresContainer wc = new WiresContainer(new Group()); assertFalse(WiresUtils.isWiresShape(wc)); }
@Test public void isWiresShapeWhenWiresLayer() { final Layer l = new Layer(); final WiresLayer wl = new WiresLayer(l); assertTrue(WiresUtils.isWiresShape(wl)); }
@Test public void isWiresShapeWhenUnregisteredWiresShape() { final WiresShape ws = new WiresShape(new MultiPath()); assertFalse(WiresUtils.isWiresShape(ws)); }
|
DelegateNativeContext2D implements INativeContext2D { public void initDeviceRatio() { } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void initDeviceRatio() { delegateNativeContext2D.initDeviceRatio(); }
|
DelegateNativeContext2D implements INativeContext2D { @Override public void saveContainer(String id) { HashMap<String, String> map = new HashMap<>(); if (canvasHandler.getGraphIndex().get(id) != null) { map.put(DEFAULT_NODE_ID, id); map.put(svgNodeId, id); } context.saveGroup(map); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void saveContainer() { delegateNativeContext2D.saveContainer(NODE_UUID); verify(context, times(1)).saveGroup(new HashMap<String, String>() {{ put(SVG_NODE_ID, NODE_UUID); put(DelegateNativeContext2D.DEFAULT_NODE_ID, NODE_UUID); }}); }
|
DelegateNativeContext2D implements INativeContext2D { @Override public void restoreContainer() { context.restoreGroup(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void restoreContainer() { delegateNativeContext2D.restoreContainer(); verify(context, times(1)).restoreGroup(); }
|
DelegateNativeContext2D implements INativeContext2D { public void save() { context.saveStyle(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void save() { delegateNativeContext2D.save(); verify(context, times(1)).saveStyle(); }
|
DelegateNativeContext2D implements INativeContext2D { public void restore() { context.restoreStyle(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void restore() { delegateNativeContext2D.restore(); verify(context, times(1)).restoreStyle(); }
|
DelegateNativeContext2D implements INativeContext2D { public void beginPath() { context.beginPath(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void beginPath() { delegateNativeContext2D.beginPath(); verify(context, times(1)).beginPath(); }
|
DelegateNativeContext2D implements INativeContext2D { public void closePath() { context.closePath(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void closePath() { delegateNativeContext2D.closePath(); verify(context, times(1)).closePath(); }
|
DelegateNativeContext2D implements INativeContext2D { public void moveTo(double x, double y) { context.moveTo(x, y); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void moveTo() { delegateNativeContext2D.moveTo(1, 1); verify(context, times(1)).moveTo(1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void lineTo(double x, double y) { context.lineTo(x, y); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void lineTo() { delegateNativeContext2D.lineTo(1, 1); verify(context, times(1)).lineTo(1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void setGlobalCompositeOperation(String operation) { context.setGlobalCompositeOperation(operation); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setGlobalCompositeOperation() { delegateNativeContext2D.setGlobalCompositeOperation("op"); verify(context, times(1)).setGlobalCompositeOperation("op"); }
|
DelegateNativeContext2D implements INativeContext2D { public void setLineCap(String lineCap) { context.setLineCap(lineCap); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setLineCap() { delegateNativeContext2D.setLineCap("linecap"); verify(context, times(1)).setLineCap("linecap"); }
|
DelegateNativeContext2D implements INativeContext2D { public void setLineJoin(String lineJoin) { context.setLineJoin(lineJoin); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setLineJoin() { delegateNativeContext2D.setLineJoin("line"); verify(context, times(1)).setLineJoin("line"); }
|
DelegateNativeContext2D implements INativeContext2D { public void quadraticCurveTo(double cpx, double cpy, double x, double y) { context.quadraticCurveTo(cpx, cpy, x, y); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void quadraticCurveTo() { delegateNativeContext2D.quadraticCurveTo(1, 1, 1, 1); verify(context, times(1)).quadraticCurveTo(1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void arc(double x, double y, double radius, double startAngle, double endAngle) { context.arc(x, y, radius, startAngle, endAngle); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void arc() { delegateNativeContext2D.arc(1, 1, 1, 1, 1); verify(context, times(1)).arc(1, 1, 1, 1, 1); }
@Test public void arc1() { delegateNativeContext2D.arc(1, 1, 1, 1, 1, true); verify(context, times(1)).arc(1, 1, 1, 1, 1, true); }
|
DelegateNativeContext2D implements INativeContext2D { public void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac) { context.ellipse(x, y, rx, ry, ro, sa, ea, ac); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void ellipse() { delegateNativeContext2D.ellipse(1, 1, 1, 1, 1, 1, 1); verify(context, times(1)).ellipse(1, 1, 1, 1, 1, 1, 1); }
@Test public void ellipse1() { delegateNativeContext2D.ellipse(1, 1, 1, 1, 1, 1, 1, true); verify(context, times(1)).ellipse(1, 1, 1, 1, 1, 1, 1, true); }
|
LiteralExpressionPropertyConverter { public static LiteralExpression wbFromDMN(final JSITLiteralExpression dmn) { if (Objects.isNull(dmn)) { return null; } final Id id = IdPropertyConverter.wbFromDMN(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); final Text text = new Text(Objects.nonNull(dmn.getText()) ? dmn.getText() : ""); final ExpressionLanguage expressionLanguage = ExpressionLanguagePropertyConverter.wbFromDMN(dmn.getExpressionLanguage()); final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues()); final LiteralExpression result = new LiteralExpression(id, description, typeRef, text, importedValues, expressionLanguage); if (Objects.nonNull(importedValues)) { importedValues.setParent(result); } return result; } static LiteralExpression wbFromDMN(final JSITLiteralExpression dmn); static JSITLiteralExpression dmnFromWB(final IsLiteralExpression wb); }
|
@Test public void testWBFromDMN() { when(literalExpression.getId()).thenReturn(UUID); when(literalExpression.getDescription()).thenReturn(DESCRIPTION); when(literalExpression.getTypeRef()).thenReturn(TYPE_REF); when(literalExpression.getText()).thenReturn(TEXT); when(literalExpression.getExpressionLanguage()).thenReturn(EXPRESSION_LANGUAGE); when(literalExpression.getImportedValues()).thenReturn(jsitImportedValues); when(jsitImportedValues.getImportedElement()).thenReturn(IMPORTED_ELEMENT); final LiteralExpression result = LiteralExpressionPropertyConverter.wbFromDMN(literalExpression); assertThat(result.getId().getValue()).isEqualTo(UUID); assertThat(result.getDescription().getValue()).isEqualTo(DESCRIPTION); assertThat(result.getTypeRef().getNamespaceURI()).isEmpty(); assertThat(result.getTypeRef().getLocalPart()).isEqualTo(TYPE_REF); assertThat(result.getText().getValue()).isEqualTo(TEXT); assertThat(result.getExpressionLanguage().getValue()).isEqualTo(EXPRESSION_LANGUAGE); assertThat(result.getImportedValues().getImportedElement()).isEqualTo(IMPORTED_ELEMENT); assertThat(result.getImportedValues().getParent()).isEqualTo(result); }
|
DelegateNativeContext2D implements INativeContext2D { public void arcTo(double x1, double y1, double x2, double y2, double radius) { context.arcTo(x1, y1, x2, y2, radius); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void arcTo() { delegateNativeContext2D.arcTo(1, 1, 1, 1, 1); verify(context, times(1)).arcTo(1, 1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y) { context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void bezierCurveTo() { delegateNativeContext2D.bezierCurveTo(1, 1, 1, 1, 1, 1); verify(context, times(1)).bezierCurveTo(1, 1, 1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void clearRect(double x, double y, double w, double h) { context.clearRect(x, y, w, h); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void clearRect() { delegateNativeContext2D.clearRect(1, 1, 1, 1); verify(context, times(1)).clearRect(1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void clip() { context.clip(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void clip() { delegateNativeContext2D.clip(); verify(context, times(1)).clip(); }
@Test(expected = UnsupportedOperationException.class) public void clip2() { final Path2D.NativePath2D path = null; delegateNativeContext2D.clip(path); }
|
DelegateNativeContext2D implements INativeContext2D { public void fill() { context.fill(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void fill() { delegateNativeContext2D.fill(); verify(context, times(1)).fill(); }
|
DelegateNativeContext2D implements INativeContext2D { public void stroke() { context.stroke(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void stroke() { delegateNativeContext2D.stroke(); verify(context, times(1)).stroke(); }
|
DelegateNativeContext2D implements INativeContext2D { public void fillRect(double x, double y, double w, double h) { context.fillRect(x, y, w, h); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void fillRect() { delegateNativeContext2D.fillRect(1, 1, 1, 1); verify(context, times(1)).fillRect(1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void fillText(String text, double x, double y) { context.fillText(text, x, y); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void fillText() { delegateNativeContext2D.fillText("text", 1, 1); verify(context, times(1)).fillText("text", 1, 1); }
@Test public void fillText1() { delegateNativeContext2D.fillText("text", 1, 1, 1); verify(context, times(1)).fillText("text", 1, 1); }
|
LiteralExpressionPropertyConverter { public static JSITLiteralExpression dmnFromWB(final IsLiteralExpression wb) { if (Objects.isNull(wb)) { return null; } final JSITLiteralExpression result = LITERAL_EXPRESSION_PROVIDER.make(); result.setId(wb.getId().getValue()); final String description = wb.getDescription().getValue(); if (StringUtils.nonEmpty(description)) { result.setDescription(description); } if (wb instanceof LiteralExpression) { final String expressionLanguage = ((LiteralExpression) wb).getExpressionLanguage().getValue(); if (StringUtils.nonEmpty(expressionLanguage)) { result.setExpressionLanguage(expressionLanguage); } } QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); result.setText(wb.getText().getValue()); final JSITImportedValues importedValues = ImportedValuesConverter.dmnFromWB(wb.getImportedValues()); if (Objects.nonNull(importedValues)) { result.setImportedValues(importedValues); } return result; } static LiteralExpression wbFromDMN(final JSITLiteralExpression dmn); static JSITLiteralExpression dmnFromWB(final IsLiteralExpression wb); }
|
@Test public void testDMNFromWB() { when(wb.getId()).thenReturn(new Id(UUID)); when(wb.getDescription()).thenReturn(new Description(DESCRIPTION)); when(wb.getTypeRef()).thenReturn(new QName(KIE.getUri(), TYPE_REF, KIE.getPrefix())); when(wb.getText()).thenReturn(new Text(TEXT)); when(wb.getExpressionLanguage()).thenReturn(new ExpressionLanguage(EXPRESSION_LANGUAGE)); final JSITLiteralExpression result = LiteralExpressionPropertyConverter.dmnFromWB(wb); verify(result).setId(UUID); verify(result).setDescription(DESCRIPTION); verify(result).setTypeRef("{" + KIE.getUri() + "}" + TYPE_REF); verify(result).setText(TEXT); verify(result).setExpressionLanguage(EXPRESSION_LANGUAGE); }
|
DelegateNativeContext2D implements INativeContext2D { public void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color) { throwException(); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test(expected = UnsupportedOperationException.class) public void fillTextWithGradient() { delegateNativeContext2D.fillTextWithGradient("text", 1, 1, 1, 1, 1, 1, "black"); }
|
DelegateNativeContext2D implements INativeContext2D { public void setFillColor(String fill) { context.setFillStyle(fill); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setFillColor() { delegateNativeContext2D.setFillColor("black"); verify(context, times(1)).setFillStyle("black"); }
|
DelegateNativeContext2D implements INativeContext2D { public void rect(double x, double y, double w, double h) { context.rect(x, y, w, h); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void rect() { delegateNativeContext2D.rect(1, 1, 1, 1); verify(context, times(1)).rect(1, 1, 1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void rotate(double angle) { context.rotate(angle); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void rotate() { delegateNativeContext2D.rotate(1); verify(context, times(1)).rotate(1); }
|
DelegateNativeContext2D implements INativeContext2D { public void scale(double sx, double sy) { context.scale(sx, sy); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void scale() { delegateNativeContext2D.scale(1, 1); verify(context, times(1)).scale(1, 1); }
|
DelegateNativeContext2D implements INativeContext2D { public void setStrokeColor(String color) { context.setStrokeStyle(color); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setStrokeColor() { delegateNativeContext2D.setStrokeColor("black"); verify(context, times(1)).setStrokeStyle("black"); }
|
DelegateNativeContext2D implements INativeContext2D { public void setStrokeWidth(double width) { context.setLineWidth(width); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setStrokeWidth() { delegateNativeContext2D.setStrokeWidth(1); verify(context, times(1)).setLineWidth(1); }
|
DelegateNativeContext2D implements INativeContext2D { public void setImageSmoothingEnabled(boolean enabled) { context.setImageSmoothingEnabled(enabled); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setImageSmoothingEnabled() { delegateNativeContext2D.setImageSmoothingEnabled(true); verify(context, times(1)).setImageSmoothingEnabled(true); }
|
DelegateNativeContext2D implements INativeContext2D { public void setFillGradient(LinearGradient.LinearGradientJSO grad) { setFillColor(null); } DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler); DelegateNativeContext2D(IContext2D context, AbstractCanvasHandler canvasHandler, Converter converter); void initDeviceRatio(); @Override void saveContainer(String id); @Override void restoreContainer(); void save(); void save(String id); void restore(); void beginPath(); void closePath(); void moveTo(double x, double y); void lineTo(double x, double y); void setGlobalCompositeOperation(String operation); void setLineCap(String lineCap); void setLineJoin(String lineJoin); void quadraticCurveTo(double cpx, double cpy, double x, double y); void arc(double x, double y, double radius, double startAngle, double endAngle); void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac); void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea); void arcTo(double x1, double y1, double x2, double y2, double radius); void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); void clearRect(double x, double y, double w, double h); void clip(); void fill(); void stroke(); void fillRect(double x, double y, double w, double h); void fillText(String text, double x, double y); void fillTextWithGradient(String text, double x, double y, double sx, double sy, double ex, double ey, String color); void fillText(String text, double x, double y, double maxWidth); void setFillColor(String fill); void rect(double x, double y, double w, double h); void rotate(double angle); void scale(double sx, double sy); void setStrokeColor(String color); void setStrokeWidth(double width); void setImageSmoothingEnabled(boolean enabled); void setFillGradient(LinearGradient.LinearGradientJSO grad); void setFillGradient(PatternGradient.PatternGradientJSO grad); void setFillGradient(RadialGradient.RadialGradientJSO grad); void transform(Transform.TransformJSO jso); void transform(double d0, double d1, double d2, double d3, double d4, double d5); void setTransform(Transform.TransformJSO jso); void setTransform(double d0, double d1, double d2, double d3, double d4, double d5); void setToIdentityTransform(); void setTextFont(String font); void setTextBaseline(String baseline); void setTextAlign(String align); void strokeText(String text, double x, double y); void setGlobalAlpha(double alpha); void translate(double x, double y); void setShadow(Shadow.ShadowJSO shadow); boolean isSupported(String feature); boolean isPointInPath(double x, double y); ImageData getImageData(double x, double y, double width, double height); ImageData createImageData(double width, double height); ImageData createImageData(ImageData data); void putImageData(ImageData image, double x, double y); void putImageData(ImageData image, double x, double y, double dx, double dy, double dw, double dh); TextMetrics measureText(String text); void drawImage(Element image, double x, double y); void drawImage(Element image, double x, double y, double w, double h); void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h); void resetClip(); void setMiterLimit(double limit); void setLineDash(NFastDoubleArrayJSO dashes); void setLineDashOffset(double offset); double getBackingStorePixelRatio(); boolean path(PathPartList.PathPartListJSO list); boolean clip(PathPartList.PathPartListJSO list); void fill(Path2D.NativePath2D path); void stroke(Path2D.NativePath2D path); void clip(Path2D.NativePath2D path); Path2D.NativePath2D getCurrentPath(); void setCurrentPath(Path2D.NativePath2D path); IContext2D getDelegate(); }
|
@Test public void setFillGradientLinear() { delegateNativeContext2D.setFillGradient(linearGradientJSO); verify(context, times(1)).setFillStyle(null); }
@Test public void setFillGradientRadial() { delegateNativeContext2D.setFillGradient(radialGradientJSO); verify(context, times(1)).setFillStyle(null); }
@Test public void setFillGradientPattern() { delegateNativeContext2D.setFillGradient(patternGradientJSO); verify(context, times(1)).setFillStyle(null); }
|
OutputClauseLiteralExpressionPropertyConverter { public static OutputClauseLiteralExpression wbFromDMN(final JSITLiteralExpression dmn) { if (Objects.isNull(dmn)) { return new OutputClauseLiteralExpression(); } final Id id = IdPropertyConverter.wbFromDMN(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); final Text text = new Text(dmn.getText()); final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues()); final OutputClauseLiteralExpression result = new OutputClauseLiteralExpression(id, description, typeRef, text, importedValues); if (Objects.nonNull(importedValues)) { importedValues.setParent(result); } return result; } static OutputClauseLiteralExpression wbFromDMN(final JSITLiteralExpression dmn); static JSITLiteralExpression dmnFromWB(final OutputClauseLiteralExpression wb); }
|
@Test public void testWBFromDMNWhenNull() { final OutputClauseLiteralExpression wb = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(null); assertThat(wb).isNotNull(); }
@Test public void testWBFromDMNWhenNonNull() { when(jsitLiteralExpression.getText()).thenReturn(TEXT); final OutputClauseLiteralExpression wb = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(jsitLiteralExpression); assertThat(wb).isNotNull(); assertThat(wb.getText().getValue()).isEqualTo(TEXT); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.