Skip to content

Commit

Permalink
Fixed last join phrase not being displayed in UI, fixes #528
Browse files Browse the repository at this point in the history
  • Loading branch information
epoupon committed Sep 22, 2024
1 parent 5c52d54 commit 4e1b422
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/libs/metadata/test/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,23 @@ namespace lms::metadata
EXPECT_EQ(track->artistDisplayName, "Artist1, Artist2"); // reconstruct artist display name since multiple entries are found and nothing is set in artist
}

TEST(Parser, multipleArtistsInArtistsWithEndDelimiter)
{
const TestTagReader testTags{
{
{ TagType::Artist, { "Artist1 & (CV. Artist2)" } },
{ TagType::Artists, { "Artist1", "Artist2" } },
}
};

std::unique_ptr<Track> track{ Parser{}.parse(testTags) };

ASSERT_EQ(track->artists.size(), 2);
EXPECT_EQ(track->artists[0].name, "Artist1");
EXPECT_EQ(track->artists[1].name, "Artist2");
EXPECT_EQ(track->artistDisplayName, "Artist1 & (CV. Artist2)");
}

TEST(Parser, singleArtistInAlbumArtists)
{
const TestTagReader testTags{
Expand Down
10 changes: 8 additions & 2 deletions src/lms/ui/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,14 @@ namespace lms::ui::utils
matchCount += 1;
}

if (matchCount != artistIds.size())
return createArtistAnchorList(artistIds, cssAnchorClass);
if (matchCount == artistIds.size())
{
const std::string_view remainingStr{ displayName.substr(currentOffset) };
if (!remainingStr.empty())
result->addNew<Wt::WText>(std::string{ remainingStr }, Wt::TextFormat::Plain);
}
else
result = createArtistAnchorList(artistIds, cssAnchorClass);

return result;
}
Expand Down

0 comments on commit 4e1b422

Please sign in to comment.