summaryrefslogtreecommitdiff
path: root/android-app/app/src/test
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-05-26 05:13:48 +0000
committerClaude <noreply@anthropic.com>2026-05-26 05:13:48 +0000
commite34df09b96f4ded3c25c5a14a0332a874205b64a (patch)
treef510434fa59ad8221d2f74cfc986fcc8d12a0433 /android-app/app/src/test
parentd35410c707900075bf4207bab518ead44d43c6e7 (diff)
Add notes to finished tracks, single Nav voice, fix speed coloring
- TrackDetailSheet: + Add note button opens a dialog with text, camera, and gallery. Entry is saved with timestampMs=track.endMs so it lands inside the track's time window and appears automatically in the event log. logEventAdapter.update() refreshes the list after save. - TripReportGenerator: removed NarrativeStyle enum and 4-style branch. generateNarrative() now emits a concise PASSAGE header (date, time range, duration), stats line (nm / avg kt / max kt), optional conditions (seas, temp), and a timestamped deck log. Fragment and layout updated to remove the ChipGroup style picker. - TrackColors: replaced Expression.get("color") — which silently fails for lineColor on LineLayer in MapLibre Android 11.x — with Expression.step(Expression.get("speed"), ...) that maps the numeric "speed" property directly to color literals. "color" string property removed from speedSegments() features. https://claude.ai/code/session_01YUbuZNDAoLea4cf9UGQ9qn
Diffstat (limited to 'android-app/app/src/test')
-rw-r--r--android-app/app/src/test/kotlin/org/terst/nav/tripreport/TripReportGeneratorTest.kt32
1 files changed, 20 insertions, 12 deletions
diff --git a/android-app/app/src/test/kotlin/org/terst/nav/tripreport/TripReportGeneratorTest.kt b/android-app/app/src/test/kotlin/org/terst/nav/tripreport/TripReportGeneratorTest.kt
index eea3234..8209d1a 100644
--- a/android-app/app/src/test/kotlin/org/terst/nav/tripreport/TripReportGeneratorTest.kt
+++ b/android-app/app/src/test/kotlin/org/terst/nav/tripreport/TripReportGeneratorTest.kt
@@ -14,8 +14,8 @@ class TripReportGeneratorTest {
private fun pt(lat: Double, lon: Double, sog: Double = 5.0, ts: Long) =
TrackPoint(lat = lat, lon = lon, sogKnots = sog, cogDeg = 0.0, timestampMs = ts)
- private fun entry(ts: Long, text: String = "note") = LogEntry(
- timestampMs = ts, text = text, entryType = EntryType.GENERAL
+ private fun entry(ts: Long, text: String = "note", photoPath: String? = null) = LogEntry(
+ timestampMs = ts, text = text, entryType = EntryType.GENERAL, photoPath = photoPath
)
// ── generateSummary ───────────────────────────────────────────────────────
@@ -30,7 +30,6 @@ class TripReportGeneratorTest {
@Test
fun `distance between two points one nm apart`() {
- // 1 nm north along prime meridian ≈ 0.01667° latitude
val points = listOf(pt(0.0, 0.0, ts = 0L), pt(0.016667, 0.0, ts = 60_000L))
val s = gen.generateSummary(points, emptyList())
assertEquals(1.0, s.distanceNm, 0.02)
@@ -70,20 +69,29 @@ class TripReportGeneratorTest {
// ── generateNarrative ─────────────────────────────────────────────────────
@Test
- fun `professional narrative contains distance and speed`() {
+ fun `narrative contains passage header and distance`() {
val points = listOf(pt(0.0, 0.0, sog = 5.0, ts = 0L), pt(0.016667, 0.0, sog = 5.0, ts = 3_600_000L))
val s = gen.generateSummary(points, emptyList())
- val narrative = gen.generateNarrative(s, NarrativeStyle.PROFESSIONAL)
- assertTrue("Expected distance in narrative", narrative.contains("NM") || narrative.contains("nm"))
+ val narrative = gen.generateNarrative(s)
+ assertTrue("Expected PASSAGE header", narrative.contains("PASSAGE"))
+ assertTrue("Expected distance in nm", narrative.contains("nm"))
+ assertTrue("Expected avg speed", narrative.contains("avg"))
+ assertTrue("Expected max speed", narrative.contains("max"))
}
@Test
- fun `all narrative styles produce non-empty output`() {
+ fun `narrative includes log entry text`() {
val points = listOf(pt(0.0, 0.0, ts = 0L), pt(0.016667, 0.0, ts = 3_600_000L))
- val s = gen.generateSummary(points, listOf(entry(1_000L)))
- for (style in NarrativeStyle.values()) {
- val narrative = gen.generateNarrative(s, style)
- assertTrue("Narrative for $style should not be blank", narrative.isNotBlank())
- }
+ val s = gen.generateSummary(points, listOf(entry(1_000L, "hoisted main")))
+ val narrative = gen.generateNarrative(s)
+ assertTrue("Expected log entry in narrative", narrative.contains("hoisted main"))
+ }
+
+ @Test
+ fun `narrative marks photo entries`() {
+ val points = listOf(pt(0.0, 0.0, ts = 0L), pt(0.016667, 0.0, ts = 3_600_000L))
+ val s = gen.generateSummary(points, listOf(entry(1_000L, "crew photo", photoPath = "/some/path.jpg")))
+ val narrative = gen.generateNarrative(s)
+ assertTrue("Expected [photo] marker", narrative.contains("[photo]"))
}
}