@Override public SWTGridDescription getGridDescription(SWTGridDescription gridDescription) { if (rendererGridDescription == null) { rendererGridDescription = GridDescriptionFactory.INSTANCE.createSimpleGrid(1, 2, this); for (int i = 0; i < rendererGridDescription.getGrid().size() - 1; i++) { final SWTGridCell swtGridCell = rendererGridDescription.getGrid().get(i); swtGridCell.setHorizontalGrab(false); } } return rendererGridDescription; }
@Test public void testGetGridDescription() { final CompoundControlSWTRenderer renderer = createRenderer(); final SWTGridDescription gridDescription = renderer.getGridDescription(mock(SWTGridDescription.class)); assertEquals(2, gridDescription.getColumns()); assertEquals(1, gridDescription.getRows()); assertEquals(2, gridDescription.getGrid().size()); final SWTGridCell label = gridDescription.getGrid().get(0); assertEquals(0, label.getColumn()); assertEquals(1, label.getHorizontalSpan()); assertEquals(0, label.getRow()); assertSame(renderer, label.getRenderer()); assertTrue(label.isHorizontalFill()); assertFalse(label.isHorizontalGrab()); assertFalse(label.isVerticalFill()); assertFalse(label.isVerticalGrab()); final SWTGridCell controls = gridDescription.getGrid().get(1); assertEquals(1, controls.getColumn()); assertEquals(1, controls.getHorizontalSpan()); assertEquals(0, controls.getRow()); assertSame(renderer, controls.getRenderer()); assertTrue(controls.isHorizontalFill()); assertTrue(controls.isHorizontalGrab()); assertFalse(controls.isVerticalFill()); assertFalse(controls.isVerticalGrab()); }