@@ -805,12 +805,11 @@ async def test_archived_map_pushes_cannot_overwrite_live_map(
805805 assert q10_api .map .robot_position == live_position
806806 assert q10_api .map .robot_heading == live_heading
807807 assert live_updates == []
808- assert q10_api .clean_history .detail_packet is not None
808+ assert q10_api .clean_history .detail is clean_record
809+ assert q10_api .clean_history .detail_packet is clean_record .map
809810 assert q10_api .clean_history .detail_packet .kind is Q10MapPacketKind .CLEAN_RECORD_DETAIL
810- assert q10_api .clean_history .detail_image_content is not None
811- assert q10_api .maps .detail_packet is not None
811+ assert q10_api .maps .detail_packet is saved_map
812812 assert q10_api .maps .detail_packet .kind is Q10MapPacketKind .SAVED_MAP_DETAIL
813- assert q10_api .maps .detail_image_content is not None
814813 assert clean_record_updates == [None ]
815814 assert saved_map_updates == [None ]
816815
@@ -826,25 +825,30 @@ def test_archive_owners_reject_wrong_packet_kinds(q10_api: Q10PropertiesApi) ->
826825
827826
828827@pytest .mark .parametrize ("scale" , [1 , 2 , 4 ])
829- async def test_all_q10_map_views_render_at_requested_scale (scale : int , fake_channel : FakeB01Q10Channel ) -> None :
828+ async def test_live_q10_map_renders_at_requested_scale (scale : int , fake_channel : FakeB01Q10Channel ) -> None :
830829 api = create (fake_channel , map_parser_config = B01Q10MapParserConfig (map_scale = scale ))
831830 payload = FIXTURE .read_bytes ()
832831 fake_channel .messages_to_stream = [
833832 parse_map_packet (payload ),
834- parse_clean_record_detail (b"\x03 \x01 " + payload [2 :]),
835- parse_map_packet (b"\x04 \x01 " + payload [2 :]),
836833 ]
837834 await api .start ()
838835 try :
839- await _wait_for (lambda : api .maps .detail_image_content is not None )
840- for content in [api .map .image_content , api .clean_history .detail_image_content , api .maps .detail_image_content ]:
841- assert content is not None
842- with Image .open (io .BytesIO (content )) as image :
843- assert image .size == (8 * scale , 6 * scale )
836+ await _wait_for (lambda : api .map .image_content is not None )
837+ assert api .map .image_content is not None
838+ with Image .open (io .BytesIO (api .map .image_content )) as image :
839+ assert image .size == (8 * scale , 6 * scale )
844840 finally :
845841 await api .close ()
846842
847843
844+ def test_q10_properties_constructor_uses_default_live_map_config (fake_channel : FakeB01Q10Channel ) -> None :
845+ api = Q10PropertiesApi (fake_channel )
846+ api .map .update_from_map_packet (parse_map_packet (FIXTURE .read_bytes ()))
847+ assert api .map .image_content is not None
848+ with Image .open (io .BytesIO (api .map .image_content )) as image :
849+ assert image .size == (32 , 24 )
850+
851+
848852@pytest .mark .parametrize ("selected,expected" , [(None , "12345" ), ("67890" , "67890" )])
849853async def test_saved_map_detail_refresh_publishes_selection (
850854 q10_api : Q10PropertiesApi ,
@@ -885,7 +889,6 @@ async def test_saved_map_details_publish_packet_map_id_and_notify(
885889 await _wait_for (lambda : bool (updates ))
886890 assert updates == [str (packet .map_id )]
887891 assert q10_api .maps .detail_packet is packet
888- assert q10_api .maps .detail_image_content is not None
889892 message_queue .put_nowait (replace (packet , map_id = 999 ))
890893 await _wait_for (lambda : len (updates ) == 2 )
891894 assert updates == [str (packet .map_id ), "999" ]
@@ -903,7 +906,7 @@ def test_saved_map_diagnostics_exclude_binary_content(q10_api: Q10PropertiesApi)
903906 q10_api .maps .update_from_map_packet (packet )
904907 data = q10_api .as_dict ()["maps" ]
905908 assert data == {"detailMapId" : str (packet .map_id )}
906- assert q10_api .maps .detail_image_content is not None
909+ assert q10_api .maps .detail_packet is packet
907910 assert q10_api .maps .as_dict (exclude = {"detail_map_id" }) == {}
908911 json .dumps (data )
909912
@@ -946,7 +949,7 @@ def predicate() -> bool:
946949
947950
948951@pytest .mark .parametrize ("drawables,expected_base" , [([], True ), ([Drawable .CHARGER ], False )])
949- async def test_all_q10_map_views_honor_drawable_selection (
952+ async def test_live_q10_map_honors_drawable_selection (
950953 drawables : list [Drawable ], expected_base : bool , fake_channel : FakeB01Q10Channel
951954) -> None :
952955 api = create (fake_channel , map_parser_config = B01Q10MapParserConfig (drawables = drawables ))
@@ -964,15 +967,12 @@ async def test_all_q10_map_views_honor_drawable_selection(
964967 )
965968 fake_channel .messages_to_stream = [
966969 packet ,
967- Q10CleanRecordDetail (map = replace (packet , kind = Q10MapPacketKind .CLEAN_RECORD_DETAIL )),
968- replace (packet , kind = Q10MapPacketKind .SAVED_MAP_DETAIL ),
969970 ]
970971 await api .start ()
971972 try :
972- await _wait_for (lambda : api .maps .detail_image_content is not None )
973- for content in [api .map .image_content , api .clean_history .detail_image_content , api .maps .detail_image_content ]:
974- assert content is not None
975- with Image .open (io .BytesIO (content )) as image :
976- assert (image .tobytes () == base_pixels ) is expected_base
973+ await _wait_for (lambda : api .map .image_content is not None )
974+ assert api .map .image_content is not None
975+ with Image .open (io .BytesIO (api .map .image_content )) as image :
976+ assert (image .tobytes () == base_pixels ) is expected_base
977977 finally :
978978 await api .close ()
0 commit comments