Skip to content

Commit 37780c4

Browse files
authored
Merge branch 'main' into AddPodcastTagsToId3v2
2 parents c72e6d3 + 228d5cb commit 37780c4

21 files changed

+711
-34
lines changed

Diff for: src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public void bgo_676934 ()
5454
[Test]
5555
public void bgo_701689 ()
5656
{
57-
// This file contains a musicbrainz track id "883821fc-9bbc-4e04-be79-b4b12c4c4a4e"
57+
// This file contains a musicbrainz recording id "883821fc-9bbc-4e04-be79-b4b12c4c4a4e"
5858
// This case also handles bgo #701690 as a proper value for the tag must be returned
5959
var file = TagLib.File.Create (TestPath.Samples + "bgo_701689.m4a");
60-
Assert.AreEqual ("883821fc-9bbc-4e04-be79-b4b12c4c4a4e", file.Tag.MusicBrainzTrackId, "#1");
60+
Assert.AreEqual ("883821fc-9bbc-4e04-be79-b4b12c4c4a4e", file.Tag.MusicBrainzRecordingId, "#1");
6161
}
6262

6363
[Test]

Diff for: src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs

+51-1
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,56 @@ public void TestMusicBrainzTrackID ()
634634
});
635635
}
636636

637+
[Test]
638+
public void TestMusicBrainzRecordingID ()
639+
{
640+
Tag tag = new Tag ();
641+
642+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
643+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
644+
Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
645+
});
646+
647+
tag.MusicBrainzRecordingId = val_sing;
648+
649+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
650+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
651+
Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
652+
});
653+
654+
tag.MusicBrainzRecordingId = string.Empty;
655+
656+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
657+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
658+
Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
659+
});
660+
}
661+
662+
[Test]
663+
public void TestMusicBrainzWorkID ()
664+
{
665+
Tag tag = new Tag ();
666+
667+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
668+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
669+
Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
670+
});
671+
672+
tag.MusicBrainzWorkId = val_sing;
673+
674+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
675+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
676+
Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
677+
});
678+
679+
tag.MusicBrainzWorkId = string.Empty;
680+
681+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
682+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
683+
Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
684+
});
685+
}
686+
637687
[Test]
638688
public void TestMusicBrainzDiscID ()
639689
{
@@ -842,4 +892,4 @@ void TagTestWithSave (ref Tag tag, TagTestFunc testFunc)
842892
testFunc (tag, "After Save");
843893
}
844894
}
845-
}
895+
}

Diff for: src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs

+50
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,56 @@ public void TestMusicBrainzTrackID ()
633633
});
634634
}
635635

636+
[Test]
637+
public void TestMusicBrainzRecordingID ()
638+
{
639+
var file = CreateFile (out var abst);
640+
641+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
642+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
643+
Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
644+
});
645+
646+
file.Tag.MusicBrainzRecordingId = val_sing;
647+
648+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
649+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
650+
Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
651+
});
652+
653+
file.Tag.MusicBrainzRecordingId = string.Empty;
654+
655+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
656+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
657+
Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
658+
});
659+
}
660+
661+
[Test]
662+
public void TestMusicBrainzWorkID ()
663+
{
664+
var file = CreateFile (out var abst);
665+
666+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
667+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
668+
Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
669+
});
670+
671+
file.Tag.MusicBrainzWorkId = val_sing;
672+
673+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
674+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
675+
Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
676+
});
677+
678+
file.Tag.MusicBrainzWorkId = string.Empty;
679+
680+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
681+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
682+
Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
683+
});
684+
}
685+
636686
[Test]
637687
public void TestMusicBrainzDiscID ()
638688
{

Diff for: src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs

+104
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,62 @@ public void TestMusicBrainzTrackID ()
866866
}
867867
}
868868

869+
[Test]
870+
public void TestMusicBrainzRecordingID ()
871+
{
872+
var tag = new Tag ();
873+
for (byte version = 2; version <= 4; version++) {
874+
tag.Version = version;
875+
876+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
877+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
878+
Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
879+
});
880+
881+
tag.MusicBrainzRecordingId = val_sing;
882+
883+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
884+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
885+
Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
886+
});
887+
888+
tag.MusicBrainzRecordingId = string.Empty;
889+
890+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
891+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
892+
Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
893+
});
894+
}
895+
}
896+
897+
[Test]
898+
public void TestMusicBrainzWorkID ()
899+
{
900+
var tag = new Tag ();
901+
for (byte version = 2; version <= 4; version++) {
902+
tag.Version = version;
903+
904+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
905+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
906+
Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
907+
});
908+
909+
tag.MusicBrainzWorkId = val_sing;
910+
911+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
912+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
913+
Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
914+
});
915+
916+
tag.MusicBrainzWorkId = string.Empty;
917+
918+
TagTestWithSave (ref tag, delegate (Tag t, string m) {
919+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
920+
Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
921+
});
922+
}
923+
}
924+
869925
[Test]
870926
public void TestMusicBrainzDiscID ()
871927
{
@@ -1686,6 +1742,54 @@ public void TestUserTextInformationFrame ()
16861742
});
16871743
}
16881744

