--- /dev/null
+/*\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