summaryrefslogtreecommitdiff
path: root/android-app/app/src/test/kotlin/org/terst
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-04-06 05:25:04 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-04-06 05:25:04 +0000
commit8004e7e05a68a2409ad0fdfc067936f9e2329067 (patch)
treee924c953934dee08b36defb6c288ae57c063295b /android-app/app/src/test/kotlin/org/terst
parent6ea6bb39678dcc7c0e7b787286eba0f425c346d9 (diff)
feat(ui): add DirectionArrowView and WaveView custom views
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 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app/src/test/kotlin/org/terst')
-rw-r--r--android-app/app/src/test/kotlin/org/terst/nav/ui/DirectionArrowViewTest.kt25
1 files changed, 25 insertions, 0 deletions
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