Allowed custom release types + handle more MusicBrainz secondary types in UI. fixes #373

This commit is contained in:
emeric
2023-12-11 23:25:58 +01:00
parent a2cc243a08
commit 3ad990a183
33 changed files with 793 additions and 725 deletions
-57
View File
@@ -115,60 +115,3 @@ TEST(MetaData, extractPerformerAndRole)
EXPECT_EQ(performer.role, testCase.expectedRole) << " str was '" << testCase.str << "'";
}
}
TEST(MetaData, primaryReleaseTypes)
{
using namespace MetaData;
struct TestCase
{
std::string str;
std::optional<Release::PrimaryType> result;
} testCases []
{
{ "", std::nullopt },
{ "album", Release::PrimaryType::Album },
{ "Album", Release::PrimaryType::Album },
{ " Album", Release::PrimaryType::Album },
{ "Album ", Release::PrimaryType::Album },
{ "ep", Release::PrimaryType::EP },
{ " ep ", Release::PrimaryType::EP },
{ "broadcast", Release::PrimaryType::Broadcast },
{ "single", Release::PrimaryType::Single },
{ "other", Release::PrimaryType::Other },
};
for (const TestCase& testCase : testCases)
{
std::optional<Release::PrimaryType> parsed {StringUtils::readAs<Release::PrimaryType>(testCase.str)};
EXPECT_EQ(parsed, testCase.result) << " str was '" << testCase.str << "'";
}
}
TEST(MetaData, secondaryReleaseTypes)
{
using namespace MetaData;
struct TestCase
{
std::string str;
std::optional<Release::SecondaryType> result;
} testCases []
{
{ "", std::nullopt },
{ "compilation", Release::SecondaryType::Compilation },
{ " compilation ", Release::SecondaryType::Compilation },
{ "soundtrack", Release::SecondaryType::Soundtrack },
{ "live", Release::SecondaryType::Live },
{ "demo", Release::SecondaryType::Demo },
};
for (const TestCase& testCase : testCases)
{
std::optional<Release::SecondaryType> parsed {StringUtils::readAs<Release::SecondaryType>(testCase.str)};
EXPECT_EQ(parsed, testCase.result) << " str was '" << testCase.str << "'";
}
}