mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-21 12:02:20 +01:00
Cover place_logo with a real-Tk test
Todo: 7808ee0a Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6c2c365a69
commit
9d63c33fa7
@ -2,7 +2,7 @@ name: diet_guard_app
|
||||
description: "Companion phone app for diet_guard: log meals on the go."
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.0.187+1
|
||||
version: 1.0.188+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
|
||||
35
diet_guard/tests/test_gatelock_logo.py
Normal file
35
diet_guard/tests/test_gatelock_logo.py
Normal file
@ -0,0 +1,35 @@
|
||||
"""The kuhy logo sits in the bottom-right corner of every gate surface."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit.tk import KuhyCredit
|
||||
import pytest
|
||||
|
||||
from diet_guard._gatelock_logo import place_logo
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pytest_xvfb import Xvfb
|
||||
|
||||
|
||||
def test_place_logo_anchors_bottom_right(xvfb: Xvfb | None) -> None:
|
||||
# Real Tk, so only ever on pytest-xvfb's private display -- never the user's.
|
||||
if xvfb is None:
|
||||
pytest.skip("needs pytest-xvfb's private display")
|
||||
assert os.environ["DISPLAY"] == f":{xvfb.display}"
|
||||
root = tk.Tk()
|
||||
try:
|
||||
root.withdraw()
|
||||
frame = tk.Frame(root)
|
||||
credit = place_logo(frame)
|
||||
assert isinstance(credit, KuhyCredit)
|
||||
assert credit.master is frame
|
||||
info = credit.place_info()
|
||||
assert info["anchor"] == "se"
|
||||
assert (info["relx"], info["rely"]) == ("1", "1")
|
||||
assert (info["x"], info["y"]) == ("-16", "-16")
|
||||
finally:
|
||||
root.destroy()
|
||||
Loading…
Reference in New Issue
Block a user