From 2f71ef509c6d495b5bb21b0b1577caf231cdd1f8 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 1 Aug 2005 17:37:15 +0000 Subject: [PATCH] Add a partial test for changing style properties git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353758 13f79535-47bb-0310-9956-ffa450edef68 --- .../hslf/record/TestStyleTextPropAtom.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java index 91679b9684..fbe4840942 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java @@ -100,6 +100,35 @@ public class TestStyleTextPropAtom extends TestCase { 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