Merge "Adding 4x4 roerder widget test" into tm-qpr-dev

This commit is contained in:
Sebastián Franco
2022-08-11 17:19:27 +00:00
committed by Android (Google) Code Review
4 changed files with 103 additions and 47 deletions

View File

@@ -20,46 +20,65 @@ import android.graphics.Point;
import java.util.Map;
public class FullReorderCase {
/** 5x5 Test
**/
private static final String START_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "222mm\n"
+ "222mm\n"
+ "ad111\n"
+ "bc111";
private static final Point MOVE_TO_5x5 = new Point(0, 4);
private static final String END_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "222ad\n"
+ "222bc\n"
+ "mm111\n"
+ "mm111";
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
MOVE_TO_5x5,
END_BOARD_STR_5x5);
/** 6x5 Test
**/
private static final String START_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "2222mm\n"
+ "2222mm\n"
+ "ad1111\n"
+ "bc1111";
private static final Point MOVE_TO_6x5 = new Point(0, 4);
private static final String END_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "2222ad\n"
+ "2222bc\n"
+ "mm1111\n"
+ "mm1111";
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
MOVE_TO_6x5,
END_BOARD_STR_6x5);
/** 4x4 Test
**/
private static final String START_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "22mm\n"
+ "admm\n"
+ "bc11";
private static final Point MOVE_TO_4x4 = new Point(0, 3);
private static final String END_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "22ad\n"
+ "mmbc\n"
+ "mm11";
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
MOVE_TO_4x4,
END_BOARD_STR_4x4);
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
Map.of(new Point(5, 5), TEST_CASE_5x5,
new Point(6, 5), TEST_CASE_6x5,
new Point(4, 4), TEST_CASE_4x4);
}

View File

@@ -20,47 +20,64 @@ import android.graphics.Point;
import java.util.Map;
public class MoveOutReorderCase {
/** 5x5 Test
**/
private static final String START_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "34-m-\n"
+ "35111\n"
+ "32111\n"
+ "32111";
private static final Point MOVE_TO_5x5 = new Point(1, 2);
private static final String END_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "345--\n"
+ "3m111\n"
+ "32111\n"
+ "32111";
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
MOVE_TO_5x5,
END_BOARD_STR_5x5);
/** 6x5 Test
**/
private static final String START_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "34-m--\n"
+ "351111\n"
+ "321111\n"
+ "321111";
private static final Point MOVE_TO_6x5 = new Point(1, 2);
private static final String END_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "345---\n"
+ "3m1111\n"
+ "321111\n"
+ "321111";
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
MOVE_TO_6x5,
END_BOARD_STR_6x5);
/** 4x4 Test
**/
private static final String START_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "34-m\n"
+ "3511\n"
+ "3211";
private static final Point MOVE_TO_4x4 = new Point(1, 2);
private static final String END_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "345-\n"
+ "3m11\n"
+ "3211";
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
MOVE_TO_4x4,
END_BOARD_STR_4x4);
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
Map.of(new Point(5, 5), TEST_CASE_5x5,
new Point(6, 5), TEST_CASE_6x5,
new Point(4, 4), TEST_CASE_4x4);
}

View File

@@ -17,60 +17,68 @@ package com.android.launcher3.celllayout.testcases;
import android.graphics.Point;
import com.android.launcher3.celllayout.CellLayoutBoard;
import java.util.Map;
public class PushReorderCase {
/** 5x5 Test
**/
private static final String START_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "222m-\n"
+ "--111\n"
+ "--333\n"
+ "-----";
private static final CellLayoutBoard START_BOARD_5x5 = CellLayoutBoard.boardFromString(
START_BOARD_STR_5x5);
private static final Point MOVE_TO_5x5 = new Point(2, 1);
private static final String END_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "--m--\n"
+ "222--\n"
+ "--111\n"
+ "--333";
private static final CellLayoutBoard END_BOARD_5x5 = CellLayoutBoard.boardFromString(
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
MOVE_TO_5x5,
END_BOARD_STR_5x5);
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_5x5,
MOVE_TO_5x5,
END_BOARD_5x5);
/** 6x5 Test
**/
private static final String START_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "2222m-\n"
+ "--111-\n"
+ "--333-\n"
+ "------";
private static final CellLayoutBoard START_BOARD_6x5 = CellLayoutBoard.boardFromString(
START_BOARD_STR_6x5);
private static final Point MOVE_TO_6x5 = new Point(2, 1);
private static final String END_BOARD_STR_6x5 = ""
+ "xxxxxx\n"
+ "--m---\n"
+ "2222--\n"
+ "--111-\n"
+ "--333-";
private static final CellLayoutBoard END_BOARD_6x5 = CellLayoutBoard.boardFromString(
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
MOVE_TO_6x5,
END_BOARD_STR_6x5);
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_6x5,
MOVE_TO_6x5,
END_BOARD_6x5);
/** 4x4 Test
**/
private static final String START_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "222m\n"
+ "-111\n"
+ "----";
private static final Point MOVE_TO_4x4 = new Point(2, 1);
private static final String END_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "--m-\n"
+ "222-\n"
+ "-111";
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
MOVE_TO_4x4,
END_BOARD_STR_4x4);
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
Map.of(new Point(5, 5), TEST_CASE_5x5,
new Point(6, 5), TEST_CASE_6x5,
new Point(4, 4), TEST_CASE_4x4);
}

View File

@@ -17,35 +17,47 @@ package com.android.launcher3.celllayout.testcases;
import android.graphics.Point;
import com.android.launcher3.celllayout.CellLayoutBoard;
import java.util.Map;
public class SimpleReorderCase {
private static final String START_BOARD_STR = ""
/** 5x5 Test
**/
private static final String START_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "--mm-\n"
+ "--mm-\n"
+ "-----\n"
+ "-----";
private static final CellLayoutBoard START_BOARD_5x5 = CellLayoutBoard.boardFromString(
START_BOARD_STR);
private static final Point MOVE_TO_5x5 = new Point(4, 4);
private static final String END_BOARD_STR_5x5 = ""
+ "xxxxx\n"
+ "-----\n"
+ "-----\n"
+ "---mm\n"
+ "---mm";
private static final CellLayoutBoard END_BOARD_5x5 = CellLayoutBoard.boardFromString(
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
MOVE_TO_5x5,
END_BOARD_STR_5x5);
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_5x5,
MOVE_TO_5x5,
END_BOARD_5x5);
/** 4x4 Test
**/
private static final String START_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "--mm\n"
+ "--mm\n"
+ "----";
private static final Point MOVE_TO_4x4 = new Point(3, 3);
private static final String END_BOARD_STR_4x4 = ""
+ "xxxx\n"
+ "----\n"
+ "--mm\n"
+ "--mm";
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
MOVE_TO_4x4,
END_BOARD_STR_4x4);
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5);
Map.of(new Point(5, 5), TEST_CASE_5x5,
new Point(4, 4), TEST_CASE_4x4);
}