v0.47.0: no album art shows a debossed panel, not a flat square
The sidebar's art square, when a track has no art, is now the list's own background with a rounded panel set into it, debossed like the visualizer and the now-playing panel. paint_deboss takes its rims in pixels when asked, so a panel as tall as the sidebar is recessed as much as a short one rather than fading over 16 px.
This commit is contained in:
@@ -98,3 +98,46 @@ def test_thumb_paints(qapp):
|
||||
trough = image.pixelColor(7, 5)
|
||||
middle = image.pixelColor(7, thumb.center().y())
|
||||
assert middle != trough
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# no album art: a debossed panel, not a flat square
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
def test_no_art_is_a_debossed_panel(qapp):
|
||||
from PyQt6.QtCore import QObject, pyqtSignal
|
||||
from lintunes.gui.sidebar import NO_ART_MARGIN, SidebarArt
|
||||
|
||||
class Player(QObject):
|
||||
track_changed = pyqtSignal(object)
|
||||
|
||||
art = SidebarArt(Player())
|
||||
art.resize(200, 200)
|
||||
image = art.grab().toImage()
|
||||
base = art.palette().base().color()
|
||||
# the margin around the panel is the list's own background...
|
||||
assert image.pixelColor(1, 100) == base
|
||||
# ...the corner is rounded off, so it's background too...
|
||||
assert image.pixelColor(NO_ART_MARGIN + 1, NO_ART_MARGIN + 1) == base
|
||||
# ...and the panel is shaded darker at the top than in the middle
|
||||
top = image.pixelColor(100, NO_ART_MARGIN + 2).lightness()
|
||||
middle = image.pixelColor(100, 100).lightness()
|
||||
assert top < middle
|
||||
|
||||
|
||||
def test_deboss_rims_can_be_fixed_in_pixels(qapp):
|
||||
"""On a 400 px panel the default rims are 32 px deep; 3 px rims leave
|
||||
row 10 already on the face, a good deal lighter."""
|
||||
from PyQt6.QtCore import QRectF
|
||||
from PyQt6.QtGui import QImage, QPainter
|
||||
color = QColor("#e0e0e0")
|
||||
|
||||
def row10(**kw):
|
||||
image = QImage(100, 400, QImage.Format.Format_ARGB32)
|
||||
image.fill(0)
|
||||
painter = QPainter(image)
|
||||
theme.paint_deboss(painter, QRectF(0.5, 0.5, 99, 399), color, 8, **kw)
|
||||
painter.end()
|
||||
return image.pixelColor(50, 10).lightness()
|
||||
|
||||
assert row10(rim=3) > row10() + 5
|
||||
|
||||
Reference in New Issue
Block a user