Merge pull request 'Remove the unfocused watched control ring' (#69) from fm/tv-watched-ring into fm/tv-round2
This commit is contained in:
commit
4af1898fd2
4 changed files with 39 additions and 1 deletions
|
|
@ -24,6 +24,8 @@ import org.json.JSONObject
|
|||
import org.junit.Before
|
||||
import org.junit.After
|
||||
import org.junit.Rule
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.justinvisser.wolfskin.design.LocalTitleBitmaps
|
||||
|
|
@ -225,4 +227,27 @@ class TitleCaptureTest {
|
|||
@Test fun round2NotHeldSeries() = capture(123, "90 Day Fiancé: Before the 90 Days")
|
||||
@Test fun round2HeldPosterFallback() = capture(124, "The Girl Who Leapt Through Time", transform = { it.copy(item = it.item.copy(backdrop = null, isPosterBackdrop = true, overview = "Short overview.")) })
|
||||
@Test fun round2NotHeldShortOverview() = capture(125, "The Amazing Spider-Man", transform = { it.copy(item = it.item.copy(backdrop = null, isPosterBackdrop = true, overview = "Short overview.")) })
|
||||
|
||||
@Test fun watchedRingBelongsOnlyToFocus() {
|
||||
lateinit var state: TitleState
|
||||
capture(126) { current, _ -> state = current; state.watched = false; option(state, "tracks") }
|
||||
val edges = mutableListOf<List<Int>>()
|
||||
for ((index, configuration) in listOf(false to false, true to false, false to true, true to true).withIndex()) {
|
||||
val (watched, focused) = configuration
|
||||
rule.runOnIdle { state.watched = watched; option(state, if (focused) "watched" else "tracks") }
|
||||
save(126 + index)
|
||||
val bounds = rule.onNodeWithTag("title-option-watched").fetchSemanticsNode().boundsInRoot
|
||||
val file = File(requireNotNull(System.getProperty("wolfskin.captureDirectory")), "st-${126 + index}.png")
|
||||
val bitmap = BitmapFactory.decodeFile(file.absolutePath)
|
||||
val edge = (-8..8).map { offset -> bitmap.getPixel(bounds.left.toInt() + offset, bounds.center.y.toInt()) }
|
||||
edges.add(edge)
|
||||
bitmap.recycle()
|
||||
}
|
||||
val accent = WolfskinTokens.Color.accent.toArgb()
|
||||
assertEquals("Unwatched at rest has no ring", 0, edges[0].count { it == accent })
|
||||
assertEquals("Watched at rest has no ring", 0, edges[1].count { it == accent })
|
||||
assertEquals("Toggling watched must not change the resting edge", edges[0], edges[1])
|
||||
assertTrue("Keyboard focus keeps its accent ring", edges[2].any { it == accent })
|
||||
assertEquals("Watched keeps exactly the same focused ring", edges[2], edges[3])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue