mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 04:19:55 +01:00
Fixed review comments from r307
This commit is contained in:
parent
3f861654ec
commit
fa3858266a
@ -125,7 +125,9 @@ class SingleSong : public LibraryBackendTest {
|
|||||||
song_.set_title("Title");
|
song_.set_title("Title");
|
||||||
song_.set_artist("Artist");
|
song_.set_artist("Artist");
|
||||||
song_.set_album("Album");
|
song_.set_album("Album");
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddDummySong() {
|
||||||
QSignalSpy added_spy(backend_.get(), SIGNAL(SongsDiscovered(SongList)));
|
QSignalSpy added_spy(backend_.get(), SIGNAL(SongsDiscovered(SongList)));
|
||||||
QSignalSpy deleted_spy(backend_.get(), SIGNAL(SongsDeleted(SongList)));
|
QSignalSpy deleted_spy(backend_.get(), SIGNAL(SongsDeleted(SongList)));
|
||||||
|
|
||||||
@ -149,12 +151,16 @@ class SingleSong : public LibraryBackendTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SingleSong, GetAllArtists) {
|
TEST_F(SingleSong, GetAllArtists) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
QStringList artists = backend_->GetAllArtists();
|
QStringList artists = backend_->GetAllArtists();
|
||||||
ASSERT_EQ(1, artists.size());
|
ASSERT_EQ(1, artists.size());
|
||||||
EXPECT_EQ(song_.artist(), artists[0]);
|
EXPECT_EQ(song_.artist(), artists[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, GetAllAlbums) {
|
TEST_F(SingleSong, GetAllAlbums) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
LibraryBackend::AlbumList albums = backend_->GetAllAlbums();
|
LibraryBackend::AlbumList albums = backend_->GetAllAlbums();
|
||||||
ASSERT_EQ(1, albums.size());
|
ASSERT_EQ(1, albums.size());
|
||||||
EXPECT_EQ(song_.album(), albums[0].album_name);
|
EXPECT_EQ(song_.album(), albums[0].album_name);
|
||||||
@ -162,6 +168,8 @@ TEST_F(SingleSong, GetAllAlbums) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, GetAlbumsByArtist) {
|
TEST_F(SingleSong, GetAlbumsByArtist) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
LibraryBackend::AlbumList albums = backend_->GetAlbumsByArtist("Artist");
|
LibraryBackend::AlbumList albums = backend_->GetAlbumsByArtist("Artist");
|
||||||
ASSERT_EQ(1, albums.size());
|
ASSERT_EQ(1, albums.size());
|
||||||
EXPECT_EQ(song_.album(), albums[0].album_name);
|
EXPECT_EQ(song_.album(), albums[0].album_name);
|
||||||
@ -169,12 +177,16 @@ TEST_F(SingleSong, GetAlbumsByArtist) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, GetAlbumArt) {
|
TEST_F(SingleSong, GetAlbumArt) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
LibraryBackend::Album album = backend_->GetAlbumArt("Artist", "Album");
|
LibraryBackend::Album album = backend_->GetAlbumArt("Artist", "Album");
|
||||||
EXPECT_EQ(song_.album(), album.album_name);
|
EXPECT_EQ(song_.album(), album.album_name);
|
||||||
EXPECT_EQ(song_.artist(), album.artist);
|
EXPECT_EQ(song_.artist(), album.artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, GetSongs) {
|
TEST_F(SingleSong, GetSongs) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
SongList songs = backend_->GetSongs("Artist", "Album");
|
SongList songs = backend_->GetSongs("Artist", "Album");
|
||||||
ASSERT_EQ(1, songs.size());
|
ASSERT_EQ(1, songs.size());
|
||||||
EXPECT_EQ(song_.album(), songs[0].album());
|
EXPECT_EQ(song_.album(), songs[0].album());
|
||||||
@ -184,6 +196,8 @@ TEST_F(SingleSong, GetSongs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, GetSongById) {
|
TEST_F(SingleSong, GetSongById) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
Song song = backend_->GetSongById(1);
|
Song song = backend_->GetSongById(1);
|
||||||
EXPECT_EQ(song_.album(), song.album());
|
EXPECT_EQ(song_.album(), song.album());
|
||||||
EXPECT_EQ(song_.artist(), song.artist());
|
EXPECT_EQ(song_.artist(), song.artist());
|
||||||
@ -192,6 +206,8 @@ TEST_F(SingleSong, GetSongById) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SingleSong, FindSongsInDirectory) {
|
TEST_F(SingleSong, FindSongsInDirectory) {
|
||||||
|
AddDummySong();
|
||||||
|
|
||||||
SongList songs = backend_->FindSongsInDirectory(1);
|
SongList songs = backend_->FindSongsInDirectory(1);
|
||||||
ASSERT_EQ(1, songs.size());
|
ASSERT_EQ(1, songs.size());
|
||||||
EXPECT_EQ(song_.album(), songs[0].album());
|
EXPECT_EQ(song_.album(), songs[0].album());
|
||||||
|
Loading…
Reference in New Issue
Block a user