Files
lintunes/tests/test_round82.py
T
trav 770a239138 v0.61.1: update the art-border test to the uniform grey line
v0.61.0 shipped with this test still pinning the old two-tone edge.
2026-10-17 00:42:58 -07:00

49 lines
1.7 KiB
Python

"""Round 82: album art sits in the same panel, in the same place, as the
empty art panel: the cover changes what is inside the frame, never the
frame."""
from PyQt6.QtGui import QColor, QPixmap
from tests.test_round80 import _sidebar
def _show_art(qapp, art, color):
pixmap = QPixmap(10, 10)
pixmap.fill(QColor(color))
art._pixmap = pixmap
art._fit_height()
qapp.processEvents()
def test_art_keeps_the_empty_panels_place_and_border(qapp, tmp_path):
from lintunes.gui.sidebar import NO_ART_GAP
window, sidebar = _sidebar(qapp, tmp_path)
art = sidebar.art
empty_geometry = art.geometry()
empty = art.grab().toImage()
_show_art(qapp, art, "white")
assert art.parentWidget() is sidebar
assert art.geometry() == empty_geometry
assert art.height() == art.width() + NO_ART_GAP
image = art.grab().toImage()
middle = image.width() // 2
# the gap unchanged; with art the outline is the lists' uniform grey
# (Round 92), the cover right inside it
from lintunes.gui.sidebar import frame_color
for y in range(NO_ART_GAP):
assert image.pixelColor(middle, y) == empty.pixelColor(middle, y)
assert image.pixelColor(middle, NO_ART_GAP).name() == frame_color(
art.palette()).name()
assert image.pixelColor(middle, NO_ART_GAP + 1) == QColor("white")
assert image.pixelColor(middle, image.height() // 2) == QColor("white")
window.close()
def test_art_changes_no_layout(qapp, tmp_path):
window, sidebar = _sidebar(qapp, tmp_path)
list_geometry = sidebar.list_area.geometry()
_show_art(qapp, sidebar.art, "red")
sidebar.art.has_art_changed.emit(True)
qapp.processEvents()
assert sidebar.list_area.geometry() == list_geometry
window.close()