MIL-013: Debian container and Windows Sandbox checks
A Debian image (python:3.13-slim-bookworm with Xvfb and GNOME's window manager) runs the linters, the whole test suite, the screenshots and the smoke test of a PyInstaller Linux binary and of the source program, so no window opens on the development machine. The screenshot tool works on Linux, a smoke driver presses the known button with the virtual mouse, and Windows Sandbox scripts are written (not run, they open a window on the host). README and the wiki Install pages describe it. Review records RC-077 (Python) and RC-078 (shell). Task: MIL-013#2 Task: MIL-013#3 Task: MIL-013#4 Task: MIL-013#5 Task: MIL-013#6 Task: MIL-013#7 Task: MIL-013#9 Task: MIL-013#10
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""Tests of the pure parts of the screenshot tool.
|
||||
|
||||
@file test_capture_screenshots.py
|
||||
@brief Checks platform_kind and window_box of tools/capture_screenshots.py.
|
||||
"""
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("PIL")
|
||||
|
||||
_TOOL_PATH = Path(__file__).resolve().parents[2] / "tools" / "capture_screenshots.py"
|
||||
|
||||
|
||||
def _load_tool() -> ModuleType:
|
||||
spec = importlib.util.spec_from_file_location("capture_screenshots", _TOOL_PATH)
|
||||
assert spec is not None
|
||||
assert spec.loader is not None
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
def test_platform_kind_is_windows_for_win32() -> None:
|
||||
assert _load_tool().platform_kind("win32") == "windows"
|
||||
|
||||
|
||||
def test_platform_kind_is_x11_for_linux() -> None:
|
||||
assert _load_tool().platform_kind("linux") == "x11"
|
||||
|
||||
|
||||
def test_window_box_adds_menu_height_on_x11() -> None:
|
||||
assert _load_tool().window_box("x11", 10, 100, 900, 726, 28) == (10, 72, 910, 826)
|
||||
|
||||
|
||||
def test_window_box_ignores_menu_height_on_windows() -> None:
|
||||
box = _load_tool().window_box("windows", 10, 100, 900, 726, 28)
|
||||
assert box == (10, 100, 910, 826)
|
||||
Reference in New Issue
Block a user