Bump floret-kit, harden the insets canary test (#177)

This commit is contained in:
makiolaj committed 2026-11-25 12:40:28 +01:00
1 parent 9f11adf63b
commit 86b09708f2
3 files changed
+7 -10

No files matched your search

@@ -1,7 +1,6 @@
package de.jeanlucmakiola.agendula.ui
import android.graphics.Insets
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsAnimation
import androidx.activity.ComponentActivity
@@ -9,7 +8,6 @@ import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.WindowInsets as ComposeInsets
import androidx.compose.foundation.layout.ime
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
@@ -32,7 +30,6 @@ class ImeInsetsResyncTest {
@Volatile
private var imeBottom = -1
private lateinit var view: View
@Test
fun keyboardInsetsSettleAfterUserDrivenAnimation() {
@@ -46,15 +43,14 @@ class ImeInsetsResyncTest {
fun withoutResyncKeyboardInsetsStayStale() {
setContent(resync = false)
runUserDrivenKeyboardAnimation()
rule.waitForIdle()
assertThat(imeBottom).isEqualTo(KEYBOARD_PX)
val settled = runCatching { rule.waitUntil(TIMEOUT_MS) { imeBottom != KEYBOARD_PX } }.isSuccess
assertThat(settled).isFalse()
}
private fun setContent(resync: Boolean) {
rule.runOnUiThread { rule.activity.enableEdgeToEdge() }
rule.setContent {
if (resync) ImeInsetsResync()
view = LocalView.current
imeBottom = ComposeInsets.ime.getBottom(LocalDensity.current)
}
rule.waitForIdle()
@@ -65,7 +61,7 @@ class ImeInsetsResyncTest {
val animation = WindowInsetsAnimation(ime, null, -1)
val keyboard = Insets.of(0, 0, 0, KEYBOARD_PX)
rule.runOnUiThread {
val root = view.rootView
val root = rule.activity.window.decorView
val midway = WindowInsets.Builder().setInsets(ime, keyboard).setVisible(ime, true).build()
root.dispatchWindowInsetsAnimationPrepare(animation)
root.dispatchWindowInsetsAnimationStart(animation, WindowInsetsAnimation.Bounds(Insets.NONE, keyboard))
@@ -73,7 +69,7 @@ class ImeInsetsResyncTest {
}
rule.waitForIdle()
assertThat(imeBottom).isEqualTo(KEYBOARD_PX)
rule.runOnUiThread { view.rootView.dispatchWindowInsetsAnimationEnd(animation) }
rule.runOnUiThread { rule.activity.window.decorView.dispatchWindowInsetsAnimationEnd(animation) }
rule.waitForIdle()
}