label.setLayoutData(layoutData);
}
grid.add(label);
}
GridProcessor gridProcessor = new GridProcessor(grid);
// Verify Grid size is correct.
assertEquals(2, gridProcessor.getColumnCount());
assertEquals(6, gridProcessor.getRowCount());
// Verify components are at correct positions.
assertEquals(0, gridProcessor.getComponentIndex(0, 0));
assertEquals(1, gridProcessor.getComponentIndex(1, 0));
assertEquals(2, gridProcessor.getComponentIndex(0, 1));
assertEquals(3, gridProcessor.getComponentIndex(1, 1));
assertEquals(4, gridProcessor.getComponentIndex(0, 2));
assertEquals(4, gridProcessor.getComponentIndex(1, 2));
assertEquals(5, gridProcessor.getComponentIndex(0, 3));
assertEquals(6, gridProcessor.getComponentIndex(1, 3));
assertEquals(7, gridProcessor.getComponentIndex(0, 4));
assertEquals(8, gridProcessor.getComponentIndex(1, 4));
assertEquals(9, gridProcessor.getComponentIndex(0, 5));
assertEquals(-1, gridProcessor.getComponentIndex(1, 5));
// Verify x-spans were untouched for the most part,
// except for oversized cell which is reduced.
assertEquals(1, gridProcessor.getColumnSpan(0, 0));
assertEquals(1, gridProcessor.getColumnSpan(1, 0));
assertEquals(1, gridProcessor.getColumnSpan(0, 1));
assertEquals(1, gridProcessor.getColumnSpan(1, 1));
assertEquals(2, gridProcessor.getColumnSpan(0, 2));
assertEquals(2, gridProcessor.getColumnSpan(1, 2));
assertEquals(1, gridProcessor.getColumnSpan(0, 3));
assertEquals(1, gridProcessor.getColumnSpan(1, 3));
assertEquals(1, gridProcessor.getColumnSpan(0, 4));
assertEquals(1, gridProcessor.getColumnSpan(1, 4));
assertEquals(1, gridProcessor.getColumnSpan(0, 5));
assertEquals(-1, gridProcessor.getColumnSpan(1, 5));
// Verify y-spans were properly reduced.
assertEquals(1, gridProcessor.getRowSpan(0, 0));
assertEquals(1, gridProcessor.getRowSpan(1, 0));
assertEquals(1, gridProcessor.getRowSpan(0, 1));
assertEquals(1, gridProcessor.getRowSpan(1, 1));
assertEquals(1, gridProcessor.getRowSpan(0, 2));
assertEquals(1, gridProcessor.getRowSpan(1, 2));
assertEquals(1, gridProcessor.getRowSpan(0, 3));
assertEquals(1, gridProcessor.getRowSpan(1, 3));
assertEquals(1, gridProcessor.getRowSpan(0, 4));
assertEquals(1, gridProcessor.getRowSpan(1, 4));
assertEquals(1, gridProcessor.getRowSpan(0, 5));
assertEquals(-1, gridProcessor.getRowSpan(1, 5));
}