package com.cottondb.days import android.app.Application import android.view.View import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.testTag import androidx.compose.ui.test.getBoundsInRoot import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.unit.dp import androidx.core.graphics.Insets import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import org.junit.Assert.assertTrue import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config /** * Days on its side at the largest text, adding with the keyboard up: the adding bar is taller than the room left * between the status bar and the keyboard, and on the emulator it rose over the clock (21 Nov 2026). The foot now * stops at the status bar. */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [35], qualifiers = "w800dp-h400dp-land-mdpi", application = Application::class) class DaysFootTopTest { @get:Rule val compose = createAndroidComposeRule() @Test fun the_foot_never_rises_over_the_status_bar() { lateinit var view: View compose.setContent { view = LocalView.current Footed(Modifier.fillMaxSize(), content = { Box(Modifier.fillMaxSize()) }) { Box(Modifier.fillMaxWidth().height(300.dp).testTag("adding-bar")) } } compose.runOnIdle { val insets = WindowInsetsCompat.Builder() .setInsets(WindowInsetsCompat.Type.statusBars(), Insets.of(0, 30, 0, 0)) .setInsets(WindowInsetsCompat.Type.ime(), Insets.of(0, 0, 0, 160)) .build() ViewCompat.dispatchApplyWindowInsets(view, insets) } compose.waitForIdle() val foot = compose.onNodeWithTag("days-foot").getBoundsInRoot() assertTrue("the foot (${foot.top}) stops at the status bar (30 dp)", foot.top >= 30.dp) assertTrue("and stands on the keyboard (${foot.bottom})", foot.bottom <= 400.dp) } }