Browse Source

upgrade to junit4

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765740 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_16_BETA1
Javen O'Neal 7 years ago
parent
commit
9ce29b30fd
1 changed files with 29 additions and 12 deletions
  1. 29
    12
      src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java

+ 29
- 12
src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java View File

package org.apache.poi.hslf; package org.apache.poi.hslf;




import junit.framework.TestCase;
import static org.apache.poi.POITestCase.assertContains;
import static org.junit.Assert.assertEquals;


import java.io.*;
import java.util.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Map;


import org.apache.poi.hslf.record.*;
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.POIDataSamples; import org.apache.poi.POIDataSamples;
import org.apache.poi.hslf.record.CurrentUserAtom;
import org.apache.poi.hslf.record.PersistPtrHolder;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.UserEditAtom;
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


/** /**
* Tests that HSLFSlideShow writes the powerpoint bit of data back out * Tests that HSLFSlideShow writes the powerpoint bit of data back out
* *
* @author Nick Burch (nick at torchbox dot com) * @author Nick Burch (nick at torchbox dot com)
*/ */
public final class TestReWriteSanity extends TestCase {
public final class TestReWriteSanity {
// HSLFSlideShow primed on the test data // HSLFSlideShow primed on the test data
private final HSLFSlideShowImpl ss;
private HSLFSlideShowImpl ss;
// POIFS primed on the test data // POIFS primed on the test data
private final POIFSFileSystem pfs;
private POIFSFileSystem pfs;


public TestReWriteSanity() throws Exception {
@Before
public void setUp() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance(); POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt")); pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
ss = new HSLFSlideShowImpl(pfs); ss = new HSLFSlideShowImpl(pfs);
} }
@After
public void tearDown() throws Exception {
pfs.close();
ss.close();
}


@Test
public void testUserEditAtomsRight() throws Exception { public void testUserEditAtomsRight() throws Exception {
// Write out to a byte array // Write out to a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
int luPos = uea.getLastUserEditAtomOffset(); int luPos = uea.getLastUserEditAtomOffset();
int ppPos = uea.getPersistPointersOffset(); int ppPos = uea.getPersistPointersOffset();


assertTrue(pp.containsKey(Integer.valueOf(ppPos)));
assertTrue(ue.containsKey(Integer.valueOf(luPos)));
assertContains(ue, Integer.valueOf(luPos));
assertContains(pp, Integer.valueOf(ppPos));
} }
} }



Loading…
Cancel
Save