nick 2005/08/01 10:37:15
Modified: src/scratchpad/testcases/org/apache/poi/hslf/record
TestStyleTextPropAtom.java
Log:
Add a partial test for changing style properties
Revision Changes Path
1.2 +29 -0
jakarta-poi/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
Index: TestStyleTextPropAtom.java
===================================================================
RCS file:
/home/cvs/jakarta-poi/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestStyleTextPropAtom.java 31 Jul 2005 18:06:48 -0000 1.1
+++ TestStyleTextPropAtom.java 1 Aug 2005 17:37:15 -0000 1.2
@@ -100,6 +100,35 @@
assertEquals(true, csb[1].isItalic() );
}
+ public void testChangeCharacterProps() throws Exception {
+ // Change from A to B
+ StyleTextPropAtom stpa = new
StyleTextPropAtom(data_a,0,data_a.length);
+ CharacterStyle[] csa = stpa.getCharacterStyles();
+
+ // Update paragraph length
+ stpa.setParagraphStyleCharactersCoveredLength(83);
+
+ // Update each of the Character Styles
+ // First is 30 long and bold
+ csa[0].setCharactersCoveredLength(30);
+ csa[0].setBold(true);
+ // Second is 28 long and italic
+ csa[1].setCharactersCoveredLength(28);
+ csa[1].setItalic(true);
+
+ // Ensure now matches data from B
+ // Disabled, as it currently doesn't, as we don't know about
+ // everything that needs updating, esp the S2 values
+// ByteArrayOutputStream baos = new ByteArrayOutputStream();
+// stpa.writeOut(baos);
+// byte[] b = baos.toByteArray();
+//
+// assertEquals(data_b.length, b.length);
+// for(int i=0; i<data_b.length; i++) {
+// assertEquals(data_b[i],b[i]);
+// }
+ }
+
public void testWrite() throws Exception {
StyleTextPropAtom stpa = new
StyleTextPropAtom(data_a,0,data_a.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/