add watermark test case (as example)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1160745 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca541c93a3
commit
48bce381fc
@ -0,0 +1,32 @@
|
||||
package org.apache.poi.hwpf.usermodel;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.ddf.EscherComplexProperty;
|
||||
import org.apache.poi.ddf.EscherContainerRecord;
|
||||
import org.apache.poi.ddf.EscherOptRecord;
|
||||
import org.apache.poi.hwpf.HWPFDocument;
|
||||
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
||||
|
||||
public class TestOfficeDrawings extends TestCase
|
||||
{
|
||||
public void testWatermark() throws UnsupportedEncodingException
|
||||
{
|
||||
HWPFDocument hwpfDocument = HWPFTestDataSamples
|
||||
.openSampleFile( "watermark.doc" );
|
||||
OfficeDrawing drawing = hwpfDocument.getOfficeDrawingsHeaders()
|
||||
.getOfficeDrawings().iterator().next();
|
||||
EscherContainerRecord escherContainerRecord = drawing
|
||||
.getOfficeArtSpContainer();
|
||||
|
||||
EscherOptRecord officeArtFOPT = escherContainerRecord
|
||||
.getChildById( (short) 0xF00B );
|
||||
EscherComplexProperty gtextUNICODE = (EscherComplexProperty) officeArtFOPT
|
||||
.lookup( 0x00c0 );
|
||||
|
||||
String text = new String( gtextUNICODE.getComplexData(), "UTF-16LE" );
|
||||
assertEquals( "DRAFT CONTRACT\0", text );
|
||||
}
|
||||
}
|
BIN
test-data/document/watermark.doc
Normal file
BIN
test-data/document/watermark.doc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user