Commit f6ad19bc authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

AlbumTrack: Remove unused setArtist method

parent eed19350
......@@ -85,19 +85,6 @@ ArtistPtr AlbumTrack::artist() const
return m_artist.get();
}
bool AlbumTrack::setArtist( std::shared_ptr<Artist> artist )
{
static const std::string req = "UPDATE " + policy::AlbumTrackTable::Name +
" SET artist_id = ? WHERE id_track = ?";
if ( artist->id() == m_artistId )
return true;
if ( sqlite::Tools::executeUpdate( m_ml->getConn(), req, artist->id(), m_id ) == false )
return false;
m_artistId = artist->id();
m_artist = artist;
return true;
}
void AlbumTrack::createTable( sqlite::Connection* dbConnection )
{
const std::string req = "CREATE TABLE IF NOT EXISTS " + policy::AlbumTrackTable::Name + "("
......
......@@ -60,7 +60,6 @@ class AlbumTrack : public IAlbumTrack, public DatabaseHelpers<AlbumTrack, policy
virtual int64_t id() const override;
virtual ArtistPtr artist() const override;
bool setArtist( std::shared_ptr<Artist> artist );
virtual GenrePtr genre() override;
bool setGenre( std::shared_ptr<Genre> genre );
virtual unsigned int trackNumber() override;
......
......@@ -51,32 +51,6 @@ TEST_F( AlbumTracks, Create )
ASSERT_EQ( 10u, f->albumTrack()->discNumber() );
}
TEST_F( AlbumTracks, Artist )
{
auto album = ml->createAlbum( "album" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
auto track = album->addTrack( f, 1, 0, 0, nullptr );
f->save();
auto artist = track->artist();
ASSERT_EQ( nullptr, artist );
auto newArtist = ml->createArtist( "Dream Seaotter" );
track->setArtist( newArtist );
artist = track->artist();
ASSERT_NE( nullptr, artist );
ASSERT_EQ( artist->name(), newArtist->name() );
Reload();
// Don't reuse the "track" and "f" variable, their type differ
auto media = ml->media( f->id() );
auto albumTrack = media->albumTrack();
artist = albumTrack->artist();
ASSERT_NE( nullptr, artist );
ASSERT_EQ( newArtist->name(), artist->name() );
ASSERT_EQ( newArtist->id(), artist->id() );
}
TEST_F( AlbumTracks, SetGenre )
{
auto a = ml->createAlbum( "album" );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment