BaseGridRenderer implements GridRenderer { void setCellHighlightSize(final Rectangle rectangle, final GridData model, final GridColumn<?> column, final List<Double> allRowHeights, final int rowIndex) { final double width = column.getWidth(); rectangle.setWidth(width); final int mergedCellsCount = getMergedCellsCount(model, rowIndex); rectangle.setHeight(allRowHeights.get(rowIndex) * mergedCellsCount); } BaseGridRenderer(final GridRendererTheme theme); @Override double getHeaderHeight(); @Override double getHeaderRowHeight(); @Override GridRendererTheme getTheme(); @Override void setTheme(final GridRendererTheme theme); @Override RendererCommand renderSelector(final double width,
                                          final double height,
                                          final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderSelectedCells(final GridData model,
                                               final GridBodyRenderContext context,
                                               final BaseGridRendererHelper rendererHelper,
                                               final List<GridData.SelectedCell> selectedCells,
                                               final BiFunction<SelectedRange, Integer, Double> selectedCellsYOffsetStrategy,
                                               final Function<SelectedRange, Double> selectedCellsHeightStrategy); @Override List<RendererCommand> renderHeader(final GridData model,
                                              final GridHeaderRenderContext context,
                                              final BaseGridRendererHelper rendererHelper,
                                              final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderHeaderBodyDivider(final double width); @Override List<RendererCommand> renderBody(final GridData model,
                                            final GridBodyRenderContext context,
                                            final BaseGridRendererHelper rendererHelper,
                                            final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderGridBoundary(final GridBoundaryRenderContext context); @Override boolean onGroupingToggle(double cellX,
                                    double cellY,
                                    double cellWidth,
                                    double cellHeight); @Override void setColumnRenderConstraint(final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint); void clearCellHighlight(); void highlightCell(final int column, final int row); Integer getHighlightCellColumnIndex(); Integer getHighlightCellRowIndex();  }
@Test public void testSetCellHighlightSize() { final Rectangle rectangle = mock(Rectangle.class); final GridData model = mock(GridData.class); final GridColumn<?> column = mock(GridColumn.class); final double width = 100; final int rowIndex = 4; final GridRow row = mock(GridRow.class); final double height = 20; when(column.getWidth()).thenReturn(width); when(model.getRow(rowIndex)).thenReturn(row); doReturn(1).when(renderer).getMergedCellsCount(model, rowIndex); renderer.setCellHighlightSize(rectangle, model, column, Collections.nCopies(5, height), rowIndex); verify(rectangle).setWidth(width); verify(rectangle).setHeight(height); }