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