From: Nick Burch Date: Sun, 14 Aug 2005 19:27:45 +0000 (+0000) Subject: Add a few more tests X-Git-Tag: BEFORE_RICHTEXT~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c4fea20971ac2efc7766f88e546924dadaa7959a;p=poi.git Add a few more tests git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353767 13f79535-47bb-0310-9956-ffa450edef68 --- 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 2ffc7e3422..a931bcd143 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java @@ -113,6 +113,44 @@ public class TestStyleTextPropAtom extends TestCase { assertEquals(25, b_ch_3.getCharactersCovered()); } + + public void testCharacterPropOrdering() throws Exception { + StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); + stpb.setParentTextSize(data_b_text_len); + + LinkedList b_ch_l = stpb.getCharacterStyles(); + TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); + LinkedList b_ch2_tp = b_ch_2.getTextPropList(); + + // First item should be a CharFlagsTextProp + TextProp tp = (TextProp)b_ch2_tp.get(0); + assertEquals(true, b_ch2_tp.get(0) instanceof CharFlagsTextProp); + } + + + public void testCharacterProps() throws Exception { + StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); + stpb.setParentTextSize(data_b_text_len); + + LinkedList b_ch_l = stpb.getCharacterStyles(); + TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0); + TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); + TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2); + + // 1st is bold + CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0); + //assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX)); + + // 2nd is italic + CharFlagsTextProp cf_2_1 = (CharFlagsTextProp)b_ch_2.getTextPropList().get(0); + //assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX)); + + // 3rd is normal + //CharFlagsTextProp cf_3_1 = (CharFlagsTextProp)b_ch_3.getTextPropList().get(0); + + } + + public void testWrite() throws Exception { StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length); ByteArrayOutputStream baos = new ByteArrayOutputStream();