commit | 546859d49d07b95bb657119332faafe34dac4af1 | [log] [tgz] |
---|---|---|
author | Louis Pullen-Freilich <[email protected]> | Fri Jun 07 13:37:27 2024 +0100 |
committer | Louis Pullen-Freilich <[email protected]> | Fri Jun 07 13:39:28 2024 +0100 |
tree | 65e196edd2a8d8530a58db02db18d917f1a26a1f | |
parent | 63b7501ca7239f265e77008ed82041d369ef8693 [diff] |
Fixes flaking OverscrollTest runOnIdle / waitForIdle does not wait for drawing, so we need to wait manually until drawing has happened. Fixes: b/345296723 Test: OverscrollTest Change-Id: Ic406e3667d183b4eb6272820f430c5c08928ebbf
diff --git a/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt b/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt index c68cb3e..d50153a 100644 --- a/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt +++ b/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
@@ -68,7 +68,6 @@ import com.google.common.truth.Truth.assertWithMessage import kotlin.math.abs import kotlinx.coroutines.runBlocking -import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -1188,7 +1187,8 @@ .drawBehind { drawCount++ } ) } - rule.runOnIdle { assertEquals(1, drawCount) } + // Due to b/302303969 there are no guarantees runOnIdle() will wait for drawing to happen + rule.waitUntil { drawCount == 1 } } @OptIn(ExperimentalTestApi::class)