final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
gridModelProps.getPropertyValue( "GridDataModel" ) );
assertNotNull( dataModel );
assertEquals( 0, dataModel.getColumnCount() );
final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
gridModelProps.getPropertyValue( "ColumnModel" ) );
assertNotNull( columnModel );
assertEquals( 0, columnModel.getColumnCount() );
final int columnCount = 3;
final int rowCount = 2;
dataModel.addRow( null, new Object[] { 1, 2, 3 } );
dataModel.addRow( null, new Object[] { 6, 5, 4 } );
assertEquals( columnCount, dataModel.getColumnCount() );
assertEquals( columnCount, columnModel.getColumnCount() );
// some cursor traveling
final XGridControl gridControl = UnoRuntime.queryInterface( XGridControl.class, control );
gridControl.goToCell( 0, 0 );
assertEquals( "wrong 'current column' (1)", 0, gridControl.getCurrentColumn() );
assertEquals( "wrong 'current row' (1)", 0, gridControl.getCurrentRow() );
gridControl.goToCell( columnCount - 1, rowCount - 1 );
assertEquals( "wrong 'current column' (2)", dataModel.getColumnCount() - 1, gridControl.getCurrentColumn() );
assertEquals( "wrong 'current row' (2)", dataModel.getRowCount() - 1, gridControl.getCurrentRow() );
// removing the last column, while the active cell is in this very last column, is expected to adjust
// the active cell
columnModel.removeColumn( columnCount - 1 );
assertEquals( "removed the last and active column, active column was not adjusted!",
columnCount - 2, gridControl.getCurrentColumn() );
// same holds for rows
dataModel.removeRow( rowCount - 1 );
assertEquals( "removed the last and active row, active row was not adjusted!",