@@ -31,7 +31,6 @@ import androidx.compose.runtime.mutableStateOf
31
31
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
32
32
import androidx.compose.ui.Modifier
33
33
import androidx.compose.ui.platform.testTag
34
- import androidx.compose.ui.test.TestMonotonicFrameClock
35
34
import androidx.compose.ui.test.junit4.ComposeContentTestRule
36
35
import androidx.compose.ui.test.junit4.createComposeRule
37
36
import androidx.compose.ui.test.onNodeWithTag
@@ -43,11 +42,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
43
42
import androidx.test.filters.LargeTest
44
43
import com.google.common.truth.Truth.assertThat
45
44
import com.google.common.truth.Truth.assertWithMessage
46
- import kotlinx.coroutines.CoroutineScope
47
45
import kotlinx.coroutines.ExperimentalCoroutinesApi
48
46
import kotlinx.coroutines.runBlocking
49
- import kotlinx.coroutines.test.TestCoroutineDispatcher
50
- import kotlinx.coroutines.test.runBlockingTest
47
+ import kotlinx.coroutines.test.runTest
51
48
import org.junit.Rule
52
49
import org.junit.Test
53
50
import org.junit.runner.RunWith
@@ -60,16 +57,13 @@ import org.junit.runner.RunWith
60
57
ExperimentalMaterialNavigationApi ::class
61
58
)
62
59
internal class SheetContentHostTest {
63
-
64
- private val testDispatcher = TestCoroutineDispatcher ()
65
- private val testClock = TestMonotonicFrameClock (CoroutineScope (testDispatcher))
66
60
private val bodyContentTag = " testBodyContent"
67
61
68
62
@get:Rule
69
63
val composeTestRule = createComposeRule()
70
64
71
65
@Test
72
- fun testSheetShownAndHidden () = runBlockingTest {
66
+ fun testSheetShownAndHidden () = runTest {
73
67
val backStackEntryState = mutableStateOf<NavBackStackEntry ?>(null )
74
68
val sheetState = ModalBottomSheetState (ModalBottomSheetValue .Hidden )
75
69
@@ -94,7 +88,7 @@ internal class SheetContentHostTest {
94
88
}
95
89
96
90
@Test
97
- fun testOnSheetDismissedCalled_ManualDismiss () = runBlockingTest(testClock) {
91
+ fun testOnSheetDismissedCalled_ManualDismiss () = runTest {
98
92
val sheetState = ModalBottomSheetState (ModalBottomSheetValue .Hidden )
99
93
val backStackEntry = createBackStackEntry(sheetState)
100
94
@@ -119,7 +113,7 @@ internal class SheetContentHostTest {
119
113
}
120
114
121
115
@Test
122
- fun testOnSheetDismissedCalled_initiallyExpanded () = runBlockingTest(testClock) {
116
+ fun testOnSheetDismissedCalled_initiallyExpanded () = runTest {
123
117
val sheetState = ModalBottomSheetState (ModalBottomSheetValue .Expanded )
124
118
val backStackEntry = createBackStackEntry(sheetState)
125
119
@@ -144,7 +138,7 @@ internal class SheetContentHostTest {
144
138
}
145
139
146
140
@Test
147
- fun testOnSheetShownCalled_onBackStackEntryEnter () = runBlockingTest(testClock) {
141
+ fun testOnSheetShownCalled_onBackStackEntryEnter () = runTest {
148
142
val sheetState = ModalBottomSheetState (ModalBottomSheetValue .Hidden )
149
143
val backStackEntryState = mutableStateOf<NavBackStackEntry ?>(null )
150
144
val shownBackStackEntries = mutableListOf<NavBackStackEntry >()
0 commit comments