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

tests: Use external media for most tests

parent bdef23a6
......@@ -44,7 +44,6 @@ public:
// And override the ID getter to return a Media instead of IMedia
std::shared_ptr<Media> media( int64_t id );
std::shared_ptr<Folder> folder( const std::string& path );
std::shared_ptr<Media> addFile( const std::string& path );
std::shared_ptr<Playlist> playlist( int64_t playlistId );
void deleteAlbum( int64_t albumId );
std::shared_ptr<Album> createAlbum( const std::string& title );
......@@ -55,7 +54,10 @@ public:
void setFsFactory( std::shared_ptr<factory::IFileSystem> fsFactory );
void deleteTrack( int64_t trackId );
std::shared_ptr<AlbumTrack> albumTrack( int64_t id );
// Use to run tests that fiddles with file properties (modification dates, size...)
std::shared_ptr<Media> addFile(fs::IFile& file);
// Used when we need an actual file instead of an external media
std::shared_ptr<Media> addFile( const std::string& path );
virtual void addLocalFsFactory() override;
std::shared_ptr<Device> device( const std::string& uuid );
......
......@@ -64,7 +64,7 @@ TEST_F( Albums, Fetch )
TEST_F( Albums, AddTrack )
{
auto a = ml->createAlbum( "albumtag" );
auto f = ml->addFile( "track.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track.mp3" ) );
auto track = a->addTrack( f, 10, 0, 0, 0 );
f->save();
ASSERT_NE( track, nullptr );
......@@ -85,7 +85,7 @@ TEST_F( Albums, NbTracks )
auto a = ml->createAlbum( "albumtag" );
for ( auto i = 1u; i <= 10; ++i )
{
auto f = ml->addFile( "track" + std::to_string(i) + ".mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track" + std::to_string(i) + ".mp3" ) );
auto track = a->addTrack( f, i, i, 0, 0 );
f->save();
ASSERT_NE( track, nullptr );
......@@ -107,7 +107,7 @@ TEST_F( Albums, TracksByGenre )
for ( auto i = 1u; i <= 10; ++i )
{
auto f = ml->addFile( "track" + std::to_string(i) + ".mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track" + std::to_string(i) + ".mp3" ) );
auto track = a->addTrack( f, i, i, 0, 0 );
f->save();
ASSERT_NE( track, nullptr );
......@@ -181,7 +181,7 @@ TEST_F( Albums, SetArtworkMrl )
TEST_F( Albums, FetchAlbumFromTrack )
{
auto a = ml->createAlbum( "album" );
auto f = ml->addFile( "file.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "file.mp3" ) );
auto t = a->addTrack( f, 1, 0, 0, 0 );
f->save();
......@@ -334,7 +334,7 @@ TEST_F( Albums, SearchAfterArtistUpdate )
TEST_F( Albums, AutoDelete )
{
auto a = ml->createAlbum( "album" );
auto m = ml->addFile( "media.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mp3" ) );
auto t = a->addTrack( m, 1, 1, 0, 0 );
auto album = ml->album( a->id() );
......@@ -349,8 +349,8 @@ TEST_F( Albums, AutoDelete )
TEST_F( Albums, SortTracks )
{
auto a = ml->createAlbum( "album" );
auto m1 = ml->addFile( "B-track1.mp3" );
auto m2 = ml->addFile( "A-track2.mp3" );
auto m1 = std::static_pointer_cast<Media>( ml->addMedia( "B-track1.mp3" ) );
auto m2 = std::static_pointer_cast<Media>( ml->addMedia( "A-track2.mp3" ) );
auto t1 = a->addTrack( m1, 1, 1, 0, 0 );
auto t2 = a->addTrack( m2, 2, 1, 0, 0 );
......@@ -414,13 +414,13 @@ TEST_F( Albums, Duration )
auto a = ml->createAlbum( "album" );
ASSERT_EQ( 0u, a->duration() );
auto m = ml->addFile( "track.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "track.mp3" ) );
m->setDuration( 100 );
m->save();
a->addTrack( m, 1, 1, 0, 0 );
ASSERT_EQ( 100u, a->duration() );
auto m2 = ml->addFile( "track2.mp3" );
auto m2 = std::static_pointer_cast<Media>( ml->addMedia( "track2.mp3" ) );
m2->setDuration( 200 );
m2->save();
a->addTrack( m2, 1, 1, 0, 0 );
......
......@@ -39,7 +39,7 @@ class AlbumTracks : public Tests
TEST_F( AlbumTracks, Create )
{
auto album = ml->createAlbum( "album" );
auto f = ml->addFile( "track1.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
auto track = album->addTrack( f, 1, 10, 0, 0 );
f->save();
ASSERT_NE( nullptr, track );
......@@ -54,7 +54,7 @@ TEST_F( AlbumTracks, Create )
TEST_F( AlbumTracks, Artist )
{
auto album = ml->createAlbum( "album" );
auto f = ml->addFile( "track1.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
auto track = album->addTrack( f, 1, 0, 0, 0 );
f->save();
......@@ -80,7 +80,7 @@ TEST_F( AlbumTracks, Artist )
TEST_F( AlbumTracks, SetGenre )
{
auto a = ml->createAlbum( "album" );
auto f = ml->addFile( "track.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track.mp3" ) );
auto t = a->addTrack( f, 1, 0, 0, 0 );
f->save();
auto genre = ml->createGenre( "happy underground post progressive death metal" );
......@@ -101,7 +101,7 @@ TEST_F( AlbumTracks, SetGenre )
TEST_F( AlbumTracks, Media )
{
auto album = ml->createAlbum( "album" );
auto f = ml->addFile( "track1.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
auto track = album->addTrack( f, 1, 10, 0, 0 );
f->save();
......@@ -120,7 +120,7 @@ TEST_F( AlbumTracks, Media )
TEST_F( AlbumTracks, Album )
{
auto album = ml->createAlbum( "album" );
auto f = ml->addFile( "track1.mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "track1.mp3" ) );
auto track = album->addTrack( f, 1, 0, 0, 0 );
f->save();
......
......@@ -122,7 +122,7 @@ TEST_F( Artists, AllSongs )
for (auto i = 1; i <= 3; ++i)
{
auto f = ml->addFile( "song" + std::to_string(i) + ".mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "song" + std::to_string(i) + ".mp3" ) );
auto res = artist->addMedia( *f );
ASSERT_TRUE( res );
}
......@@ -226,7 +226,7 @@ TEST_F( Artists, SortMedia )
for (auto i = 1; i <= 3; ++i)
{
auto f = ml->addFile( "song" + std::to_string(i) + ".mp3" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "song" + std::to_string(i) + ".mp3" ) );
f->setDuration( 10 - i );
f->save();
artist->addMedia( *f );
......
......@@ -35,14 +35,14 @@ class AudioTracks : public Tests
TEST_F( AudioTracks, AddTrack )
{
auto f = std::static_pointer_cast<Media>( ml->addFile( "file.mp3" ) );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "file.mp3" ) );
bool res = f->addAudioTrack( "PCM", 128, 44100, 2, "fr", "test" );
ASSERT_TRUE( res );
}
TEST_F( AudioTracks, GetSetProperties )
{
auto f = std::static_pointer_cast<Media>( ml->addFile( "file.mp3" ) );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "file.mp3" ) );
ASSERT_NE( f, nullptr );
f->addAudioTrack( "PCM", 128, 44100, 2, "en", "test desc" );
auto tracks = f->audioTracks();
......@@ -72,7 +72,7 @@ TEST_F( AudioTracks, GetSetProperties )
TEST_F( AudioTracks, FetchTracks )
{
auto f = std::static_pointer_cast<Media>( ml->addFile( "file.mp3" ) );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "file.mp3" ) );
f->addAudioTrack( "PCM", 128, 44100, 2, "en", "test desc" );
f->addAudioTrack( "WMA", 128, 48000, 2, "fr", "test desc 2" );
......
......@@ -66,12 +66,10 @@ TEST_F( Files, Remove )
TEST_F( Files, Media )
{
ASSERT_EQ( f->id(), f->media()->id() );
ASSERT_EQ( m->id(), f->media()->id() );
Reload();
auto m = ml->media( "media.mkv" );
ASSERT_NE( nullptr, m );
auto files = m->files();
ASSERT_EQ( 1u, files.size() );
f = std::static_pointer_cast<File>( files[0] );
......
......@@ -66,7 +66,7 @@ TEST_F( Genres, ListAlbumTracks )
for ( auto i = 1u; i <= 3; i++ )
{
auto m = ml->addFile( "track" + std::to_string( i ) + ".mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "track" + std::to_string( i ) + ".mp3" ) );
auto t = a->addTrack( m, i, 1, 0, 0 );
if ( i != 1 )
t->setGenre( g );
......@@ -89,13 +89,13 @@ TEST_F( Genres, ListArtists )
for ( auto i = 1u; i <= 5; ++i )
{
auto m = ml->addFile( std::to_string( i ) + ".mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( std::to_string( i ) + ".mp3" ) );
auto track = album->addTrack( m, i, 1, a->id(), 0 );
track->setGenre( g );
}
for ( auto i = 1u; i <= 5; ++i )
{
auto m = ml->addFile( std::to_string( i ) + "_2.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( std::to_string( i ) + "_2.mp3" ) );
auto track = album2->addTrack( m, i, 1, a2->id(), 0 );
track->setGenre( g );
}
......@@ -106,12 +106,12 @@ TEST_F( Genres, ListArtists )
TEST_F( Genres, ListAlbums )
{
auto album = ml->createAlbum( "album" );
auto m = ml->addFile( "some track.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "some track.mp3" ) );
auto t = album->addTrack( m, 10, 1, 0, 0 );
t->setGenre( g );
auto album2 = ml->createAlbum( "album2" );
m = ml->addFile( "some other track.mp3" );
m = std::static_pointer_cast<Media>( ml->addMedia( "some other track.mp3" ) );
t = album2->addTrack( m, 10, 1, 0, 0 );
t->setGenre( g );
......@@ -119,7 +119,7 @@ TEST_F( Genres, ListAlbums )
// Now we create more albums with "random" genre, all of them should have 1 album
for ( auto i = 1u; i <= 5u; ++i )
{
auto m = ml->addFile( std::to_string( i ) + ".mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( std::to_string( i ) + ".mp3" ) );
auto track = album->addTrack( m, i, 1, 0, 0 );
auto g = ml->createGenre( std::to_string( i ) );
track->setGenre( g );
......@@ -169,7 +169,7 @@ TEST_F( Genres, SortTracks )
for ( auto i = 1u; i <= 2; i++ )
{
auto m = ml->addFile( "track" + std::to_string( i ) + ".mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "track" + std::to_string( i ) + ".mp3" ) );
auto t = a->addTrack( m, i, 1, 0, 0 );
m->setDuration( i );
m->save();
......
......@@ -36,7 +36,7 @@ class Labels : public Tests
TEST_F( Labels, Add )
{
auto f = ml->addFile( "media.avi" );
auto f = ml->addMedia( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......@@ -58,7 +58,7 @@ TEST_F( Labels, Add )
TEST_F( Labels, Remove )
{
auto m = ml->addFile( "media.avi" );
auto m = ml->addMedia( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......@@ -101,9 +101,9 @@ TEST_F( Labels, Remove )
TEST_F( Labels, Files )
{
auto f = ml->addFile( "media.avi" );
auto f2 = ml->addFile( "file.mp3" );
auto f3 = ml->addFile( "otter.mkv" );
auto f = ml->addMedia( "media.avi" );
auto f2 = ml->addMedia( "file.mp3" );
auto f3 = ml->addMedia( "otter.mkv" );
auto l1 = ml->createLabel( "label1" );
auto l2 = ml->createLabel( "label2" );
......@@ -128,7 +128,7 @@ TEST_F( Labels, Files )
TEST_F( Labels, Delete )
{
auto f = ml->addFile( "media.avi" );
auto f = ml->addMedia( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......
......@@ -66,7 +66,7 @@ TEST_F( Medias, Create )
TEST_F( Medias, Fetch )
{
auto f = ml->addFile( "media.avi" );
auto f = ml->addMedia( "media.avi" );
auto f2 = ml->media( f->id() );
ASSERT_EQ( f->id(), f2->id() );
ASSERT_EQ( f, f2 );
......@@ -80,7 +80,7 @@ TEST_F( Medias, Fetch )
TEST_F( Medias, Duration )
{
auto f = ml->addFile( "media.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "media.avi" ) );
ASSERT_EQ( f->duration(), -1 );
// Use a value that checks we're using a 64bits value
......@@ -98,7 +98,7 @@ TEST_F( Medias, Duration )
TEST_F( Medias, Thumbnail )
{
auto f = ml->addFile( "media.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "media.avi" ) );
ASSERT_EQ( f->thumbnail(), "" );
std::string newThumbnail( "/path/to/thumbnail" );
......@@ -115,7 +115,7 @@ TEST_F( Medias, Thumbnail )
TEST_F( Medias, PlayCount )
{
auto f = ml->addFile( "media.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "media.avi" ) );
ASSERT_EQ( 0, f->playCount() );
f->increasePlayCount();
ASSERT_EQ( 1, f->playCount() );
......@@ -128,7 +128,7 @@ TEST_F( Medias, PlayCount )
TEST_F( Medias, Progress )
{
auto f = ml->addFile( "media.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "media.avi" ) );
ASSERT_EQ( 0, f->metadata( Media::MetadataType::Progress ).integer() );
f->setMetadata( Media::MetadataType::Progress, 123 );
ASSERT_EQ( 123, f->metadata( Media::MetadataType::Progress ).integer() );
......@@ -141,7 +141,7 @@ TEST_F( Medias, Progress )
TEST_F( Medias, Rating )
{
auto f = ml->addFile( "media.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "media.avi" ) );
ASSERT_FALSE( f->metadata( Media::MetadataType::Rating ).isSet() );
f->setMetadata( Media::MetadataType::Rating, 12345 );
ASSERT_EQ( 12345, f->metadata( Media::MetadataType::Rating ).integer() );
......@@ -156,7 +156,7 @@ TEST_F( Medias, Search )
{
for ( auto i = 1u; i <= 10u; ++i )
{
auto m = ml->addFile( "track " + std::to_string( i ) + ".mp3" );
ml->addMedia( "track " + std::to_string( i ) + ".mp3" );
}
auto media = ml->searchMedia( "tra" ).others;
ASSERT_EQ( 10u, media.size() );
......@@ -173,7 +173,7 @@ TEST_F( Medias, Search )
TEST_F( Medias, SearchAfterEdit )
{
auto m = ml->addFile( "media.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mp3" ) );
auto media = ml->searchMedia( "media" ).others;
ASSERT_EQ( 1u, media.size() );
......@@ -190,7 +190,7 @@ TEST_F( Medias, SearchAfterEdit )
TEST_F( Medias, SearchAfterDelete )
{
auto m = ml->addFile( "media.mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mp3" ) );
auto media = ml->searchMedia( "media" ).others;
ASSERT_EQ( 1u, media.size() );
......@@ -204,7 +204,7 @@ TEST_F( Medias, SearchAfterDelete )
TEST_F( Medias, SearchByLabel )
{
auto m = ml->addFile( "media.mkv" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mkv" ) );
auto media = ml->searchMedia( "otter" ).others;
ASSERT_EQ( 0u, media.size() );
......@@ -253,7 +253,7 @@ TEST_F( Medias, SearchTracks )
auto a = ml->createAlbum( "album" );
for ( auto i = 1u; i <= 10u; ++i )
{
auto m = ml->addFile( "track " + std::to_string( i ) + ".mp3" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "track " + std::to_string( i ) + ".mp3" ) );
a->addTrack( m, i, 1, 0, 0 );
}
auto tracks = ml->searchMedia( "tra" ).tracks;
......@@ -271,7 +271,7 @@ TEST_F( Medias, SearchTracks )
TEST_F( Medias, Favorite )
{
auto m = ml->addFile( "media.mkv" );
auto m = ml->addMedia( "media.mkv" );
ASSERT_FALSE( m->isFavorite() );
m->setFavorite( true );
......@@ -285,7 +285,7 @@ TEST_F( Medias, Favorite )
TEST_F( Medias, History )
{
auto m = ml->addFile( "media.mkv" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mkv" ) );
auto history = ml->lastMediaPlayed();
ASSERT_EQ( 0u, history.size() );
......@@ -297,7 +297,7 @@ TEST_F( Medias, History )
ASSERT_EQ( m->id(), history[0]->id() );
compat::this_thread::sleep_for( std::chrono::seconds{ 1 } );
auto m2 = ml->addFile( "media.mkv" );
auto m2 = std::static_pointer_cast<Media>( ml->addMedia( "media2.mkv" ) );
m2->increasePlayCount();
history = ml->lastMediaPlayed();
......@@ -308,7 +308,7 @@ TEST_F( Medias, History )
TEST_F( Medias, ClearHistory )
{
auto m = ml->addFile( "media.mkv" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "media.mkv" ) );
auto history = ml->lastMediaPlayed();
ASSERT_EQ( 0u, history.size() );
......@@ -331,7 +331,7 @@ TEST_F( Medias, ClearHistory )
TEST_F( Medias, SetReleaseDate )
{
auto m = ml->addFile( "movie.mkv" );
auto m = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
ASSERT_EQ( m->releaseDate(), 0u );
m->setReleaseDate( 1234 );
......@@ -346,17 +346,17 @@ TEST_F( Medias, SetReleaseDate )
TEST_F( Medias, SortByAlpha )
{
auto m1 = ml->addFile( "media1.mp3" );
auto m1 = std::static_pointer_cast<Media>( ml->addMedia( "media1.mp3" ) );
m1->setTitle( "Abcd" );
m1->setType( Media::Type::Audio );
m1->save();
auto m2 = ml->addFile( "media2.mp3" );
auto m2 = std::static_pointer_cast<Media>( ml->addMedia( "media2.mp3" ) );
m2->setTitle( "Zyxw" );
m2->setType( Media::Type::Audio );
m2->save();
auto m3 = ml->addFile( "media3.mp3" );
auto m3 = std::static_pointer_cast<Media>( ml->addMedia( "media3.mp3" ) );
m3->setTitle( "afterA-beforeZ" );
m3->setType( Media::Type::Audio );
m3->save();
......@@ -426,7 +426,7 @@ TEST_F( Medias, SortByFileSize )
TEST_F( Medias, SetType )
{
auto m1 = ml->addFile( "media1.mp3" );
auto m1 = std::static_pointer_cast<Media>( ml->addMedia( "media1.mp3" ) );
ASSERT_EQ( IMedia::Type::Unknown, m1->type() );
m1->setType( IMedia::Type::Video );
......@@ -442,7 +442,7 @@ TEST_F( Medias, SetType )
TEST_F( Medias, Metadata )
{
auto m = ml->addFile( "media.mp3" );
auto m = ml->addMedia( "media.mp3" );
{
const auto& md = m->metadata( Media::MetadataType::Speed );
......@@ -466,7 +466,7 @@ TEST_F( Medias, Metadata )
TEST_F( Medias, MetadataOverride )
{
auto m = ml->addFile( "media.mp3" );
auto m = ml->addMedia( "media.mp3" );
auto res = m->setMetadata( Media::MetadataType::Speed, "foo" );
ASSERT_TRUE( res );
......
......@@ -36,7 +36,7 @@ class Movies : public Tests
TEST_F( Movies, Create )
{
auto media = ml->addFile( "movie.mkv" );
auto media = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
auto m = ml->createMovie( *media, "movie" );
ASSERT_NE( m, nullptr );
ASSERT_EQ( m->title(), "movie" );
......@@ -44,7 +44,7 @@ TEST_F( Movies, Create )
TEST_F( Movies, Fetch )
{
auto media = ml->addFile( "movie.mkv" );
auto media = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
auto m = ml->createMovie( *media, "movie" );
auto m2 = ml->movie( "movie" );
......@@ -59,7 +59,7 @@ TEST_F( Movies, Fetch )
TEST_F( Movies, SetShortSummary )
{
auto media = ml->addFile( "movie.mkv" );
auto media = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
auto m = ml->createMovie( *media, "movie" );
ASSERT_EQ( m->shortSummary().length(), 0u );
......@@ -74,7 +74,7 @@ TEST_F( Movies, SetShortSummary )
TEST_F( Movies, SetArtworkMrl )
{
auto media = ml->addFile( "movie.mkv" );
auto media = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
auto m = ml->createMovie( *media, "movie" );
ASSERT_EQ( m->artworkMrl().length(), 0u );
......@@ -89,7 +89,7 @@ TEST_F( Movies, SetArtworkMrl )
TEST_F( Movies, SetImdbId )
{
auto media = ml->addFile( "movie.mkv" );
auto media = std::static_pointer_cast<Media>( ml->addMedia( "movie.mkv" ) );
auto m = ml->createMovie( *media, "movie" );
ASSERT_EQ( m->imdbId().length(), 0u );
......@@ -104,7 +104,7 @@ TEST_F( Movies, SetImdbId )
TEST_F( Movies, AssignToFile )
{
auto f = ml->addFile( "file.avi" );
auto f = std::static_pointer_cast<Media>( ml->addMedia( "file.avi" ) );
ASSERT_EQ( f->movie(), nullptr );
auto m = ml->createMovie( *f, "movie" );
......
......@@ -108,7 +108,7 @@ TEST_F( Playlists, FetchAll )
TEST_F( Playlists, Add )
{
auto m = ml->addFile( "file.mkv" );
auto m = ml->addMedia( "file.mkv" );
auto res = pl->append( m->id() );
ASSERT_TRUE( res );
auto media = pl->media();
......@@ -120,7 +120,7 @@ TEST_F( Playlists, Append )
{
for ( auto i = 0; i < 5; ++i )
{
auto m = ml->addFile( "media" + std::to_string( i ) + ".mkv" );
auto m = ml->addMedia( "media" + std::to_string( i ) + ".mkv" );
ASSERT_NE( nullptr, m );
pl->append( m->id() );
}
......@@ -137,17 +137,17 @@ TEST_F( Playlists, Insert )
{
for ( auto i = 1; i < 4; ++i )
{
auto m = ml->addFile( "media" + std::to_string( i ) + ".mkv" );
auto m = ml->addMedia( "media" + std::to_string( i ) + ".mkv" );
ASSERT_NE( nullptr, m );
auto res = pl->append( m->id() );
ASSERT_TRUE( res );
}
// [<1,1>,<2,2>,<3,3>]
auto firstMedia = ml->addFile( "first.mkv" );
auto firstMedia = ml->addMedia( "first.mkv" );
pl->add( firstMedia->id(), 1 );
// [<4,1>,<1,2>,<2,3>,<3,4>]
auto middleMedia = ml->addFile( "middle.mkv" );
auto middleMedia = ml->addMedia( "middle.mkv" );
pl->add( middleMedia->id(), 3 );
// [<4,1>,<1,2>,<5,3>,<2,4>,<3,5>]
auto media = pl->media();
......@@ -164,7 +164,7 @@ TEST_F( Playlists, Move )
{
for ( auto i = 1; i < 6; ++i )
{
auto m = ml->addFile( "media" + std::to_string( i ) + ".mkv" );
auto m = ml->addMedia( "media" + std::to_string( i ) + ".mkv" );
ASSERT_NE( nullptr, m );
auto res = pl->append( m->id() );
ASSERT_TRUE( res );
......@@ -186,7 +186,7 @@ TEST_F( Playlists, Remove )
{
for ( auto i = 1; i < 6; ++i )
{
auto m = ml->addFile( "media" + std::to_string( i ) + ".mkv" );
auto m = ml->addMedia( "media" + std::to_string( i ) + ".mkv" );
ASSERT_NE( nullptr, m );
auto res = pl->