You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/05/21 20:15:01 UTC
svn commit: r777204 [15/21] - in /poi/trunk/src/scratchpad:
examples/src/org/apache/poi/hslf/examples/
examples/src/org/apache/poi/hwpf/ src/org/apache/poi/hdf/event/
src/org/apache/poi/hdf/extractor/ src/org/apache/poi/hdf/extractor/data/
src/org/apac...
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java Thu May 21 18:12:22 2009
@@ -14,208 +14,209 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.chunks;
import junit.framework.TestCase;
-public class TestChunks extends TestCase {
+public final class TestChunks extends TestCase {
public static final byte[] data_a = new byte[] { 70, 0, 0, 0,
- -1, -1, -1, -1, 2, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
- 0, 0, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0,
- 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 36, 0, 0, 0, 1, 0, 84, 24, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 3, 0, 0,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, 0, 0, 1, 0, 84, 24, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 85, 5, 0, 0,
0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
public static final byte[] data_b = new byte[] { 70, 0, 0, 0,
- -1, -1, -1, -1, 3, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
- 0, 0, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 3, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1,
0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0,
- 0, 2, 0, 0, 0, 32, 0, 0, 0, 1, 0, 84, 24, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0, 0, -110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -124,
- 0, 0, 0, 2, 0, 85, 63, 0, 0, 0, 0, 0, 0, 33, 64, 63, 0, 0, 0, 0, 0, 0,
- 38, 64, 63, 0, 0, 0, 0, 0, 0, -64, 63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 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
public void testChunkHeaderA() throws Exception {
ChunkFactory cf = new ChunkFactory(11);
- ChunkHeader h =
+ ChunkHeader h =
ChunkHeader.createChunkHeader(11, data_a, 0);
-
+
assertTrue(h instanceof ChunkHeaderV11);
ChunkHeaderV11 header = (ChunkHeaderV11)h;
-
+
assertEquals(70, header.getType());
assertEquals(-1, header.getId());
assertEquals(2, header.getUnknown1());
assertEquals(68, header.getLength());
assertEquals(0, header.getUnknown2());
assertEquals(0, header.getUnknown3());
-
+
assertTrue(header.hasTrailer());
assertTrue(header.hasSeparator());
}
public void testChunkHeaderB() throws Exception {
ChunkFactory cf = new ChunkFactory(11);
- ChunkHeader h =
+ ChunkHeader h =
ChunkHeader.createChunkHeader(11, data_b, 0);
-
+
assertTrue(h instanceof ChunkHeaderV11);
ChunkHeaderV11 header = (ChunkHeaderV11)h;
-
+
assertEquals(70, header.getType());
assertEquals(-1, header.getId());
assertEquals(3, header.getUnknown1());
assertEquals(68, header.getLength());
assertEquals(0, header.getUnknown2());
assertEquals(0, header.getUnknown3());
-
+
assertTrue(header.hasTrailer());
assertTrue(header.hasSeparator());
}
-
+
public void testOneChunk() throws Exception {
ChunkFactory cf = new ChunkFactory(11);
cf.createChunk(data_a, 0);
cf.createChunk(data_b, 0);
-
+
Chunk chunk = cf.createChunk(data_a, 0);
assertNotNull(chunk.getHeader());
assertNotNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
-
+
// Should be 19 + length + 8 + 4 big
assertEquals(68, chunk.getHeader().getLength());
assertEquals(68+19+8+4, chunk.getOnDiskSize());
-
+
// Type is 70, or 0x46
assertEquals(70, chunk.getHeader().getType());
assertEquals(0x46, chunk.getHeader().getType());
-
+
// Should have two virtual chunk commands, a
// 10 (page sheet) and an 18
assertEquals(2, chunk.commandDefinitions.length);
assertEquals(0, chunk.getCommands().length);
-
+
assertEquals(10, chunk.commandDefinitions[0].getType());
assertEquals(0, chunk.commandDefinitions[0].getOffset());
assertEquals("PageSheet", chunk.commandDefinitions[0].getName());
-
+
assertEquals(18, chunk.commandDefinitions[1].getType());
assertEquals(0, chunk.commandDefinitions[1].getOffset());
assertEquals("0", chunk.commandDefinitions[1].getName());
}
-
+
public void testAnotherChunk() throws Exception {
ChunkFactory cf = new ChunkFactory(11);
-
+
// Go for the 2nd chunk in the stream
int offset = 0;
Chunk chunk = cf.createChunk(data_b, offset);
offset += chunk.getOnDiskSize();
chunk = cf.createChunk(data_b, offset);
-
+
assertNotNull(chunk.getHeader());
assertNotNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
-
+
// Should be 19 + length + 8 + 4 big
assertEquals(32, chunk.getHeader().getLength());
assertEquals(32+19+8+4, chunk.getOnDiskSize());
-
+
// Type is 104, or 0x68
assertEquals(104, chunk.getHeader().getType());
assertEquals(0x68, chunk.getHeader().getType());
-
+
// Should have two virtual chunk commands, a
// 10 (Unknown) and an 18
assertEquals(2, chunk.commandDefinitions.length);
assertEquals(0, chunk.getCommands().length);
-
+
assertEquals(10, chunk.commandDefinitions[0].getType());
assertEquals(0, chunk.commandDefinitions[0].getOffset());
assertEquals("PropList", chunk.commandDefinitions[0].getName());
-
+
assertEquals(18, chunk.commandDefinitions[1].getType());
assertEquals(0, chunk.commandDefinitions[1].getOffset());
assertEquals("0", chunk.commandDefinitions[1].getName());
}
-
+
public void testManyChunks() throws Exception {
ChunkFactory cf = new ChunkFactory(11);
Chunk chunk;
int offset = 0;
-
+
chunk = cf.createChunk(data_a, offset);
assertNotNull(chunk.getHeader());
assertNotNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
offset += chunk.getOnDiskSize();
-
+
chunk = cf.createChunk(data_a, offset);
assertNotNull(chunk.getHeader());
assertNotNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
offset += chunk.getOnDiskSize();
-
+
// Has a separator but no trailer
chunk = cf.createChunk(data_a, offset);
assertNotNull(chunk.getHeader());
assertNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
offset += chunk.getOnDiskSize();
-
+
chunk = cf.createChunk(data_a, offset);
assertNotNull(chunk.getHeader());
assertNull(chunk.getTrailer());
assertNotNull(chunk.getSeparator());
offset += chunk.getOnDiskSize();
-
+
chunk = cf.createChunk(data_a, offset);
assertNotNull(chunk.getHeader());
assertNull(chunk.getTrailer());
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.extractor;
import java.io.ByteArrayOutputStream;
@@ -26,25 +27,25 @@
import org.apache.poi.hdgf.HDGFDiagram;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-public class TestVisioExtractor extends TestCase {
+public final class TestVisioExtractor extends TestCase {
private String dirname;
private String defFilename;
protected void setUp() throws Exception {
dirname = System.getProperty("HDGF.testdata.path");
defFilename = dirname + "/Test_Visio-Some_Random_Text.vsd";
}
-
+
/**
* Test the 3 different ways of creating one
*/
public void testCreation() throws Exception {
VisioTextExtractor extractor;
-
+
extractor = new VisioTextExtractor(new FileInputStream(defFilename));
assertNotNull(extractor);
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
-
+
extractor = new VisioTextExtractor(
new POIFSFileSystem(
new FileInputStream(defFilename)
@@ -53,7 +54,7 @@
assertNotNull(extractor);
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
-
+
extractor = new VisioTextExtractor(
new HDGFDiagram(
new POIFSFileSystem(
@@ -65,53 +66,53 @@
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
}
-
+
public void testExtraction() throws Exception {
VisioTextExtractor extractor =
new VisioTextExtractor(new FileInputStream(defFilename));
-
+
// Check the array fetch
String[] text = extractor.getAllText();
assertNotNull(text);
assertEquals(3, text.length);
-
+
assertEquals("Test View\n", text[0]);
assertEquals("I am a test view\n", text[1]);
assertEquals("Some random text, on a page\n", text[2]);
-
+
// And the all-in fetch
String textS = extractor.getText();
assertEquals("Test View\nI am a test view\nSome random text, on a page\n", textS);
}
-
+
public void testProblemFiles() throws Exception {
File a = new File(dirname, "44594.vsd");
VisioTextExtractor.main(new String[] {a.toString()});
-
+
File b = new File(dirname, "44594-2.vsd");
VisioTextExtractor.main(new String[] {b.toString()});
-
+
File c = new File(dirname, "ShortChunk1.vsd");
VisioTextExtractor.main(new String[] {c.toString()});
-
+
File d = new File(dirname, "ShortChunk2.vsd");
VisioTextExtractor.main(new String[] {d.toString()});
-
+
File e = new File(dirname, "ShortChunk3.vsd");
VisioTextExtractor.main(new String[] {e.toString()});
}
-
+
public void testMain() throws Exception {
PrintStream oldOut = System.out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream capture = new PrintStream(baos);
System.setOut(capture);
-
+
VisioTextExtractor.main(new String[] {defFilename});
-
+
// Put things back
System.setOut(oldOut);
-
+
// Check
capture.flush();
String text = baos.toString();
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.pointers;
import junit.framework.TestCase;
@@ -21,14 +22,14 @@
/**
* Tests for the pointer factory, and the pointers themselves
*/
-public class TestPointerFactory extends TestCase {
+public final class TestPointerFactory extends TestCase {
// Type: 16 Addr: 0143aff4 Offset: 80 Len: 54 Format: 46 From: 8a94
private static byte[] vp6_a = new byte[] {
22, 0, 0, 0, -12, -81, 67, 1, -128, 0, 0, 0, 84, 0, 0, 0, 70, 0
};
// Type: 17 Addr: 014fd84c Offset: d4 Len: 20 Format: 54 From: 8a94
private static byte[] vp6_b = new byte[] {
- 23, 0, 0, 0, 76, -40, 79, 1, -44, 0, 0, 0, 32, 0, 0, 0, 84, 0
+ 23, 0, 0, 0, 76, -40, 79, 1, -44, 0, 0, 0, 32, 0, 0, 0, 84, 0
};
// Type: 17 Addr: 014fd8bc Offset: f8 Len: 20 Format: 54 From: 8a94
private static byte[] vp6_c = new byte[] {
@@ -38,7 +39,7 @@
private static byte[] vp6_d = new byte[] {
-1, 0, 0, 0, -84, -1, 79, 1, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0
};
-
+
public void testCreateV4() throws Exception {
PointerFactory pf = new PointerFactory(4);
try {
@@ -48,7 +49,7 @@
// As expected
}
}
-
+
public void testCreateV5() throws Exception {
PointerFactory pf = new PointerFactory(5);
try {
@@ -62,46 +63,46 @@
public void testCreateV6() throws Exception {
PointerFactory pf = new PointerFactory(6);
-
+
Pointer a = pf.createPointer(vp6_a, 0);
assertEquals(0x16, a.getType());
assertEquals(0x0143aff4, a.getAddress());
assertEquals(0x80, a.getOffset());
assertEquals(0x54, a.getLength());
assertEquals(0x46, a.getFormat());
-
+
assertTrue(a.destinationCompressed());
assertTrue(a.destinationHasStrings());
assertFalse(a.destinationHasChunks());
assertFalse(a.destinationHasPointers());
-
+
assertEquals(18, a.getSizeInBytes());
-
-
+
+
Pointer b = pf.createPointer(vp6_b, 0);
assertEquals(0x17, b.getType());
assertEquals(0x014fd84c, b.getAddress());
assertEquals(0xd4, b.getOffset());
assertEquals(0x20, b.getLength());
assertEquals(0x54, b.getFormat());
-
+
assertFalse(b.destinationCompressed());
assertFalse(b.destinationHasStrings());
assertFalse(b.destinationHasChunks());
assertTrue(b.destinationHasPointers());
-
+
Pointer c = pf.createPointer(vp6_c, 0);
assertEquals(0x17, c.getType());
assertEquals(0x014fd8bc, c.getAddress());
assertEquals(0xf8, c.getOffset());
assertEquals(0x20, c.getLength());
assertEquals(0x54, c.getFormat());
-
+
assertFalse(c.destinationCompressed());
assertFalse(c.destinationHasStrings());
assertFalse(c.destinationHasChunks());
assertTrue(c.destinationHasPointers());
-
+
// Type: ff Addr: 014fffac Offset: 0 Len: 0 Format: 60 From: 8a94
Pointer d = pf.createPointer(vp6_d, 0);
assertEquals(0xff, d.getType());
@@ -109,7 +110,7 @@
assertEquals(0x00, d.getOffset());
assertEquals(0x00, d.getLength());
assertEquals(0x60, d.getFormat());
-
+
assertFalse(d.destinationCompressed());
assertFalse(d.destinationHasStrings());
assertFalse(d.destinationHasChunks());
@@ -118,19 +119,19 @@
public void testCreateV6FromMid() throws Exception {
PointerFactory pf = new PointerFactory(11);
-
+
// Create a from part way down the byte stream
byte[] bytes = new byte[28];
System.arraycopy(vp6_b, 0, bytes, 0, 10);
System.arraycopy(vp6_a, 0, bytes, 10, 18);
-
+
Pointer a = pf.createPointer(bytes, 10);
assertEquals(0x16, a.getType());
assertEquals(0x0143aff4, a.getAddress());
assertEquals(0x80, a.getOffset());
assertEquals(0x54, a.getLength());
assertEquals(0x46, a.getFormat());
-
+
assertTrue(a.destinationCompressed());
assertTrue(a.destinationHasStrings());
assertFalse(a.destinationHasChunks());
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.streams;
import org.apache.poi.hdgf.pointers.Pointer;
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java Thu May 21 18:12:22 2009
@@ -14,72 +14,73 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.streams;
import org.apache.poi.hdgf.pointers.Pointer;
-public class TestStreamBasics extends StreamTest {
+public final class TestStreamBasics extends StreamTest {
/** The header from when compressedStream is decompressed */
public static final byte[] compressedStreamDCHeader = new byte[] {
-60, 2, 0, 0
};
public static final byte[] compressedStream = new byte[] {
- 123, -60, 2, -21, -16, 1, 0, 0, -72, -13, -16, 78, -32, -5, 1,
- 0, 3, -21, -16, 10, 5, 4, -21, -16, 21, 9, -21, -16, 103, -21,
- -16, 34, -36, -1, 52, 15, 70, 15, 120, 88, 15, -7, -2, -28, -9,
- -123, 21, 0, 44, -122, 1, -4, 104, 15, -24, -13, 40, -98, 32,
- 78, 102, -67, -1, -2, -30, 64, 40, -67, -113, -73, 116, -98,
- -85, 2, 66, 123, 9, 109, -85, 2, -89, 14, -56, -69, -83, -79,
- -34, -3, 120, 110, 75, -9, -10, 20, -6, -25, -12, 22, -21, -16,
- -12, -81, 67, 1, -128, -70, -21, -16, 84, -21, -16, 70, 0, 23,
- -21, -16, 76, 47, -40, 79, 1, -44, -21, -16, 32, 3, 18, 12, 17,
- -43, -68, 17, 16, -8, 21, 22, -1, -21, -16, -84, -1, -35, 79,
- -9, -10, 96, 0, 46, -21, -16, 44, -39, -41, 79, 1, 119, -13,
- -16, -106, -13, -16, 84, 0, 125, 26, -21, -16, 68, -38, 79, 1,
- 17, 10, 0, -97, 50, 10, 0, 0, -42, -108, 15, 118, 31, 0, -3, 29,
- -21, -16, -100, -25, 79, 1, -18, 97, -36, 76, 16, -21, -16, 86,
- 0, 36, -5, 1, -5, 79, 63, 1, -124, 98, 0, 0, 28, 3, 20, -34, -3,
- 125, 33, -21, -16, 100, -4, 79, 1, -92, -91, 16, -22, 24, 19, 41,
- -21, -16, -44, -59, 16, 108, 100, 0, -21, 0, 71, -105, 18, 39, 85,
- 17, -3, 79, 1, 95, -108, 113, 0, 0, 104, 3, 18, 49, 49, 17, -1, 64,
- 85, 1, 0, 114, 0, 0, -93, -36, -21, -16, 100, 31, 0, 0, -40, -21,
- -16, -92, 66, 127, 85, 1, 98, 119, 0, 0, -48, 79, 18, -3, 50, -17,
- 1, 67, 85, 1, 81, -127, 0, -41, 0, 14, 6, 4, 17, 63, -63, 17, 68,
- 85, -65, 1, 30, -120, 0, 0, 42, 79, 18, 68, 126, -21, -16, -76, 69,
+ 123, -60, 2, -21, -16, 1, 0, 0, -72, -13, -16, 78, -32, -5, 1,
+ 0, 3, -21, -16, 10, 5, 4, -21, -16, 21, 9, -21, -16, 103, -21,
+ -16, 34, -36, -1, 52, 15, 70, 15, 120, 88, 15, -7, -2, -28, -9,
+ -123, 21, 0, 44, -122, 1, -4, 104, 15, -24, -13, 40, -98, 32,
+ 78, 102, -67, -1, -2, -30, 64, 40, -67, -113, -73, 116, -98,
+ -85, 2, 66, 123, 9, 109, -85, 2, -89, 14, -56, -69, -83, -79,
+ -34, -3, 120, 110, 75, -9, -10, 20, -6, -25, -12, 22, -21, -16,
+ -12, -81, 67, 1, -128, -70, -21, -16, 84, -21, -16, 70, 0, 23,
+ -21, -16, 76, 47, -40, 79, 1, -44, -21, -16, 32, 3, 18, 12, 17,
+ -43, -68, 17, 16, -8, 21, 22, -1, -21, -16, -84, -1, -35, 79,
+ -9, -10, 96, 0, 46, -21, -16, 44, -39, -41, 79, 1, 119, -13,
+ -16, -106, -13, -16, 84, 0, 125, 26, -21, -16, 68, -38, 79, 1,
+ 17, 10, 0, -97, 50, 10, 0, 0, -42, -108, 15, 118, 31, 0, -3, 29,
+ -21, -16, -100, -25, 79, 1, -18, 97, -36, 76, 16, -21, -16, 86,
+ 0, 36, -5, 1, -5, 79, 63, 1, -124, 98, 0, 0, 28, 3, 20, -34, -3,
+ 125, 33, -21, -16, 100, -4, 79, 1, -92, -91, 16, -22, 24, 19, 41,
+ -21, -16, -44, -59, 16, 108, 100, 0, -21, 0, 71, -105, 18, 39, 85,
+ 17, -3, 79, 1, 95, -108, 113, 0, 0, 104, 3, 18, 49, 49, 17, -1, 64,
+ 85, 1, 0, 114, 0, 0, -93, -36, -21, -16, 100, 31, 0, 0, -40, -21,
+ -16, -92, 66, 127, 85, 1, 98, 119, 0, 0, -48, 79, 18, -3, 50, -17,
+ 1, 67, 85, 1, 81, -127, 0, -41, 0, 14, 6, 4, 17, 63, -63, 17, 68,
+ 85, -65, 1, 30, -120, 0, 0, 42, 79, 18, 68, 126, -21, -16, -76, 69,
85, 1, 102, -119, 72, 37, 0, 97, 33 };
public static final byte[] uncompressedStream = new byte[] {
- 0, 1, 0, 0, -72, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0,
- 0, 9, 0, 0, 0, 103, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -123, 21, 0, 44, -123, 21, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, -98, 32, 78, 102, -67,
- -2, -30, 64, 40, -67, -113, -73, 116, -67, -2, -30, 64, 40, 66,
- 123, 9, 109, -67, -2, -30, 64, 40, -98, 32, 78, 102, -67, -2, -30,
- 64, 40, -67, -113, -73, 116, -67, -2, -30, 64, -56, -83, -79, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 110, 75, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, -12, -81, 67,
- 1, -128, 0, 0, 0, 84, 0, 0, 0, 70, 0, 23, 0, 0, 0, 76, -40, 79, 1,
- -44, 0, 0, 0, 32, 0, 0, 0, 84, 0, 23, 0, 0, 0, -68, -40, 79, 1, -8,
- 0, 0, 0, 32, 0, 0, 0, 84, 0, -1, 0, 0, 0, -84, -1, 79, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 96, 0, 46, 0, 0, 0, 44, -39, 79, 1, 119, 1, 0, 0,
- -106, 1, 0, 0, 84, 0, 26, 0, 0, 0, 68, -38, 79, 1, 17, 3, 0, 0,
- 50, 10, 0, 0, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 29, 0, 0, 0, -100, -25, 79, 1, -18, 97, 0, 0, -106, 0, 0, 0, 86, 0,
- 36, 0, 0, 0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 0, 0, 0, 0, 0, 0,
+ -123, 21, 0, 44, -123, 21, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, -98, 32, 78, 102, -67,
+ -2, -30, 64, 40, -67, -113, -73, 116, -67, -2, -30, 64, 40, 66,
+ 123, 9, 109, -67, -2, -30, 64, 40, -98, 32, 78, 102, -67, -2, -30,
+ 64, 40, -67, -113, -73, 116, -67, -2, -30, 64, -56, -83, -79, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 110, 75, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, -12, -81, 67,
+ 1, -128, 0, 0, 0, 84, 0, 0, 0, 70, 0, 23, 0, 0, 0, 76, -40, 79, 1,
+ -44, 0, 0, 0, 32, 0, 0, 0, 84, 0, 23, 0, 0, 0, -68, -40, 79, 1, -8,
+ 0, 0, 0, 32, 0, 0, 0, 84, 0, -1, 0, 0, 0, -84, -1, 79, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 96, 0, 46, 0, 0, 0, 44, -39, 79, 1, 119, 1, 0, 0,
+ -106, 1, 0, 0, 84, 0, 26, 0, 0, 0, 68, -38, 79, 1, 17, 3, 0, 0,
+ 50, 10, 0, 0, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 29, 0, 0, 0, -100, -25, 79, 1, -18, 97, 0, 0, -106, 0, 0, 0, 86, 0,
+ 36, 0, 0, 0, -12, -5, 79, 1, -124, 98, 0, 0, 28, 0, 0, 0, 84, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 100,
+ -4, 79, 1, -92, 98, 0, 0, 32, 0, 0, 0, 84, 0, 41, 0, 0, 0, -44, -4,
+ 79, 1, 108, 100, 0, 0, 71, 0, 0, 0, 86, 0, 39, 0, 0, 0, 68, -3, 79,
+ 1, -108, 113, 0, 0, 104, 0, 0, 0, 84, 0, 49, 0, 0, 0, -84, 64, 85,
+ 1, 0, 114, 0, 0, -93, 0, 0, 0, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -40, 0, 0, 0, -92, 66, 85, 1, 98, 119,
+ 0, 0, -48, 1, 0, 0, 84, 0, 50, 0, 0, 0, 20, 67, 85, 1, 81, -127,
+ 0, 0, 14, 6, 0, 0, 84, 0, 63, 0, 0, 0, 100, 68, 85, 1, 30, -120,
+ 0, 0, 42, 1, 0, 0, 84, 0, 68, 0, 0, 0, -76, 69, 85, 1, 102, -119,
0, 0, 42, 1, 0, 0, 84, 0, 0, 0, 0, 0
};
@@ -88,31 +89,31 @@
Pointer ptr = new TestPointer(true, 0, compressedStream.length, -1, (short)-1);
// Now the stream
Stream stream = Stream.createStream(ptr, compressedStream, null, null);
-
+
// Check
assertNotNull(stream.getPointer());
assertNotNull(stream.getStore());
assertTrue(stream.getStore() instanceof StreamStore);
assertTrue(stream.getStore() instanceof CompressedStreamStore);
assertTrue(stream instanceof UnknownStream);
-
+
// Check the stream store
CompressedStreamStore ss = (CompressedStreamStore)stream.getStore();
assertEquals(4, ss._getBlockHeader().length);
assertEquals(compressedStream.length, ss._getCompressedContents().length);
assertEquals(uncompressedStream.length, ss.getContents().length);
-
+
for(int i=0; i<uncompressedStream.length; i++) {
assertEquals(uncompressedStream[i], ss.getContents()[i]);
}
}
-
+
public void testUncompressedStream() {
// Create a fake pointer
Pointer ptr = new TestPointer(false, 0, uncompressedStream.length, -1, (short)-1);
// Now the stream
Stream stream = Stream.createStream(ptr, uncompressedStream, null, null);
-
+
// Check
assertNotNull(stream.getPointer());
assertNotNull(stream.getStore());
@@ -120,4 +121,4 @@
assertFalse(stream.getStore() instanceof CompressedStreamStore);
assertTrue(stream instanceof UnknownStream);
}
-}
\ No newline at end of file
+}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.streams;
import java.io.FileInputStream;
@@ -28,7 +29,7 @@
/**
* Tests for bugs with streams
*/
-public class TestStreamBugs extends StreamTest {
+public final class TestStreamBugs extends StreamTest {
private byte[] contents;
private ChunkFactory chunkFactory;
private PointerFactory ptrFactory;
@@ -42,7 +43,7 @@
FileInputStream fin = new FileInputStream(filename);
filesystem = new POIFSFileSystem(fin);
-
+
DocumentEntry docProps =
(DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");
@@ -50,41 +51,41 @@
contents = new byte[docProps.getSize()];
filesystem.createDocumentInputStream("VisioDocument").read(contents);
}
-
+
public void testGetTrailer() throws Exception {
Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);
}
-
+
public void TOIMPLEMENTtestGetCertainChunks() throws Exception {
int offsetA = 3708;
int offsetB = 3744;
}
-
+
public void testGetChildren() throws Exception {
Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
TrailerStream trailer = (TrailerStream)
Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);
-
+
// Get without recursing
Pointer[] ptrs = trailer.getChildPointers();
for(int i=0; i<ptrs.length; i++) {
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
}
-
+
// Get with recursing into chunks
for(int i=0; i<ptrs.length; i++) {
- Stream stream =
+ Stream stream =
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
if(stream instanceof ChunkStream) {
ChunkStream cStream = (ChunkStream)stream;
cStream.findChunks();
}
}
-
+
// Get with recursing into chunks and pointers
for(int i=0; i<ptrs.length; i++) {
- Stream stream =
+ Stream stream =
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
if(stream instanceof PointerContainingStream) {
PointerContainingStream pStream =
@@ -92,7 +93,7 @@
pStream.findChildren(contents);
}
}
-
+
trailer.findChildren(contents);
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hdgf.streams;
import java.io.FileInputStream;
@@ -25,7 +26,7 @@
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-public class TestStreamComplex extends StreamTest {
+public final class TestStreamComplex extends StreamTest {
private byte[] contents;
private int trailerPointerAt = 0x24;
private int trailerDataAt = 0x8a94;
@@ -40,7 +41,7 @@
FileInputStream fin = new FileInputStream(filename);
POIFSFileSystem filesystem = new POIFSFileSystem(fin);
-
+
DocumentEntry docProps =
(DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");
@@ -55,71 +56,71 @@
public void testTrailer() {
// Find the trailer
Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
-
+
assertEquals(20, trailerPtr.getType());
assertEquals(trailerDataAt, trailerPtr.getOffset());
-
+
Stream stream = Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
assertTrue(stream instanceof TrailerStream);
TrailerStream ts = (TrailerStream)stream;
-
+
assertNotNull(ts.getChildPointers());
assertNull(ts.getPointedToStreams());
-
+
assertEquals(20, ts.getChildPointers().length);
assertEquals(0x16, ts.getChildPointers()[0].getType());
assertEquals(0x17, ts.getChildPointers()[1].getType());
assertEquals(0x17, ts.getChildPointers()[2].getType());
assertEquals(0xff, ts.getChildPointers()[3].getType());
}
-
+
public void testChunks() {
Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
TrailerStream ts = (TrailerStream)
Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
-
+
// Should be 7th one
Pointer chunkPtr = ts.getChildPointers()[5];
assertFalse(chunkPtr.destinationHasStrings());
assertTrue(chunkPtr.destinationHasChunks());
assertFalse(chunkPtr.destinationHasPointers());
-
+
Stream stream = Stream.createStream(chunkPtr, contents, chunkFactory, ptrFactory);
assertNotNull(stream);
assertTrue(stream instanceof ChunkStream);
-
+
// Now find the chunks within it
ChunkStream cs = (ChunkStream)stream;
cs.findChunks();
}
-
+
public void testStrings() {
Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
TrailerStream ts = (TrailerStream)
Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
-
+
// Should be the 1st one
Pointer stringPtr = ts.getChildPointers()[0];
assertTrue(stringPtr.destinationHasStrings());
assertFalse(stringPtr.destinationHasChunks());
assertFalse(stringPtr.destinationHasPointers());
-
+
Stream stream = Stream.createStream(stringPtr, contents, chunkFactory, ptrFactory);
assertNotNull(stream);
assertTrue(stream instanceof StringsStream);
}
-
+
public void testPointerToStrings() {
// The stream at 0x347f has strings
// The stream at 0x4312 has a pointer to 0x347f
// The stream at 0x44d3 has a pointer to 0x4312
// (it's the 2nd one of 3, and the block is compressed)
-
+
TestPointer ptr44d3 = new TestPointer(true, 0x44d3, 0x51, 0x4e, (short)0x56);
ptr44d3.hasPointers = true;
PointerContainingStream s44d3 = (PointerContainingStream)
Stream.createStream(ptr44d3, contents, chunkFactory, ptrFactory);
-
+
// Type: 0d Addr: 014ff644 Offset: 4312 Len: 48 Format: 54 From: 44d3
Pointer ptr4312 = s44d3.getChildPointers()[1];
assertEquals(0x0d, ptr4312.getType());
@@ -128,10 +129,10 @@
assertEquals(0x54, ptr4312.getFormat());
assertTrue(ptr4312.destinationHasPointers());
assertFalse(ptr4312.destinationHasStrings());
-
+
PointerContainingStream s4312 = (PointerContainingStream)
Stream.createStream(ptr4312, contents, chunkFactory, ptrFactory);
-
+
// Check it has 0x347f
// Type: 1f Addr: 01540004 Offset: 347f Len: 8e8 Format: 46 From: 4312
assertEquals(2, s4312.getChildPointers().length);
@@ -142,7 +143,7 @@
assertEquals(0x46, ptr347f.getFormat());
assertFalse(ptr347f.destinationHasPointers());
assertTrue(ptr347f.destinationHasStrings());
-
+
// Find the children of 0x4312
assertNull(s4312.getPointedToStreams());
s4312.findChildren(contents);
@@ -152,89 +153,89 @@
assertTrue(s4312.getPointedToStreams()[0] instanceof StringsStream);
assertTrue(s4312.getPointedToStreams()[1] instanceof StringsStream);
}
-
+
public void testTrailerContents() {
Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
TrailerStream ts = (TrailerStream)
Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
-
+
assertNotNull(ts.getChildPointers());
assertNull(ts.getPointedToStreams());
assertEquals(20, ts.getChildPointers().length);
-
+
ts.findChildren(contents);
-
+
assertNotNull(ts.getChildPointers());
assertNotNull(ts.getPointedToStreams());
assertEquals(20, ts.getChildPointers().length);
assertEquals(20, ts.getPointedToStreams().length);
-
+
// Step down:
// 8 -> 4 -> 5 -> 1 -> 0 == String
assertNotNull(ts.getPointedToStreams()[8]);
assertTrue(ts.getPointedToStreams()[8] instanceof PointerContainingStream);
-
- PointerContainingStream s8 =
+
+ PointerContainingStream s8 =
(PointerContainingStream)ts.getPointedToStreams()[8];
assertNotNull(s8.getPointedToStreams());
-
+
assertNotNull(s8.getPointedToStreams()[4]);
assertTrue(s8.getPointedToStreams()[4] instanceof PointerContainingStream);
-
- PointerContainingStream s84 =
+
+ PointerContainingStream s84 =
(PointerContainingStream)s8.getPointedToStreams()[4];
assertNotNull(s84.getPointedToStreams());
-
+
assertNotNull(s84.getPointedToStreams()[5]);
assertTrue(s84.getPointedToStreams()[5] instanceof PointerContainingStream);
-
- PointerContainingStream s845 =
+
+ PointerContainingStream s845 =
(PointerContainingStream)s84.getPointedToStreams()[5];
assertNotNull(s845.getPointedToStreams());
-
+
assertNotNull(s845.getPointedToStreams()[1]);
assertTrue(s845.getPointedToStreams()[1] instanceof PointerContainingStream);
-
- PointerContainingStream s8451 =
+
+ PointerContainingStream s8451 =
(PointerContainingStream)s845.getPointedToStreams()[1];
assertNotNull(s8451.getPointedToStreams());
-
+
assertNotNull(s8451.getPointedToStreams()[0]);
assertTrue(s8451.getPointedToStreams()[0] instanceof StringsStream);
assertTrue(s8451.getPointedToStreams()[1] instanceof StringsStream);
}
-
+
public void testChunkWithText() throws Exception {
// Parent ChunkStream is at 0x7194
// This is one of the last children of the trailer
Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
TrailerStream ts = (TrailerStream)
Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
-
+
ts.findChildren(contents);
-
+
assertNotNull(ts.getChildPointers());
assertNotNull(ts.getPointedToStreams());
assertEquals(20, ts.getChildPointers().length);
assertEquals(20, ts.getPointedToStreams().length);
-
+
assertEquals(0x7194, ts.getChildPointers()[13].getOffset());
assertEquals(0x7194, ts.getPointedToStreams()[13].getPointer().getOffset());
-
+
PointerContainingStream ps7194 = (PointerContainingStream)
ts.getPointedToStreams()[13];
-
+
// First child is at 0x64b3
assertEquals(0x64b3, ps7194.getChildPointers()[0].getOffset());
assertEquals(0x64b3, ps7194.getPointedToStreams()[0].getPointer().getOffset());
-
+
ChunkStream cs = (ChunkStream)ps7194.getPointedToStreams()[0];
-
+
// Should be 26bc bytes un-compressed
assertEquals(0x26bc, cs.getStore().getContents().length);
// And should have lots of children
assertEquals(131, cs.getChunks().length);
-
+
// One of which is Text
boolean hasText = false;
for(int i=0; i<cs.getChunks().length; i++) {
@@ -245,20 +246,20 @@
assertTrue(hasText);
// Which is the 72nd command
assertEquals("Text", cs.getChunks()[72].getName());
-
+
Chunk text = cs.getChunks()[72];
assertEquals("Text", text.getName());
-
+
// Which contains our text
assertEquals(1, text.getCommands().length);
assertEquals("Test View\n", text.getCommands()[0].getValue());
-
-
+
+
// Almost at the end is some more text
assertEquals("Text", cs.getChunks()[128].getName());
text = cs.getChunks()[128];
assertEquals("Text", text.getName());
-
+
assertEquals(1, text.getCommands().length);
assertEquals("Some random text, on a page\n", text.getCommands()[0].getValue());
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hpbf;
import java.io.File;
@@ -21,7 +22,7 @@
import junit.framework.TestCase;
-public class TestHPBFDocument extends TestCase {
+public final class TestHPBFDocument extends TestCase {
private String dir;
protected void setUp() throws Exception {
@@ -33,10 +34,10 @@
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
assertNotNull(doc);
}
-
+
public void testBits() throws Exception {
File f = new File(dir, "Sample.pub");
HPBFDocument doc = new HPBFDocument(
@@ -47,13 +48,13 @@
assertNotNull(doc.getQuillContents());
assertNotNull(doc.getEscherStm());
assertNotNull(doc.getEscherDelayStm());
-
+
assertTrue(doc.getMainContents().getData().length > 0);
assertTrue(doc.getQuillContents().getData().length > 0);
assertTrue(doc.getEscherStm().getData().length > 0);
assertTrue(doc.getEscherDelayStm().getData().length == 0);
}
-
+
// TODO
// public void testWrite() throws Exception {
// }
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hpbf.extractor;
import java.io.File;
@@ -23,7 +24,7 @@
import junit.framework.TestCase;
-public class TextPublisherTextExtractor extends TestCase {
+public final class TextPublisherTextExtractor extends TestCase {
private String dir;
protected void setUp() throws Exception {
@@ -36,27 +37,27 @@
new FileInputStream(f)
);
- PublisherTextExtractor ext =
+ PublisherTextExtractor ext =
new PublisherTextExtractor(doc);
ext.getText();
-
+
f = new File(dir, "Simple.pub");
ext = new PublisherTextExtractor(
new FileInputStream(f)
);
ext.getText();
}
-
+
public void testContents() throws Exception {
File f = new File(dir, "Sample.pub");
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
- PublisherTextExtractor ext =
+ PublisherTextExtractor ext =
new PublisherTextExtractor(doc);
String text = ext.getText();
-
+
assertEquals(
"This is some text on the first page\n" +
"It\u2019s in times new roman, font size 10, all normal\n" +
@@ -84,7 +85,7 @@
"Within doc to page 1\n"
, text
);
-
+
// Now a simpler one
f = new File(dir, "Simple.pub");
ext = new PublisherTextExtractor(
@@ -102,7 +103,7 @@
, text
);
}
-
+
/**
* We have the same file saved for Publisher 98, Publisher
* 2000 and Publisher 2007. Check they all agree.
@@ -111,30 +112,30 @@
public void testMultipleVersions() throws Exception {
File f;
HPBFDocument doc;
-
+
f = new File(dir, "Sample.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
String s2007 = (new PublisherTextExtractor(doc)).getText();
-
+
f = new File(dir, "Sample2000.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
String s2000 = (new PublisherTextExtractor(doc)).getText();
-
+
f = new File(dir, "Sample98.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
String s98 = (new PublisherTextExtractor(doc)).getText();
-
+
// Check they all agree
assertEquals(s2007, s2000);
assertEquals(s2007, s98);
}
-
+
/**
* Test that the hyperlink extraction stuff works as well
* as we can hope it to.
@@ -145,24 +146,24 @@
new FileInputStream(f)
);
- PublisherTextExtractor ext =
+ PublisherTextExtractor ext =
new PublisherTextExtractor(doc);
ext.getText();
-
+
// Default is no hyperlinks
assertEquals("1234567890LINK\n", ext.getText());
-
+
// Turn on
ext.setHyperlinksByDefault(true);
assertEquals("1234567890LINK\n<http://poi.apache.org/>\n", ext.getText());
-
-
+
+
// Now a much more complex document
f = new File(dir, "Sample.pub");
ext = new PublisherTextExtractor(new FileInputStream(f));
ext.setHyperlinksByDefault(true);
String text = ext.getText();
-
+
assertTrue(text.endsWith(
"<http://poi.apache.org/>\n" +
"<C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx>\n" +
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hpbf.model;
import java.io.File;
@@ -23,7 +24,7 @@
import junit.framework.TestCase;
-public class TestEscherParts extends TestCase {
+public final class TestEscherParts extends TestCase {
private String dir;
protected void setUp() throws Exception {
@@ -38,16 +39,16 @@
EscherStm es = doc.getEscherStm();
EscherDelayStm eds = doc.getEscherDelayStm();
-
+
assertNotNull(es);
assertNotNull(eds);
-
+
assertEquals(13, es.getEscherRecords().length);
assertEquals(0, eds.getEscherRecords().length);
-
+
// TODO - check the contents
}
-
+
public void testComplex() throws Exception {
File f = new File(dir, "SampleBrochure.pub");
HPBFDocument doc = new HPBFDocument(
@@ -56,16 +57,16 @@
EscherStm es = doc.getEscherStm();
EscherDelayStm eds = doc.getEscherDelayStm();
-
+
assertNotNull(es);
assertNotNull(eds);
-
+
assertEquals(30, es.getEscherRecords().length);
assertEquals(19, eds.getEscherRecords().length);
-
+
// TODO - check contents
-
-
+
+
// Now do another complex file
f = new File(dir, "SampleNewsletter.pub");
doc = new HPBFDocument(
@@ -74,10 +75,10 @@
es = doc.getEscherStm();
eds = doc.getEscherDelayStm();
-
+
assertNotNull(es);
assertNotNull(eds);
-
+
assertEquals(51, es.getEscherRecords().length);
assertEquals(92, eds.getEscherRecords().length);
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hpbf.model;
import java.io.File;
@@ -28,7 +29,7 @@
import junit.framework.TestCase;
-public class TestQuillContents extends TestCase {
+public final class TestQuillContents extends TestCase {
private String dir;
protected void setUp() throws Exception {
@@ -40,7 +41,7 @@
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
QuillContents qc = doc.getQuillContents();
assertEquals(20, qc.getBits().length);
for(int i=0; i<19; i++) {
@@ -48,88 +49,88 @@
}
// Last one is blank
assertNull(qc.getBits()[19]);
-
+
// Should be text, then three STSHs
assertEquals("TEXT", qc.getBits()[0].getThingType());
assertEquals("TEXT", qc.getBits()[0].getBitType());
assertEquals(0, qc.getBits()[0].getOptA());
-
+
assertEquals("STSH", qc.getBits()[1].getThingType());
assertEquals("STSH", qc.getBits()[1].getBitType());
assertEquals(0, qc.getBits()[1].getOptA());
-
+
assertEquals("STSH", qc.getBits()[2].getThingType());
assertEquals("STSH", qc.getBits()[2].getBitType());
assertEquals(1, qc.getBits()[2].getOptA());
-
+
assertEquals("STSH", qc.getBits()[3].getThingType());
assertEquals("STSH", qc.getBits()[3].getBitType());
assertEquals(2, qc.getBits()[3].getOptA());
}
-
+
public void testText() throws Exception {
File f = new File(dir, "Sample.pub");
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
QuillContents qc = doc.getQuillContents();
assertEquals(20, qc.getBits().length);
-
+
QCTextBit text = (QCTextBit)qc.getBits()[0];
String t = text.getText();
assertTrue(t.startsWith("This is some text on the first page"));
assertTrue(t.endsWith("Within doc to page 1\r"));
}
-
+
public void testPLC() throws Exception {
File f = new File(dir, "Simple.pub");
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
QuillContents qc = doc.getQuillContents();
assertEquals(20, qc.getBits().length);
-
+
assertTrue(qc.getBits()[9] instanceof Type4);
assertTrue(qc.getBits()[10] instanceof Type4);
assertTrue(qc.getBits()[12] instanceof Type8);
-
+
Type4 plc9 = (Type4)qc.getBits()[9];
Type4 plc10 = (Type4)qc.getBits()[10];
Type8 plc12 = (Type8)qc.getBits()[12];
-
-
+
+
assertEquals(1, plc9.getNumberOfPLCs());
assertEquals(4, plc9.getPreData().length);
assertEquals(1, plc9.getPlcValA().length);
assertEquals(1, plc9.getPlcValB().length);
-
+
assertEquals(0, plc9.getPreData()[0]);
assertEquals(0, plc9.getPreData()[1]);
assertEquals(0, plc9.getPreData()[2]);
assertEquals(0, plc9.getPreData()[3]);
assertEquals(0x356, plc9.getPlcValA()[0]);
assertEquals(0x600, plc9.getPlcValB()[0]);
-
-
+
+
assertEquals(1, plc10.getNumberOfPLCs());
assertEquals(4, plc10.getPreData().length);
assertEquals(1, plc10.getPlcValA().length);
assertEquals(1, plc10.getPlcValB().length);
-
+
assertEquals(0, plc10.getPreData()[0]);
assertEquals(0, plc10.getPreData()[1]);
assertEquals(0, plc10.getPreData()[2]);
assertEquals(0, plc10.getPreData()[3]);
assertEquals(0x356, plc10.getPlcValA()[0]);
assertEquals(0x800, plc10.getPlcValB()[0]);
-
+
assertEquals(2, plc12.getNumberOfPLCs());
assertEquals(7, plc12.getPreData().length);
assertEquals(2, plc12.getPlcValA().length);
assertEquals(2, plc12.getPlcValB().length);
-
+
assertEquals(0xff, plc12.getPreData()[0]);
assertEquals(0, plc12.getPreData()[1]);
assertEquals(0x3d, plc12.getPreData()[2]);
@@ -142,49 +143,49 @@
assertEquals(0x05, plc12.getPlcValA()[1]);
assertEquals(0x04, plc12.getPlcValB()[1]);
}
-
+
public void testComplexPLC() throws Exception {
File f = new File(dir, "Sample.pub");
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
QuillContents qc = doc.getQuillContents();
assertEquals(20, qc.getBits().length);
-
+
assertTrue(qc.getBits()[10] instanceof Type4);
assertTrue(qc.getBits()[11] instanceof Type4);
assertTrue(qc.getBits()[13] instanceof Type0);
assertTrue(qc.getBits()[14] instanceof Type12);
assertTrue(qc.getBits()[15] instanceof Type12);
assertTrue(qc.getBits()[16] instanceof Type8);
-
+
Type4 plc10 = (Type4)qc.getBits()[10];
Type4 plc11 = (Type4)qc.getBits()[11];
Type0 plc13 = (Type0)qc.getBits()[13];
Type12 plc14 = (Type12)qc.getBits()[14];
Type12 plc15 = (Type12)qc.getBits()[15];
Type8 plc16 = (Type8)qc.getBits()[16];
-
-
+
+
assertEquals(1, plc10.getNumberOfPLCs());
assertEquals(4, plc10.getPreData().length);
assertEquals(1, plc10.getPlcValA().length);
assertEquals(1, plc10.getPlcValB().length);
-
+
assertEquals(0, plc10.getPreData()[0]);
assertEquals(0, plc10.getPreData()[1]);
assertEquals(0, plc10.getPreData()[2]);
assertEquals(0, plc10.getPreData()[3]);
assertEquals(0x5d0, plc10.getPlcValA()[0]);
assertEquals(0x800, plc10.getPlcValB()[0]);
-
-
+
+
assertEquals(2, plc11.getNumberOfPLCs());
assertEquals(4, plc11.getPreData().length);
assertEquals(2, plc11.getPlcValA().length);
assertEquals(2, plc11.getPlcValB().length);
-
+
assertEquals(0, plc11.getPreData()[0]);
assertEquals(0, plc11.getPreData()[1]);
assertEquals(0, plc11.getPreData()[2]);
@@ -193,13 +194,13 @@
assertEquals(0x5d0, plc11.getPlcValB()[0]);
assertEquals(0xa00, plc11.getPlcValA()[1]);
assertEquals(0xc00, plc11.getPlcValB()[1]);
-
-
+
+
assertEquals(5, plc13.getNumberOfPLCs());
assertEquals(4, plc13.getPreData().length);
assertEquals(5, plc13.getPlcValA().length);
assertEquals(5, plc13.getPlcValB().length);
-
+
assertEquals(0xff00, plc13.getPreData()[0]);
assertEquals(0, plc13.getPreData()[1]);
assertEquals(0xf, plc13.getPreData()[2]);
@@ -214,16 +215,16 @@
assertEquals(0x00, plc13.getPlcValB()[3]);
assertEquals(0x50, plc13.getPlcValA()[4]);
assertEquals(0x00, plc13.getPlcValB()[4]);
-
-
+
+
// TODO - test the type 12s
-
-
+
+
assertEquals(6, plc16.getNumberOfPLCs());
assertEquals(7, plc16.getPreData().length);
assertEquals(6, plc16.getPlcValA().length);
assertEquals(6, plc16.getPlcValB().length);
-
+
assertEquals(0xff, plc16.getPreData()[0]);
assertEquals(0, plc16.getPreData()[1]);
assertEquals(0x56, plc16.getPreData()[2]);
@@ -244,127 +245,127 @@
assertEquals(0x000004, plc16.getPlcValA()[5]);
assertEquals(0x000004, plc16.getPlcValB()[5]);
}
-
+
public void testNoHyperlinks() throws Exception {
File f = new File(dir, "SampleNewsletter.pub");
HPBFDocument doc = new HPBFDocument(
new FileInputStream(f)
);
-
+
QuillContents qc = doc.getQuillContents();
assertEquals(20, qc.getBits().length);
-
+
Type12 plc18 = (Type12)qc.getBits()[18];
-
+
assertEquals(1, plc18.getNumberOfPLCs());
assertEquals(0, plc18.getNumberOfHyperlinks());
assertEquals(0, plc18.getTextStartAt(0));
assertEquals(601, plc18.getAllTextEndAt());
}
-
+
public void testSimpleHyperlink() throws Exception {
File f;
HPBFDocument doc;
QuillContents qc;
Type12 hlBit;
-
+
// Link at 10
f = new File(dir, "LinkAt10.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBit = (Type12)qc.getBits()[12];
assertEquals(1, hlBit.getNumberOfPLCs());
assertEquals(1, hlBit.getNumberOfHyperlinks());
-
+
assertEquals(10, hlBit.getTextStartAt(0));
assertEquals(15, hlBit.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));
-
+
// Longer link at 10
f = new File(dir, "LinkAt10Longer.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBit = (Type12)qc.getBits()[12];
assertEquals(1, hlBit.getNumberOfPLCs());
assertEquals(1, hlBit.getNumberOfHyperlinks());
-
+
assertEquals(10, hlBit.getTextStartAt(0));
assertEquals(15, hlBit.getAllTextEndAt());
assertEquals("http://poi.apache.org/hpbf/", hlBit.getHyperlink(0));
-
+
// Link at 20
f = new File(dir, "LinkAt20.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBit = (Type12)qc.getBits()[12];
assertEquals(1, hlBit.getNumberOfPLCs());
assertEquals(1, hlBit.getNumberOfHyperlinks());
-
+
assertEquals(20, hlBit.getTextStartAt(0));
assertEquals(25, hlBit.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));
}
-
+
public void testManyHyperlinks() throws Exception {
File f;
HPBFDocument doc;
QuillContents qc;
Type12 hlBit;
-
+
// Link at 10
f = new File(dir, "LinkAt10.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBit = (Type12)qc.getBits()[12];
assertEquals(1, hlBit.getNumberOfPLCs());
assertEquals(1, hlBit.getNumberOfHyperlinks());
-
+
assertEquals(10, hlBit.getTextStartAt(0));
assertEquals(15, hlBit.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));
-
+
}
-
+
public void testHyperlinkDifferentVersions() throws Exception {
File f;
HPBFDocument doc;
QuillContents qc;
Type12 hlBitA;
Type12 hlBitB;
-
+
// Latest version
f = new File(dir, "Sample.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBitA = (Type12)qc.getBits()[14];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());
-
+
assertEquals(25, hlBitA.getTextStartAt(0));
assertEquals(72, hlBitA.getTextStartAt(1));
assertEquals(87, hlBitA.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));
-
+
hlBitB = (Type12)qc.getBits()[15];
assertEquals(3, hlBitB.getNumberOfPLCs());
assertEquals(3, hlBitB.getNumberOfHyperlinks());
-
+
assertEquals(27, hlBitB.getTextStartAt(0));
assertEquals(37, hlBitB.getTextStartAt(1));
assertEquals(54, hlBitB.getTextStartAt(2));
@@ -372,28 +373,28 @@
assertEquals("", hlBitB.getHyperlink(0));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
-
+
// 2000 version
f = new File(dir, "Sample2000.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBitA = (Type12)qc.getBits()[13];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());
-
+
assertEquals(25, hlBitA.getTextStartAt(0));
assertEquals(72, hlBitA.getTextStartAt(1));
assertEquals(87, hlBitA.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));
-
+
hlBitB = (Type12)qc.getBits()[14];
assertEquals(3, hlBitB.getNumberOfPLCs());
assertEquals(3, hlBitB.getNumberOfHyperlinks());
-
+
assertEquals(27, hlBitB.getTextStartAt(0));
assertEquals(37, hlBitB.getTextStartAt(1));
assertEquals(54, hlBitB.getTextStartAt(2));
@@ -401,28 +402,28 @@
assertEquals("", hlBitB.getHyperlink(0));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
-
+
// 98 version
f = new File(dir, "Sample98.pub");
doc = new HPBFDocument(
new FileInputStream(f)
);
qc = doc.getQuillContents();
-
+
hlBitA = (Type12)qc.getBits()[13];
assertEquals(2, hlBitA.getNumberOfPLCs());
assertEquals(2, hlBitA.getNumberOfHyperlinks());
-
+
assertEquals(25, hlBitA.getTextStartAt(0));
assertEquals(72, hlBitA.getTextStartAt(1));
assertEquals(87, hlBitA.getAllTextEndAt());
assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));
-
+
hlBitB = (Type12)qc.getBits()[14];
assertEquals(3, hlBitB.getNumberOfPLCs());
assertEquals(3, hlBitB.getNumberOfHyperlinks());
-
+
assertEquals(27, hlBitB.getTextStartAt(0));
assertEquals(37, hlBitB.getTextStartAt(1));
assertEquals(54, hlBitB.getTextStartAt(2));
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf;
@@ -31,7 +28,7 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestEncryptedFile extends TestCase {
+public final class TestEncryptedFile extends TestCase {
// A non encrypted file
private String ss_ne;
// An encrypted file, with encrypted properties
@@ -40,23 +37,23 @@
private String ss_np_e;
// An encrypted file, with a 56 bit key
private String ss_56_e;
-
+
public TestEncryptedFile() throws Exception {
String dirname = System.getProperty("HSLF.testdata.path");
-
+
ss_ne = dirname + "/basic_test_ppt_file.ppt";
ss_e = dirname + "/Password_Protected-hello.ppt";
ss_np_e = dirname + "/Password_Protected-np-hello.ppt";
ss_56_e = dirname + "/Password_Protected-56-hello.ppt";
}
-
+
public void testLoadNonEncrypted() throws Exception {
HSLFSlideShow hss = new HSLFSlideShow(ss_ne);
-
+
assertNotNull(hss);
}
-
+
public void testLoadEncrypted() throws Exception {
try {
new HSLFSlideShow(ss_e);
@@ -64,14 +61,14 @@
} catch(EncryptedPowerPointFileException e) {
// Good
}
-
+
try {
new HSLFSlideShow(ss_np_e);
fail();
} catch(EncryptedPowerPointFileException e) {
// Good
}
-
+
try {
new HSLFSlideShow(ss_56_e);
fail();
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf;
@@ -33,7 +30,7 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestReWrite extends TestCase {
+public final class TestReWrite extends TestCase {
// HSLFSlideShow primed on the test data
private HSLFSlideShow hssA;
private HSLFSlideShow hssB;
@@ -45,17 +42,17 @@
public void setUp() throws Exception {
String dirname = System.getProperty("HSLF.testdata.path");
-
+
String filenameA = dirname + "/basic_test_ppt_file.ppt";
FileInputStream fisA = new FileInputStream(filenameA);
pfsA = new POIFSFileSystem(fisA);
hssA = new HSLFSlideShow(pfsA);
-
+
String filenameB = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
FileInputStream fisB = new FileInputStream(filenameB);
pfsB = new POIFSFileSystem(fisB);
hssB = new HSLFSlideShow(pfsB);
-
+
String filenameC = dirname + "/WithMacros.ppt";
FileInputStream fisC = new FileInputStream(filenameC);
pfsC = new POIFSFileSystem(fisC);
@@ -92,27 +89,27 @@
assertEquals(_oData[i], _nData[i]);
}
}
-
+
public void testWithMacroStreams() throws Exception {
// Check that they're apparently the same
assertSlideShowWritesOutTheSame(hssC, pfsC);
-
+
// Currently has a Macros stream
assertNotNull( pfsC.getRoot().getEntry("Macros") );
-
+
// Write out normally, will loose the macro stream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
hssC.write(baos);
POIFSFileSystem pfsNew = new POIFSFileSystem(
new ByteArrayInputStream(baos.toByteArray()) );
-
+
try {
pfsNew.getRoot().getEntry("Macros");
fail();
} catch(FileNotFoundException e) {
// Good, as expected
}
-
+
// But if we write out with nodes preserved, will be there
baos = new ByteArrayOutputStream();
hssC.write(baos, true);
@@ -123,11 +120,11 @@
/**
* Ensure that simply opening a slideshow (usermodel) view of it
- * doesn't change things
+ * doesn't change things
*/
public void testSlideShowWritesOutTheSame() throws Exception {
assertSlideShowWritesOutTheSame(hssA, pfsA);
-
+
// Some bug in StyleTextPropAtom rewriting means this will fail
// We need to identify and fix that first
//assertSlideShowWritesOutTheSame(hssB, pfsB);
@@ -137,7 +134,7 @@
SlideShow ss = new SlideShow(hss);
ss.getSlides();
ss.getNotes();
-
+
// Now write out to a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
hss.write(baos);
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf;
@@ -33,7 +30,7 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestReWriteSanity extends TestCase {
+public final class TestReWriteSanity extends TestCase {
// HSLFSlideShow primed on the test data
private HSLFSlideShow ss;
// POIFS primed on the test data
@@ -58,7 +55,7 @@
// Create a new one from that
HSLFSlideShow wss = new HSLFSlideShow(bais);
- // Find the location of the PersistPtrIncrementalBlocks and
+ // Find the location of the PersistPtrIncrementalBlocks and
// UserEditAtoms
Record[] r = wss.getRecords();
Hashtable pp = new Hashtable();
@@ -75,7 +72,7 @@
ue.put(new Integer(pos), r[i]);
lastUEPos = pos;
}
-
+
ByteArrayOutputStream bc = new ByteArrayOutputStream();
r[i].writeOut(bc);
pos += bc.size();
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf;
@@ -30,7 +27,7 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestRecordCounts extends TestCase {
+public final class TestRecordCounts extends TestCase {
// HSLFSlideShow primed on the test data
private HSLFSlideShow ss;
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
-
package org.apache.poi.hslf.extractor;
@@ -29,7 +26,7 @@
*
* @author Nick Burch (nick at torchbox dot com)
*/
-public class TestCruddyExtractor extends TestCase {
+public final class TestCruddyExtractor extends TestCase {
// Extractor primed on the test data
private QuickButCruddyTextExtractor te;
// All the text to be found in the file
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java Thu May 21 18:12:22 2009
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.hslf.model;
import junit.framework.TestCase;
@@ -26,10 +27,10 @@
/**
* Test <code>Fill</code> object.
- *
+ *
* @author Yegor Kozlov
*/
-public class TestBackground extends TestCase {
+public final class TestBackground extends TestCase {
/**
* Default background for slide, shape and slide master.
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java Thu May 21 18:12:22 2009
@@ -1,80 +1,81 @@
-/* ====================================================================
- 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.hslf.model;
-
-import junit.framework.TestCase;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.HSLFSlideShow;
-
-import java.awt.*;
-import java.awt.Rectangle;
-import java.awt.geom.*;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * Test Freeform object.
- * The Freeform shape is constructed from java.awt.GeneralPath.
- * Check that the get/set path accessors are consistent.
- * (TODO: verification of Bezier curves is more difficult due to rounding error. Figure out a test approach for that)
- *
- * @author Yegor Kozlov
- */
-public class TestFreeform extends TestCase {
-
- public void testClosedPath() throws Exception {
-
- GeneralPath path1 = new GeneralPath();
- path1.moveTo(100, 100);
- path1.lineTo(200, 100);
- path1.lineTo(200, 200);
- path1.lineTo(100, 200);
- path1.closePath();
-
- Freeform p = new Freeform();
- p.setPath(path1);
-
- java.awt.Shape path2 = p.getOutline();
- assertTrue(new Area(path1).equals(new Area(path2)));
- }
-
- public void testLine() throws Exception {
-
- GeneralPath path1 = new GeneralPath(new Line2D.Double(100, 100, 200, 100));
-
- Freeform p = new Freeform();
- p.setPath(path1);
-
- java.awt.Shape path2 = p.getOutline();
- assertTrue(new Area(path1).equals(new Area(path2)));
- }
-
- public void testRectangle() throws Exception {
-
- GeneralPath path1 = new GeneralPath(new Rectangle2D.Double(100, 100, 200, 50));
-
- Freeform p = new Freeform();
- p.setPath(path1);
-
- java.awt.Shape path2 = p.getOutline();
- assertTrue(new Area(path1).equals(new Area(path2)));
- }
-}
+/* ====================================================================
+ 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.hslf.model;
+
+import junit.framework.TestCase;
+import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.RichTextRun;
+import org.apache.poi.hslf.HSLFSlideShow;
+
+import java.awt.*;
+import java.awt.Rectangle;
+import java.awt.geom.*;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * Test Freeform object.
+ * The Freeform shape is constructed from java.awt.GeneralPath.
+ * Check that the get/set path accessors are consistent.
+ * (TODO: verification of Bezier curves is more difficult due to rounding error. Figure out a test approach for that)
+ *
+ * @author Yegor Kozlov
+ */
+public final class TestFreeform extends TestCase {
+
+ public void testClosedPath() throws Exception {
+
+ GeneralPath path1 = new GeneralPath();
+ path1.moveTo(100, 100);
+ path1.lineTo(200, 100);
+ path1.lineTo(200, 200);
+ path1.lineTo(100, 200);
+ path1.closePath();
+
+ Freeform p = new Freeform();
+ p.setPath(path1);
+
+ java.awt.Shape path2 = p.getOutline();
+ assertTrue(new Area(path1).equals(new Area(path2)));
+ }
+
+ public void testLine() throws Exception {
+
+ GeneralPath path1 = new GeneralPath(new Line2D.Double(100, 100, 200, 100));
+
+ Freeform p = new Freeform();
+ p.setPath(path1);
+
+ java.awt.Shape path2 = p.getOutline();
+ assertTrue(new Area(path1).equals(new Area(path2)));
+ }
+
+ public void testRectangle() throws Exception {
+
+ GeneralPath path1 = new GeneralPath(new Rectangle2D.Double(100, 100, 200, 50));
+
+ Freeform p = new Freeform();
+ p.setPath(path1);
+
+ java.awt.Shape path2 = p.getOutline();
+ assertTrue(new Area(path1).equals(new Area(path2)));
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org