Merge "Re-enable and fix failing tests in NotificationStackScrollLayoutTest" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
149fed16df
@@ -61,7 +61,6 @@ import android.view.WindowInsets;
|
|||||||
import android.view.WindowInsetsAnimation;
|
import android.view.WindowInsetsAnimation;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.test.annotation.UiThreadTest;
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.keyguard.BouncerPanelExpansionCalculator;
|
import com.android.keyguard.BouncerPanelExpansionCalculator;
|
||||||
@@ -84,12 +83,11 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
|
|||||||
import com.android.systemui.statusbar.notification.row.FooterView;
|
import com.android.systemui.statusbar.notification.row.FooterView;
|
||||||
import com.android.systemui.statusbar.phone.CentralSurfaces;
|
import com.android.systemui.statusbar.phone.CentralSurfaces;
|
||||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||||
|
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
|
||||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||||
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
|
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -103,7 +101,6 @@ import java.util.ArrayList;
|
|||||||
/**
|
/**
|
||||||
* Tests for {@link NotificationStackScrollLayout}.
|
* Tests for {@link NotificationStackScrollLayout}.
|
||||||
*/
|
*/
|
||||||
@Ignore("b/255552856")
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@TestableLooper.RunWithLooper
|
@TestableLooper.RunWithLooper
|
||||||
@@ -113,7 +110,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
private NotificationStackScrollLayout mStackScrollerInternal; // See explanation below
|
private NotificationStackScrollLayout mStackScrollerInternal; // See explanation below
|
||||||
private AmbientState mAmbientState;
|
private AmbientState mAmbientState;
|
||||||
private TestableResources mTestableResources;
|
private TestableResources mTestableResources;
|
||||||
|
|
||||||
@Rule public MockitoRule mockito = MockitoJUnit.rule();
|
@Rule public MockitoRule mockito = MockitoJUnit.rule();
|
||||||
@Mock private CentralSurfaces mCentralSurfaces;
|
@Mock private CentralSurfaces mCentralSurfaces;
|
||||||
@Mock private SysuiStatusBarStateController mBarState;
|
@Mock private SysuiStatusBarStateController mBarState;
|
||||||
@@ -128,7 +124,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Mock private NotificationSection mNotificationSection;
|
@Mock private NotificationSection mNotificationSection;
|
||||||
@Mock private NotificationSwipeHelper mNotificationSwipeHelper;
|
@Mock private NotificationSwipeHelper mNotificationSwipeHelper;
|
||||||
@Mock private NotificationStackScrollLayoutController mStackScrollLayoutController;
|
@Mock private NotificationStackScrollLayoutController mStackScrollLayoutController;
|
||||||
@Mock private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
@Mock private ScreenOffAnimationController mScreenOffAnimationController;
|
||||||
@Mock private NotificationShelf mNotificationShelf;
|
@Mock private NotificationShelf mNotificationShelf;
|
||||||
@Mock private NotificationStackSizeCalculator mNotificationStackSizeCalculator;
|
@Mock private NotificationStackSizeCalculator mNotificationStackSizeCalculator;
|
||||||
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
||||||
@@ -136,7 +132,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Mock private FeatureFlags mFeatureFlags;
|
@Mock private FeatureFlags mFeatureFlags;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@UiThreadTest
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
allowTestableLooperAsMainThread();
|
allowTestableLooperAsMainThread();
|
||||||
mTestableResources = mContext.getOrCreateTestableResources();
|
mTestableResources = mContext.getOrCreateTestableResources();
|
||||||
@@ -162,7 +157,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mDependency.injectTestDependency(AmbientState.class, mAmbientState);
|
mDependency.injectTestDependency(AmbientState.class, mAmbientState);
|
||||||
mDependency.injectTestDependency(NotificationShelf.class, mNotificationShelf);
|
mDependency.injectTestDependency(NotificationShelf.class, mNotificationShelf);
|
||||||
mDependency.injectTestDependency(
|
mDependency.injectTestDependency(
|
||||||
UnlockedScreenOffAnimationController.class, mUnlockedScreenOffAnimationController);
|
ScreenOffAnimationController.class, mScreenOffAnimationController);
|
||||||
|
|
||||||
NotificationShelfController notificationShelfController =
|
NotificationShelfController notificationShelfController =
|
||||||
mock(NotificationShelfController.class);
|
mock(NotificationShelfController.class);
|
||||||
@@ -364,7 +359,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
|
||||||
public void testSetExpandedHeight_listenerReceivedCallbacks() {
|
public void testSetExpandedHeight_listenerReceivedCallbacks() {
|
||||||
final float expectedHeight = 0f;
|
final float expectedHeight = 0f;
|
||||||
|
|
||||||
@@ -374,20 +368,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mStackScroller.setExpandedHeight(expectedHeight);
|
mStackScroller.setExpandedHeight(expectedHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAppearFractionCalculation() {
|
|
||||||
// appear start position
|
|
||||||
when(mNotificationShelf.getIntrinsicHeight()).thenReturn(100);
|
|
||||||
// because it's the same as shelf height, appear start position equals shelf height
|
|
||||||
mStackScroller.mStatusBarHeight = 100;
|
|
||||||
// appear end position
|
|
||||||
when(mEmptyShadeView.getHeight()).thenReturn(200);
|
|
||||||
|
|
||||||
assertEquals(0f, mStackScroller.calculateAppearFraction(100));
|
|
||||||
assertEquals(1f, mStackScroller.calculateAppearFraction(200));
|
|
||||||
assertEquals(0.5f, mStackScroller.calculateAppearFraction(150));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAppearFractionCalculationIsNotNegativeWhenShelfBecomesSmaller() {
|
public void testAppearFractionCalculationIsNotNegativeWhenShelfBecomesSmaller() {
|
||||||
// this situation might occur if status bar height is defined in pixels while shelf height
|
// this situation might occur if status bar height is defined in pixels while shelf height
|
||||||
@@ -405,7 +385,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
|
||||||
public void testSetExpandedHeight_withSplitShade_doesntInterpolateStackHeight() {
|
public void testSetExpandedHeight_withSplitShade_doesntInterpolateStackHeight() {
|
||||||
mTestableResources
|
mTestableResources
|
||||||
.addOverride(R.bool.config_use_split_notification_shade, /* value= */ true);
|
.addOverride(R.bool.config_use_split_notification_shade, /* value= */ true);
|
||||||
@@ -590,6 +569,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReInflatesFooterViews() {
|
public void testReInflatesFooterViews() {
|
||||||
|
when(mEmptyShadeView.getTextResource()).thenReturn(R.string.empty_shade_text);
|
||||||
clearInvocations(mStackScroller);
|
clearInvocations(mStackScroller);
|
||||||
mStackScroller.reinflateViews();
|
mStackScroller.reinflateViews();
|
||||||
verify(mStackScroller).setFooterView(any());
|
verify(mStackScroller).setFooterView(any());
|
||||||
@@ -597,21 +577,18 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
|
||||||
public void testSetIsBeingDraggedResetsExposedMenu() {
|
public void testSetIsBeingDraggedResetsExposedMenu() {
|
||||||
mStackScroller.setIsBeingDragged(true);
|
mStackScroller.setIsBeingDragged(true);
|
||||||
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
|
||||||
public void testPanelTrackingStartResetsExposedMenu() {
|
public void testPanelTrackingStartResetsExposedMenu() {
|
||||||
mStackScroller.onPanelTrackingStarted();
|
mStackScroller.onPanelTrackingStarted();
|
||||||
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
|
||||||
public void testDarkModeResetsExposedMenu() {
|
public void testDarkModeResetsExposedMenu() {
|
||||||
mStackScroller.setHideAmount(0.1f, 0.1f);
|
mStackScroller.setHideAmount(0.1f, 0.1f);
|
||||||
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
verify(mNotificationSwipeHelper).resetExposedMenuView(true, true);
|
||||||
@@ -916,7 +893,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mStackScroller.setHasFilteredOutSeenNotifications(true);
|
mStackScroller.setHasFilteredOutSeenNotifications(true);
|
||||||
mStackScroller.updateEmptyShadeView(true, false);
|
mStackScroller.updateEmptyShadeView(true, false);
|
||||||
|
|
||||||
verify(mEmptyShadeView).setFooterText(not(0));
|
verify(mEmptyShadeView).setFooterText(not(eq(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user