public virtual void TestShouldConsiderTwoEquivalentObjectsEqual()
 {
     ID3v2ObseletePictureFrameData frameData1 = new ID3v2ObseletePictureFrameData(false
         , TEST_MIME_TYPE, unchecked((byte)0), new EncodedText(unchecked((byte)1), TEST_DESCRIPTION
         ), DUMMY_IMAGE_DATA);
     ID3v2ObseletePictureFrameData frameData2 = new ID3v2ObseletePictureFrameData(false
         , TEST_MIME_TYPE, unchecked((byte)0), new EncodedText(unchecked((byte)1), TEST_DESCRIPTION
         ), DUMMY_IMAGE_DATA);
     Assert.AreEqual(frameData1, frameData2);
 }
 public virtual void TestShouldReadFrameData()
 {
     byte[] bytes = new byte[] { unchecked((int)(0x00)), (byte)('P'), (byte)('N'), (byte
         )('G'), unchecked((int)(0x01)), (byte)('D'), (byte)('E'), (byte)('S'), (byte)('C'
         ), (byte)('R'), (byte)('I'), (byte)('P'), (byte)('T'), (byte)('I'), (byte)('O'),
         (byte)('N'), unchecked((int)(0x00)), 1, 2, 3, 4, 5 };
     ID3v2ObseletePictureFrameData frameData = new ID3v2ObseletePictureFrameData(false, bytes);
     Assert.AreEqual(TEST_MIME_TYPE, frameData.GetMimeType());
     Assert.AreEqual(unchecked((byte)1), frameData.GetPictureType());
     Assert.AreEqual(new EncodedText(unchecked((byte)0), TEST_DESCRIPTION), frameData.GetDescription());
     Assert.IsTrue(Arrays.Equals(DUMMY_IMAGE_DATA, frameData.GetImageData()));
 }
 public virtual void TestShouldReadFrameDataWithUnicodeDescription()
 {
     byte[] bytes = new byte[] { unchecked((int)(0x01)), (byte)('P'), (byte)('N'), (byte
         )('G'), unchecked((int)(0x01)), unchecked((byte)unchecked((int)(0xff))), unchecked(
         (byte)unchecked((int)(0xfe))), unchecked((byte)unchecked((int)(0xb3))), unchecked(
         (int)(0x03)), unchecked((byte)unchecked((int)(0xb5))), unchecked((int)(0x03)), unchecked(
         (byte)unchecked((int)(0xb9))), unchecked((int)(0x03)), unchecked((byte)unchecked(
         (int)(0xac))), unchecked((int)(0x03)), 0, 0, 1, 2, 3, 4, 5 };
     ID3v2ObseletePictureFrameData frameData = new ID3v2ObseletePictureFrameData(false, bytes);
     Assert.AreEqual(TEST_MIME_TYPE, frameData.GetMimeType());
     Assert.AreEqual(unchecked((byte)1), frameData.GetPictureType());
     Assert.AreEqual(new EncodedText(EncodedText.TEXT_ENCODING_UTF_16, TEST_DESCRIPTION_UNICODE), frameData.GetDescription());
     Assert.IsTrue(Arrays.Equals(DUMMY_IMAGE_DATA, frameData.GetImageData()));
 }
Esempio n. 4
0
 private ID3v2PictureFrameData CreatePictureFrameData(string id)
 {
     ID3v2FrameSet frameSet = frameSets.Get(id);
     if (frameSet != null)
     {
         ID3v2Frame frame = (ID3v2Frame)frameSet.GetFrames()[0];
         ID3v2PictureFrameData frameData;
         try
         {
             if (obseleteFormat)
             {
                 frameData = new ID3v2ObseletePictureFrameData(UseFrameUnsynchronisation(), frame.
                     GetData());
             }
             else
             {
                 frameData = new ID3v2PictureFrameData(UseFrameUnsynchronisation(), frame.GetData(
                     ));
             }
             return frameData;
         }
         catch (InvalidDataException)
         {
         }
     }
     // do nothing
     return null;
 }