Skip to content

test(map): add v1 map test fixtures and snapshot tests - #969

Merged
allenporter merged 2 commits into
Python-roborock:mainfrom
allenporter:test-v1-map-fixtures
Sep 28, 2026
Merged

allenporter merged 2 commits into
Python-roborock:mainfrom
allenporter:test-v1-map-fixtures

Conversation

@allenporter

Copy link
Copy Markdown
Contributor

Description

This PR adds real Roborock V1 binary map fixtures (RRMap format) and comprehensive syrupy snapshot tests for roborock.map.map_parser.

Previously, tests/map/test_map_parser.py only contained tests for invalid empty payloads (b"", b"12345"), while valid map decoding, image extraction, and rendering options were unexercised in unit tests (and mocked everywhere else).

Changes

  • Added 4 real Roborock V1 fixtures under tests/map/testdata/v1/:
    • s5_fw2008_with_segments.bin: Roborock S5 multi-room map (rooms 1 & 2), charger, vacuum position, and navigation path.
    • s5_fw1886_with_forbidden_zones_and_virtual_walls.bin: Virtual walls, forbidden/no-go areas, and active zones.
    • s5_fw1886_with_goto_target.bin: Pinpoint target location and computed goto path.
    • s6_fw2652_with_active_segment_and_no_mop_zone.bin: Roborock S6 map with 6 segmented rooms, an active segment, and a no-mop zone.
  • Added tests/map/testdata/v1/README.md documenting upstream source (Valetudo), Apache 2.0 license compatibility, and features exercised by each fixture.
  • Added snapshot tests in tests/map/test_map_parser.py using syrupy (SnapshotAssertion) verifying:
    • Decoded map metadata (charger, vacuum_position, rooms, walls, no_go_areas, no_mopping_areas, zones, path_points, header parameters)
    • Rendered image properties ((width, height), PNG format) without storing OS-variant zlib binary chunks in snapshot files
  • Added tests for MapParserConfig variants (show_background=False, show_walls=False, show_rooms=False, scaling) and _create_image_generator.
  • Brought roborock/map/map_parser.py test line coverage to 100%.

Copilot AI lite review requested due to automatic review settings September 27, 2026 20:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add goto_target assertions and correct the fixture documentation before approval.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds Roborock V1 map fixtures and snapshot tests covering parsing, rendering, and configuration variants.

Changes:

  • Added four real S5/S6 binary map fixtures with attribution.
  • Added parser and rendering snapshot tests.
  • Added configuration and image-generator coverage.
File Summary
tests/​map/​testdata/​v1/​README.md Documents fixture sources and coverage; its goto-path description needs correction.
tests/​map/​test_map_parser.py Adds fixture parsing and rendering tests; should assert goto_target.
tests/​map/​__snapshots__/​test_map_parser.ambr Stores expected parsed-map snapshots.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +28 to +29
"charger": md.charger,
"vacuum_position": md.vacuum_position,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Added goto to the snapshot projection (Point(x=25874, y=26218, a=None) for s5_fw1886_with_goto_target.bin) and updated the fixture description in README.md to accurately reference goto and predicted_path.

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐐

@allenporter
allenporter merged commit a8260c5 into Python-roborock:main Sep 28, 2026
7 checks passed
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.

3 participants