]> source.dussan.org Git - poi.git/commitdiff
junit test for sprm, added missing line from r1137143
authorYegor Kozlov <yegor@apache.org>
Mon, 20 Jun 2011 08:01:23 +0000 (08:01 +0000)
committerYegor Kozlov <yegor@apache.org>
Mon, 20 Jun 2011 08:01:23 +0000 (08:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1137538 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TestSprms.java [new file with mode: 0755]

index b4b322d4ff79aef3433dfc2cefe637a53c01a03e..9268183702970966b9a53f9cc504da92ff3ab28f 100644 (file)
@@ -347,6 +347,7 @@ public final class ParagraphSprmUncompressor
         break;
       case 0x41:
         // sprmPFBiDi 
+        newPAP.setFBiDi((byte) sprm.getOperand());
         break;
       case 0x43:
 
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TestSprms.java b/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TestSprms.java
new file mode 100755 (executable)
index 0000000..3bd0309
--- /dev/null
@@ -0,0 +1,61 @@
+/*\r
+ *  ====================================================================\r
+ *    Licensed to the Apache Software Foundation (ASF) under one or more\r
+ *    contributor license agreements.  See the NOTICE file distributed with\r
+ *    this work for additional information regarding copyright ownership.\r
+ *    The ASF licenses this file to You under the Apache License, Version 2.0\r
+ *    (the "License"); you may not use this file except in compliance with\r
+ *    the License.  You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ * ====================================================================\r
+ */\r
+\r
+package org.apache.poi.hwpf.sprm;\r
+\r
+import java.io.ByteArrayInputStream;\r
+import java.io.ByteArrayOutputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+\r
+import junit.framework.TestCase;\r
+import org.apache.poi.POIDataSamples;\r
+import org.apache.poi.hwpf.HWPFDocument;\r
+\r
+public class TestSprms extends TestCase {\r
+    /**\r
+     * Test correct processing of "sprmPJc" by uncompressor\r
+     */\r
+    public void testSprmPJc() throws IOException {\r
+        InputStream resourceAsStream = POIDataSamples.getDocumentInstance()\r
+                .openResourceAsStream("Bug49820.doc");\r
+        HWPFDocument hwpfDocument = new HWPFDocument(resourceAsStream);\r
+        assertEquals(1, hwpfDocument.getStyleSheet().getParagraphStyle(8)\r
+                .getJustification());\r
+        resourceAsStream.close();\r
+    }\r
+\r
+    /**\r
+     * Test correct processing of "sprmPJc" by compressor and uncompressor\r
+     */\r
+    public void testSprmPJcResave() throws IOException {\r
+        InputStream resourceAsStream = POIDataSamples.getDocumentInstance()\r
+                .openResourceAsStream("Bug49820.doc");\r
+        HWPFDocument hwpfDocument = new HWPFDocument(resourceAsStream);\r
+        resourceAsStream.close();\r
+\r
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
+        hwpfDocument.write(baos);\r
+        hwpfDocument = new HWPFDocument(\r
+                new ByteArrayInputStream(baos.toByteArray()));\r
+\r
+        assertEquals(1, hwpfDocument.getStyleSheet().getParagraphStyle(8)\r
+                .getJustification());\r
+    }\r
+}\r