mirror of https://github.com/apache/poi.git
upgrade to junit4
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db63b9cf69
commit
9ce29b30fd
|
@ -18,15 +18,24 @@
|
||||||
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.io.ByteArrayInputStream;
|
||||||
import java.util.*;
|
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
|
||||||
|
@ -34,18 +43,26 @@ import org.apache.poi.POIDataSamples;
|
||||||
*
|
*
|
||||||
* @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();
|
||||||
|
@ -87,8 +104,8 @@ public final class TestReWriteSanity extends TestCase {
|
||||||
int luPos = uea.getLastUserEditAtomOffset();
|
int luPos = uea.getLastUserEditAtomOffset();
|
||||||
int ppPos = uea.getPersistPointersOffset();
|
int ppPos = uea.getPersistPointersOffset();
|
||||||
|
|
||||||
assertTrue(pp.containsKey(Integer.valueOf(ppPos)));
|
assertContains(ue, Integer.valueOf(luPos));
|
||||||
assertTrue(ue.containsKey(Integer.valueOf(luPos)));
|
assertContains(pp, Integer.valueOf(ppPos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue