@Test
public void onlyOneCellSelectedAtAnyTime() {
selectionLayer.getSelectionModel().setMultipleSelectionAllowed(false);
selectionLayer.clear();
selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
false, true));
Collection<PositionCoordinate> cells = ArrayUtil
.asCollection(selectionLayer.getSelectedCellPositions());
assertEquals(1, cells.size());
assertEquals(1, selectionLayer.getSelectedColumnPositions().length);
assertEquals(1, selectionLayer.getSelectedColumnPositions()[0]);
assertEquals(1, selectionLayer.getSelectedRowCount());
// select another column with control mask
selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
false, true));
cells = ArrayUtil.asCollection(selectionLayer
.getSelectedCellPositions());
assertEquals(1, cells.size());
assertEquals(1, selectionLayer.getSelectedColumnPositions().length);
assertEquals(2, selectionLayer.getSelectedColumnPositions()[0]);
assertEquals(1, selectionLayer.getSelectedRowCount());
// select additional columns with shift mask
// only the last column should be selected afterwards
selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 5, 0,
true, false));
cells = ArrayUtil.asCollection(selectionLayer
.getSelectedCellPositions());
assertEquals(1, cells.size());