package com.cottondb.days import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import com.cottondb.days.pen.DaysCardLook import com.cottondb.days.pen.Pen import com.cottondb.days.pen.PenPalette import com.cottondb.days.pen.PenType import com.cottondb.days.ui.AsideRoom import com.cottondb.days.ui.DateName import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test /** * RULE: the shell's pages over Days (Delete account, sign-in, the gate) stand on the paper and ink as they are now. The * card look is made once, on Grey; it kept Grey's light ground under Night's light ink, so Delete account read as * blank paper in a dark phone with Night chosen (the store-readiness walk, 26 Nov 2026). */ class DaysCardLookColoursTest { private val night = PenPalette.grey.copy(sheet = Color(0xFF15171F), ground = Color(0xFF101218), ink = Color(0xFFE6E8F0)) @After fun back() { Pen.palette = PenPalette.grey } @Test fun the_ground_and_ink_follow_the_paper_chosen_after_the_look_was_made() { val look = DaysCardLook(PenType(FontFamily.Monospace)) Pen.palette = night assertEquals(night.sheet, look.ground) assertEquals(night.ink, look.ink) assertEquals(night.ink, look.danger) } } /** RULE: at the largest text a view's aside (Late's day) goes under the words rather than breaking them inside a word. */ class DaysAsideUnderTest { @Test fun an_aside_that_fits_its_third_stays_beside() = assertFalse(AsideRoom.under(asideWidth = 250, wordsWidth = 900)) @Test fun an_aside_wider_than_its_third_goes_under() = assertTrue(AsideRoom.under(asideWidth = 330, wordsWidth = 900)) } /** RULE: TalkBack says today's date once ("Today, Thursday 26 November. Jump to a day"), not twice. */ class DaysDateNameTest { private fun today(date: String) = "Today, $date" @Test fun today_is_said_once_before_its_date() = assertEquals("Today, Thursday 26 November", DateName.said("Thursday 26 November", today = true, todaySays = ::today)) @Test fun another_day_is_its_date() = assertEquals("Friday 27 November", DateName.said("Friday 27 November", today = false, todaySays = ::today)) } /** RULE: on a tablet Days stands in a phone's measure; a phone is never narrowed. */ class DaysWidthTest { @Test fun no_phone_is_narrowed() = assertTrue(DaysWidth.MOST >= 480.dp) @Test fun a_tablet_is_held_to_a_phones_measure() = assertTrue(DaysWidth.MOST <= 640.dp) }