Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoader import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.MainCoroutineDispatcher import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -711,7 +712,7 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() { // Construction of a tiling divider with null config expects a null pointer here // which is a sign a new divider is being created due to dpi changes. @Test(expected = NullPointerException::class) @Test fun tilingDividerDestroyed_whenDpiChanges() { val task1 = createVisibleTask() val additionalTaskHelper: DesktopTilingWindowDecoration.AppResizingHelper = mock() Loading @@ -736,9 +737,9 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() { tilingDecoration.leftTaskResizingHelper = tiledTaskHelper tilingDecoration.desktopTilingDividerWindowManager = desktopTilingDividerWindowManager assertThrows(NullPointerException::class.java) { tilingDecoration.onDensityOrFontScaleChanged() verify(desktopTilingDividerWindowManager, times(1)).release() } } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt +10 −5 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.currentTime import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -98,12 +99,16 @@ class AuthenticationInteractorTest : SysuiTestCase() { assertFailed(underTest.authenticate(listOf(9, 8, 7, 6, 5, 4))) } @Test(expected = IllegalArgumentException::class) fun authenticate_withEmptyPin_throwsException() = @Test fun authenticate_withEmptyPin_throwsException() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin) underTest.authenticate(listOf()) } } } @Test fun authenticate_withCorrectMaxLengthPin_succeeds() = Loading packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt +7 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -158,14 +160,16 @@ class DeviceItemActionInteractorTest : SysuiTestCase() { } } @Test(expected = IllegalArgumentException::class) @Test fun onActionIconClick_audioSharingDeviceType_throwException() { with(kosmos) { assertThrows(IllegalArgumentException::class.java) { testScope.runTest { actionInteractorImpl.onActionIconClick(audioSharingDeviceItem) {} } } } } private companion object { const val DEVICE_NAME = "device" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt +9 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Assert.assertThrows import org.junit.Test import org.junit.runner.RunWith Loading @@ -43,8 +45,12 @@ class CoroutineResultTest : SysuiTestCase() { assertThat(actual.exceptionOrNull()).isInstanceOf(Exception::class.java) } @Test(expected = CancellationException::class) fun suspendRunCatching_whenCancelled_shouldResumeWithException() = runTest { @Test fun suspendRunCatching_whenCancelled_shouldResumeWithException() { assertThrows(CancellationException::class.java) { runTest { suspendRunCatching { cancel() } } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt +21 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -507,19 +508,29 @@ class ResizeableItemFrameViewModelTest : SysuiTestCase() { assertThat(resizeInfo).isNull() } @Test(expected = IllegalArgumentException::class) fun testIllegalState_maxHeightLessThanMinHeight() = @Test fun testIllegalState_maxHeightLessThanMinHeight() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(maxHeightPx = 50, minHeightPx = 100)) } } } @Test(expected = IllegalArgumentException::class) fun testIllegalState_currentSpanExceedsTotalSpans() = testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) } @Test fun testIllegalState_currentSpanExceedsTotalSpans() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) } } } @Test(expected = IllegalArgumentException::class) fun testIllegalState_resizeMultipleZeroOrNegative() = @Test fun testIllegalState_resizeMultipleZeroOrNegative() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) } } } @Test fun testZeroHeights_cannotResize() = Loading Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoader import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.MainCoroutineDispatcher import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -711,7 +712,7 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() { // Construction of a tiling divider with null config expects a null pointer here // which is a sign a new divider is being created due to dpi changes. @Test(expected = NullPointerException::class) @Test fun tilingDividerDestroyed_whenDpiChanges() { val task1 = createVisibleTask() val additionalTaskHelper: DesktopTilingWindowDecoration.AppResizingHelper = mock() Loading @@ -736,9 +737,9 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() { tilingDecoration.leftTaskResizingHelper = tiledTaskHelper tilingDecoration.desktopTilingDividerWindowManager = desktopTilingDividerWindowManager assertThrows(NullPointerException::class.java) { tilingDecoration.onDensityOrFontScaleChanged() verify(desktopTilingDividerWindowManager, times(1)).release() } } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt +10 −5 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.currentTime import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -98,12 +99,16 @@ class AuthenticationInteractorTest : SysuiTestCase() { assertFailed(underTest.authenticate(listOf(9, 8, 7, 6, 5, 4))) } @Test(expected = IllegalArgumentException::class) fun authenticate_withEmptyPin_throwsException() = @Test fun authenticate_withEmptyPin_throwsException() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin) underTest.authenticate(listOf()) } } } @Test fun authenticate_withCorrectMaxLengthPin_succeeds() = Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt +7 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -158,14 +160,16 @@ class DeviceItemActionInteractorTest : SysuiTestCase() { } } @Test(expected = IllegalArgumentException::class) @Test fun onActionIconClick_audioSharingDeviceType_throwException() { with(kosmos) { assertThrows(IllegalArgumentException::class.java) { testScope.runTest { actionInteractorImpl.onActionIconClick(audioSharingDeviceItem) {} } } } } private companion object { const val DEVICE_NAME = "device" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt +9 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Assert.assertThrows import org.junit.Test import org.junit.runner.RunWith Loading @@ -43,8 +45,12 @@ class CoroutineResultTest : SysuiTestCase() { assertThat(actual.exceptionOrNull()).isInstanceOf(Exception::class.java) } @Test(expected = CancellationException::class) fun suspendRunCatching_whenCancelled_shouldResumeWithException() = runTest { @Test fun suspendRunCatching_whenCancelled_shouldResumeWithException() { assertThrows(CancellationException::class.java) { runTest { suspendRunCatching { cancel() } } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt +21 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -507,19 +508,29 @@ class ResizeableItemFrameViewModelTest : SysuiTestCase() { assertThat(resizeInfo).isNull() } @Test(expected = IllegalArgumentException::class) fun testIllegalState_maxHeightLessThanMinHeight() = @Test fun testIllegalState_maxHeightLessThanMinHeight() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(maxHeightPx = 50, minHeightPx = 100)) } } } @Test(expected = IllegalArgumentException::class) fun testIllegalState_currentSpanExceedsTotalSpans() = testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) } @Test fun testIllegalState_currentSpanExceedsTotalSpans() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) } } } @Test(expected = IllegalArgumentException::class) fun testIllegalState_resizeMultipleZeroOrNegative() = @Test fun testIllegalState_resizeMultipleZeroOrNegative() { Assert.assertThrows(IllegalArgumentException::class.java) { testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) } } } @Test fun testZeroHeights_cannotResize() = Loading