Ejemplo n.º 1
0
 private static RecalcIdRecord Create(byte[] data)
 {
     RecordInputStream in1 = TestcaseRecordInputStream.Create(RecalcIdRecord.sid, data);
     RecalcIdRecord result = new RecalcIdRecord(in1);
     Assert.AreEqual(0, in1.Remaining);
     return result;
 }
Ejemplo n.º 2
0
        public void TestBadFirstField_bug48096()
        {
            /**
             * Data taken from the sample file referenced in Bugzilla 48096, file offset 0x0D45.
             * The apparent problem is that the first data short field has been written with the
             * wrong <i>endianness</n>.  Excel seems to ignore whatever value is present in this
             * field, and always reWrites it as (C1, 01). POI now does the same.
             */
            byte[] badData = HexRead.ReadFromString("C1 01 08 00 01 C1 00 00 00 01 69 61");
            byte[] goodData = HexRead.ReadFromString("C1 01 08 00 C1 01 00 00 00 01 69 61");

            RecordInputStream in1 = TestcaseRecordInputStream.Create(badData);
            RecalcIdRecord r;
            try
            {
                r = new RecalcIdRecord(in1);
            }
            catch (RecordFormatException e)
            {
                if (e.Message.Equals("expected 449 but got 49409"))
                {
                    throw new AssertionException("Identified bug 48096");
                }
                throw e;
            }
            Assert.AreEqual(0, in1.Remaining);
            Assert.IsTrue(Arrays.Equals(r.Serialize(), goodData));
        }