Loading src/com/android/launcher3/testing/TestInformationHandler.java +4 −3 Original line number Diff line number Diff line Loading @@ -202,10 +202,11 @@ public class TestInformationHandler implements ResourceBasedOverride { } case TestProtocol.REQUEST_WORKSPACE_COLUMNS_ROWS: { InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext); return getLauncherUIProperty(Bundle::putParcelable, launcher -> new Point( InvariantDeviceProfile.INSTANCE.get(mContext).numColumns, InvariantDeviceProfile.INSTANCE.get(mContext).numRows) ); idp.getDeviceProfile(mContext).getPanelCount() * idp.numColumns, idp.numRows )); } case TestProtocol.REQUEST_WORKSPACE_CURRENT_PAGE_INDEX: { Loading tests/assets/ReorderWidgets/multiple_cell_layouts_no_space_reorder 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|aeeee --mm-|acccc --mm-|acccc ggggg|acccc ggggg|adddd arguments: 7 1 board: 10x5 xxxxx|aeeee ---mm|acccc ---mm|acccc ggggg|acccc ggggg|adddd # 4x4 Test board: 4x4 xxxx|aeee --mm|accc --mm|accc gggg|accc arguments: 5 1 board: 8x4 xxxx|aeee --mm|accc --mm|accc gggg|accc # 6x5 Test board: 6x5 xxxxxx|aeeeee --mm--|accccc --mm--|accccc gggggg|accccc gggggg|addddd arguments: 8 1 board: 12x5 xxxxxx|aeeeee ----mm|accccc ----mm|accccc gggggg|accccc gggggg|addddd tests/assets/ReorderWidgets/multiple_cell_layouts_reorder_other_side 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|aaaaa --mm-|plllh --mm-|piiih ggggg|piiih ggggg|fffff arguments: 7 1 board: 10x5 xxxxx|aaaaa --lll|p-mmh ---ii|pimmh ggggg|piiih ggggg|fffff # 4x4 Test board: 4x4 xxxx|aaaa --mm|pllh --mm|piih gggg|ffff arguments: 5 1 board: 8x4 xxxx|aaaa --ll|pmmh --ii|pmmh gggg|ffff # 6x5 Test board: 6x5 xxxxxx|aaaaaa --mmm-|pllllh --mmm-|piiiih --mmm-|piiiih gggggg|ffffff arguments: 8 1 board: 12x5 xxxxxx|aaaaaa --llll|p-mmmh ---iii|pimmmh ---iii|pimmmh gggggg|ffffff No newline at end of file tests/assets/ReorderWidgets/multiple_cell_layouts_simple_reorder 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|----- --mm-|----- --mm-|----- -----|----- -----|----- arguments: 8 3 board: 10x5 xxxxx|----- -----|----- -----|----- -----|---mm -----|---mm # 4x4 Test board: 4x4 xxxx|---- --mm|---- --mm|---- ----|---- arguments: 5 3 board: 8x4 xxxx|---- ----|---- ----|-mm- ----|-mm- # 6x5 Test board: 6x5 xxxxxx|------ --m---|------ ------|------ ------|------ ------|------ arguments: 10 4 board: 12x5 xxxxxx|------ ------|------ ------|------ ------|------ ------|----m- No newline at end of file tests/src/com/android/launcher3/celllayout/CellLayoutBoard.java +28 −1 Original line number Diff line number Diff line Loading @@ -141,9 +141,14 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { return this.mType == CellType.IGNORE; } boolean contains(int x, int y) { return mBounds.contains(x, y); } @Override public String toString() { return "WidgetRect type = " + mType + " bounds = " + mBounds.toString(); return "WidgetRect type = " + mType + " x = " + getCellX() + " | y " + getCellY() + " xs = " + getSpanX() + " ys = " + getSpanY(); } } Loading Loading @@ -227,6 +232,17 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { } } public boolean pointInsideRect(int x, int y, WidgetRect rect) { Boolean isXInRect = x >= rect.getCellX() && x < rect.getCellX() + rect.getSpanX(); Boolean isYInRect = y >= rect.getCellY() && y < rect.getCellY() + rect.getSpanY(); return isXInRect && isYInRect; } public WidgetRect getWidgetAt(int x, int y) { return mWidgetsRects.stream() .filter(widgetRect -> pointInsideRect(x, y, widgetRect)).findFirst().orElse(null); } public List<WidgetRect> getWidgets() { return mWidgetsRects; } Loading Loading @@ -443,6 +459,17 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { return null; } public static WidgetRect getWidgetIn(List<CellLayoutBoard> boards, int x, int y) { for (CellLayoutBoard board : boards) { WidgetRect main = board.getWidgetAt(x, y); if (main != null) { return main; } x -= board.mWidth; } return null; } public static CellLayoutBoard boardFromString(String boardStr) { String[] lines = boardStr.split("\n"); CellLayoutBoard board = new CellLayoutBoard(); Loading Loading
src/com/android/launcher3/testing/TestInformationHandler.java +4 −3 Original line number Diff line number Diff line Loading @@ -202,10 +202,11 @@ public class TestInformationHandler implements ResourceBasedOverride { } case TestProtocol.REQUEST_WORKSPACE_COLUMNS_ROWS: { InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext); return getLauncherUIProperty(Bundle::putParcelable, launcher -> new Point( InvariantDeviceProfile.INSTANCE.get(mContext).numColumns, InvariantDeviceProfile.INSTANCE.get(mContext).numRows) ); idp.getDeviceProfile(mContext).getPanelCount() * idp.numColumns, idp.numRows )); } case TestProtocol.REQUEST_WORKSPACE_CURRENT_PAGE_INDEX: { Loading
tests/assets/ReorderWidgets/multiple_cell_layouts_no_space_reorder 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|aeeee --mm-|acccc --mm-|acccc ggggg|acccc ggggg|adddd arguments: 7 1 board: 10x5 xxxxx|aeeee ---mm|acccc ---mm|acccc ggggg|acccc ggggg|adddd # 4x4 Test board: 4x4 xxxx|aeee --mm|accc --mm|accc gggg|accc arguments: 5 1 board: 8x4 xxxx|aeee --mm|accc --mm|accc gggg|accc # 6x5 Test board: 6x5 xxxxxx|aeeeee --mm--|accccc --mm--|accccc gggggg|accccc gggggg|addddd arguments: 8 1 board: 12x5 xxxxxx|aeeeee ----mm|accccc ----mm|accccc gggggg|accccc gggggg|addddd
tests/assets/ReorderWidgets/multiple_cell_layouts_reorder_other_side 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|aaaaa --mm-|plllh --mm-|piiih ggggg|piiih ggggg|fffff arguments: 7 1 board: 10x5 xxxxx|aaaaa --lll|p-mmh ---ii|pimmh ggggg|piiih ggggg|fffff # 4x4 Test board: 4x4 xxxx|aaaa --mm|pllh --mm|piih gggg|ffff arguments: 5 1 board: 8x4 xxxx|aaaa --ll|pmmh --ii|pmmh gggg|ffff # 6x5 Test board: 6x5 xxxxxx|aaaaaa --mmm-|pllllh --mmm-|piiiih --mmm-|piiiih gggggg|ffffff arguments: 8 1 board: 12x5 xxxxxx|aaaaaa --llll|p-mmmh ---iii|pimmmh ---iii|pimmmh gggggg|ffffff No newline at end of file
tests/assets/ReorderWidgets/multiple_cell_layouts_simple_reorder 0 → 100644 +56 −0 Original line number Diff line number Diff line ################################################################################################### # This file contains test case composed of the following tags: # * # (coments): Lines starting with this character would be ignored. # * arguments: is set of words separated by spaces that can later be parsed # * board: represent a workspace, the first line is the dimensions of the board width x height (wxh) # There are different characters on the board that represent different things: # * x: The x character represents spaces that would be ignored, for example it can be used in # the first row if we don't know how wide the smartspace is. # * i: Represents an icon on the workspace, none in particular just an icon # * [a-z]: Represents a widget and it can be any number or character # except any other already in use. The whole continuos are of the same character is the # area of the widget. # * [A-Z]: Represents a folder and number of icons in the folder is represented by the order of # letter in the alphabet, A=2, B=3, C=4 ... etc. # Test are parsed by CellLayoutTestCaseReader.java and boards are parsed by CellLayoutBoard.java ################################################################################################### # 5x5 Test board: 5x5 xxxxx|----- --mm-|----- --mm-|----- -----|----- -----|----- arguments: 8 3 board: 10x5 xxxxx|----- -----|----- -----|----- -----|---mm -----|---mm # 4x4 Test board: 4x4 xxxx|---- --mm|---- --mm|---- ----|---- arguments: 5 3 board: 8x4 xxxx|---- ----|---- ----|-mm- ----|-mm- # 6x5 Test board: 6x5 xxxxxx|------ --m---|------ ------|------ ------|------ ------|------ arguments: 10 4 board: 12x5 xxxxxx|------ ------|------ ------|------ ------|------ ------|----m- No newline at end of file
tests/src/com/android/launcher3/celllayout/CellLayoutBoard.java +28 −1 Original line number Diff line number Diff line Loading @@ -141,9 +141,14 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { return this.mType == CellType.IGNORE; } boolean contains(int x, int y) { return mBounds.contains(x, y); } @Override public String toString() { return "WidgetRect type = " + mType + " bounds = " + mBounds.toString(); return "WidgetRect type = " + mType + " x = " + getCellX() + " | y " + getCellY() + " xs = " + getSpanX() + " ys = " + getSpanY(); } } Loading Loading @@ -227,6 +232,17 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { } } public boolean pointInsideRect(int x, int y, WidgetRect rect) { Boolean isXInRect = x >= rect.getCellX() && x < rect.getCellX() + rect.getSpanX(); Boolean isYInRect = y >= rect.getCellY() && y < rect.getCellY() + rect.getSpanY(); return isXInRect && isYInRect; } public WidgetRect getWidgetAt(int x, int y) { return mWidgetsRects.stream() .filter(widgetRect -> pointInsideRect(x, y, widgetRect)).findFirst().orElse(null); } public List<WidgetRect> getWidgets() { return mWidgetsRects; } Loading Loading @@ -443,6 +459,17 @@ public class CellLayoutBoard implements Comparable<CellLayoutBoard> { return null; } public static WidgetRect getWidgetIn(List<CellLayoutBoard> boards, int x, int y) { for (CellLayoutBoard board : boards) { WidgetRect main = board.getWidgetAt(x, y); if (main != null) { return main; } x -= board.mWidth; } return null; } public static CellLayoutBoard boardFromString(String boardStr) { String[] lines = boardStr.split("\n"); CellLayoutBoard board = new CellLayoutBoard(); Loading