Skip to content

Raise unit test coverage from 49% to 81% - #49

Merged
afarber merged 2 commits into
mainfrom
more-unit-tests
Oct 13, 2026
Merged

afarber merged 2 commits into
mainfrom
more-unit-tests

Conversation

@afarber

@afarber afarber commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Unit test coverage was at 49% of instructions (38% of branches), and the gate only required 20%. Several public classes had no tests at all: Circle, GroundOverlay, TileOverlay, every *Options builder, PredefinedTileProviders and the Projection class.

What's in here:

  • New tests for those classes, plus MapControllerOverlaysTest, which covers circles, ground and tile overlays, their touch handling, info window hits, and one draw() call with every shape type (holes, geodesic, dash patterns, style spans, rotated ground overlays, tile overlays above and below the base map)
  • Removed five private draw helpers in MapController (drawPolylines, drawPolylineWithSpans, drawPolygons, drawCircles, drawMarkers). Nothing called them; draw() uses the zIndex-aware versions. That's about 250 lines of dead code
  • Coverage gate raised from 20% to 75%
  • The test table in TESTING_UNIT.md was quite out of date, so it's regenerated with the real counts (456 tests in 35 classes)

Result: 81% instructions, 79% lines, 65% branches. The biggest remaining gap is OpenMapView itself (23%), mostly touch handling, which the instrumented tests exercise on a device instead.

Merges cleanly with #48, which touches the same script.

- Add tests for Circle, GroundOverlay, TileOverlay, Tile, the Options
  builders, PredefinedTileProviders and the public Projection class
- Add MapControllerOverlaysTest for circles, ground and tile overlays,
  their touch detection, info windows and drawing every shape type
- Remove five private draw helpers in MapController that were never
  called (replaced earlier by the zIndex-aware versions)
- Raise the coverage gate from 20% to 75%
- Update the test table in TESTING_UNIT.md with current counts
@afarber
afarber merged commit d9aa8a6 into main Oct 13, 2026
14 checks passed
@afarber
afarber deleted the more-unit-tests branch October 13, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant