Fix tests

Test: atest InsetsAnimationControlImplTest
Bug: 118118435
Change-Id: I92f5a91b24d3441c092c9dab55d9340b7da3ab14
This commit is contained in:
Jorim Jaggi
2019-01-14 14:05:05 +01:00
parent 98c756513d
commit fae3e276b1
3 changed files with 9 additions and 4 deletions

View File

@@ -122,7 +122,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
mController.scheduleApplyChangeInsets();
}
void applyChangeInsets(InsetsState state) {
@VisibleForTesting
public void applyChangeInsets(InsetsState state) {
final Insets offset = Insets.subtract(mShownInsets, mPendingInsets);
ArrayList<SurfaceParams> params = new ArrayList<>();
if (offset.left != 0) {

View File

@@ -223,15 +223,18 @@ public class InsetsController implements WindowInsetsController {
mState.dump(prefix + " ", pw);
}
void dispatchAnimationStarted(WindowInsetsAnimationListener.InsetsAnimation animation) {
@VisibleForTesting
public void dispatchAnimationStarted(WindowInsetsAnimationListener.InsetsAnimation animation) {
mViewRoot.mView.dispatchWindowInsetsAnimationStarted(animation);
}
void dispatchAnimationFinished(WindowInsetsAnimationListener.InsetsAnimation animation) {
@VisibleForTesting
public void dispatchAnimationFinished(WindowInsetsAnimationListener.InsetsAnimation animation) {
mViewRoot.mView.dispatchWindowInsetsAnimationFinished(animation);
}
void scheduleApplyChangeInsets() {
@VisibleForTesting
public void scheduleApplyChangeInsets() {
if (!mAnimCallbackScheduled) {
mViewRoot.mChoreographer.postCallback(Choreographer.CALLBACK_INSETS_ANIMATION,
mAnimCallback, null /* token*/);

View File

@@ -98,6 +98,7 @@ public class InsetsAnimationControlImplTest {
@Test
public void testChangeInsets() {
mController.changeInsets(Insets.of(0, 30, 40, 0));
mController.applyChangeInsets(new InsetsState());
assertEquals(Insets.of(0, 30, 40, 0), mController.getCurrentInsets());
ArgumentCaptor<SurfaceParams> captor = ArgumentCaptor.forClass(SurfaceParams.class);