Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodAlphaViewModelTest.kt +5 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,11 @@ package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -74,9 +77,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @DisableSceneContainer @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -186,9 +189,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_whenGone_equalsZero() = testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionStep( Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt +32 −36 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags as AConfigFlags Loading Loading @@ -69,10 +71,11 @@ class AodBurnInViewModelTest : SysuiTestCase() { private val burnInFlow = MutableStateFlow(BurnInModel()) @Before @DisableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun setUp() { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) MockitoAnnotations.initMocks(this) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) kosmos.burnInInteractor = burnInInteractor Loading Loading @@ -174,10 +177,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters.copy( minViewY = 100, Loading Loading @@ -226,10 +228,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters.copy( minViewY = 100, Loading Loading @@ -310,104 +311,99 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = false, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = false, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) private fun testBurnInViewModelForClocks( isSmallClock: Boolean, isWeatherClock: Boolean, expectedScaleOnly: Boolean, enableMigrateClocksToBlueprintFlag: Boolean, enableComposeLockscreenFlag: Boolean ) = testScope.runTest { if (enableMigrateClocksToBlueprintFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } if (enableComposeLockscreenFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } if (isSmallClock) { keyguardClockRepository.setClockSize(ClockSize.SMALL) // we need the following step to update stateFlow value Loading packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard import android.content.BroadcastReceiver import android.platform.test.annotations.DisableFlags import android.view.View import android.view.ViewTreeObserver import android.widget.FrameLayout Loading Loading @@ -263,9 +264,9 @@ class ClockEventControllerTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun keyguardCallback_visibilityChanged_clockDozeCalled() = runBlocking(IMMEDIATE) { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() verify(keyguardUpdateMonitor).registerCallback(capture(captor)) Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −42 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import android.database.ContentObserver; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import android.view.View; Loading @@ -48,11 +49,10 @@ import org.mockito.verification.VerificationMode; @SmallTest @RunWith(AndroidJUnit4.class) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { @Test public void testInit_viewAlreadyAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); verifyAttachment(times(1)); Loading @@ -60,8 +60,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testInit_viewNotYetAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); Loading @@ -78,16 +76,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testInitSubControllers() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); verify(mKeyguardSliceViewController).init(); } @Test public void testInit_viewDetached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); mController.init(); Loading @@ -101,8 +95,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testPluginPassesStatusBarState() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); Loading @@ -116,8 +108,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); Loading @@ -126,8 +116,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void onLocaleListChangedRebuildsSmartspaceView() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); Loading @@ -138,8 +126,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); mController.init(); Loading @@ -153,8 +139,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(false); mController.init(); Loading @@ -163,8 +147,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testRefresh() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.refresh(); verify(mSmartspaceController).requestSmartspaceUpdate(); Loading @@ -172,8 +154,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testChangeToDoubleLineClockSetsSmallClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, UserHandle.USER_CURRENT)) .thenReturn(0); Loading @@ -197,15 +177,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClock_ForwardsToClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); assertEquals(mClockController, mController.getClock()); } @Test public void testGetLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -218,8 +194,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetSmallLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -232,16 +206,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClockBottom_nullClock_returnsZero() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); assertEquals(0, mController.getClockBottom(10)); } @Test public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor.forClass(ContentObserver.class); Loading @@ -260,8 +230,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); when(mSmartspaceController.isEnabled()).thenReturn(true); Loading @@ -284,15 +252,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClock_nullClock_returnsNull() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); assertNull(mController.getClock()); } private void verifyAttachment(VerificationMode times) { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); verify(mClockRegistry, times).registerClockChangeListener( any(ClockRegistry.ClockChangeListener.class)); verify(mClockEventController, times).registerListeners(mView); Loading @@ -300,8 +264,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSplitShadeEnabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); Loading @@ -309,8 +271,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSplitShadeDisabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.content.Context; import android.platform.test.annotations.DisableFlags; import android.testing.TestableLooper.RunWithLooper; import android.util.AttributeSet; import android.view.LayoutInflater; Loading Loading @@ -60,6 +61,7 @@ import org.mockito.MockitoAnnotations; // the main thread before acquiring a wake lock. This class is constructed when // the keyguard_clock_switch layout is inflated. @RunWithLooper(setAsMainLooper = true) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchTest extends SysuiTestCase { @Mock ViewGroup mMockKeyguardSliceView; Loading @@ -81,8 +83,6 @@ public class KeyguardClockSwitchTest extends SysuiTestCase { @Before public void setUp() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); MockitoAnnotations.initMocks(this); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodAlphaViewModelTest.kt +5 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,11 @@ package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -74,9 +77,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @DisableSceneContainer @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_WhenNotGone_clockMigrationFlagIsOff_emitsKeyguardAlpha() = testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionSteps( Loading Loading @@ -186,9 +189,9 @@ class AodAlphaViewModelTest : SysuiTestCase() { @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun alpha_whenGone_equalsZero() = testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val alpha by collectLastValue(underTest.alpha) keyguardTransitionRepository.sendTransitionStep( Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt +32 −36 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags as AConfigFlags Loading Loading @@ -69,10 +71,11 @@ class AodBurnInViewModelTest : SysuiTestCase() { private val burnInFlow = MutableStateFlow(BurnInModel()) @Before @DisableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun setUp() { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) MockitoAnnotations.initMocks(this) whenever(burnInInteractor.burnIn(anyInt(), anyInt())).thenReturn(burnInFlow) kosmos.burnInInteractor = burnInInteractor Loading Loading @@ -174,10 +177,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOff_staysOutOfTopInset() = testScope.runTest { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters.copy( minViewY = 100, Loading Loading @@ -226,10 +228,9 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_whenFullyDozing_MigrationFlagOn_staysOutOfTopInset() = testScope.runTest { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) burnInParameters = burnInParameters.copy( minViewY = 100, Loading Loading @@ -310,104 +311,99 @@ class AodBurnInViewModelTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_weatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = false, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @DisableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) @EnableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun translationAndScale_composeFlagOff_nonWeatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = false ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_weatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = true, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherLargeClock() = testBurnInViewModelForClocks( isSmallClock = false, isWeatherClock = false, expectedScaleOnly = true, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) @Test @EnableFlags( AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, AConfigFlags.FLAG_COMPOSE_LOCKSCREEN ) fun translationAndScale_composeFlagOn_nonWeatherSmallClock() = testBurnInViewModelForClocks( isSmallClock = true, isWeatherClock = false, expectedScaleOnly = false, enableMigrateClocksToBlueprintFlag = true, enableComposeLockscreenFlag = true ) private fun testBurnInViewModelForClocks( isSmallClock: Boolean, isWeatherClock: Boolean, expectedScaleOnly: Boolean, enableMigrateClocksToBlueprintFlag: Boolean, enableComposeLockscreenFlag: Boolean ) = testScope.runTest { if (enableMigrateClocksToBlueprintFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) } if (enableComposeLockscreenFlag) { mSetFlagsRule.enableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } else { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_COMPOSE_LOCKSCREEN) } if (isSmallClock) { keyguardClockRepository.setClockSize(ClockSize.SMALL) // we need the following step to update stateFlow value Loading
packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard import android.content.BroadcastReceiver import android.platform.test.annotations.DisableFlags import android.view.View import android.view.ViewTreeObserver import android.widget.FrameLayout Loading Loading @@ -263,9 +264,9 @@ class ClockEventControllerTest : SysuiTestCase() { } @Test @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun keyguardCallback_visibilityChanged_clockDozeCalled() = runBlocking(IMMEDIATE) { mSetFlagsRule.disableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() verify(keyguardUpdateMonitor).registerCallback(capture(captor)) Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −42 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import android.database.ContentObserver; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.provider.Settings; import android.view.View; Loading @@ -48,11 +49,10 @@ import org.mockito.verification.VerificationMode; @SmallTest @RunWith(AndroidJUnit4.class) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchControllerBaseTest { @Test public void testInit_viewAlreadyAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); verifyAttachment(times(1)); Loading @@ -60,8 +60,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testInit_viewNotYetAttached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); Loading @@ -78,16 +76,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testInitSubControllers() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.init(); verify(mKeyguardSliceViewController).init(); } @Test public void testInit_viewDetached() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<View.OnAttachStateChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); mController.init(); Loading @@ -101,8 +95,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testPluginPassesStatusBarState() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); Loading @@ -116,8 +108,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); Loading @@ -126,8 +116,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void onLocaleListChangedRebuildsSmartspaceView() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); Loading @@ -138,8 +126,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void onLocaleListChanged_rebuildsSmartspaceViews_whenDecouplingEnabled() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.isDateWeatherDecoupled()).thenReturn(true); mController.init(); Loading @@ -153,8 +139,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isEnabled()).thenReturn(false); mController.init(); Loading @@ -163,8 +147,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testRefresh() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.refresh(); verify(mSmartspaceController).requestSmartspaceUpdate(); Loading @@ -172,8 +154,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testChangeToDoubleLineClockSetsSmallClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSecureSettings.getIntForUser(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, UserHandle.USER_CURRENT)) .thenReturn(0); Loading @@ -197,15 +177,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClock_ForwardsToClock() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); assertEquals(mClockController, mController.getClock()); } @Test public void testGetLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.VISIBLE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -218,8 +194,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetSmallLargeClockBottom_returnsExpectedValue() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mLargeClockFrame.getVisibility()).thenReturn(View.GONE); when(mLargeClockFrame.getHeight()).thenReturn(100); when(mSmallClockFrame.getHeight()).thenReturn(50); Loading @@ -232,16 +206,12 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClockBottom_nullClock_returnsZero() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); assertEquals(0, mController.getClockBottom(10)); } @Test public void testChangeLockscreenWeatherEnabledSetsWeatherViewVisible() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mSmartspaceController.isWeatherEnabled()).thenReturn(true); ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor.forClass(ContentObserver.class); Loading @@ -260,8 +230,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testChangeClockDateWeatherEnabled_SetsDateWeatherViewVisibility() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); ArgumentCaptor<ClockRegistry.ClockChangeListener> listenerArgumentCaptor = ArgumentCaptor.forClass(ClockRegistry.ClockChangeListener.class); when(mSmartspaceController.isEnabled()).thenReturn(true); Loading @@ -284,15 +252,11 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testGetClock_nullClock_returnsNull() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); when(mClockEventController.getClock()).thenReturn(null); assertNull(mController.getClock()); } private void verifyAttachment(VerificationMode times) { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); verify(mClockRegistry, times).registerClockChangeListener( any(ClockRegistry.ClockChangeListener.class)); verify(mClockEventController, times).registerListeners(mView); Loading @@ -300,8 +264,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSplitShadeEnabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(true); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); Loading @@ -309,8 +271,6 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro @Test public void testSplitShadeDisabledSetToSmartspaceController() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); mController.setSplitShadeEnabled(false); verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.content.Context; import android.platform.test.annotations.DisableFlags; import android.testing.TestableLooper.RunWithLooper; import android.util.AttributeSet; import android.view.LayoutInflater; Loading Loading @@ -60,6 +61,7 @@ import org.mockito.MockitoAnnotations; // the main thread before acquiring a wake lock. This class is constructed when // the keyguard_clock_switch layout is inflated. @RunWithLooper(setAsMainLooper = true) @DisableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) public class KeyguardClockSwitchTest extends SysuiTestCase { @Mock ViewGroup mMockKeyguardSliceView; Loading @@ -81,8 +83,6 @@ public class KeyguardClockSwitchTest extends SysuiTestCase { @Before public void setUp() { mSetFlagsRule.disableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); MockitoAnnotations.initMocks(this); when(mMockKeyguardSliceView.getContext()).thenReturn(mContext); when(mMockKeyguardSliceView.findViewById(R.id.keyguard_status_area)) Loading