poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r385356 - /jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java
Date Sun, 12 Mar 2006 19:19:19 GMT
Author: nick
Date: Sun Mar 12 11:19:18 2006
New Revision: 385356

URL: http://svn.apache.org/viewcvs?rev=385356&view=rev
Log:
Tests for creating a new Comment2000 record

Modified:
    jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java

Modified: jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java
URL: http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java?rev=385356&r1=385355&r2=385356&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java
(original)
+++ jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestComment2000.java
Sun Mar 12 11:19:18 2006
@@ -126,23 +126,35 @@
 	public void testChange() throws Exception {
 		Comment2000 ca = new Comment2000(data_a, 0, data_a.length);
 		Comment2000 cb = new Comment2000(data_b, 0, data_b.length);
+		Comment2000 cn = new Comment2000();
 		ca.setAuthor("Hogwarts");
 		ca.setAuthorInitials("H");
 		ca.setText("Comments are fun things to add in, aren't they?");
+		cn.setAuthor("Hogwarts");
+		cn.setAuthorInitials("H");
+		cn.setText("Comments are fun things to add in, aren't they?");
 		
 		// Change the Comment2000Atom
 		Comment2000Atom c2a = ca.getComment2000Atom();
+		Comment2000Atom c2n = cn.getComment2000Atom();
 		c2a.setNumber(1);
 		c2a.setXOffset(0x0a);
 		c2a.setYOffset(0x0a);
+		c2n.setNumber(1);
+		c2n.setXOffset(0x0a);
+		c2n.setYOffset(0x0a);
 		
 		Date new_date = sdf.parse("2006-01-24 22:25:03.725");
 		c2a.setDate(new_date);
+		c2n.setDate(new_date);
 		
 		// Check now the same
 		assertEquals(ca.getText(), cb.getText());
+		assertEquals(cn.getText(), cb.getText());
 		assertEquals(ca.getAuthor(), cb.getAuthor());
+		assertEquals(cn.getAuthor(), cb.getAuthor());
 		assertEquals(ca.getAuthorInitials(), cb.getAuthorInitials());
+		assertEquals(cn.getAuthorInitials(), cb.getAuthorInitials());
 		
 		// Check bytes weren't the same
 		try {
@@ -155,14 +167,21 @@
 		}
 		
 		// Check bytes are now the same
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		ca.writeOut(baos);
-		byte[] b = baos.toByteArray();
+		ByteArrayOutputStream baosa = new ByteArrayOutputStream();
+		ByteArrayOutputStream baosn = new ByteArrayOutputStream();
+		ca.writeOut(baosa);
+		cn.writeOut(baosn);
+		byte[] ba = baosa.toByteArray();
+		byte[] bn = baosn.toByteArray();
 		
 		// Should now be the same
-		assertEquals(data_b.length, b.length);
+		assertEquals(data_b.length, ba.length);
 		for(int i=0; i<data_b.length; i++) {
-			assertEquals(data_b[i],b[i]);
+			assertEquals(data_b[i],ba[i]);
+		}
+		assertEquals(data_b.length, bn.length);
+		for(int i=0; i<data_b.length; i++) {
+			assertEquals(data_b[i],bn[i]);
 		}
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message