diff --git a/app/src/test/java/space/bloggin/mercies/ShotsTest.kt b/app/src/test/java/space/bloggin/mercies/ShotsTest.kt index 693f917..3390e15 100644 --- a/app/src/test/java/space/bloggin/mercies/ShotsTest.kt +++ b/app/src/test/java/space/bloggin/mercies/ShotsTest.kt @@ -22,6 +22,7 @@ class ShotsTest { @get:Rule val rule = createAndroidComposeRule() private val out = File("build/shots").apply { mkdirs() } private fun shot(n: String) { rule.waitForIdle(); rule.mainClock.advanceTimeBy(1500); rule.waitForIdle(); rule.onRoot().captureRoboImage(File(out, "$n.png").path) } + private fun store() = rule.activity.state.store private fun ui(b: AppState.() -> Unit) { rule.runOnUiThread { rule.activity.state.b() }; rule.waitForIdle() } @Test fun all() { @@ -66,6 +67,32 @@ class ShotsTest { shot("10_sage_prayers") ui { prefs.look = 0 } + // ---- 1.2: X warning, notepad, heart + val longPrayer = store().prayers(false).first { it.forWho == "Mom" } + ui { tab = 2; sendText(prayerMessage(longPrayer.copy(text = longPrayer.text + " " + longPrayer.text + " Hold her close, and hold us close too.")), "A prayer for you", Card("A prayer for Mom", longPrayer.text, "Simple Mercies")) } + shot("11_x_warning") + ui { xWarn = null; tab = 3; prefs.padKind = 0 + store.addPad(0, "Remember to call the county about the culvert at Mill Road.", LocalDate.now().minusDays(1)) + store.addPad(0, "Psalm 46:10 kept coming back to me all morning.") + } + shot("12_pad_thoughts") + ui { prefs.padKind = 1 + store.addPad(1, "Pick up the prescription"); store.addPad(1, "Mow before the rain"); store.addPad(1, "Call Mom after the surgery") } + shot("13_pad_todo") + // tick one: run the heart and capture it partway through + rule.mainClock.autoAdvance = false + ui { val t = store.pads(1).first { it.text.startsWith("Mow") }; store.setPadDone(t.id, true); heart = HeartBurst(androidx.compose.ui.geometry.Offset(150f, 900f), prefs.active.accent, 1L) } + for ((n, ms) in listOf("14_heart_a" to 300L, "14_heart_b" to 500L, "14_heart_c" to 600L, "14_heart_d" to 400L, "14_heart_e" to 400L)) { + rule.mainClock.advanceTimeBy(ms); rule.onRoot().captureRoboImage(File(out, "$n.png").path) + } + rule.mainClock.advanceTimeBy(1500); rule.mainClock.autoAdvance = true + shot("15_after_heart") + ui { prefs.padKind = 2; store.addPad(2, "I was back at the grocery store, but every aisle was a cornfield and the carts were horses.") } + shot("16_pad_dreams") + ui { open(Over.Settings) } + shot("17_settings") + ui { back() } + val ctx = rule.activity Shape.entries.forEachIndexed { i, s -> val b = ShareKit.render(ctx, Card("A prayer for Mom", "Lord, give her strength for the surgery on Thursday, steady hands for the doctors, and peace for all of us waiting.", "Simple Mercies"), Looks.all[i], s)