Skip to content

Commit

Permalink
Add test for deebot_client.Map._get_svg_traces_path
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Rutkowski authored and Filip Rutkowski committed May 6, 2024
1 parent cabf37a commit 93748e5
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import asyncio
from typing import TYPE_CHECKING
from unittest.mock import ANY, AsyncMock, Mock, call
from unittest.mock import ANY, AsyncMock, Mock, call, patch

import pytest
import svg
Expand Down Expand Up @@ -141,6 +141,34 @@ async def on_change() -> None:
assert not map._unsubscribers


@patch(
"deebot_client.util.decompress_7z_base64_data",
Mock(return_value=b"\x10\x00\x00\x01\x00"),
)
async def test_Map_svg_traces_path(
execute_mock: AsyncMock, event_bus_mock: Mock
) -> None:
map = Map(execute_mock, event_bus_mock)

path = map._get_svg_traces_path()
assert path is None

map._update_trace_points("")
path = map._get_svg_traces_path()

assert path == Path(
fill="none",
stroke="#fff",
stroke_width=1.5,
stroke_linejoin="round",
vector_effect="non-scaling-stroke",
transform=[
svg.Scale(0.2, -0.2),
],
d=[svg.MoveTo(x=16, y=256)],
)


def test_compact_path() -> None:
"""Test that the path is compacted correctly."""
path = Path(
Expand Down

0 comments on commit 93748e5

Please sign in to comment.