Files
LLeMbas-Android/app/src/test/java/eu/llembas/android/SmallThingsTest.kt
T
HomerandClaude Fable 5.2 f2a2acf996
CI / check (push) Canceled after 0s
Three APKs: the notification listener leaves the standard builds; releases drop x86_64
Google Play Protect blocked installing beta.7, most likely for the
notification listener (notification summaries).

- A second flavour dimension, `reading`: `standard` declares no listener and
  no permission of it; `notifications` is the full build plus the listener,
  with the same application id and key. Variants: fullStandard,
  fullNotifications, fdroidStandard (no F-Droid build with the listener).
  The listener class and its manifest entry live in src/notifications only.
- Settings in a standard build says where notification summaries went and
  why. The self-updater installs only its own kind: a notifications build
  takes latest.json's optional `notifications {url, sha256}` or nothing.
- Release builds carry arm64-v8a and armeabi-v7a only; debug keeps x86_64
  for the emulator. The engine's unused C and C++ API libraries are left out.
- scripts/check-apk.sh checks the built files (listener only where it may
  be, model stored, no x86 in a release); CI runs it on the three debug APKs
  and on an unsigned release build, release.yml on what it publishes.
- release.yml publishes llembas-android-<version>.apk, -notifications.apk
  and -fdroid.apk with SHA256SUMS.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 09:58:07 +00:00

53 lines
2.2 KiB
Kotlin

package eu.llembas.android
import eu.llembas.android.api.LembasJson
import eu.llembas.android.assist.AssistController
import eu.llembas.android.assist.Recorder
import eu.llembas.android.update.Latest
import eu.llembas.android.update.LatestFile
import eu.llembas.android.update.Updater
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class SmallThingsTest {
@Test
fun versionsCompareAsNumbers() {
assertTrue(Updater.newer("0.10.0", "0.9.9"))
assertTrue(Updater.newer("1.0.0", "0.99.0"))
assertFalse(Updater.newer("0.1.0", "0.1.0"))
assertFalse(Updater.newer("0.1.0", "0.2.0"))
}
@Test
fun aBuildUpdatesItselfToItsOwnKindOnly() {
val plain = LembasJson.decodeFromString(Latest.serializer(), """{"version":"1.0.0","url":"https://example.org/a.apk","sha256":"aa"}""")
assertEquals(LatestFile("https://example.org/a.apk", "aa"), plain.fileFor(notificationsBuild = false))
// A release that names no notifications APK: that build installs nothing, rather than lose its listener.
assertNull(plain.fileFor(notificationsBuild = true))
val both = LembasJson.decodeFromString(
Latest.serializer(),
"""{"version":"1.0.0","url":"https://example.org/a.apk","sha256":"aa","notifications":{"url":"https://example.org/a-notifications.apk","sha256":"bb"}}""",
)
assertEquals(LatestFile("https://example.org/a-notifications.apk", "bb"), both.fileFor(notificationsBuild = true))
assertEquals(LatestFile("https://example.org/a.apk", "aa"), both.fileFor(notificationsBuild = false))
}
@Test
fun aVoiceReadsNoMarkup() {
val said = AssistController.plain("**Bake** it.\n\n```sh\nbake\n```\nSee [the recipe](https://example.org).")
assertEquals("Bake it. See the recipe.", said)
}
@Test
fun aRecordingIsAValidWavFile() {
val wav = Recorder.wav(ByteArray(3200))
assertEquals(44 + 3200, wav.size)
assertEquals("RIFF", String(wav, 0, 4))
assertEquals("WAVE", String(wav, 8, 4))
assertEquals("data", String(wav, 36, 4))
}
}