v0.51.2: album art sits in the empty art panel's own frame, below the list, instead of inside the list's frame
This commit is contained in:
+33
-15
@@ -1,27 +1,45 @@
|
||||
"""Round 82: the list frame closes above album art too."""
|
||||
"""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 test_art_draws_the_frames_closing_line(qapp, tmp_path):
|
||||
"""A white cover inside the list's frame starts under a line in the
|
||||
frame's own color, not straight on from the list."""
|
||||
from lintunes.gui.sidebar import ART_RULE
|
||||
window, sidebar = _sidebar(qapp, tmp_path)
|
||||
art = sidebar.art
|
||||
def _show_art(qapp, art, color):
|
||||
pixmap = QPixmap(10, 10)
|
||||
pixmap.fill(QColor("white"))
|
||||
pixmap.fill(QColor(color))
|
||||
art._pixmap = pixmap
|
||||
art.has_art_changed.emit(True)
|
||||
art._fit_height()
|
||||
qapp.processEvents()
|
||||
group = sidebar.list_area.grab().toImage()
|
||||
# the frame's own left edge, halfway down the list
|
||||
frame = group.pixelColor(0, group.height() // 4)
|
||||
|
||||
|
||||
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
|
||||
for y in range(ART_RULE):
|
||||
assert image.pixelColor(middle, y) == frame
|
||||
assert image.pixelColor(middle, ART_RULE) == QColor("white")
|
||||
# the gap and the panel's darker top edge, unchanged
|
||||
for y in range(NO_ART_GAP + 1):
|
||||
assert image.pixelColor(middle, y) == empty.pixelColor(middle, y)
|
||||
# ...and the cover just inside it
|
||||
assert image.pixelColor(middle, NO_ART_GAP + 2) == 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()
|
||||
|
||||
Reference in New Issue
Block a user