Files
lintunes/tests/test_round61.py
T
travandClaude Opus 5.5 372946c79f v0.24.0: click the blank cover
Clicking the gray sidebar art square (playing track has no embedded art)
now opens Download Album Art for that track, same as the right-click menu.
Once art is embedded the square refreshes and a click opens the big view
again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 23:52:09 -07:00

64 lines
2.1 KiB
Python

"""Round 61: clicking the gray (art-less) sidebar square asks for the
playing track's art to be downloaded; with art it still opens the big view."""
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QPixmap
from lintunes.models import Track
from tests.test_round49 import _FakePlayer, _release
def _art():
from lintunes.gui.sidebar import SidebarArt
art = SidebarArt(_FakePlayer())
art.resize(100, 100)
requested = []
art.download_art_requested.connect(requested.append)
return art, requested
def _track(tid=7):
# No location: set_track reads no art, which is the gray-square case
return Track(track_id=tid, name="Song", artist="Artist", album="Album")
class TestGraySquareClick:
def test_click_without_art_requests_a_download(self, qapp):
art, requested = _art()
art.set_track(_track(42))
art.mouseReleaseEvent(_release(Qt.MouseButton.LeftButton))
assert requested == [42]
assert not art._art_window.isVisible()
def test_no_track_requests_nothing(self, qapp):
art, requested = _art()
art.mouseReleaseEvent(_release(Qt.MouseButton.LeftButton))
assert requested == []
def test_with_art_opens_the_big_view_instead(self, qapp):
art, requested = _art()
art.set_track(_track())
pixmap = QPixmap(32, 32)
pixmap.fill(Qt.GlobalColor.blue)
art._pixmap = pixmap
art.mouseReleaseEvent(_release(Qt.MouseButton.LeftButton))
try:
assert requested == []
assert art._art_window.isVisible()
finally:
art._art_window.hide()
def test_right_click_or_release_outside_requests_nothing(self, qapp):
art, requested = _art()
art.set_track(_track())
art.mouseReleaseEvent(_release(Qt.MouseButton.RightButton))
art.mouseReleaseEvent(_release(Qt.MouseButton.LeftButton, 500, 500))
assert requested == []
def test_tooltip_says_what_a_click_will_do(self, qapp):
art, _ = _art()
art.set_track(None)
assert art.toolTip() == ""
art.set_track(_track())
assert art.toolTip() == "Click to download album art"