v0.95.0: the now-playing panel puts the title beside artist-over-album when it all fits, and keeps the stack (now with an ellipsis) when it doesn't

This commit is contained in:
2026-11-17 19:22:10 -08:00
parent 81b6fa509f
commit cea9daa09f
4 changed files with 173 additions and 20 deletions
+47
View File
@@ -268,3 +268,50 @@ def test_the_new_playlist_gets_its_cover(window, qapp, fake, mp3_file,
_pump(qapp, lambda: saved)
assert playlist_art.find(manager.data_dir, playlist.persistent_id) \
== saved[0]
# --------------------------------------------------------------------------
# E. the now-playing words: side by side when they fit, stacked when not
def test_title_beside_artist_over_album_when_there_is_room(qapp):
from lintunes.gui.transport import NowPlayingText
from PyQt6.QtWidgets import QWidget
holder = QWidget() # a window would get a title bar
holder.resize(1000, 100)
text = NowPlayingText(holder)
holder.show()
text.set_song("Tomorrow's Girls", "Donald Fagen", "Kamakiriad")
text.resize(900, 50)
text.arrange()
assert text.side
assert text.title.geometry().right() < text.artist.geometry().left()
assert text.artist.geometry().left() == text.album.geometry().left()
assert text.artist.geometry().bottom() < text.album.geometry().top()
assert (text.artist.text(), text.album.text()) == ("Donald Fagen",
"Kamakiriad")
text.resize(text.title.fontMetrics().horizontalAdvance(
"Tomorrow's Girls") + 20, 50) # too narrow: the stack
assert not text.side and text.album.isHidden()
assert text.artist.text().startswith("Donald Fagen") # maybe elided
assert text.title.geometry().bottom() < text.artist.geometry().top()
text.resize(600, 50)
text.set_lines("DJ mode", "x")
text.set_song("Tomorrow's Girls", "Donald Fagen", "Kamakiriad")
assert text.side
def test_fixed_lines_and_a_bare_title_always_stack(qapp):
from lintunes.gui.transport import NowPlayingText
from PyQt6.QtWidgets import QWidget
holder = QWidget() # a window would get a title bar
holder.resize(1000, 100)
text = NowPlayingText(holder)
holder.show()
text.resize(900, 50)
text.set_lines("DJ mode", "Drag songs onto the records")
assert not text.side and text.artist.text() == "Drag songs onto the records"
text.set_song("Untitled", "", "")
assert not text.side and text.artist.text() == ""
text.set_song("Song", "", "Album only")
assert text.side and not text.album.isHidden() and text.artist.isHidden()