diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-15 07:39:39 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-15 07:39:39 +0000 |
| commit | a66e96f70b1d46961fc5a3f6324d0d960bc1337b (patch) | |
| tree | 8ae6e484d176b8bfeccbed121e6b72f384b664d7 /android-app/app/src/androidTest/kotlin/org/terst | |
| parent | 9124d1390a0655f62b1de859c2ce0c353c4d9c45 (diff) | |
fix: rasterise vector drawable for MapLibre; add startup smoke test
Bug: BitmapFactory.decodeResource() returns null for vector drawables
(ic_tidal_arrow.xml). style.addImage(id, null) then NPE-crashed inside
MapLibre's native layer. The previous style URL was invalid so the
setStyle callback never fired and the bug was hidden; fixing the URL
in c7b42ab exposed it.
Fix: draw the VectorDrawable onto a Canvas to produce a real Bitmap
before handing it to MapLibre, matching the pattern already used in
MapFragment for the wind-arrow icon.
Also adds:
- MainActivitySmokeTest: Espresso test that launches MainActivity and
asserts it doesn't immediately crash — catches this class of bug.
- CI smoke-test job: runs the Espresso test on an API-30 emulator via
reactivecircus/android-emulator-runner after the build job passes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app/src/androidTest/kotlin/org/terst')
| -rw-r--r-- | android-app/app/src/androidTest/kotlin/org/terst/nav/MainActivitySmokeTest.kt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/android-app/app/src/androidTest/kotlin/org/terst/nav/MainActivitySmokeTest.kt b/android-app/app/src/androidTest/kotlin/org/terst/nav/MainActivitySmokeTest.kt new file mode 100644 index 0000000..fec571a --- /dev/null +++ b/android-app/app/src/androidTest/kotlin/org/terst/nav/MainActivitySmokeTest.kt @@ -0,0 +1,29 @@ +package org.terst.nav + +import androidx.test.core.app.ActivityScenario +import androidx.test.ext.junit.runners.AndroidJUnit4 +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Smoke test: verifies MainActivity launches without crashing. + * + * Run on an emulator/device via: + * ./gradlew connectedDebugAndroidTest + * + * In CI, requires an emulator step before the Gradle task. + */ +@RunWith(AndroidJUnit4::class) +class MainActivitySmokeTest { + + @Test + fun mainActivity_launches_withoutCrash() { + ActivityScenario.launch(MainActivity::class.java).use { scenario -> + // If we reach this line the activity started without throwing. + // onActivity lets us assert it is in a resumed state. + scenario.onActivity { activity -> + assert(!activity.isFinishing) { "MainActivity finished immediately after launch" } + } + } + } +} |
