A testcase that I should have added before.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f61f0058b
commit
b05947a181
@ -0,0 +1,55 @@
|
||||
######################################################
|
||||
# Rich text with extended information test
|
||||
|
||||
[rich-header]
|
||||
1D 00 # String length 0x1b=29
|
||||
0D # Option flag, rich text + 16bit + extended
|
||||
02 00 # Formatting runs
|
||||
03 00 00 00 # Far east data size
|
||||
# String: At a dinner party or
|
||||
41 00 74 00 20 00 61 00 20 00
|
||||
64 00 69 00 6E 00 6E 00 65 00
|
||||
72 00 20 00 70 00 61 00 72 00
|
||||
74 00 79 00 20 00 6F 00 72 00
|
||||
|
||||
[rich-continue1]
|
||||
# Continuation record
|
||||
00 # option flag
|
||||
|
||||
# string:at at at
|
||||
41 74 20
|
||||
41 74 20
|
||||
41 74 20
|
||||
|
||||
00 00 # Formatting run 1, first formated char at 0
|
||||
00 00 # Formatting run 1, Index to font record
|
||||
02 00 # Formatting run 2, first formated char at 2
|
||||
00 00 # Formatting run 2, Index to font record
|
||||
|
||||
FF FF FF # extended data
|
||||
|
||||
|
||||
########################################################
|
||||
# Normal text with extended information.
|
||||
|
||||
[norich-header]
|
||||
1D 00 # String length 0x1b=29
|
||||
05 # Option flag, 16bit + extended
|
||||
03 00 00 00 # Far east data size
|
||||
# String: At a dinner party or
|
||||
41 00 74 00 20 00 61 00 20 00
|
||||
64 00 69 00 6E 00 6E 00 65 00
|
||||
72 00 20 00 70 00 61 00 72 00
|
||||
74 00 79 00 20 00 6F 00 72 00
|
||||
|
||||
[norich-continue1]
|
||||
# Continuation record
|
||||
00 # option flag
|
||||
|
||||
# string:at at at
|
||||
41 74 20
|
||||
41 74 20
|
||||
41 74 20
|
||||
|
||||
FF FF FF # extended data
|
||||
|
@ -72,6 +72,11 @@ public class TestSSTDeserializer
|
||||
private String _test_file_path;
|
||||
private static final String _test_file_path_property = "HSSF.testdata.path";
|
||||
|
||||
public TestSSTDeserializer( String s )
|
||||
{
|
||||
super( s );
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
_test_file_path = System.getProperty( _test_file_path_property );
|
||||
@ -83,7 +88,7 @@ public class TestSSTDeserializer
|
||||
byte[] bytes = HexRead.readData( _test_file_path + File.separator + "richtextdata.txt", "header" );
|
||||
BinaryTree strings = new BinaryTree();
|
||||
SSTDeserializer deserializer = new SSTDeserializer( strings );
|
||||
deserializer.manufactureStrings( bytes, 0, (short) 45 );
|
||||
deserializer.manufactureStrings( bytes, 0, (short)bytes.length );
|
||||
byte[] continueBytes = HexRead.readData( _test_file_path + File.separator + "richtextdata.txt", "continue1" );
|
||||
deserializer.processContinueRecord( continueBytes );
|
||||
|
||||
@ -96,7 +101,7 @@ public class TestSSTDeserializer
|
||||
byte[] bytes = HexRead.readData( _test_file_path + File.separator + "evencontinuation.txt", "header" );
|
||||
BinaryTree strings = new BinaryTree();
|
||||
SSTDeserializer deserializer = new SSTDeserializer( strings );
|
||||
deserializer.manufactureStrings( bytes, 0, (short) 43 );
|
||||
deserializer.manufactureStrings( bytes, 0, (short)bytes.length );
|
||||
byte[] continueBytes = HexRead.readData( _test_file_path + File.separator + "evencontinuation.txt", "continue1" );
|
||||
deserializer.processContinueRecord( continueBytes );
|
||||
|
||||
@ -114,7 +119,7 @@ public class TestSSTDeserializer
|
||||
byte[] bytes = HexRead.readData( _test_file_path + File.separator + "stringacross2continuations.txt", "header" );
|
||||
BinaryTree strings = new BinaryTree();
|
||||
SSTDeserializer deserializer = new SSTDeserializer( strings );
|
||||
deserializer.manufactureStrings( bytes, 0, (short) 43 );
|
||||
deserializer.manufactureStrings( bytes, 0, (short)bytes.length );
|
||||
bytes = HexRead.readData( _test_file_path + File.separator + "stringacross2continuations.txt", "continue1" );
|
||||
deserializer.processContinueRecord( bytes );
|
||||
bytes = HexRead.readData( _test_file_path + File.separator + "stringacross2continuations.txt", "continue2" );
|
||||
@ -125,4 +130,28 @@ public class TestSSTDeserializer
|
||||
|
||||
}
|
||||
|
||||
public void testExtendedStrings()
|
||||
throws Exception
|
||||
{
|
||||
byte[] bytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "rich-header" );
|
||||
BinaryTree strings = new BinaryTree();
|
||||
SSTDeserializer deserializer = new SSTDeserializer( strings );
|
||||
deserializer.manufactureStrings( bytes, 0, (short)bytes.length );
|
||||
byte[] continueBytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "rich-continue1" );
|
||||
deserializer.processContinueRecord( continueBytes );
|
||||
|
||||
assertEquals( "At a dinner party orAt At At ", strings.get( new Integer( 0 ) ) + "" );
|
||||
|
||||
|
||||
bytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "norich-header" );
|
||||
strings = new BinaryTree();
|
||||
deserializer = new SSTDeserializer( strings );
|
||||
deserializer.manufactureStrings( bytes, 0, (short)bytes.length );
|
||||
continueBytes = HexRead.readData( _test_file_path + File.separator + "extendedtextstrings.txt", "norich-continue1" );
|
||||
deserializer.processContinueRecord( continueBytes );
|
||||
|
||||
assertEquals( "At a dinner party orAt At At ", strings.get( new Integer( 0 ) ) + "" );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user