Skip to content

The real map providers have no tests, and adding one is an advertised extension point #127

Description

@parawanderer

The gap

GoogleMapProvider and AMapProvider have no tests at all. Every screen test runs against
FakeMapProvider, so a change to MapMarker, MapPolyline or IMapProvider can break both real
providers while the entire suite stays green.

This matters more than an ordinary coverage gap because adding a provider is an advertised
extension point
— rule 7 in AGENTS.md invites it, and notes that a third party added MapLibre in
about eighty lines. Somebody following that invitation gets no safety net, and the tests will
actively reassure them.

Why it is not simply fixed

Neither can run on the managed device:

  • aosp-atd carries no Play Services, so Google's map cannot initialise
  • the AMap SDK is optional at compile time and AMapProvider reaches it entirely by reflection

A google system image would cover the first. Nothing covers the second without the SDK present.

What has been done

CoordinateConverterTest (JVM, 6 tests, milliseconds) now covers the GCJ-02 conversion, which was
the one piece that is pure arithmetic. It was worth doing first out of all proportion to its size:
a wrong conversion does not fail, it puts every pin a few hundred metres from the tag for every
user in mainland China, and nothing else in the app would notice.

That leaves the provider classes themselves.

Divergences already spotted, untested

  • Google handles all three icon modes (iconBitmap, iconResourceId, useDefaultIcon); AMap
    handles only the bitmap
    and silently ignores iconResource. Nothing uses iconResource
    today, so it is latent rather than broken.
  • AMapProvider converts WGS-84 to GCJ-02 on the way out (markers, polylines, camera) and back on
    the way in (map clicks, getCameraPosition). That symmetry is what keeps the app's internal
    coordinates uniformly WGS-84, and nothing checks it holds for any newly added call.

Options, roughly in order of value

  1. A contract test run against every provider — a small suite asserting the shared promises
    (addMarker returns marker.getId(), removeMarker removes it, coordinates round-trip) that
    any new provider must pass. Would need a device with Play Services for the Google case.
  2. A google managed device profile, opted into rather than default, so the Google provider gets
    basic coverage without slowing every run.
  3. Accept it and write it down — a note in AGENTS.md rule 7 saying the providers are
    untested and a change to IMapProvider needs manual checking on both.

Option 3 costs nothing and is honest; the others are real work. Even done alone, 3 is better than
the current position, where the gap is invisible.


🤖 Written by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    @appIssues regarding the OpenTagViewer Android appenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions