mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-28 10:09:24 +01:00
Prepend a 0 to single-digit track numbers in the organiser. Fixes issue #438
This commit is contained in:
parent
093f198556
commit
f0b984cbe9
@ -139,6 +139,11 @@ QString OrganiseFormat::TagValue(const QString &tag, const Song &song) const {
|
||||
|
||||
if (value == "0" || value == "-1")
|
||||
value = "";
|
||||
|
||||
// Prepend a 0 to single-digit track numbers
|
||||
if (tag == "track" && value.length() == 1)
|
||||
value.prepend('0');
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -123,3 +123,19 @@ TEST_F(OrganiseFormatTest, ReplaceNonAscii) {
|
||||
song_.set_artist(QString::fromUtf8("Владимир Высоцкий"));
|
||||
EXPECT_EQ("________ ________", format_.GetFilenameForSong(song_));
|
||||
}
|
||||
|
||||
TEST_F(OrganiseFormatTest, TrackNumberPadding) {
|
||||
format_.set_format("%track");
|
||||
|
||||
song_.set_track(9);
|
||||
EXPECT_EQ("09", format_.GetFilenameForSong(song_));
|
||||
|
||||
song_.set_track(99);
|
||||
EXPECT_EQ("99", format_.GetFilenameForSong(song_));
|
||||
|
||||
song_.set_track(999);
|
||||
EXPECT_EQ("999", format_.GetFilenameForSong(song_));
|
||||
|
||||
song_.set_track(0);
|
||||
EXPECT_EQ("", format_.GetFilenameForSong(song_));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user