diff options
author | Javen O'Neal <onealj@apache.org> | 2016-10-20 02:24:50 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-10-20 02:24:50 +0000 |
commit | 5232c0e1a6b51e51ebb8eee77e3db5b054423e53 (patch) | |
tree | b9a49e4d66012da6eab42a1bc53cac05769798e4 /src/scratchpad | |
parent | 9ce29b30fde0d31dc60b24a0c8f6cd7daacc2729 (diff) | |
download | poi-5232c0e1a6b51e51ebb8eee77e3db5b054423e53.tar.gz poi-5232c0e1a6b51e51ebb8eee77e3db5b054423e53.zip |
whitespace
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765741 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java b/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java index 6c7262a231..f6d18a9816 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java @@ -44,76 +44,76 @@ import org.junit.Test; * @author Nick Burch (nick at torchbox dot com) */ public final class TestReWriteSanity { - // HSLFSlideShow primed on the test data - private HSLFSlideShowImpl ss; - // POIFS primed on the test data - private POIFSFileSystem pfs; + // HSLFSlideShow primed on the test data + private HSLFSlideShowImpl ss; + // POIFS primed on the test data + private POIFSFileSystem pfs; - @Before + @Before public void setUp() throws Exception { POIDataSamples slTests = POIDataSamples.getSlideShowInstance(); - pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt")); - ss = new HSLFSlideShowImpl(pfs); + pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt")); + ss = new HSLFSlideShowImpl(pfs); + } + + @After + public void tearDown() throws Exception { + pfs.close(); + ss.close(); } - - @After - public void tearDown() throws Exception { - pfs.close(); - ss.close(); - } @Test - public void testUserEditAtomsRight() throws Exception { - // Write out to a byte array - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ss.write(baos); - - // Build an input stream of it - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - - // Create a new one from that - HSLFSlideShowImpl wss = new HSLFSlideShowImpl(bais); - - // Find the location of the PersistPtrIncrementalBlocks and - // UserEditAtoms - Record[] r = wss.getRecords(); - Map<Integer,Record> pp = new HashMap<Integer,Record>(); - Map<Integer,Object> ue = new HashMap<Integer,Object>(); - ue.put(Integer.valueOf(0),Integer.valueOf(0)); // Will show 0 if first - int pos = 0; - int lastUEPos = -1; - - for (final Record rec : r) { - if(rec instanceof PersistPtrHolder) { - pp.put(Integer.valueOf(pos), rec); - } - if(rec instanceof UserEditAtom) { - ue.put(Integer.valueOf(pos), rec); - lastUEPos = pos; - } - - ByteArrayOutputStream bc = new ByteArrayOutputStream(); - rec.writeOut(bc); - pos += bc.size(); - } - - // Check that the UserEditAtom's point to right stuff - for (final Record rec : r) { - if(rec instanceof UserEditAtom) { - UserEditAtom uea = (UserEditAtom)rec; - int luPos = uea.getLastUserEditAtomOffset(); - int ppPos = uea.getPersistPointersOffset(); - - assertContains(ue, Integer.valueOf(luPos)); - assertContains(pp, Integer.valueOf(ppPos)); - } - } - - // Check that the CurrentUserAtom points to the right UserEditAtom - CurrentUserAtom cua = wss.getCurrentUserAtom(); - int listedUEPos = (int)cua.getCurrentEditOffset(); - assertEquals(lastUEPos,listedUEPos); - - wss.close(); - } + public void testUserEditAtomsRight() throws Exception { + // Write out to a byte array + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ss.write(baos); + + // Build an input stream of it + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + + // Create a new one from that + HSLFSlideShowImpl wss = new HSLFSlideShowImpl(bais); + + // Find the location of the PersistPtrIncrementalBlocks and + // UserEditAtoms + Record[] r = wss.getRecords(); + Map<Integer,Record> pp = new HashMap<Integer,Record>(); + Map<Integer,Object> ue = new HashMap<Integer,Object>(); + ue.put(Integer.valueOf(0),Integer.valueOf(0)); // Will show 0 if first + int pos = 0; + int lastUEPos = -1; + + for (final Record rec : r) { + if(rec instanceof PersistPtrHolder) { + pp.put(Integer.valueOf(pos), rec); + } + if(rec instanceof UserEditAtom) { + ue.put(Integer.valueOf(pos), rec); + lastUEPos = pos; + } + + ByteArrayOutputStream bc = new ByteArrayOutputStream(); + rec.writeOut(bc); + pos += bc.size(); + } + + // Check that the UserEditAtom's point to right stuff + for (final Record rec : r) { + if(rec instanceof UserEditAtom) { + UserEditAtom uea = (UserEditAtom)rec; + int luPos = uea.getLastUserEditAtomOffset(); + int ppPos = uea.getPersistPointersOffset(); + + assertContains(ue, Integer.valueOf(luPos)); + assertContains(pp, Integer.valueOf(ppPos)); + } + } + + // Check that the CurrentUserAtom points to the right UserEditAtom + CurrentUserAtom cua = wss.getCurrentUserAtom(); + int listedUEPos = (int)cua.getCurrentEditOffset(); + assertEquals(lastUEPos,listedUEPos); + + wss.close(); + } } |