import pytest

from tarot.tarot_api import Tarot
from tarot.ui import CubeDisplay


def test_cube_zoom():
    cube = Tarot.cube
    display = CubeDisplay(cube)
    assert display.zoom_level == 1.0

    display._zoom(1.1)
    assert display.zoom_level > 1.0

    display._zoom(0.5)
    assert display.zoom_level < 1.0


def test_cube_zoom_limits():
    cube = Tarot.cube
    display = CubeDisplay(cube)

    # Test upper limit
    for _ in range(20):
        display._zoom(1.5)
    assert display.zoom_level <= 3.0

    # Test lower limit
    for _ in range(20):
        display._zoom(0.5)
    assert display.zoom_level >= 0.5
