test_desktop_input.py 809 B

1234567891011121314151617181920
  1. from types import SimpleNamespace
  2. import pytest
  3. from module.base.cBezier import human_track
  4. from module.device.method.windows_impl import Window
  5. @pytest.mark.parametrize('start,end', [((10, 10), (10, 10)), ((10, 10), (10, 11)), ((10, 10), (10, 200))])
  6. def test_degenerate_swipe_still_reaches_endpoint(start, end):
  7. points = human_track(start, end)
  8. assert points
  9. assert tuple(points[-1]) == end
  10. assert all(point[0] == 10 for point in points)
  11. @pytest.mark.parametrize('size,expected', [((1280, 720), (640, 360)), ((1024, 576), (512, 288))])
  12. def test_desktop_click_coordinates_follow_virtual_client_size(size, expected):
  13. window = SimpleNamespace(screenshot_size=(1280, 720), desktop_client_size_virtual=lambda: size)
  14. assert Window.desktop_message_coord(window, 640, 360) == expected