public void TestResultEqualsToAbstractShape() { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sh = wb.CreateSheet() as HSSFSheet; HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch; HSSFTextbox textbox = patriarch.CreateTextbox(new HSSFClientAnchor()) as HSSFTextbox; TextboxShape textboxShape = HSSFTestModelHelper.CreateTextboxShape(1025, textbox); Assert.AreEqual(textbox.GetEscherContainer().ChildRecords.Count, 5); Assert.AreEqual(textboxShape.SpContainer.ChildRecords.Count, 5); //sp record byte[] expected = textboxShape.SpContainer.GetChild(0).Serialize(); byte[] actual = textbox.GetEscherContainer().GetChild(0).Serialize(); Assert.AreEqual(expected.Length, actual.Length); Assert.IsTrue(Arrays.Equals(expected, actual)); expected = textboxShape.SpContainer.GetChild(2).Serialize(); actual = textbox.GetEscherContainer().GetChild(2).Serialize(); Assert.AreEqual(expected.Length, actual.Length); Assert.IsTrue(Arrays.Equals(expected, actual)); expected = textboxShape.SpContainer.GetChild(3).Serialize(); actual = textbox.GetEscherContainer().GetChild(3).Serialize(); Assert.AreEqual(expected.Length, actual.Length); Assert.IsTrue(Arrays.Equals(expected, actual)); expected = textboxShape.SpContainer.GetChild(4).Serialize(); actual = textbox.GetEscherContainer().GetChild(4).Serialize(); Assert.AreEqual(expected.Length, actual.Length); Assert.IsTrue(Arrays.Equals(expected, actual)); ObjRecord obj = textbox.GetObjRecord(); ObjRecord objShape = textboxShape.ObjRecord; expected = obj.Serialize(); actual = objShape.Serialize(); TextObjectRecord tor = textbox.GetTextObjectRecord(); TextObjectRecord torShape = textboxShape.TextObjectRecord; expected = tor.Serialize(); actual = torShape.Serialize(); Assert.AreEqual(expected.Length, actual.Length); Assert.IsTrue(Arrays.Equals(expected, actual)); }
public void TestShapeId() { HSSFClientAnchor anchor = new HSSFClientAnchor(); AbstractShape shape; CommonObjectDataSubRecord cmo; shape = new TextboxShape(new HSSFTextbox(null, anchor), 1025); cmo = (CommonObjectDataSubRecord)shape.ObjRecord.SubRecords[(0)]; Assert.AreEqual(1, cmo.ObjectId); shape = new PictureShape(new HSSFPicture(null, anchor), 1026); cmo = (CommonObjectDataSubRecord)shape.ObjRecord.SubRecords[(0)]; Assert.AreEqual(2, cmo.ObjectId); shape = new CommentShape(new HSSFComment(null, anchor), 1027); cmo = (CommonObjectDataSubRecord)shape.ObjRecord.SubRecords[(0)]; Assert.AreEqual(1027, cmo.ObjectId); }