mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Merge "Use overridden default xml for TwoPanelWorkspaceTest" into tm-qpr-dev
This commit is contained in:
@@ -210,12 +210,19 @@ public class DebugTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_USE_TEST_WORKSPACE_LAYOUT: {
|
||||
useTestWorkspaceLayout(true);
|
||||
useTestWorkspaceLayout(
|
||||
LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST);
|
||||
return response;
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_USE_TEST2_WORKSPACE_LAYOUT: {
|
||||
useTestWorkspaceLayout(
|
||||
LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2);
|
||||
return response;
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT: {
|
||||
useTestWorkspaceLayout(false);
|
||||
useTestWorkspaceLayout(null);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -257,12 +264,17 @@ public class DebugTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void useTestWorkspaceLayout(boolean useTestWorkspaceLayout) {
|
||||
private void useTestWorkspaceLayout(String layout) {
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
LauncherSettings.Settings.call(mContext.getContentResolver(), useTestWorkspaceLayout
|
||||
? LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG
|
||||
: LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG);
|
||||
if (layout != null) {
|
||||
LauncherSettings.Settings.call(mContext.getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG,
|
||||
layout);
|
||||
} else {
|
||||
LauncherSettings.Settings.call(mContext.getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG);
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
|
||||
57
res/xml/default_test2_workspace.xml
Normal file
57
res/xml/default_test2_workspace.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Split display specific version of Launcher3/res/xml/default_workspace_4x4.xml -->
|
||||
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" >
|
||||
|
||||
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
|
||||
<!-- Dialer Messaging Chrome Camera -->
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:screen="0"
|
||||
launcher:x="0"
|
||||
launcher:y="0"
|
||||
launcher:className="com.google.android.dialer.extensions.GoogleDialtactsActivity"
|
||||
launcher:packageName="com.google.android.dialer" />
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:screen="1"
|
||||
launcher:x="1"
|
||||
launcher:y="0"
|
||||
launcher:className="com.google.android.apps.messaging.ui.ConversationListActivity"
|
||||
launcher:packageName="com.google.android.apps.messaging" />
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:screen="2"
|
||||
launcher:x="2"
|
||||
launcher:y="0"
|
||||
launcher:className="com.google.android.apps.chrome.Main"
|
||||
launcher:packageName="com.android.chrome" />
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:screen="3"
|
||||
launcher:x="3"
|
||||
launcher:y="0"
|
||||
launcher:className="com.android.camera.CameraLauncher"
|
||||
launcher:packageName="com.google.android.GoogleCamera" />
|
||||
|
||||
<!-- Bottom row -->
|
||||
<!-- Maps [space] [space] Play -->
|
||||
<favorite
|
||||
launcher:className="com.google.android.maps.MapsActivity"
|
||||
launcher:packageName="com.google.android.apps.maps"
|
||||
launcher:screen="0"
|
||||
launcher:x="0"
|
||||
launcher:y="-1" />
|
||||
|
||||
<favorite
|
||||
launcher:className="com.android.vending.AssetBrowserActivity"
|
||||
launcher:packageName="com.android.vending"
|
||||
launcher:screen="0"
|
||||
launcher:x="3"
|
||||
launcher:y="-1" />
|
||||
|
||||
<!-- TODO: Place weather widget when it's available -->
|
||||
|
||||
</favorites>
|
||||
@@ -106,6 +106,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
public static final String KEY_LAYOUT_PROVIDER_AUTHORITY = "KEY_LAYOUT_PROVIDER_AUTHORITY";
|
||||
|
||||
private static final int TEST_WORKSPACE_LAYOUT_RES_XML = R.xml.default_test_workspace;
|
||||
private static final int TEST2_WORKSPACE_LAYOUT_RES_XML = R.xml.default_test2_workspace;
|
||||
|
||||
static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
|
||||
|
||||
@@ -114,7 +115,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
private long mLastRestoreTimestamp = 0L;
|
||||
|
||||
private boolean mUseTestWorkspaceLayout;
|
||||
private int mDefaultWorkspaceLayoutOverride = 0;
|
||||
|
||||
/**
|
||||
* $ adb shell dumpsys activity provider com.android.launcher3
|
||||
@@ -402,11 +403,21 @@ public class LauncherProvider extends ContentProvider {
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG: {
|
||||
mUseTestWorkspaceLayout = true;
|
||||
switch (arg) {
|
||||
case LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST:
|
||||
mDefaultWorkspaceLayoutOverride = TEST_WORKSPACE_LAYOUT_RES_XML;
|
||||
break;
|
||||
case LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2:
|
||||
mDefaultWorkspaceLayoutOverride = TEST2_WORKSPACE_LAYOUT_RES_XML;
|
||||
break;
|
||||
default:
|
||||
mDefaultWorkspaceLayoutOverride = 0;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG: {
|
||||
mUseTestWorkspaceLayout = false;
|
||||
mDefaultWorkspaceLayoutOverride = 0;
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_LOAD_DEFAULT_FAVORITES: {
|
||||
@@ -628,8 +639,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
private DefaultLayoutParser getDefaultLayoutParser(LauncherWidgetHolder widgetHolder) {
|
||||
InvariantDeviceProfile idp = LauncherAppState.getIDP(getContext());
|
||||
int defaultLayout = mUseTestWorkspaceLayout
|
||||
? TEST_WORKSPACE_LAYOUT_RES_XML : idp.defaultLayoutId;
|
||||
int defaultLayout = mDefaultWorkspaceLayoutOverride > 0
|
||||
? mDefaultWorkspaceLayoutOverride : idp.defaultLayoutId;
|
||||
|
||||
if (getContext().getSystemService(UserManager.class).isDemoUser()
|
||||
&& idp.demoModeLayoutId != 0) {
|
||||
|
||||
@@ -377,6 +377,8 @@ public class LauncherSettings {
|
||||
|
||||
public static final String METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG =
|
||||
"set_use_test_workspace_layout_flag";
|
||||
public static final String ARG_DEFAULT_WORKSPACE_LAYOUT_TEST = "default_test_workspace";
|
||||
public static final String ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2 = "default_test2_workspace";
|
||||
|
||||
public static final String METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG =
|
||||
"clear_use_test_workspace_layout_flag";
|
||||
|
||||
@@ -106,6 +106,7 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging";
|
||||
public static final String REQUEST_CLEAR_DATA = "clear-data";
|
||||
public static final String REQUEST_USE_TEST_WORKSPACE_LAYOUT = "use-test-workspace-layout";
|
||||
public static final String REQUEST_USE_TEST2_WORKSPACE_LAYOUT = "use-test2-workspace-layout";
|
||||
public static final String REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT =
|
||||
"use-default-workspace-layout";
|
||||
public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names";
|
||||
|
||||
@@ -21,8 +21,6 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
@@ -33,6 +31,7 @@ import com.android.launcher3.tapl.Workspace;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -53,22 +52,24 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
mLauncher.useTest2WorkspaceLayoutOnReload();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
|
||||
assumeTrue(mLauncher.isTwoPanels());
|
||||
|
||||
// Removing the Gmail widget so there are space in the right panel to run the test.
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
workspace.deleteWidget(workspace.tryGetWidget("Gmail", DEFAULT_UI_TIMEOUT));
|
||||
|
||||
// Pre verifying the screens
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
||||
assertPageEmpty(launcher, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mLauncher.useDefaultWorkspaceLayoutOnReload();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testDragIconToRightPanel() {
|
||||
@@ -78,8 +79,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Chrome");
|
||||
assertItemsOnPage(launcher, 0, "Maps", "Play Store");
|
||||
assertItemsOnPage(launcher, 1, "Chrome");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,39 +93,39 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
workspace.flingBackward();
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Chrome");
|
||||
assertItemsOnPage(launcher, 3, "Photos");
|
||||
assertItemsOnPage(launcher, 3, "Maps");
|
||||
});
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Chrome");
|
||||
assertPageEmpty(launcher, 3);
|
||||
assertPageEmpty(launcher, 4);
|
||||
assertItemsOnPage(launcher, 5, "Photos");
|
||||
assertItemsOnPage(launcher, 5, "Maps");
|
||||
});
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Chrome");
|
||||
assertItemsOnPage(launcher, 3, "Photos");
|
||||
assertItemsOnPage(launcher, 3, "Maps");
|
||||
});
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
|
||||
|
||||
workspace.flingForward();
|
||||
|
||||
@@ -132,8 +133,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1);
|
||||
assertItemsOnPage(launcher, 0, "Chrome", "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Chrome", "Play Store");
|
||||
assertItemsOnPage(launcher, 1, "Maps");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -142,13 +143,13 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
public void testDragIconToPage2() {
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 2, "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Maps");
|
||||
assertPageEmpty(launcher, 3);
|
||||
});
|
||||
}
|
||||
@@ -162,8 +163,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertPageEmpty(launcher, 2);
|
||||
assertItemsOnPage(launcher, 3, "Phone");
|
||||
});
|
||||
@@ -178,16 +179,16 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
workspace.flingBackward();
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 5);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 5);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Messages");
|
||||
assertPageEmpty(launcher, 3);
|
||||
assertPageEmpty(launcher, 4);
|
||||
assertItemsOnPage(launcher, 5, "Photos");
|
||||
assertItemsOnPage(launcher, 5, "Maps");
|
||||
});
|
||||
|
||||
workspace.flingBackward();
|
||||
@@ -196,10 +197,10 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 4, 5, 6, 7);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertPageEmpty(launcher, 4);
|
||||
assertItemsOnPage(launcher, 5, "Photos");
|
||||
assertItemsOnPage(launcher, 5, "Maps");
|
||||
assertItemsOnPage(launcher, 6, "Messages");
|
||||
assertPageEmpty(launcher, 7);
|
||||
});
|
||||
@@ -208,10 +209,10 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 4, 5);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Messages");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertItemsOnPage(launcher, 1, "Messages");
|
||||
assertPageEmpty(launcher, 4);
|
||||
assertItemsOnPage(launcher, 5, "Photos");
|
||||
assertItemsOnPage(launcher, 5, "Maps");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -220,23 +221,23 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
public void testEmptyPageDoesNotGetRemovedIfPagePairIsNotEmpty() {
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
|
||||
workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 0);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Chrome");
|
||||
assertItemsOnPage(launcher, 3, "Photos");
|
||||
assertItemsOnPage(launcher, 3, "Maps");
|
||||
});
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertItemsOnPage(launcher, 1, "Maps");
|
||||
assertItemsOnPage(launcher, 2, "Chrome");
|
||||
assertPageEmpty(launcher, 3);
|
||||
});
|
||||
@@ -248,8 +249,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertItemsOnPage(launcher, 1, "Maps");
|
||||
assertPageEmpty(launcher, 2);
|
||||
assertItemsOnPage(launcher, 3, "Chrome");
|
||||
});
|
||||
@@ -265,8 +266,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3);
|
||||
assertItemsOnPage(launcher, 0, "Gmail", "Photos", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 0, "Maps");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Play Store");
|
||||
assertItemsOnPage(launcher, 3, "Chrome");
|
||||
});
|
||||
@@ -277,8 +278,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather", "Chrome");
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
||||
assertItemsOnPage(launcher, 1, "Chrome");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -287,27 +288,27 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
public void testMiddleEmptyPagesGetRemoved() {
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
|
||||
workspace.dragIcon(workspace.getHotseatAppIcon("Messages"), 3);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 2, "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 2, "Maps");
|
||||
assertPageEmpty(launcher, 3);
|
||||
assertPageEmpty(launcher, 4);
|
||||
assertItemsOnPage(launcher, 5, "Messages");
|
||||
});
|
||||
|
||||
workspace.flingBackward();
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
|
||||
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
|
||||
|
||||
executeOnLauncher(launcher -> {
|
||||
assertPagesExist(launcher, 0, 1, 4, 5);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
|
||||
assertItemsOnPage(launcher, 1, "Weather");
|
||||
assertItemsOnPage(launcher, 4, "Photos");
|
||||
assertItemsOnPage(launcher, 0, "Play Store");
|
||||
assertPageEmpty(launcher, 1);
|
||||
assertItemsOnPage(launcher, 4, "Maps");
|
||||
assertItemsOnPage(launcher, 5, "Messages");
|
||||
});
|
||||
}
|
||||
@@ -335,21 +336,14 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
CellLayout page = launcher.getWorkspace().getScreenWithId(pageId);
|
||||
int itemCount = page.getShortcutsAndWidgets().getChildCount();
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
CharSequence title = null;
|
||||
View child = page.getShortcutsAndWidgets().getChildAt(i);
|
||||
ItemInfo itemInfo = (ItemInfo) child.getTag();
|
||||
ItemInfo itemInfo = (ItemInfo) page.getShortcutsAndWidgets().getChildAt(i).getTag();
|
||||
if (itemInfo != null) {
|
||||
title = itemInfo.title;
|
||||
}
|
||||
if (title == null) {
|
||||
title = child.getContentDescription();
|
||||
}
|
||||
if (title != null) {
|
||||
assertTrue("There was an extra item on page " + pageId + ": " + title,
|
||||
itemTitleSet.remove(title));
|
||||
assertTrue("There was an extra item on page " + pageId + ": " + itemInfo.title,
|
||||
itemTitleSet.remove(itemInfo.title));
|
||||
}
|
||||
}
|
||||
assertTrue("Could NOT find some of the items on page " + pageId + ": "
|
||||
+ String.join(",", itemTitleSet), itemTitleSet.isEmpty());
|
||||
+ itemTitleSet.stream().collect(Collectors.joining(",")),
|
||||
itemTitleSet.isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1848,6 +1848,14 @@ public final class LauncherInstrumentation {
|
||||
getTestInfo(TestProtocol.REQUEST_USE_TEST_WORKSPACE_LAYOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the workspace with a test layout that includes Maps/Play on workspace, and
|
||||
* Dialer/Messaging/Chrome/Camera on hotseat.
|
||||
*/
|
||||
public void useTest2WorkspaceLayoutOnReload() {
|
||||
getTestInfo(TestProtocol.REQUEST_USE_TEST2_WORKSPACE_LAYOUT);
|
||||
}
|
||||
|
||||
/** Reloads the workspace with the default layout defined by the user's grid size selection. */
|
||||
public void useDefaultWorkspaceLayoutOnReload() {
|
||||
getTestInfo(TestProtocol.REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT);
|
||||
|
||||
@@ -334,28 +334,14 @@ public final class Workspace extends Home {
|
||||
* @return validated workspace after the existing appIcon being deleted.
|
||||
*/
|
||||
public Workspace deleteAppIcon(HomeAppIcon homeAppIcon) {
|
||||
return deleteLaunchable(homeAppIcon, LONG_CLICK_EVENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the widget from the workspace.
|
||||
*
|
||||
* @param widget to be deleted.
|
||||
* @return validated workspace after the existing widget being deleted.
|
||||
*/
|
||||
public Workspace deleteWidget(Widget widget) {
|
||||
return deleteLaunchable(widget, Widget.LONG_CLICK_EVENT);
|
||||
}
|
||||
|
||||
private Workspace deleteLaunchable(Launchable launchable, Pattern longClickEvent) {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"removing app icon from workspace")) {
|
||||
dragIconToWorkspace(
|
||||
mLauncher,
|
||||
launchable,
|
||||
homeAppIcon,
|
||||
() -> getDropPointFromDropTargetBar(mLauncher, DELETE_TARGET_TEXT_ID),
|
||||
() -> mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, longClickEvent),
|
||||
() -> mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT),
|
||||
/* expectDropEvents= */ null);
|
||||
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
|
||||
Reference in New Issue
Block a user