mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 19:27:16 +01:00
gatelock tests: pin density in widget tests
xvfb-run's 640x480 screen compacts the scale to 0.7 and clamps body and label to the same 11px floor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZd3smuxDGmEgXkYP8
This commit is contained in:
parent
97d043d424
commit
71ea92f3c2
@ -16,6 +16,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
from gatelock import _density
|
||||
from gatelock._config import LockConfig
|
||||
from gatelock.widgets import (
|
||||
DEFAULT_WRAP,
|
||||
@ -50,6 +51,18 @@ def _font_px(widget: tk.Misc) -> int:
|
||||
return abs(int(tkfont.Font(font=widget.cget("font")).actual("size")))
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _full_size_type_scale() -> Iterator[None]:
|
||||
"""Pin the density to 1.0 so type-size comparisons ignore the display.
|
||||
|
||||
``xvfb-run`` defaults to a 640x480 screen, which compacts the scale to 0.7
|
||||
and clamps both the body and label roles to the same 11px floor -- so
|
||||
"primary reads larger" and "caption is smaller" became 8 vs 8.
|
||||
"""
|
||||
with _density.forced(1.0):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def root() -> Iterator[tk.Tk]:
|
||||
"""A focused toplevel; Xvfb has no WM to assign X focus for us."""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user