junit test for sprm, added missing line from r1137143

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1137538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2011-06-20 08:01:23 +00:00
parent 545cde3374
commit 2761d5a900
2 changed files with 62 additions and 0 deletions

View File

@ -347,6 +347,7 @@ public final class ParagraphSprmUncompressor
break;
case 0x41:
// sprmPFBiDi
newPAP.setFBiDi((byte) sprm.getOperand());
break;
case 0x43:

View File

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