1745+
[Test]
1746+
public void TestMovementNameFrame ()
1747+
{
1748+
ByteVector id = "MVNM";
1749+
var frame = new TextInformationFrame (id) {
1750+
Text = val_mult
1751+
};
1752+
1753+
FrameTest (frame, 2,
1754+
delegate (Frame f, StringType e) {
1755+
(f as TextInformationFrame).TextEncoding = e;
1756+
},
1757+
(d, v) => new TextInformationFrame (d, v),
1758+
1759+
delegate (Frame f, string m) {
1760+
var g = (f as TextInformationFrame);
1761+
Assert.AreEqual (id, g.FrameId, m);
1762+
Assert.AreEqual (val_mult.Length, g.Text.Length, m);
1763+
for (int i = 0; i < val_mult.Length; i++) {
1764+
Assert.AreEqual (val_mult[i], g.Text[i], m);
1765+
}
1766+
});
1767+
}
1768+
1769+
[Test]
1770+
public void TestMovementNumberFrame ()
1771+
{
1772+
ByteVector id = "MVIN";
1773+
var frame = new TextInformationFrame (id) {
1774+
Text = val_mult
1775+
};
1776+
1777+
FrameTest (frame, 2,
1778+
delegate (Frame f, StringType e) {
1779+
(f as TextInformationFrame).TextEncoding = e;
1780+
},
1781+
(d, v) => new TextInformationFrame (d, v),
1782+
1783+
delegate (Frame f, string m) {
1784+
var g = (f as TextInformationFrame);
1785+
Assert.AreEqual (id, g.FrameId, m);
1786+
Assert.AreEqual (val_mult.Length, g.Text.Length, m);
1787+
for (int i = 0; i < val_mult.Length; i++) {
1788+
Assert.AreEqual (val_mult[i], g.Text[i], m);
1789+
}
1790+
});
1791+
}
1792+
16891793
[Test]
16901794
public void TestUniqueFileIdentifierFrame ()
16911795
{

Diff for: src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs

+50
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,56 @@ public void TestMusicBrainzTrackID ()
634634
});
635635
}
636636

637+
[Test]
638+
public void TestMusicBrainzRecordingID ()
639+
{
640+
var file = CreateFile (out var abst);
641+
642+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
643+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
644+
Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
645+
});
646+
647+
file.Tag.MusicBrainzRecordingId = val_sing;
648+
649+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
650+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
651+
Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
652+
});
653+
654+
file.Tag.MusicBrainzRecordingId = string.Empty;
655+
656+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
657+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
658+
Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
659+
});
660+
}
661+
662+
[Test]
663+
public void TestMusicBrainzWorkID ()
664+
{
665+
var file = CreateFile (out var abst);
666+
667+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
668+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
669+
Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
670+
});
671+
672+
file.Tag.MusicBrainzWorkId = val_sing;
673+
674+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
675+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
676+
Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
677+
});
678+
679+
file.Tag.MusicBrainzWorkId = string.Empty;
680+
681+
TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
682+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
683+
Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
684+
});
685+
}
686+
637687
[Test]
638688
public void TestMusicBrainzDiscID ()
639689
{

Diff for: src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs

+50
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,56 @@ public void TestMusicBrainzTrackID ()
659659
});
660660
}
661661

662+
[Test]
663+
public void TestMusicBrainzRecordingID ()
664+
{
665+
var tag = new XiphComment ();
666+
667+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
668+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
669+
Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
670+
});
671+
672+
tag.MusicBrainzRecordingId = val_sing;
673+
674+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
675+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
676+
Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
677+
});
678+
679+
tag.MusicBrainzRecordingId = string.Empty;
680+
681+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
682+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
683+
Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
684+
});
685+
}
686+
687+
[Test]
688+
public void TestMusicBrainzWorkID ()
689+
{
690+
var tag = new XiphComment ();
691+
692+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
693+
Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
694+
Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
695+
});
696+
697+
tag.MusicBrainzWorkId = val_sing;
698+
699+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
700+
Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
701+
Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
702+
});
703+
704+
tag.MusicBrainzWorkId = string.Empty;
705+
706+
TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
707+
Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
708+
Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
709+
});
710+
}
711+
662712
[Test]
663713
public void TestMusicBrainzDiscID ()
664714
{

0 commit comments

Comments
 (0)