Commit 4b72828b authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

tests: Use addMedia instead of addFile when appropriate

parent 84cb91cc
......@@ -125,10 +125,10 @@ TEST_F( Artists, Albums )
ASSERT_NE( album1, nullptr );
ASSERT_NE( album2, nullptr );
auto media1 = ml->addFile( "track1.mp3" );
auto media1 = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
ASSERT_NE( nullptr, media1 );
album1->addTrack( media1, 1, 0, artist->id(), nullptr );
auto media2 = ml->addFile( "track2.mp3" );
auto media2 = std::static_pointer_cast<Media>( ml->addMedia( "track2.mp3" ) );
ASSERT_NE( nullptr, media2 );
album2->addTrack( media2, 1, 0, artist->id(), nullptr );
......@@ -373,15 +373,15 @@ TEST_F( Artists, SortAlbum )
{
auto artist = ml->createArtist( "Dream Seaotter" );
auto album1 = ml->createAlbum( "album1" );
auto media1 = ml->addFile( "track1.mp3" );
auto media1 = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
album1->addTrack( media1, 1, 0, artist->id(), nullptr );
album1->setReleaseYear( 2000, false );
auto album2 = ml->createAlbum( "album2" );
auto media2 = ml->addFile( "track2.mp3" );
auto media2 = std::static_pointer_cast<Media>( ml->addMedia( "track2.mp3" ) );
album2->addTrack( media2, 1, 0, artist->id(), nullptr );
album2->setReleaseYear( 1000, false );
auto album3 = ml->createAlbum( "album3" );
auto media3 = ml->addFile( "track2.mp3" );
auto media3 = std::static_pointer_cast<Media>( ml->addMedia( "track3.mp3" ) );
album3->addTrack( media3, 1, 0, artist->id(), nullptr );
album3->setReleaseYear( 2000, false );
......@@ -492,8 +492,8 @@ TEST_F( Artists, SortTracksMultiDisc )
for ( auto i = 0; i < 3; ++i )
{
auto j = i * 2;
auto media1 = ml->addFile( "track_" + std::to_string( j ) + ".mp3" );
auto media2 = ml->addFile( "track_" + std::to_string( j + 1 ) + ".mp3" );
auto media1 = std::static_pointer_cast<Media>( ml->addMedia( "track_" + std::to_string( j ) + ".mp3" ) );
auto media2 = std::static_pointer_cast<Media>( ml->addMedia( "track_" + std::to_string( j + 1 ) + ".mp3" ) );
album->addTrack( media1, i, 1, artist->id(), nullptr );
album->addTrack( media2, i, 2, artist->id(), nullptr );
artist->addMedia( *media1 );
......
......@@ -139,7 +139,7 @@ TEST_F( DbModel, Upgrade4to5 )
// The culprit with V4 was an invalid migration, leading to missing fields
// in File and most likely Playlist tables. Simply try to create/fetch a file
auto m = ml->addFile( "test.mkv" );
auto m = ml->addMedia( "test.mkv" );
ASSERT_NE( m, nullptr );
auto files = ml->files();
ASSERT_NE( files.size(), 0u );
......
......@@ -45,7 +45,7 @@ TEST_F( Thumbnails, Create )
TEST_F( Thumbnails, MediaSetThumbnail )
{
std::string mrl = "/path/to/thumbnail.png";
auto m = ml->addFile( "/path/to/media.mp3" );
auto m = ml->addMedia( "/path/to/media.mp3" );
ASSERT_FALSE( m->isThumbnailGenerated() );
auto res = m->setThumbnail( mrl );
ASSERT_TRUE( res );
......
Markdown is supported
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