Match Home focus and recovery details
This commit is contained in:
parent
c534ea75c2
commit
3b7249888f
14 changed files with 115 additions and 18 deletions
|
|
@ -105,6 +105,33 @@ class HomeKeysTest {
|
|||
assertNull(action)
|
||||
}
|
||||
|
||||
@Test fun downClampsToShortRowsAndNeverMovesPastTheFinalSeeAll() {
|
||||
val shell = ShellState(fixturePeople(), "justin").apply { pickerVisible = false; navFocused = false }
|
||||
val cards = HomeFixture(rule.activity).snapshot("justin").rows.first { it.id == "lib-movies" }.cards
|
||||
val long = HomeRow(id = "long", kind = HomeRowKind.Shelf, cards = cards)
|
||||
val short = long.copy(id = "short", cards = cards.take(2), total = 2)
|
||||
val tail = short.copy(id = "tail", total = 20)
|
||||
shell.view.cards[long.id] = cards.lastIndex
|
||||
var action: HomeAction? = null
|
||||
rule.setContent { WolfskinTheme {
|
||||
ShellSurface(shell) { modifier -> HomeScreen(shell, HomeSnapshot(listOf(long, short, tail)), modifier) { action = it } }
|
||||
} }
|
||||
press("DOWN")
|
||||
assertEquals(short.id, listOf(long, short, tail)[shell.view.row].id)
|
||||
assertEquals(1, shell.view.cards[short.id])
|
||||
rule.onNodeWithTag("home-card:short:1").assertIsDisplayed()
|
||||
press("RIGHT")
|
||||
assertEquals(1, shell.view.cards[short.id])
|
||||
press("DOWN")
|
||||
press("RIGHT")
|
||||
press("DOWN")
|
||||
assertEquals(2, shell.view.row)
|
||||
assertEquals(2, shell.view.cards[tail.id])
|
||||
rule.onNodeWithTag("home-card:tail:2").assertIsDisplayed()
|
||||
press("OK")
|
||||
assertEquals(tail.id, (action as HomeAction.SeeAll).row.id)
|
||||
}
|
||||
|
||||
private fun press(name: String) {
|
||||
val key = when (name) {
|
||||
"UP" -> Key.DirectionUp; "DOWN" -> Key.DirectionDown
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue