handler.setCurrentShape(shell);
// should selct 1 point
handler.getMouseTracker().setDragStarted(Point.valueOf(0,0));
MapMouseEvent event = new MapMouseEvent(null, 11, 11, MapMouseEvent.NONE, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 11, 11, MapMouseEvent.NONE, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(1, handler.getEditBlackboard().getSelection().size());
assertEquals(Point.valueOf(0,10), handler.getEditBlackboard().getSelection().iterator().next());
// should replace old selection of (0,10) with 20,20
handler.getMouseTracker().setDragStarted(Point.valueOf(30,30));
event = new MapMouseEvent(null, 19, 19, MapMouseEvent.NONE, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 19, 19, MapMouseEvent.NONE, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(1, handler.getEditBlackboard().getSelection().size());
assertEquals(Point.valueOf(20,20), handler.getEditBlackboard().getSelection().iterator().next());
// should add (0,10) to selection
handler.getMouseTracker().setDragStarted(Point.valueOf(0,0));
event = new MapMouseEvent(null, 11, 11, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 11, 11, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(2, handler.getEditBlackboard().getSelection().size());
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,20)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(0,10)));
// should add all points to selection
handler.getMouseTracker().setDragStarted(Point.valueOf(0,0));
event = new MapMouseEvent(null, 30, 30, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 30,30, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(4, handler.getEditBlackboard().getSelection().size());
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(0,10)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,10)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,20)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,20)));
// should make no change
handler.getMouseTracker().setDragStarted(Point.valueOf(0,0));
event = new MapMouseEvent(null, 1, 1, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 1,1, MapMouseEvent.SHIFT_DOWN_MASK, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(4, handler.getEditBlackboard().getSelection().size());
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(0,10)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,10)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(20,20)));
assertTrue(handler.getEditBlackboard().getSelection().contains(Point.valueOf(10,20)));
// should clear selection
handler.getMouseTracker().setDragStarted(Point.valueOf(0,0));
event = new MapMouseEvent(null, 1, 1, MapMouseEvent.NONE, MapMouseEvent.BUTTON1,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.DRAGGED);
event = new MapMouseEvent(null, 1,1, MapMouseEvent.NONE, MapMouseEvent.NONE,
MapMouseEvent.BUTTON1);
handler.handleEvent(event, EventType.RELEASED);
assertEquals(0, handler.getEditBlackboard().getSelection().size());
}