@Test
public void onlyOneRowSelectedAtAnyTime() {
selectionLayer.getSelectionModel().setMultipleSelectionAllowed(false);
selectionLayer.clear();
selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 1, 0,
false, true));
Collection<PositionCoordinate> cells = ArrayUtil
.asCollection(selectionLayer.getSelectedCellPositions());
Assert.assertEquals(selectionLayer.getColumnCount(), cells.size());
Assert.assertEquals(1, selectionLayer.getSelectedRowCount());
// select another cell with control mask
selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 2, 1,
false, true));
cells = ArrayUtil.asCollection(selectionLayer
.getSelectedCellPositions());
Assert.assertEquals(selectionLayer.getColumnCount(), cells.size());
Assert.assertEquals(1, selectionLayer.getSelectedRowCount());
// select additional cells with shift mask
selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 2, 10,
true, false));
cells = ArrayUtil.asCollection(selectionLayer
.getSelectedCellPositions());
Assert.assertEquals(selectionLayer.getColumnCount(), cells.size());
Assert.assertEquals(1, selectionLayer.getSelectedRowCount());
// select additional cells with shift mask
selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 10, 0,
true, false));
cells = ArrayUtil.asCollection(selectionLayer
.getSelectedCellPositions());
Assert.assertEquals(selectionLayer.getColumnCount(), cells.size());