tysm fable
This commit is contained in:
@ -381,6 +381,54 @@ class TestArtSearch:
|
||||
assert not manager.undo_stack.can_undo()
|
||||
|
||||
|
||||
class TestAlbumWideArt:
|
||||
def test_album_tracks_matches_album_case_insensitively(self):
|
||||
from lintunes.gui.main_window import album_tracks
|
||||
library = Library()
|
||||
library.tracks = {
|
||||
1: Track(track_id=1, artist="Artist", album="Great Album"),
|
||||
2: Track(track_id=2, artist="artist", album="great album"),
|
||||
3: Track(track_id=3, artist="Someone Else", album="Great Album",
|
||||
album_artist="Artist"), # album_artist wins the grouping
|
||||
4: Track(track_id=4, artist="Artist", album="Other Album"),
|
||||
5: Track(track_id=5, artist="Other Artist", album="Great Album"),
|
||||
}
|
||||
ids = {t.track_id
|
||||
for t in album_tracks(library, "Artist", "Great Album")}
|
||||
assert ids == {1, 2, 3}
|
||||
|
||||
def _dialog(self, qapp, monkeypatch, track_count, album_count):
|
||||
from lintunes.art_search import AlbumArtFetcher, ArtCandidate
|
||||
from lintunes.gui.album_art_dialog import AlbumArtDialog
|
||||
# No network: capture the fetch and feed the image back by hand.
|
||||
monkeypatch.setattr(AlbumArtFetcher, "fetch", lambda self, c: None)
|
||||
candidate = ArtCandidate(artist="A", album="B", art_url="https://x")
|
||||
dialog = AlbumArtDialog([candidate], track_count,
|
||||
album_count=album_count)
|
||||
dialog._on_image({"candidate": candidate, "image": b"img",
|
||||
"mime": "image/png"})
|
||||
return dialog
|
||||
|
||||
def test_album_button_applies_to_whole_album(self, qapp, monkeypatch):
|
||||
dialog = self._dialog(qapp, monkeypatch, track_count=1, album_count=12)
|
||||
assert dialog._album_btn is not None
|
||||
assert dialog._album_btn.isEnabled()
|
||||
assert "12" in dialog._album_btn.text()
|
||||
assert not dialog.apply_to_album
|
||||
dialog._accept_album()
|
||||
assert dialog.apply_to_album
|
||||
assert dialog.selected_image == b"img"
|
||||
assert dialog.selected_mime == "image/png"
|
||||
|
||||
def test_no_album_button_when_selection_covers_album(self, qapp,
|
||||
monkeypatch):
|
||||
dialog = self._dialog(qapp, monkeypatch, track_count=5, album_count=5)
|
||||
assert dialog._album_btn is None
|
||||
dialog._accept_current()
|
||||
assert not dialog.apply_to_album
|
||||
assert dialog.selected_image == b"img"
|
||||
|
||||
|
||||
# ---- context menu exposes the new action's signal ----
|
||||
|
||||
class TestDownloadArtSignal:
|
||||
|
||||
Reference in New Issue
Block a user