}
grid.add(label);
}
// Set Row Sizes
grid.setRowHeight(0, new Extent(1));
grid.setRowHeight(1, new Extent(2));
grid.setRowHeight(2, new Extent(4));
grid.setRowHeight(3, new Extent(8));
grid.setRowHeight(4, new Extent(16));
grid.setRowHeight(5, new Extent(32));
grid.setRowHeight(6, new Extent(64));
GridProcessor gridProcessor = new GridProcessor(grid);
// Verify Grid size is correct.
assertEquals(3, gridProcessor.getColumnCount());
assertEquals(5, gridProcessor.getRowCount());
// Verify components are at correct positions.
assertEquals(0, gridProcessor.getComponentIndex(0, 0));
assertEquals(1, gridProcessor.getComponentIndex(1, 0));
assertEquals(2, gridProcessor.getComponentIndex(2, 0));
assertEquals(3, gridProcessor.getComponentIndex(0, 1));
assertEquals(4, gridProcessor.getComponentIndex(1, 1));
assertEquals(5, gridProcessor.getComponentIndex(2, 1));
assertEquals(6, gridProcessor.getComponentIndex(0, 2));
assertEquals(7, gridProcessor.getComponentIndex(1, 2));
assertEquals(8, gridProcessor.getComponentIndex(2, 2));
assertEquals(6, gridProcessor.getComponentIndex(0, 3));
assertEquals(9, gridProcessor.getComponentIndex(1, 3));
assertEquals(8, gridProcessor.getComponentIndex(2, 3));
assertEquals(10, gridProcessor.getComponentIndex(0, 4));
assertEquals(11, gridProcessor.getComponentIndex(1, 4));
assertEquals(11, gridProcessor.getComponentIndex(2, 4));
// Verify x-spans were untouched.
assertEquals(1, gridProcessor.getColumnSpan(0, 0));
assertEquals(1, gridProcessor.getColumnSpan(1, 0));
assertEquals(1, gridProcessor.getColumnSpan(2, 0));
assertEquals(1, gridProcessor.getColumnSpan(0, 1));
assertEquals(1, gridProcessor.getColumnSpan(1, 1));
assertEquals(1, gridProcessor.getColumnSpan(2, 1));
assertEquals(1, gridProcessor.getColumnSpan(0, 2));
assertEquals(1, gridProcessor.getColumnSpan(1, 2));
assertEquals(1, gridProcessor.getColumnSpan(2, 2));
assertEquals(1, gridProcessor.getColumnSpan(0, 3));
assertEquals(1, gridProcessor.getColumnSpan(1, 3));
assertEquals(1, gridProcessor.getColumnSpan(2, 3));
assertEquals(1, gridProcessor.getColumnSpan(0, 4));
assertEquals(2, gridProcessor.getColumnSpan(1, 4));
assertEquals(2, gridProcessor.getColumnSpan(2, 4));
// Verify y-spans were properly reduced.
assertEquals(1, gridProcessor.getRowSpan(0, 0));
assertEquals(1, gridProcessor.getRowSpan(1, 0));
assertEquals(1, gridProcessor.getRowSpan(2, 0));
assertEquals(1, gridProcessor.getRowSpan(0, 1));
assertEquals(1, gridProcessor.getRowSpan(1, 1));
assertEquals(1, gridProcessor.getRowSpan(2, 1));
assertEquals(2, gridProcessor.getRowSpan(0, 2));
assertEquals(1, gridProcessor.getRowSpan(1, 2));
assertEquals(2, gridProcessor.getRowSpan(2, 2));
assertEquals(2, gridProcessor.getRowSpan(0, 3));
assertEquals(1, gridProcessor.getRowSpan(1, 3));
assertEquals(2, gridProcessor.getRowSpan(2, 3));
assertEquals(1, gridProcessor.getRowSpan(0, 4));
assertEquals(1, gridProcessor.getRowSpan(1, 4));
assertEquals(1, gridProcessor.getRowSpan(2, 4));
// Verify column sizes were properly combined.
assertEquals(new Extent(1), gridProcessor.getRowHeight(0));
assertEquals(new Extent(6), gridProcessor.getRowHeight(1));
assertEquals(new Extent(8), gridProcessor.getRowHeight(2));
assertEquals(new Extent(16), gridProcessor.getRowHeight(3));
assertEquals(new Extent(96), gridProcessor.getRowHeight(4));
}