25 lines
838 B
Python
25 lines
838 B
Python
|
|
import sys
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.skipif(sys.platform != "win32", reason="Tray nur auf Windows")
|
||
|
|
class TestCreateIcon:
|
||
|
|
def test_returns_image_for_each_state(self):
|
||
|
|
from PIL import Image
|
||
|
|
from whisper_local.tray._tray import AppState
|
||
|
|
from whisper_local.tray._icon import create_icon
|
||
|
|
|
||
|
|
for state in AppState:
|
||
|
|
img = create_icon(state)
|
||
|
|
assert isinstance(img, Image.Image)
|
||
|
|
assert img.size == (64, 64)
|
||
|
|
assert img.mode == "RGBA"
|
||
|
|
|
||
|
|
def test_different_states_have_different_colors(self):
|
||
|
|
from whisper_local.tray._tray import AppState
|
||
|
|
from whisper_local.tray._icon import create_icon
|
||
|
|
|
||
|
|
waiting = create_icon(AppState.WAITING)
|
||
|
|
recording = create_icon(AppState.RECORDING)
|
||
|
|
assert waiting.tobytes() != recording.tobytes()
|