0.122.1 (versionCode 314): the Originals row never trails focus; Orbit Rush's rocks redrawn
- The Originals row scrolls itself: the focused card whole on screen at once (any running scroll dropped), the peek easing in over 140 ms; rapid or held presses and Reduce motion scroll at once. RowScrollTest checks the card is whole after every rapid press both ways. - Asteroid Alley's rock: lumpy angular asteroids in three shapes and rotations, off-centre craters of different sizes, a darker rim (Paul: the round one with a dot looked wrong). The shield pickup is a shield shape, Double Stars two stars, the Forbidden gate three marks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package tv.orbit.classic.arcade
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* The Originals row never trails focus (Paul, 313: "can scroll before it catches up"): at every press the focused card is
|
||||
* fully on screen straight away, whether the presses come one at a time (then the peek eases in) or rapidly (all at once).
|
||||
*/
|
||||
class RowScrollTest {
|
||||
// The Arcade home at 1080p: 736 dp of shelf at 2 px a dp; ten Originals 4.6 across.
|
||||
private val d = 2f
|
||||
private val view = 736 * d; private val edge = 12 * d; private val gap = 10 * d
|
||||
private val card = (view - edge * 2 - gap * 4) / 4.6f
|
||||
private val peek = gap + card * .35f
|
||||
private val n = 10
|
||||
private val max = (edge * 2 + n * card + (n - 1) * gap - view).toInt()
|
||||
|
||||
private fun whole(i: Int, scroll: Int): Boolean {
|
||||
val left = edge + i * (card + gap) - scroll; val right = left + card
|
||||
return left >= -.5f && right <= view + .5f
|
||||
}
|
||||
|
||||
@Test fun rapidPressesKeepTheFocusedCardWhole() {
|
||||
var scroll = 0
|
||||
// ▶ held: each press scrolls at once to the target.
|
||||
for (i in 0 until n) {
|
||||
val plan = rowScroll(i, scroll, card, gap, edge, view, peek, max)
|
||||
scroll = plan.target
|
||||
assertTrue("▶ to $i: card not whole at $scroll", whole(i, scroll))
|
||||
}
|
||||
assertEquals(max, scroll)
|
||||
// ◀ held all the way back.
|
||||
for (i in n - 1 downTo 0) {
|
||||
scroll = rowScroll(i, scroll, card, gap, edge, view, peek, max).target
|
||||
assertTrue("◀ to $i: card not whole at $scroll", whole(i, scroll))
|
||||
}
|
||||
assertEquals(0, scroll)
|
||||
}
|
||||
|
||||
@Test fun anUnhurriedPressShowsTheCardWholeAtOnceThenEasesToThePeek() {
|
||||
// The animation may be cut short by the next press at any point: the card is whole at the start of the ease, and the
|
||||
// ease only moves further the same way, so it stays whole all along it.
|
||||
var scroll = 0
|
||||
for (i in 0 until n) {
|
||||
val plan = rowScroll(i, scroll, card, gap, edge, view, peek, max)
|
||||
assertTrue("$i: not whole at once", whole(i, plan.now))
|
||||
for (k in 0..10) { val mid = plan.now + (plan.target - plan.now) * k / 10; assertTrue("$i: not whole mid-ease", whole(i, mid)) }
|
||||
// Cut short halfway: the next press starts from there.
|
||||
scroll = (plan.now + plan.target) / 2
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun theNextCardPeeksInWhenThereIsOne() {
|
||||
var scroll = 0
|
||||
for (i in 0 until n - 1) {
|
||||
scroll = rowScroll(i, scroll, card, gap, edge, view, peek, max).target
|
||||
val nextLeft = edge + (i + 1) * (card + gap) - scroll
|
||||
assertTrue("$i: no peek of the next card", nextLeft < view - card * .2f)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun pressesCloseTogetherCountAsRapid() {
|
||||
val p = RowPacer()
|
||||
assertFalse(p.rapid(1_000)); assertTrue(p.rapid(1_050)); assertTrue(p.rapid(1_100)); assertFalse(p.rapid(1_600))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user