Commit 84ec8879 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

tests: files: Use filenames with an actual media extension

parent 07c0eb51
......@@ -53,7 +53,7 @@ TEST_F( Albums, AddTrack )
TEST_F( Albums, AssignTrack )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto a = ml->createAlbum( "album" );
auto t = a->addTrack( "track", 1 );
......@@ -65,7 +65,7 @@ TEST_F( Albums, AssignTrack )
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
t = f->albumTrack();
ASSERT_NE( t, nullptr );
ASSERT_EQ( t->title(), "track" );
......@@ -73,7 +73,7 @@ TEST_F( Albums, AssignTrack )
TEST_F( Albums, DeleteTrack )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto a = ml->createAlbum( "album" );
auto t = a->addTrack( "track", 1 );
f->setAlbumTrack( t );
......@@ -81,7 +81,7 @@ TEST_F( Albums, DeleteTrack )
bool res = t->destroy();
ASSERT_TRUE( res );
auto f2 = ml->file( "file" );
auto f2 = ml->file( "file.avi" );
ASSERT_EQ( f2, nullptr );
}
......@@ -160,13 +160,13 @@ TEST_F( Albums, FetchAlbumFromTrack )
{
{
auto a = ml->createAlbum( "album" );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto t = a->addTrack( "track 1", 1 );
f->setAlbumTrack( t );
}
Reload();
auto f = ml->file( "file" );
auto f = ml->file( "file.avi" );
auto t = f->albumTrack();
auto a = t->album();
ASSERT_NE( a, nullptr );
......@@ -176,13 +176,13 @@ TEST_F( Albums, FetchAlbumFromTrack )
TEST_F( Albums, DestroyAlbum )
{
auto a = ml->createAlbum( "album" );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto t = a->addTrack( "track 1", 1 );
f->setAlbumTrack( t );
bool res = a->destroy();
ASSERT_TRUE( res );
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
}
......@@ -9,14 +9,14 @@ class AudioTracks : public Tests
TEST_F( AudioTracks, AddTrack )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.mp3" );
bool res = f->addAudioTrack( "PCM", 44100, 128, 2 );
ASSERT_TRUE( res );
}
TEST_F( AudioTracks, FetchTracks )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.mp3" );
f->addAudioTrack( "PCM", 44100, 128, 2 );
f->addAudioTrack( "WMA", 48000, 128, 2 );
......@@ -26,10 +26,10 @@ TEST_F( AudioTracks, FetchTracks )
TEST_F( AudioTracks, CheckUnique )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.mp3" );
f->addAudioTrack( "PCM", 44100, 128, 2 );
auto f2 = ml->addFile( "file2" );
auto f2 = ml->addFile( "file2.mp3" );
f2->addAudioTrack( "PCM", 44100, 128, 2 );
auto ts = f->audioTracks();
......
......@@ -15,7 +15,7 @@ TEST_F( Files, Init )
TEST_F( Files, Create )
{
auto f = ml->addFile( "/dev/null" );
auto f = ml->addFile( "media.avi" );
ASSERT_NE( f, nullptr );
ASSERT_EQ( f->playCount(), 0 );
......@@ -30,56 +30,56 @@ TEST_F( Files, Create )
TEST_F( Files, Fetch )
{
auto f = ml->addFile( "/dev/null" );
auto f2 = ml->file( "/dev/null" );
auto f = ml->addFile( "media.avi" );
auto f2 = ml->file( "media.avi" );
ASSERT_EQ( f->mrl(), f2->mrl() );
ASSERT_EQ( f, f2 );
// Flush cache and fetch from DB
Reload();
f2 = ml->file( "/dev/null" );
f2 = ml->file( "media.avi" );
ASSERT_EQ( f->mrl(), f2->mrl() );
ASSERT_TRUE( f2->isStandAlone() );
}
TEST_F( Files, Delete )
{
auto f = ml->addFile( "/dev/loutre" );
auto f2 = ml->file( "/dev/loutre" );
auto f = ml->addFile( "media.avi" );
auto f2 = ml->file( "media.avi" );
ASSERT_EQ( f, f2 );
ml->deleteFile( f );
f2 = ml->file( "/dev/loutre" );
f2 = ml->file( "media.avi" );
ASSERT_EQ( f2, nullptr );
}
TEST_F( Files, Duplicate )
{
auto f = ml->addFile( "/dev/moulaf" );
auto f2 = ml->addFile( "/dev/moulaf" );
auto f = ml->addFile( "media.avi" );
auto f2 = ml->addFile( "media.avi" );
ASSERT_NE( f, nullptr );
ASSERT_EQ( f2, nullptr );
f2 = ml->file( "/dev/moulaf" );
f2 = ml->file( "media.avi" );
ASSERT_EQ( f, f2 );
}
TEST_F( Files, LastModificationDate )
{
auto f = ml->addFile( "/dev/seaotter" );
auto f = ml->addFile( "media.avi" );
ASSERT_NE( 0u, f->lastModificationDate() );
Reload();
auto f2 = ml->file( "/dev/seaotter" );
auto f2 = ml->file( "media.avi" );
ASSERT_EQ( f->lastModificationDate(), f2->lastModificationDate() );
}
TEST_F( Files, Duration )
{
auto f = ml->addFile( "/some/file" );
auto f = ml->addFile( "media.avi" );
ASSERT_EQ( f->duration(), 0u );
f->setDuration( 123u );
......@@ -87,13 +87,13 @@ TEST_F( Files, Duration )
Reload();
f = ml->file( "/some/file" );
f = ml->file( "media.avi" );
ASSERT_EQ( f->duration(), 123u );
}
TEST_F( Files, Snapshot )
{
auto f = ml->addFile( "/some/file" );
auto f = ml->addFile( "media.avi" );
ASSERT_EQ( f->snapshot(), "" );
std::string newSnapshot( "/path/to/snapshot" );
......@@ -103,6 +103,6 @@ TEST_F( Files, Snapshot )
Reload();
f = ml->file( "/some/file" );
f = ml->file( "media.avi" );
ASSERT_EQ( f->snapshot(), newSnapshot );
}
......@@ -10,7 +10,7 @@ class Labels : public Tests
TEST_F( Labels, Add )
{
auto f = ml->addFile( "/dev/null" );
auto f = ml->addFile( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......@@ -32,7 +32,7 @@ TEST_F( Labels, Add )
TEST_F( Labels, Remove )
{
auto f = ml->addFile( "/dev/null" );
auto f = ml->addFile( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......@@ -75,9 +75,9 @@ TEST_F( Labels, Remove )
TEST_F( Labels, Files )
{
auto f = ml->addFile( "/dev/null" );
auto f2 = ml->addFile( "/dev/moulaf" );
auto f3 = ml->addFile( "/sea/otter" );
auto f = ml->addFile( "media.avi" );
auto f2 = ml->addFile( "file.mp3" );
auto f3 = ml->addFile( "otter.mkv" );
auto l1 = ml->createLabel( "label1" );
auto l2 = ml->createLabel( "label2" );
......@@ -102,7 +102,7 @@ TEST_F( Labels, Files )
TEST_F( Labels, Delete )
{
auto f = ml->addFile( "/dev/null" );
auto f = ml->addFile( "media.avi" );
auto l1 = ml->createLabel( "sea otter" );
auto l2 = ml->createLabel( "cony the cone" );
......
......@@ -83,7 +83,7 @@ TEST_F( Movies, SetImdbId )
TEST_F( Movies, AssignToFile )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto m = ml->createMovie( "movie" );
ASSERT_EQ( f->movie(), nullptr );
......@@ -92,7 +92,7 @@ TEST_F( Movies, AssignToFile )
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
m = f->movie();
ASSERT_NE( m, nullptr );
ASSERT_EQ( m->title(), "movie" );
......@@ -100,17 +100,17 @@ TEST_F( Movies, AssignToFile )
TEST_F( Movies, DestroyMovie )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
auto m = ml->createMovie( "movie" );
f->setMovie( m );
m->destroy();
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
}
......@@ -108,7 +108,7 @@ TEST_F( Shows, FetchShowFromEpisode )
{
auto s = ml->createShow( "show" );
auto e = s->addEpisode( "episode 1", 1 );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
f->setShowEpisode( e );
auto e2 = f->showEpisode();
......@@ -118,7 +118,7 @@ TEST_F( Shows, FetchShowFromEpisode )
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
s2 = f->showEpisode()->show();
ASSERT_NE( s2, nullptr );
ASSERT_EQ( s->name(), s2->name() );
......@@ -192,7 +192,7 @@ TEST_F( Shows, FileSetShowEpisode )
{
auto show = ml->createShow( "show" );
auto e = show->addEpisode( "episode 1", 1 );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
ASSERT_EQ( f->showEpisode(), nullptr );
f->setShowEpisode( e );
......@@ -200,7 +200,7 @@ TEST_F( Shows, FileSetShowEpisode )
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
e = f->showEpisode();
ASSERT_NE( e, nullptr );
ASSERT_EQ( e->name(), "episode 1" );
......@@ -210,17 +210,17 @@ TEST_F( Shows, DeleteShowEpisode )
{
auto show = ml->createShow( "show" );
auto e = show->addEpisode( "episode 1", 1 );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
f->setShowEpisode( e );
e->destroy();
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
Reload();
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
}
......@@ -228,11 +228,11 @@ TEST_F( Shows, DeleteShow )
{
auto show = ml->createShow( "show" );
auto e = show->addEpisode( "episode 1", 1 );
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
f->setShowEpisode( e );
bool res = show->destroy();
ASSERT_TRUE( res );
f = ml->file( "file" );
f = ml->file( "file.avi" );
ASSERT_EQ( f, nullptr );
}
......@@ -9,14 +9,14 @@ class VideoTracks : public Tests
TEST_F( VideoTracks, AddTrack )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
bool res = f->addVideoTrack( "H264", 1920, 1080, 29.97 );
ASSERT_TRUE( res );
}
TEST_F( VideoTracks, FetchTracks )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
f->addVideoTrack( "H264", 1920, 1080, 29.97 );
f->addVideoTrack( "VP80", 640, 480, 29.97 );
......@@ -26,10 +26,10 @@ TEST_F( VideoTracks, FetchTracks )
TEST_F( VideoTracks, CheckUnique )
{
auto f = ml->addFile( "file" );
auto f = ml->addFile( "file.avi" );
f->addVideoTrack( "H264", 1920, 1080, 29.97 );
auto f2 = ml->addFile( "file2" );
auto f2 = ml->addFile( "file2.avi" );
f2->addVideoTrack( "H264", 1920, 1080, 29.97 );
auto ts = f->videoTracks();
......
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