mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Fix LauncherProvider newScreenId issue
Remove maxScreenId from LauncherProvider and whenever we need a new screenId, query the database to calculate a new screenId. Also converted and refactored AddWorkspaceItemsTaskTest and added some extra test cases. Test: manual & AddWorkspaceItemsTaskTest.kt Bug: 199160559 Change-Id: I185f6823fed171d778af0130497f5ffaf89c0a70
This commit is contained in:
@@ -86,8 +86,6 @@ public class AddWorkspaceItemsTaskTest {
|
||||
|
||||
@Test
|
||||
public void testFindSpaceForItem_prefers_second() throws Exception {
|
||||
mIdp.isSplitDisplay = false;
|
||||
|
||||
// First screen has only one hole of size 1
|
||||
int nextId = setupWorkspaceWithHoles(1, 1, new Rect(2, 2, 3, 3));
|
||||
|
||||
@@ -108,24 +106,6 @@ public class AddWorkspaceItemsTaskTest {
|
||||
.isRegionVacant(spaceFound[1], spaceFound[2], 2, 3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindSpaceForItem_prefers_third_on_split_display() throws Exception {
|
||||
mIdp.isSplitDisplay = true;
|
||||
// First screen has only one hole of size 1
|
||||
int nextId = setupWorkspaceWithHoles(1, 1, new Rect(2, 2, 3, 3));
|
||||
|
||||
// Second screen has 2 holes of sizes 3x2 and 2x3
|
||||
setupWorkspaceWithHoles(nextId, 2, new Rect(2, 0, 5, 2), new Rect(0, 2, 2, 5));
|
||||
|
||||
int[] spaceFound = newTask().findSpaceForItem(
|
||||
mAppState, mModelHelper.getBgDataModel(), mExistingScreens, mNewScreens, 1, 1);
|
||||
// For split display, it picks the next screen, even if there is enough space
|
||||
// on previous screen
|
||||
assertEquals(2, spaceFound[0]);
|
||||
assertTrue(mScreenOccupancy.get(spaceFound[0])
|
||||
.isRegionVacant(spaceFound[1], spaceFound[2], 1, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindSpaceForItem_adds_new_screen() throws Exception {
|
||||
// First screen has 2 holes of sizes 3x2 and 2x3
|
||||
|
||||
Reference in New Issue
Block a user