BaseGridRenderer implements GridRenderer { void setCellHighlightY(final Rectangle r, final BaseGridRendererHelper rendererHelper, final int visibleRowIndex, final GridData model) { final GridCell<?> cell = model.getCell(getHighlightCellRowIndex(), getHighlightCellColumnIndex()); if (!cell.isMerged()) { r.setY(rendererHelper.getRowOffset(visibleRowIndex)); } else { int firstRowOfMergedBlock = getFirstRowIndexOfMergedBlock(model, visibleRowIndex); r.setY(rendererHelper.getRowOffset(firstRowOfMergedBlock)); } } 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 testSetCellHighlightY() { final int visibleRowIndex = 2; final Rectangle rectangle = mock(Rectangle.class); final double y = 190; final GridCell cell = mock(GridCell.class); final int rowIndex = 5; final int columnIndex = 1; when(rendererHelper.getRowOffset(visibleRowIndex)).thenReturn(y); doReturn(rowIndex).when(renderer).getHighlightCellRowIndex(); doReturn(columnIndex).when(renderer).getHighlightCellColumnIndex(); final GridData dataModel = mock(GridData.class); when(dataModel.getCell(rowIndex, columnIndex)).thenReturn(cell); when(cell.isMerged()).thenReturn(false); renderer.setCellHighlightY(rectangle, rendererHelper, visibleRowIndex, dataModel); verify(rectangle).setY(y); }