@Override //When entering a DecoratedWorkbenchPanel show the Compass public void onEnter(DragContext context) { compass.onEnter(context); }
@Override //Hide the DecoratedWorkbenchPanel's Compass public void onLeave(DragContext context) { compass.onLeave(context); }
@Override public void onMove(DragContext context) { compass.onMove(context); }
@Test public void compassDelegationTest() { CompassWidget compass = compassDropController.compass; DragContext dragContext = mock(DragContext.class); compassDropController.onEnter(dragContext); verify(compass).onEnter(dragContext); compassDropController.onLeave(dragContext); verify(compass).onLeave(dragContext); compassDropController.onMove(dragContext); verify(compass).onMove(dragContext); }
Position p = compass.getDropPosition(); if (p == CompassPosition.NONE) { return; compass.onDrop(context);
public void mockDropTargetPositionNone() { when(this.compass.getDropPosition()).thenReturn(CompassPosition.NONE); }
@Test public void onDropDoesNothing() { //Mock If not dropTarget has been identified do nothing compassDropController.mockDropTargetPositionNone(); DragContext dragContext = mock(DragContext.class); compassDropController.onDrop(dragContext); verify(compassDropController.compass, never()).onDrop(dragContext); }
@Test public void compassDelegationTest() { CompassWidget compass = compassDropController.compass; DragContext dragContext = mock(DragContext.class); compassDropController.onEnter(dragContext); verify(compass).onEnter(dragContext); compassDropController.onLeave(dragContext); verify(compass).onLeave(dragContext); compassDropController.onMove(dragContext); verify(compass).onMove(dragContext); }
public void mockDropTargetPositionNone() { when(this.compass.getDropPosition()).thenReturn(CompassPosition.NONE); }
@Test public void onDropDoesNothing() { //Mock If not dropTarget has been identified do nothing compassDropController.mockDropTargetPositionNone(); DragContext dragContext = mock(DragContext.class); compassDropController.onDrop(dragContext); verify(compassDropController.compass, never()).onDrop(dragContext); }
public void mockDropTargetPosition(Position position) { when(this.compass.getDropPosition()).thenReturn(position); }
public void mockDropTargetPosition(Position position) { when(this.compass.getDropPosition()).thenReturn(position); }