Fix TaplTestsLauncher.testWorkspace's page expectation for 2 panel
- In tablet, workspace is scrollable only if page count > 2 instead of 1 Bug: 191344757 Test: TaplTestsLauncher.testWorkspace Change-Id: I1db4e03bc1edd7976a75b2a5f6fedf69eea7b435
This commit is contained in:
parent
c167b0bdf3
commit
fc27bd17af
|
@ -80,8 +80,12 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
assertTrue(message, failed);
|
||||
}
|
||||
|
||||
private int pagesPerScreen() {
|
||||
return mLauncher.isTablet() ? 2 : 1;
|
||||
}
|
||||
|
||||
private boolean isWorkspaceScrollable(Launcher launcher) {
|
||||
return launcher.getWorkspace().getPageCount() > 1;
|
||||
return launcher.getWorkspace().getPageCount() > pagesPerScreen();
|
||||
}
|
||||
|
||||
private int getCurrentWorkspacePage(Launcher launcher) {
|
||||
|
@ -195,8 +199,9 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
workspace.ensureWorkspaceIsScrollable();
|
||||
|
||||
executeOnLauncher(
|
||||
launcher -> assertEquals("Ensuring workspace scrollable didn't switch to page #1",
|
||||
1, getCurrentWorkspacePage(launcher)));
|
||||
launcher -> assertEquals(
|
||||
"Ensuring workspace scrollable didn't switch to next screen",
|
||||
pagesPerScreen(), getCurrentWorkspacePage(launcher)));
|
||||
executeOnLauncher(
|
||||
launcher -> assertTrue("ensureScrollable didn't make workspace scrollable",
|
||||
isWorkspaceScrollable(launcher)));
|
||||
|
@ -212,8 +217,8 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
|
||||
workspace.flingForward();
|
||||
executeOnLauncher(
|
||||
launcher -> assertEquals("Flinging forward didn't switch workspace to page #1",
|
||||
1, getCurrentWorkspacePage(launcher)));
|
||||
launcher -> assertEquals("Flinging forward didn't switch workspace to next screen",
|
||||
pagesPerScreen(), getCurrentWorkspacePage(launcher)));
|
||||
assertTrue("Launcher internal state is not Home", isInState(() -> LauncherState.NORMAL));
|
||||
|
||||
// Test starting a workspace app.
|
||||
|
|
|
@ -163,7 +163,7 @@ public final class Workspace extends Home {
|
|||
}
|
||||
|
||||
private boolean isWorkspaceScrollable(UiObject2 workspace) {
|
||||
return workspace.getChildCount() > 1;
|
||||
return workspace.getChildCount() > (mLauncher.isTablet() ? 2 : 1);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
Loading…
Reference in New Issue