package com.cottondb.days import android.app.Application import android.view.View import android.view.ViewGroup import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.ui.Modifier 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.assertEquals 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 with the camera's cutout at the left (the emulator's punch hole, 136 px of cutout inset at 2.625, * 21 Nov 2026): the times and marks at the start of every row stood under the hole. Days now stands clear of the * sides' cutout and navigation buttons. */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [35], qualifiers = "w800dp-h400dp-land-mdpi", application = Application::class) class DaysSidesTest { @get:Rule val compose = createAndroidComposeRule() @Test fun days_stands_clear_of_a_cutout_at_its_side() { compose.setContent { Box(Modifier.fillMaxSize().clearOfSides()) { Box(Modifier.fillMaxSize().testTag("inside")) } } compose.runOnIdle { val content = compose.activity.findViewById(android.R.id.content) val view: View = content.getChildAt(0) val insets = WindowInsetsCompat.Builder() .setInsets(WindowInsetsCompat.Type.displayCutout(), Insets.of(48, 0, 0, 0)) .setInsets(WindowInsetsCompat.Type.navigationBars(), Insets.of(0, 0, 32, 0)) .build() ViewCompat.dispatchApplyWindowInsets(view, insets) } compose.waitForIdle() val inside = compose.onNodeWithTag("inside").getBoundsInRoot() assertEquals("clear of the cutout at the left", 48.dp, inside.left) assertEquals("clear of the navigation buttons at the right", 800.dp - 32.dp, inside.right) } }