v0.92.0: no black corners on windows shown before they were polished; Copy beside Shazams that couldn't be imported, to

search by hand
This commit is contained in:
2026-11-08 20:54:26 -08:00
parent bf68e99b8d
commit 8afcd4433b
6 changed files with 173 additions and 21 deletions
+9 -5
View File
@@ -544,8 +544,12 @@ def test_every_column_edge_can_be_dragged(qapp):
from lintunes.gui import shazam_import as ui
window = ui.ShazamImportWindow([_song("a")])
preview = ui.ShazamPreviewDialog(_Reader([_song("a")]), set(), [], None)
for tree in (window._tree, preview._tree):
header = tree.header()
for i in range(header.count() - 1):
assert header.sectionResizeMode(i) == QHeaderView.ResizeMode.Interactive
assert header.stretchLastSection()
header = preview._tree.header()
for i in range(header.count() - 1):
assert header.sectionResizeMode(i) == QHeaderView.ResizeMode.Interactive
assert header.stretchLastSection()
# Round 128: the import window's last column is Copy, a fixed button;
# the song and status edges still drag, and the status fills the rest.
header = window._tree.header()
for i in (0, 1):
assert header.sectionResizeMode(i) == QHeaderView.ResizeMode.Interactive
+59
View File
@@ -0,0 +1,59 @@
"""Round 128.
- A window shown without being polished first got its native surface before
the title-bar installer asked for an alpha channel, so the cleared corners
outside the curve came out black.
- Importing Shazams: a song that couldn't be imported gets a Copy button
(right-hand column) that puts "Artist — Title (Album)" on the clipboard,
to search for it by hand.
"""
from datetime import datetime
from PyQt6.QtWidgets import QDialog, QToolButton
from lintunes.gui import shazam_import as ui
from lintunes.gui import titlebar
from lintunes.shazam import ShazamSong
def test_a_window_shown_unpolished_still_gets_alpha(qapp):
installer = titlebar.install(qapp)
try:
dialog = QDialog() # shown at once: created, then polished
dialog.show()
qapp.processEvents()
assert dialog.windowHandle().format().alphaBufferSize() == 8
dialog.close()
finally:
qapp.removeEventFilter(installer)
def _song(rid, **kw):
return ShazamSong(request_id=rid, when=datetime(2026, 10, 1, 20, 15), **kw)
def _copy_in(window, rid):
cell = window._tree.itemWidget(window._rows[rid], 2)
return cell.findChild(QToolButton) if cell is not None else None
def test_songs_that_failed_get_a_copy_button(qapp):
window = ui.ShazamImportWindow([
_song("a", title="America Latina"),
_song("b", title="Ghor Bari", artist="Kalyani Ghosh", album="Songs"),
_song("c", title="Digital Love", artist="Daft Punk")])
assert _copy_in(window, "a") is None
window.failed("a", "nothing found that's just the song")
window.set_stage("b", "Downloading…")
window.finish(cancelled=False) # b never landed: Not found
window.imported("c", object())
assert _copy_in(window, "c") is None
_copy_in(window, "b").click()
assert qapp.clipboard().text() == "Kalyani Ghosh — Ghor Bari (Songs)"
_copy_in(window, "a").click()
assert qapp.clipboard().text() == "America Latina"
# A row that recovers loses it again.
window.set_stage("a", ui.IMPORTING)
assert _copy_in(window, "a") is None