mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 18:28:20 +00:00
Add more tests for {request,hide}Window.
Flag: TEST_ONLY Fix: 346394585 Test: TaskbarOverlayControllerTests Change-Id: I59ed58d7f3a4d46bccfb34ef6923f1bf4f5bf2c1
This commit is contained in:
@@ -30,6 +30,7 @@ import com.android.launcher3.taskbar.TaskbarUnitTestRule
|
||||
import com.android.launcher3.taskbar.TaskbarUnitTestRule.InjectController
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit.EmulatedDevices
|
||||
import com.android.launcher3.views.BaseDragLayer
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Rule
|
||||
@@ -64,6 +65,17 @@ class TaskbarOverlayControllerTest {
|
||||
assertThat(context1).isNotSameInstanceAs(context2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testRequestWindow_afterHidingOverlay_createsNewWindow() {
|
||||
val context1 = overlayController.requestWindow()
|
||||
TestOverlayView.show(context1)
|
||||
overlayController.hideWindow()
|
||||
|
||||
val context2 = overlayController.requestWindow()
|
||||
assertThat(context1).isNotSameInstanceAs(context2)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testRequestWindow_addsProxyView() {
|
||||
@@ -79,6 +91,17 @@ class TaskbarOverlayControllerTest {
|
||||
assertThat(overlay.isOpen).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRequestWindow_attachesDragLayer() {
|
||||
lateinit var dragLayer: BaseDragLayer<*>
|
||||
getInstrumentation().runOnMainSync {
|
||||
dragLayer = overlayController.requestWindow().dragLayer
|
||||
}
|
||||
|
||||
// Allow drag layer to attach before checking.
|
||||
getInstrumentation().runOnMainSync { assertThat(dragLayer.isAttachedToWindow).isTrue() }
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testHideWindow_closesOverlay() {
|
||||
@@ -87,6 +110,20 @@ class TaskbarOverlayControllerTest {
|
||||
assertThat(overlay.isOpen).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testHideWindow_detachesDragLayer() {
|
||||
lateinit var dragLayer: BaseDragLayer<*>
|
||||
getInstrumentation().runOnMainSync {
|
||||
dragLayer = overlayController.requestWindow().dragLayer
|
||||
}
|
||||
|
||||
// Wait for drag layer to be attached to window before hiding.
|
||||
getInstrumentation().runOnMainSync {
|
||||
overlayController.hideWindow()
|
||||
assertThat(dragLayer.isAttachedToWindow).isFalse()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testTwoOverlays_closeOne_windowStaysOpen() {
|
||||
|
||||
Reference in New Issue
Block a user