Exemplo n.º 1
0
 public virtual void TestShouldIgnoreIncompleteMpegFrame()
 {
     Mp3File mp3File = new Mp3File(MP3_WITH_INCOMPLETE_MPEG_FRAME, 256);
     Assert.AreEqual(unchecked((int)(0x44B)), mp3File.GetXingOffset());
     Assert.AreEqual(unchecked((int)(0x5EC)), mp3File.GetStartOffset());
     Assert.AreEqual(unchecked((int)(0xF17)), mp3File.GetEndOffset());
     Assert.IsTrue(mp3File.HasId3v1Tag());
     Assert.IsTrue(mp3File.HasId3v2Tag());
     Assert.AreEqual(5, mp3File.GetFrameCount());
 }
Exemplo n.º 2
0
 public virtual void TestShouldRemoveCustomTag()
 {
     string filename = MP3_WITH_ID3V1_AND_ID3V23_AND_CUSTOM_TAGS;
     string saveFilename = filename + ".copy";
     try
     {
         Mp3File mp3File = new Mp3File(filename);
         mp3File.RemoveCustomTag();
         mp3File.Save(saveFilename);
         Mp3File newMp3File = new Mp3File(saveFilename);
         Assert.IsTrue(newMp3File.HasId3v1Tag());
         Assert.IsTrue(newMp3File.HasId3v2Tag());
         Assert.IsFalse(newMp3File.HasCustomTag());
     }
     finally
     {
         TestHelper.DeleteFile(saveFilename);
     }
 }
Exemplo n.º 3
0
 public virtual void TestShouldInitialiseProperlyWhenNotScanningFile()
 {
     Mp3File mp3File = new Mp3File(MP3_WITH_INCOMPLETE_MPEG_FRAME, 256, false);
     Assert.IsTrue(mp3File.HasId3v1Tag());
     Assert.IsTrue(mp3File.HasId3v2Tag());
 }
Exemplo n.º 4
0
 private Mp3File LoadAndCheckTestMp3(string filename, int bufferLength)
 {
     Mp3File mp3File = new Mp3File(filename, bufferLength);
     Assert.IsTrue(mp3File.HasXingFrame());
     Assert.AreEqual(6, mp3File.GetFrameCount());
     Assert.AreEqual(MpegFrame.MPEG_VERSION_1_0, mp3File.GetVersion());
     Assert.AreEqual(MpegFrame.MPEG_LAYER_3, mp3File.GetLayer());
     Assert.AreEqual(44100, mp3File.GetSampleRate());
     Assert.AreEqual(MpegFrame.CHANNEL_MODE_JOINT_STEREO, mp3File.GetChannelMode());
     Assert.AreEqual(MpegFrame.EMPHASIS_NONE, mp3File.GetEmphasis());
     Assert.IsTrue(mp3File.IsOriginal());
     Assert.IsFalse(mp3File.IsCopyright());
     Assert.AreEqual(128, mp3File.GetXingBitrate());
     Assert.AreEqual(125, mp3File.GetBitrate());
     Assert.AreEqual(1, ((MutableInteger)mp3File.GetBitrates()[224]).GetValue());
     Assert.AreEqual(1, ((MutableInteger)mp3File.GetBitrates()[112]).GetValue());
     Assert.AreEqual(2, ((MutableInteger)mp3File.GetBitrates()[96]).GetValue());
     Assert.AreEqual(1, ((MutableInteger)mp3File.GetBitrates()[192]).GetValue());
     Assert.AreEqual(1, ((MutableInteger)mp3File.GetBitrates()[32]).GetValue());
     Assert.AreEqual(156, mp3File.GetLengthInMilliseconds());
     return mp3File;
 }
Exemplo n.º 5
0
 public virtual void TestShouldThrowExceptionIfSavingMp3WithSameNameAsSourceFile()
 {
     Mp3File mp3file = new Mp3File(MP3_WITH_ID3V1_AND_ID3V23_AND_CUSTOM_TAGS);
     try
     {
         mp3file.Save(MP3_WITH_ID3V1_AND_ID3V23_AND_CUSTOM_TAGS);
         Assert.Fail("IllegalArgumentException expected but not thrown");
     }
     catch (ArgumentException e)
     {
         Assert.AreEqual("Save filename same as source filename", e.Message);
     }
 }