TileMover { private static TileSize shrinkLeft(TileSize size) { return new TileSize(Math.max(1, size.getWidth() - 1), size.getHeight()); } TileMover(WidgetPane pane); void collapseTile(Tile tile, int count, Direction direction);  }
@Test public void testShrinkLeft() { pane.setNumColumns(4); Tile<?> first = new WidgetTile(new MockWidget(), TWO_BY_ONE); Tile<?> second = new WidgetTile(new MockWidget(), TWO_BY_ONE); pane.addTile(first, new GridPoint(0, 0), TWO_BY_ONE); pane.addTile(second, new GridPoint(2, 0), TWO_BY_ONE); waitForFxEvents(); pane.setNumColumns(2); waitForFxEvents(); assertAll( () -> assertEquals(new GridPoint(0, 0), pane.getTileLayout(first).origin), () -> assertEquals(ONE_BY_ONE, pane.getTileLayout(first).size), () -> assertEquals(new GridPoint(1, 0), pane.getTileLayout(second).origin), () -> assertEquals(ONE_BY_ONE, pane.getTileLayout(second).size) ); }