Example #1
0
        public void TestCloneMulBlank_bug46776()
        {
            Record[] recs =
            {
                InternalSheet.CreateBOF(),
                new DimensionsRecord(),
                new RowRecord(1),
                new MulBlankRecord(1, 3, new short[] { 0x0F, 0x0F, 0x0F, }),
                new RowRecord(2),
                CreateWindow2Record(),
                EOFRecord.instance,
            };

            InternalSheet sheet = CreateSheet(recs.ToList());

            InternalSheet sheet2;

            try
            {
                sheet2 = sheet.CloneSheet();
            }
            catch (Exception e)
            {
                if (e.Message.Equals("The class org.apache.poi.hssf.record.MulBlankRecord needs to define a clone method"))
                {
                    throw new AssertionException("Identified bug 46776");
                }
                throw e;
            }

            TestCases.HSSF.UserModel.RecordInspector.RecordCollector rc = new TestCases.HSSF.UserModel.RecordInspector.RecordCollector();
            sheet2.VisitContainedRecords(rc, 0);
            Record[] clonedRecs = rc.Records;
            Assert.AreEqual(recs.Length + 2, clonedRecs.Length); // +2 for INDEX and DBCELL
        }