Add unit test for CellLayout making sure the reorder are valid and fix Multipage CellLyout

The new test generate hundreds of new boards using a fixed seed so the
test cases can be recreated if there is an error.

Some of the new clases where inside of CellLayoutBoard and moved
outside.

Flag: LEGACY FOLDABLE_SINGLE_PAGE DISABLED
Bug: 270395274
Test: ReorderAlgorithmUnitTest
Change-Id: I083fb6701b02b7c0b2cf24634ca71acb0c75902e
This commit is contained in:
Sebastian Franco committed 2023-11-27 17:12:43 -06:00
1 parent 0bb6034f74
commit 6c7d817bc7
10 files changed
+448 -160

No files matched your search

@@ -38,8 +38,8 @@ public class MulticellReorderAlgorithm extends ReorderAlgorithm {
mSeam = new View(cellLayout.getContext());
}
private ItemConfiguration removeSeamFromSolution(
ItemConfiguration solution) {
public ItemConfiguration removeSeamFromSolution(ItemConfiguration solution) {
solution.map.remove(mSeam);
solution.map.forEach((view, cell) -> cell.cellX =
cell.cellX > mCellLayout.getCountX() / 2 ? cell.cellX - 1 : cell.cellX);
solution.cellX =
@@ -48,9 +48,8 @@ public class MulticellReorderAlgorithm extends ReorderAlgorithm {
}
@Override
public ItemConfiguration closestEmptySpaceReorder(int pixelX, int pixelY,
int minSpanX, int minSpanY,
int spanX, int spanY) {
public ItemConfiguration closestEmptySpaceReorder(int pixelX, int pixelY, int minSpanX,
int minSpanY, int spanX, int spanY) {
return removeSeamFromSolution(simulateSeam(
() -> super.closestEmptySpaceReorder(pixelX, pixelY, minSpanX, minSpanY, spanX,
spanY)));