Skip to content

Commit a116ed5

Browse files
committed
Created Tests for CreateID3Tags
1 parent 54e536f commit a116ed5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/TaglibSharp.Tests/FileFormats/Id3BothFormatTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,29 @@ public void TestRemoveTags ()
109109
file.RemoveTags (TagTypes.AllTags);
110110
Assert.AreEqual (TagTypes.None, file.TagTypes);
111111
}
112+
113+
[Test]
114+
public void TestCreateId3Tags ()
115+
{
116+
string tempFile = TestPath.Samples + "tmpwrite_sample_createid3tags.mp3";
117+
118+
System.IO.File.Copy (sample_file, tempFile, true);
119+
120+
// Remove All Tags first
121+
var file = File.Create (tempFile);
122+
file.RemoveTags (TagTypes.AllTags);
123+
file.Save ();
124+
125+
// No TagTypes should exist
126+
TagLib.Mpeg.AudioFile.CreateID3Tags = false;
127+
file = File.Create (tempFile);
128+
Assert.AreEqual (TagTypes.None, file.TagTypes);
129+
file.Save ();
130+
131+
// Empty TagTypes should be created
132+
TagLib.Mpeg.AudioFile.CreateID3Tags = true;
133+
file = File.Create (tempFile);
134+
Assert.AreEqual (TagTypes.Id3v1 | TagTypes.Id3v2, file.TagTypes);
135+
}
112136
}
113137
}

0 commit comments

Comments
 (0)