@Test public void modelCellChangedEvenTriggersRepaint() { // -XX // --X // --- Iterable<Grid.Location> changedCells = asList( Grid.Location.of(Grid.Row.First, Grid.Column.Third), Grid.Location.of(Grid.Row.First, Grid.Column.Second), Grid.Location.of(Grid.Row.Second, Grid.Column.Third)); modelCellChanged.fireEvent( new TicTacToeGridModel.CellsChangedEventObject(aGrid.getModel(), changedCells)); assertThat(aGrid.areaRepainted, is(true)); assertThat(aGrid.repaintedRegions, is(equivalentTo(expectedRepaintedRegions()))); }
@Before public void before() { modelCellChanged = new EventSupport<>(); TicTacToeGridModel model = new TicTacToeGridModel() { @Override public EventSupport<CellsChangedEventObject> cellsChanged() { return modelCellChanged; } }; EvenlyDistributedCellsStyleStub style = new EvenlyDistributedCellsStyleStub.Builder().build(); TicTacToeGridUI ui = new TicTacToeGridUIStub(); ui.setStyle(style); aGrid = new PaintTrackingTicTacToeGridSpy(model, ui); aGrid.setSize(style.backgroundImageWidth * 2, style.backgroundImageHeight * 2); }
@Test public void changingModelTriggersFullRepaint() { aGrid.setModel(new TicTacToeGridModel()); assertThat(aGrid.fullRepaint, is(true)); }