public void RemoveComment() { CommentsTable sheetComments = new CommentsTable(); CT_Comment a1 = sheetComments.NewComment("A1"); CT_Comment a2 = sheetComments.NewComment("A2"); CT_Comment a3 = sheetComments.NewComment("A3"); Assert.AreSame(a1, sheetComments.GetCTComment("A1")); Assert.AreSame(a2, sheetComments.GetCTComment("A2")); Assert.AreSame(a3, sheetComments.GetCTComment("A3")); Assert.AreEqual(3, sheetComments.GetNumberOfComments()); Assert.IsTrue(sheetComments.RemoveComment("A1")); Assert.AreEqual(2, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment("A1")); Assert.AreSame(a2, sheetComments.GetCTComment("A2")); Assert.AreSame(a3, sheetComments.GetCTComment("A3")); Assert.IsTrue(sheetComments.RemoveComment("A2")); Assert.AreEqual(1, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment("A1")); Assert.IsNull(sheetComments.GetCTComment("A2")); Assert.AreSame(a3, sheetComments.GetCTComment("A3")); Assert.IsTrue(sheetComments.RemoveComment("A3")); Assert.AreEqual(0, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment("A1")); Assert.IsNull(sheetComments.GetCTComment("A2")); Assert.IsNull(sheetComments.GetCTComment("A3")); }
public void RemoveComment() { CellAddress addrA1 = new CellAddress("A1"); CellAddress addrA2 = new CellAddress("A2"); CellAddress addrA3 = new CellAddress("A3"); CommentsTable sheetComments = new CommentsTable(); CT_Comment a1 = sheetComments.NewComment(addrA1); CT_Comment a2 = sheetComments.NewComment(addrA2); CT_Comment a3 = sheetComments.NewComment(addrA3); Assert.AreSame(a1, sheetComments.GetCTComment(addrA1)); Assert.AreSame(a2, sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.AreEqual(3, sheetComments.GetNumberOfComments()); Assert.IsTrue(sheetComments.RemoveComment(addrA1)); Assert.AreEqual(2, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.AreSame(a2, sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.IsTrue(sheetComments.RemoveComment(addrA2)); Assert.AreEqual(1, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.IsNull(sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.IsTrue(sheetComments.RemoveComment(addrA3)); Assert.AreEqual(0, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.IsNull(sheetComments.GetCTComment(addrA2)); Assert.IsNull(sheetComments.GetCTComment(addrA3)); }
public void TestGetSetCol() { CommentsTable sheetComments = new CommentsTable(); XSSFVMLDrawing vml = new XSSFVMLDrawing(); CT_Comment ctComment = sheetComments.NewComment("A1"); CT_Shape vmlShape = vml.newCommentShape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); comment.Column = (1); Assert.AreEqual(1, comment.Column); Assert.AreEqual(1, new CellReference(ctComment.@ref).Col); Assert.AreEqual(1, vmlShape.GetClientDataArray(0).GetColumnArray(0)); comment.Column = (5); Assert.AreEqual(5, comment.Column); Assert.AreEqual(5, new CellReference(ctComment.@ref).Col); Assert.AreEqual(5, vmlShape.GetClientDataArray(0).GetColumnArray(0)); }
public void TestConstructor() { CommentsTable sheetComments = new CommentsTable(); Assert.IsNotNull(sheetComments.GetCTComments().commentList); Assert.IsNotNull(sheetComments.GetCTComments().authors); Assert.AreEqual(1, sheetComments.GetCTComments().authors.SizeOfAuthorArray()); Assert.AreEqual(1, sheetComments.GetNumberOfAuthors()); CT_Comment ctComment = sheetComments.NewComment("A1"); CT_Shape vmlShape = new CT_Shape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); Assert.AreEqual(null, comment.String.String); Assert.AreEqual(0, comment.Row); Assert.AreEqual(0, comment.Column); Assert.AreEqual("", comment.Author); Assert.AreEqual(false, comment.Visible); }
public void TestAuthor() { CommentsTable sheetComments = new CommentsTable(); CT_Comment ctComment = sheetComments.NewComment("A1"); Assert.AreEqual(1, sheetComments.GetNumberOfAuthors()); XSSFComment comment = new XSSFComment(sheetComments, ctComment, null); Assert.AreEqual("", comment.Author); comment.Author = ("Apache POI"); Assert.AreEqual("Apache POI", comment.Author); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); comment.Author = ("Apache POI"); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); comment.Author = (""); Assert.AreEqual("", comment.Author); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); }