public void TestReadPNG() { //provided in bug-44886 byte[] data = _samples.ReadFile("Container.dat"); EscherContainerRecord record = new EscherContainerRecord(); record.FillFields(data, 0, new DefaultEscherRecordFactory()); EscherContainerRecord bstore = (EscherContainerRecord)record.ChildRecords[1]; EscherBSERecord bse1 = (EscherBSERecord)bstore.ChildRecords[0]; Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeWin32); Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeMacOS); Assert.IsTrue(Arrays.Equals(new byte[] { 0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC, 0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2 }, bse1.UID)); Assert.AreEqual(255, bse1.Tag); Assert.AreEqual(32308, bse1.Size); EscherBitmapBlip blip1 = (EscherBitmapBlip)bse1.BlipRecord; Assert.AreEqual(0x6E00, blip1.Options); Assert.AreEqual(EscherBitmapBlip.RECORD_ID_PNG, blip1.RecordId); Assert.IsTrue(Arrays.Equals(new byte[] { 0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC, 0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2 }, blip1.UID)); //Serialize and Read again byte[] ser = bse1.Serialize(); EscherBSERecord bse2 = new EscherBSERecord(); bse2.FillFields(ser, 0, new DefaultEscherRecordFactory()); Assert.AreEqual(bse1.RecordId, bse2.RecordId); Assert.AreEqual(bse1.BlipTypeWin32, bse2.BlipTypeWin32); Assert.AreEqual(bse1.BlipTypeMacOS, bse2.BlipTypeMacOS); Assert.IsTrue(Arrays.Equals(bse1.UID, bse2.UID)); Assert.AreEqual(bse1.Tag, bse2.Tag); Assert.AreEqual(bse1.Size, bse2.Size); EscherBitmapBlip blip2 = (EscherBitmapBlip)bse1.BlipRecord; Assert.AreEqual(blip1.Options, blip2.Options); Assert.AreEqual(blip1.RecordId, blip2.RecordId); Assert.AreEqual(blip1.UID, blip2.UID); Assert.IsTrue(Arrays.Equals(blip1.PictureData, blip1.PictureData)); }
public void TestBug44857() { byte[] data = _samples.ReadFile("Container.dat"); // This used to fail with an OutOfMemory EscherContainerRecord record = new EscherContainerRecord(); record.FillFields(data, 0, new DefaultEscherRecordFactory()); }
public static byte[] GetTestDataFileContent(String fileName) { return(_inst.ReadFile(fileName)); }