Commit 1a9cb434 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

samples: Add artwork extraction functionnal tests

parent d3ce4abe
......@@ -219,6 +219,11 @@ void Tests::checkAlbums( const rapidjson::Value& expectedAlbums, std::vector<Alb
if ( a->releaseYear() != releaseYear )
return false;
}
if ( expectedAlbum.HasMember( "hasArtwork" ) )
{
if ( expectedAlbum["hasArtwork"].GetBool() == a->artworkMrl().empty() )
return false;
}
return true;
});
ASSERT_NE( end( albums ), it );
......@@ -315,6 +320,10 @@ void Tests::checkAlbumTracks( const IAlbum* album, const std::vector<MediaPtr>&
if ( expectedTrack["cd"].GetUint() != albumTrack->discNumber() )
return;
}
if ( expectedTrack.HasMember( "hasArtwork" ) )
{
ASSERT_EQ( expectedTrack["hasArtwork"].GetBool(), track->thumbnail().empty() == false );
}
// Always check if the album link is correct. This isn't part of finding the proper album, so just fail hard
// if the check fails.
const auto trackAlbum = albumTrack->album();
......
......@@ -44,6 +44,8 @@ static const char* testCases[] = {
"multi_cd",
"no_album_artist",
"utf8",
"deduce_artwork_from_album",
"deduce_artwork_from_track",
};
class TestEnv : public ::testing::Environment
......
Subproject commit 4f5dc0f22b24374d460b9ea3839b8c351491456d
Subproject commit 917c603d10d067535c219609642e9e979336e695
{
"input": [
"music/artwork_from_album"
],
"expected": {
"nbAudios": 3,
"nbVideos": 0,
"albums": [{
"title": "album",
"artist": "artist",
"hasArtwork": true,
"tracks": [
{
"title": "Track 1",
"hasArtwork": true
},
{
"title": "Track 2",
"hasArtwork": true
},
{
"title": "Track 3",
"hasArtwork": true
}]
}]
}
}
{
"input": [
"music/artwork_from_last_track"
],
"expected": {
"nbAudios": 3,
"nbVideos": 0,
"albums": [{
"title": "album",
"artist": "artist",
"hasArtwork": true,
"tracks": [
{
"title": "Track 1",
"hasArtwork": true
},
{
"title": "Track 2",
"hasArtwork": true
},
{
"title": "Track 3",
"hasArtwork": true
}]
}]
}
}
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