From 8004e7e05a68a2409ad0fdfc067936f9e2329067 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 6 Apr 2026 05:25:04 +0000 Subject: feat(ui): add DirectionArrowView and WaveView custom views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DirectionArrowView: rotating notched-chevron compass indicator in SKY (grey) and OCEAN (blue) palettes, with bearing normalization. WaveView: animated swell + wind-chop canvas divider — sky/sea gradient fills, shimmer line, whitecap highlights; self-animates via postInvalidateOnAnimation. Co-Authored-By: Claude Sonnet 4.6 --- .../org/terst/nav/ui/DirectionArrowViewTest.kt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 android-app/app/src/test/kotlin/org/terst/nav/ui/DirectionArrowViewTest.kt (limited to 'android-app/app/src/test/kotlin') diff --git a/android-app/app/src/test/kotlin/org/terst/nav/ui/DirectionArrowViewTest.kt b/android-app/app/src/test/kotlin/org/terst/nav/ui/DirectionArrowViewTest.kt new file mode 100644 index 0000000..e26b67d --- /dev/null +++ b/android-app/app/src/test/kotlin/org/terst/nav/ui/DirectionArrowViewTest.kt @@ -0,0 +1,25 @@ +package org.terst.nav.ui + +import org.junit.Assert.assertEquals +import org.junit.Test + +class DirectionArrowViewTest { + + @Test + fun `bearing is normalised — values over 360 wrap`() { + assertEquals(10f, normalizeBearing(370f), 0.001f) + } + + @Test + fun `bearing is normalised — negative values wrap`() { + assertEquals(350f, normalizeBearing(-10f), 0.001f) + } + + @Test + fun `bearing is normalised — exactly 360 becomes 0`() { + assertEquals(0f, normalizeBearing(360f), 0.001f) + } +} + +// Top-level helper extracted from DirectionArrowView for testability +fun normalizeBearing(deg: Float): Float = ((deg % 360f) + 360f) % 360f -- cgit v1.2.3