Skip to content

Commit

Permalink
Fix GlideTest.loading_slot test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Oct 15, 2020
1 parent 4f14152 commit c53982a
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.onCommit
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.ColorPainter
Expand Down Expand Up @@ -403,18 +404,16 @@ class GlideTest {

val glide = Glide.with(InstrumentationRegistry.getInstrumentation().targetContext)

// Pause all requests so that the request doesn't complete
glide.pauseAllRequests()

composeTestRule.setContent {
onCommit {
// Pause all requests so that the request doesn't complete. This needs to be done
// inside our content because Glide automatically resumeRequests() in onStart
glide.pauseAllRequests()
}

GlideImage(
data = server.url("/image").toString(),
requestManager = glide,
requestBuilder = {
// Disable memory cache. If the item is in the cache, the fetch is
// synchronous and the dispatcher pause has no effect
skipMemoryCache(true)
},
modifier = Modifier.preferredSize(128.dp, 128.dp),
loading = { Text(text = "Loading") },
onRequestCompleted = { loadLatch.countDown() }
Expand Down

0 comments on commit c53982a

Please sign in to comment.