Bump floret-kit, test the theme opt-out (#177)
This commit is contained in:
1 parent
1938991a6b
commit
4d70732278
2 files changed
+22
-6
No files matched your search
@@ -18,6 +18,9 @@ import androidx.test.filters.SdkSuppress
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import de.jeanlucmakiola.agendula.ui.theme.AgendulaTheme
|
||||
import de.jeanlucmakiola.floret.components.FullScreenPicker
|
||||
import de.jeanlucmakiola.agendula.ui.theme.AgendulaDarkFallback
|
||||
import de.jeanlucmakiola.agendula.ui.theme.AgendulaLightFallback
|
||||
import de.jeanlucmakiola.floret.identity.FloretExpressiveTheme
|
||||
import de.jeanlucmakiola.floret.identity.ImeInsetsResync
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
@@ -54,11 +57,24 @@ class ImeInsetsResyncTest {
|
||||
rule.waitUntil(TIMEOUT_MS) { imeBottom == 0 }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun themeWithoutResyncLeavesKeyboardInsetsAlone() {
|
||||
setContent {
|
||||
FloretExpressiveTheme(AgendulaLightFallback, AgendulaDarkFallback, resyncImeInsets = false) { ImeReader() }
|
||||
}
|
||||
runUserDrivenKeyboardAnimation()
|
||||
assertStaysStale()
|
||||
}
|
||||
|
||||
/** Shows the Compose behaviour [ImeInsetsResync] works around; drop it and this once this fails. */
|
||||
@Test
|
||||
fun withoutResyncKeyboardInsetsStayStale() {
|
||||
setContent { ImeReader() }
|
||||
runUserDrivenKeyboardAnimation()
|
||||
assertStaysStale()
|
||||
}
|
||||
|
||||
private fun assertStaysStale() {
|
||||
val settled = runCatching { rule.waitUntil(STALE_WINDOW_MS) { imeBottom != KEYBOARD_PX } }.isSuccess
|
||||
assertThat(settled).isFalse()
|
||||
}
|
||||
@@ -84,16 +100,16 @@ class ImeInsetsResyncTest {
|
||||
val ime = WindowInsets.Type.ime()
|
||||
val animation = WindowInsetsAnimation(ime, null, -1)
|
||||
val keyboard = Insets.of(0, 0, 0, KEYBOARD_PX)
|
||||
val root = checkNotNull(root)
|
||||
val decor = checkNotNull(root)
|
||||
rule.runOnUiThread {
|
||||
val midway = WindowInsets.Builder().setInsets(ime, keyboard).setVisible(ime, true).build()
|
||||
root.dispatchWindowInsetsAnimationPrepare(animation)
|
||||
root.dispatchWindowInsetsAnimationStart(animation, WindowInsetsAnimation.Bounds(Insets.NONE, keyboard))
|
||||
root.dispatchWindowInsetsAnimationProgress(midway, listOf(animation))
|
||||
decor.dispatchWindowInsetsAnimationPrepare(animation)
|
||||
decor.dispatchWindowInsetsAnimationStart(animation, WindowInsetsAnimation.Bounds(Insets.NONE, keyboard))
|
||||
decor.dispatchWindowInsetsAnimationProgress(midway, listOf(animation))
|
||||
}
|
||||
rule.waitForIdle()
|
||||
assertThat(imeBottom).isEqualTo(KEYBOARD_PX)
|
||||
rule.runOnUiThread { root.dispatchWindowInsetsAnimationEnd(animation) }
|
||||
rule.runOnUiThread { decor.dispatchWindowInsetsAnimationEnd(animation) }
|
||||
rule.waitForIdle()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule floret-kit updated: 48e25995fc...0c8f5367f5.
Reference in new issue
Block a user