mirror of https://github.com/apache/poi.git
Sonar fixes
JUnit5 test classes and methods should have default package visibility git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a4ed4359cc
commit
b4133f5e23
|
@ -37,11 +37,11 @@ public final class TestHDGFCore {
|
|||
private VisioTextExtractor textExtractor;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd"));
|
||||
}
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
if (textExtractor != null) textExtractor.close();
|
||||
if (hdgf != null) hdgf.close();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public final class TestHDGFCore {
|
|||
* chunk commands.
|
||||
*/
|
||||
@Test
|
||||
public void DISABLEDtestAIOOB() throws Exception {
|
||||
void DISABLEDtestAIOOB() throws Exception {
|
||||
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("44501.vsd"));
|
||||
|
||||
hdgf = new HDGFDiagram(fs);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class TestVSDDumper {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void main() throws Exception {
|
||||
void main() throws Exception {
|
||||
File file = POIDataSamples.getDiagramInstance().getFile("Test_Visio-Some_Random_Text.vsd");
|
||||
VSDDumper.main(new String[] { file.getAbsolutePath() });
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class TestStreamBugs extends StreamTest {
|
|||
private POIFSFileSystem filesystem;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
ptrFactory = new PointerFactory(11);
|
||||
chunkFactory = new ChunkFactory(11);
|
||||
|
||||
|
@ -61,7 +61,7 @@ public final class TestStreamBugs extends StreamTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void TOIMPLEMENTtestGetCertainChunks() {
|
||||
void TOIMPLEMENTtestGetCertainChunks() {
|
||||
int offsetA = 3708;
|
||||
int offsetB = 3744;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class TestStreamComplex extends StreamTest {
|
|||
private PointerFactory ptrFactory;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
ptrFactory = new PointerFactory(11);
|
||||
chunkFactory = new ChunkFactory(11);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TestHemfPicture {
|
|||
/*
|
||||
@Test
|
||||
@Disabled("Only for manual tests")
|
||||
public void paintSingle() throws Exception {
|
||||
void paintSingle() throws Exception {
|
||||
File fileIn = new File("tmp/emfs/govdocs1/844/844795.ppt_2.emf");
|
||||
|
||||
String[] args = {
|
||||
|
@ -83,7 +83,7 @@ public class TestHemfPicture {
|
|||
/*
|
||||
@Test
|
||||
@Disabled("Only for manual tests - need to add org.tukaani:xz:1.8 for this to work")
|
||||
public void paintMultiple() throws Exception {
|
||||
void paintMultiple() throws Exception {
|
||||
Pattern fileExt = Pattern.compile("(?i)^(.+/)*(.+)\\.(emf|wmf)$");
|
||||
final byte[] buf = new byte[50_000_000];
|
||||
try (SevenZFile sevenZFile = new SevenZFile(new File("tmp/plus_emf.7z"))
|
||||
|
@ -295,7 +295,7 @@ public class TestHemfPicture {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void nestedWmfEmf() throws Exception {
|
||||
void nestedWmfEmf() throws Exception {
|
||||
try (InputStream is = sl_samples.openResourceAsStream("nested_wmf.emf")) {
|
||||
HemfPicture emf1 = new HemfPicture(is);
|
||||
List<HwmfEmbedded> embeds = new ArrayList<>();
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug63955() throws IOException {
|
||||
void bug63955() throws IOException {
|
||||
HMEFMessage tnefDat = openSample("bug63955-winmail.dat");
|
||||
List<MAPIAttribute> atts = tnefDat.getMessageMAPIAttributes();
|
||||
assertEquals(96, atts.size());
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class TestMAPIAttributes {
|
|||
private HMEFMessage quick;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
try (InputStream stream = _samples.openResourceAsStream("quick-winmail.dat")) {
|
||||
quick = new HMEFMessage(stream);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public final class TestTNEFAttributes {
|
|||
private HMEFMessage quick;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
try (InputStream is = _samples.openResourceAsStream("quick-winmail.dat")) {
|
||||
quick = new HMEFMessage(is);
|
||||
}
|
||||
|
|
|
@ -32,18 +32,18 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
public class TestHMEFDumper {
|
||||
@Test
|
||||
public void noArguments() {
|
||||
void noArguments() {
|
||||
assertThrows(IllegalArgumentException.class, TestHMEFDumper::doMain);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void main() throws Exception {
|
||||
void main() throws Exception {
|
||||
File file = POIDataSamples.getHMEFInstance().getFile("quick-winmail.dat");
|
||||
doMain(file.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mainFull() throws Exception {
|
||||
void mainFull() throws Exception {
|
||||
File file = POIDataSamples.getHMEFInstance().getFile("quick-winmail.dat");
|
||||
doMain("--full", file.getAbsolutePath());
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class TestPOIDocumentScratchpad {
|
|||
* a Word Document for our testing
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
doc = new HSLFSlideShowImpl(POIDataSamples.getSlideShowInstance().openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
doc2 = HWPFTestDataSamples.openSampleFile("test2.doc");
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public final class TestReWrite {
|
|||
private POIFSFileSystem pfsC;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
|
||||
|
@ -73,7 +73,7 @@ public final class TestReWrite {
|
|||
assertWritesOutTheSame(hssB, pfsB);
|
||||
}
|
||||
|
||||
public void assertWritesOutTheSame(HSLFSlideShowImpl hss, POIFSFileSystem pfs) throws Exception {
|
||||
void assertWritesOutTheSame(HSLFSlideShowImpl hss, POIFSFileSystem pfs) throws Exception {
|
||||
// Write out to a byte array, and to a temp file
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
hss.write(baos);
|
||||
|
@ -156,7 +156,7 @@ public final class TestReWrite {
|
|||
//assertSlideShowWritesOutTheSame(hssB, pfsB);
|
||||
}
|
||||
|
||||
public void assertSlideShowWritesOutTheSame(HSLFSlideShowImpl hss, POIFSFileSystem pfs) throws IOException {
|
||||
void assertSlideShowWritesOutTheSame(HSLFSlideShowImpl hss, POIFSFileSystem pfs) throws IOException {
|
||||
// Create a slideshow covering it
|
||||
@SuppressWarnings("resource")
|
||||
HSLFSlideShow ss = new HSLFSlideShow(hss);
|
||||
|
|
|
@ -50,14 +50,14 @@ public final class TestReWriteSanity {
|
|||
private POIFSFileSystem pfs;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShowImpl(pfs);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
pfs.close();
|
||||
ss.close();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class TestRecordCounts {
|
|||
private HSLFSlideShowImpl ss;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
void setup() throws Exception {
|
||||
ss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public abstract class BasePPTIteratingTest {
|
|||
private final PrintStream save = System.out;
|
||||
|
||||
@BeforeEach
|
||||
public void setUpBase() throws UnsupportedEncodingException {
|
||||
void setUpBase() throws UnsupportedEncodingException {
|
||||
// set a higher max allocation limit as some test-files require more
|
||||
IOUtils.setByteArrayMaxOverride(5*1024*1024);
|
||||
|
||||
|
@ -84,7 +84,7 @@ public abstract class BasePPTIteratingTest {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDownBase() {
|
||||
void tearDownBase() {
|
||||
System.setOut(save);
|
||||
|
||||
// reset
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class TestCruddyExtractor {
|
|||
};
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
void setup() throws Exception {
|
||||
te = new QuickButCruddyTextExtractor(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.zaxxer.sparsebits.SparseBitSet;
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.hslf.usermodel.HSLFObjectShape;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||
|
@ -470,16 +470,33 @@ public final class TestExtractor {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void glyphCounting() throws IOException {
|
||||
void glyphCounting() throws IOException {
|
||||
String[] expected = {
|
||||
"Times New Roman", "\t\n ,-./01234679:ABDEFGILMNOPRSTVWabcdefghijklmnoprstuvwxyz\u00F3\u201C\u201D",
|
||||
"Arial", " Lacdilnost"
|
||||
};
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
try (SlideShowExtractor<?,?> ppt = openExtractor("45543.ppt")) {
|
||||
for (int i=0; i<expected.length; i+=2) {
|
||||
BitSet l = ppt.getCodepoints(expected[i], null, null);
|
||||
String s = l.stream().mapToObj(Character::toChars).map(String::valueOf).collect(Collectors.joining());
|
||||
assertEquals(expected[i+1], s);
|
||||
final String font = expected[i];
|
||||
final String cps = expected[i+1];
|
||||
|
||||
sb.setLength(0);
|
||||
|
||||
BitSet l1 = ppt.getCodepoints(font, null, null);
|
||||
l1.stream().mapToObj(Character::toChars).forEach(sb::append);
|
||||
assertEquals(cps, sb.toString());
|
||||
|
||||
sb.setLength(0);
|
||||
|
||||
SparseBitSet l2 = ppt.getCodepointsInSparseBitSet(font, null, null);
|
||||
int cp = 0;
|
||||
while ((cp = l2.nextSetBit(cp+1)) != -1) {
|
||||
sb.append(Character.toChars(cp));
|
||||
}
|
||||
assertEquals(cps, sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ public final class TestHeadersFooters
|
|||
ppt1.close();
|
||||
}
|
||||
@Test
|
||||
public void bug58144a() throws IOException {
|
||||
void bug58144a() throws IOException {
|
||||
try (InputStream is = _slTests.openResourceAsStream("bug58144-headers-footers-2003.ppt");
|
||||
SlideShow<?,?> ppt = new HSLFSlideShow(is)) {
|
||||
HSLFSlide sl = (HSLFSlide) ppt.getSlides().get(0);
|
||||
|
@ -249,7 +249,7 @@ public final class TestHeadersFooters
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug58144b() throws IOException {
|
||||
void bug58144b() throws IOException {
|
||||
try (InputStream is = _slTests.openResourceAsStream("bug58144-headers-footers-2007.ppt");
|
||||
SlideShow<?,?> ppt = new HSLFSlideShow(is)) {
|
||||
Slide<?, ?> sl = ppt.getSlides().get(0);
|
||||
|
|
|
@ -95,7 +95,7 @@ public final class TestHyperlink {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug47291() throws IOException {
|
||||
void bug47291() throws IOException {
|
||||
HSLFSlideShow ppt1 = new HSLFSlideShow();
|
||||
HSLFSlide slide1 = ppt1.createSlide();
|
||||
HSLFTextRun r1 = slide1.createTextBox().setText("page1");
|
||||
|
|
|
@ -69,7 +69,7 @@ public final class TestShapes {
|
|||
private HSLFSlideShow pptB;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
try (InputStream is1 = _slTests.openResourceAsStream("empty.ppt");
|
||||
InputStream is2 = _slTests.openResourceAsStream("empty_textbox.ppt")) {
|
||||
ppt = new HSLFSlideShow(is1);
|
||||
|
@ -78,7 +78,7 @@ public final class TestShapes {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void graphics() throws IOException {
|
||||
void graphics() throws IOException {
|
||||
HSLFSlide slide = ppt.createSlide();
|
||||
|
||||
HSLFLine line = new HSLFLine();
|
||||
|
@ -124,7 +124,7 @@ public final class TestShapes {
|
|||
* Verify that we can read TextBox shapes
|
||||
*/
|
||||
@Test
|
||||
public void textBoxRead() throws IOException {
|
||||
void textBoxRead() throws IOException {
|
||||
ppt = new HSLFSlideShow(_slTests.openResourceAsStream("with_textbox.ppt"));
|
||||
HSLFSlide sl = ppt.getSlides().get(0);
|
||||
for (HSLFShape sh : sl.getShapes()) {
|
||||
|
@ -211,7 +211,7 @@ public final class TestShapes {
|
|||
* and set some of the style attributes
|
||||
*/
|
||||
@Test
|
||||
public void textBoxWriteBytes() throws IOException {
|
||||
void textBoxWriteBytes() throws IOException {
|
||||
ppt = new HSLFSlideShow();
|
||||
HSLFSlide sl = ppt.createSlide();
|
||||
HSLFTextRun rt;
|
||||
|
@ -269,7 +269,7 @@ public final class TestShapes {
|
|||
* Test with an empty text box
|
||||
*/
|
||||
@Test
|
||||
public void emptyTextBox() {
|
||||
void emptyTextBox() {
|
||||
assertEquals(2, pptB.getSlides().size());
|
||||
HSLFSlide s1 = pptB.getSlides().get(0);
|
||||
HSLFSlide s2 = pptB.getSlides().get(1);
|
||||
|
@ -284,7 +284,7 @@ public final class TestShapes {
|
|||
* it must be the same as returned by Slide.getTextRuns().
|
||||
*/
|
||||
@Test
|
||||
public void textBoxSet() throws IOException {
|
||||
void textBoxSet() throws IOException {
|
||||
textBoxSet("with_textbox.ppt");
|
||||
textBoxSet("basic_test_ppt_file.ppt");
|
||||
textBoxSet("next_test_ppt_file.ppt");
|
||||
|
@ -326,7 +326,7 @@ public final class TestShapes {
|
|||
* Test adding shapes to <code>ShapeGroup</code>
|
||||
*/
|
||||
@Test
|
||||
public void shapeGroup() throws IOException {
|
||||
void shapeGroup() throws IOException {
|
||||
HSLFSlideShow ss = new HSLFSlideShow();
|
||||
|
||||
HSLFSlide slide = ss.createSlide();
|
||||
|
@ -381,7 +381,7 @@ public final class TestShapes {
|
|||
* Test functionality of Sheet.removeShape(Shape shape)
|
||||
*/
|
||||
@Test
|
||||
public void removeShapes() throws IOException {
|
||||
void removeShapes() throws IOException {
|
||||
String file = "with_textbox.ppt";
|
||||
HSLFSlideShow ss = new HSLFSlideShow(_slTests.openResourceAsStream(file));
|
||||
HSLFSlide sl = ss.getSlides().get(0);
|
||||
|
@ -408,7 +408,7 @@ public final class TestShapes {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void lineWidth() {
|
||||
void lineWidth() {
|
||||
HSLFSimpleShape sh = new HSLFAutoShape(ShapeType.RT_TRIANGLE);
|
||||
|
||||
AbstractEscherOptRecord opt = sh.getEscherOptRecord();
|
||||
|
@ -423,7 +423,7 @@ public final class TestShapes {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shapeId() throws IOException {
|
||||
void shapeId() throws IOException {
|
||||
HSLFSlideShow ss = new HSLFSlideShow();
|
||||
HSLFSlide slide = ss.createSlide();
|
||||
|
||||
|
@ -473,7 +473,7 @@ public final class TestShapes {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void lineColor() throws IOException {
|
||||
void lineColor() throws IOException {
|
||||
HSLFSlideShow ss = new HSLFSlideShow(_slTests.openResourceAsStream("51731.ppt"));
|
||||
List<HSLFShape> shape = ss.getSlides().get(0).getShapes();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public final class TestSlideChangeNotes {
|
|||
private HSLFSlideShow ss;
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws Exception {
|
||||
void init() throws Exception {
|
||||
POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
|
||||
HSLFSlideShowImpl hss = new HSLFSlideShowImpl(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShow(hss);
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class TestTextRunReWrite {
|
|||
* Load up a test PPT file with rich data
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
|
||||
ss = new HSLFSlideShow(slTests.openResourceAsStream(filename));
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class TestCurrentUserAtom {
|
|||
private static final String encFile = "Password_Protected-hello.ppt";
|
||||
|
||||
@Test
|
||||
public void readNormal() throws Exception {
|
||||
void readNormal() throws Exception {
|
||||
POIFSFileSystem fs = new POIFSFileSystem(_slTests.getFile(normalFile));
|
||||
|
||||
CurrentUserAtom cu = new CurrentUserAtom(fs.getRoot());
|
||||
|
@ -66,7 +66,7 @@ public final class TestCurrentUserAtom {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readEnc() throws Exception {
|
||||
void readEnc() throws Exception {
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(_slTests.getFile(encFile))) {
|
||||
new CurrentUserAtom(fs.getRoot());
|
||||
assertThrows(EncryptedPowerPointFileException.class, () -> new HSLFSlideShowImpl(fs).close());
|
||||
|
@ -74,7 +74,7 @@ public final class TestCurrentUserAtom {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void writeNormal() throws Exception {
|
||||
void writeNormal() throws Exception {
|
||||
// Get raw contents from a known file
|
||||
byte[] contents;
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(_slTests.getFile(normalFile))) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class TestDocument {
|
|||
private POIFSFileSystem pfs;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
void setup() throws Exception {
|
||||
pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShowImpl(pfs);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class TestDocumentEncryption {
|
|||
"Password_Protected-hello.ppt",
|
||||
"Password_Protected-np-hello.ppt"
|
||||
})
|
||||
public void cryptoAPIDecryptionOther(String pptFile) throws Exception {
|
||||
void cryptoAPIDecryptionOther(String pptFile) throws Exception {
|
||||
Biff8EncryptionKey.setCurrentUserPassword("hello");
|
||||
try {
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(slTests.getFile(pptFile), true);
|
||||
|
@ -75,7 +75,7 @@ public class TestDocumentEncryption {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void cryptoAPIChangeKeySize() throws Exception {
|
||||
void cryptoAPIChangeKeySize() throws Exception {
|
||||
String pptFile = "cryptoapi-proc2356.ppt";
|
||||
Biff8EncryptionKey.setCurrentUserPassword("crypto");
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(slTests.getFile(pptFile), true);
|
||||
|
@ -106,7 +106,7 @@ public class TestDocumentEncryption {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void cryptoAPIEncryption() throws Exception {
|
||||
void cryptoAPIEncryption() throws Exception {
|
||||
/* documents with multiple edits need to be normalized for encryption */
|
||||
String pptFile = "57272_corrupted_usereditatom.ppt";
|
||||
ByteArrayOutputStream encrypted = new ByteArrayOutputStream();
|
||||
|
@ -140,7 +140,7 @@ public class TestDocumentEncryption {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void cryptoAPIDecryption() throws Exception {
|
||||
void cryptoAPIDecryption() throws Exception {
|
||||
// taken from a msdn blog:
|
||||
// http://blogs.msdn.com/b/openspecification/archive/2009/05/08/dominic-salemno.aspx
|
||||
Biff8EncryptionKey.setCurrentUserPassword("crypto");
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class TestDocumentEncryptionAtom {
|
|||
};
|
||||
|
||||
@Test
|
||||
public void recordType() throws IOException {
|
||||
void recordType() throws IOException {
|
||||
DocumentEncryptionAtom dea1 = new DocumentEncryptionAtom(data_a, 0, data_a.length);
|
||||
assertEquals(12052l, dea1.getRecordType());
|
||||
|
||||
|
@ -101,7 +101,7 @@ public final class TestDocumentEncryptionAtom {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void encryptionTypeName() throws IOException {
|
||||
void encryptionTypeName() throws IOException {
|
||||
DocumentEncryptionAtom dea1 = new DocumentEncryptionAtom(data_a, 0, data_a.length);
|
||||
assertEquals("Microsoft Base Cryptographic Provider v1.0", dea1.getEncryptionProviderName());
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public final class TestFontCollection {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug61881() throws IOException {
|
||||
void bug61881() throws IOException {
|
||||
try (InputStream is = _slTests.openResourceAsStream("bug61881.ppt")) {
|
||||
try (HSLFSlideShow ppt = new HSLFSlideShow(is)) {
|
||||
assertEquals("?imes New Roman",ppt.getFont(3).getTypeface());
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class TestRecordContainer {
|
|||
private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
// Find a real RecordContainer record
|
||||
InputStream is = slTests.openResourceAsStream("basic_test_ppt_file.ppt");
|
||||
hss = new HSLFSlideShowImpl(is);
|
||||
|
@ -56,7 +56,7 @@ public final class TestRecordContainer {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void closeResources() throws IOException {
|
||||
void closeResources() throws IOException {
|
||||
hss.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class TestTxMasterStyleAtom {
|
|||
private HSLFSlideShow _ppt;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
_ppt = new HSLFSlideShow();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ public final class TestAddingSlides {
|
|||
* Create/open the slideshows
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
ss_empty = new HSLFSlideShow();
|
||||
ss_one = HSLFTestDataSamples.getSlideShow("Single_Coloured_Page.ppt");
|
||||
ss_two = HSLFTestDataSamples.getSlideShow("basic_test_ppt_file.ppt");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
ss_two.close();
|
||||
ss_one.close();
|
||||
ss_empty.close();
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class TestBackground {
|
|||
* Default background for slide, shape and slide master.
|
||||
*/
|
||||
@Test
|
||||
public void defaults() throws IOException {
|
||||
void defaults() throws IOException {
|
||||
HSLFSlideShow ppt = new HSLFSlideShow();
|
||||
|
||||
assertEquals(HSLFFill.FILL_SOLID, ppt.getSlideMasters().get(0).getBackground().getFill().getFillType());
|
||||
|
@ -68,7 +68,7 @@ public final class TestBackground {
|
|||
* Read fill information from an reference ppt file
|
||||
*/
|
||||
@Test
|
||||
public void readBackground() throws IOException {
|
||||
void readBackground() throws IOException {
|
||||
HSLFSlideShow ppt = HSLFTestDataSamples.getSlideShow("backgrounds.ppt");
|
||||
HSLFFill fill;
|
||||
HSLFShape shape;
|
||||
|
@ -101,7 +101,7 @@ public final class TestBackground {
|
|||
* Create a ppt with various fill effects
|
||||
*/
|
||||
@Test
|
||||
public void backgroundPicture() throws IOException {
|
||||
void backgroundPicture() throws IOException {
|
||||
HSLFSlideShow ppt1 = new HSLFSlideShow();
|
||||
HSLFSlide slide;
|
||||
HSLFFill fill;
|
||||
|
|
|
@ -97,7 +97,7 @@ public final class TestBugs {
|
|||
* Bug 41384: Array index wrong in record creation
|
||||
*/
|
||||
@Test
|
||||
public void bug41384() throws IOException {
|
||||
void bug41384() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("41384.ppt")) {
|
||||
assertEquals(1, ppt.getSlides().size());
|
||||
|
||||
|
@ -113,7 +113,7 @@ public final class TestBugs {
|
|||
* when the RichTextRun comes from a Notes model object
|
||||
*/
|
||||
@Test
|
||||
public void bug42474_1() throws IOException {
|
||||
void bug42474_1() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42474-1.ppt")) {
|
||||
assertEquals(2, ppt.getSlides().size());
|
||||
|
||||
|
@ -139,7 +139,7 @@ public final class TestBugs {
|
|||
* Second fix from Bug 42474: Incorrect matching of notes to slides
|
||||
*/
|
||||
@Test
|
||||
public void bug42474_2() throws IOException {
|
||||
void bug42474_2() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42474-2.ppt")) {
|
||||
|
||||
//map slide number and starting phrase of its notes
|
||||
|
@ -168,7 +168,7 @@ public final class TestBugs {
|
|||
* Bug 42485: All TextBoxes inside ShapeGroups have null TextRuns
|
||||
*/
|
||||
@Test
|
||||
public void bug42485 () throws IOException {
|
||||
void bug42485 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42485.ppt")) {
|
||||
for (HSLFShape shape : ppt.getSlides().get(0).getShapes()) {
|
||||
if (shape instanceof HSLFGroupShape) {
|
||||
|
@ -188,7 +188,7 @@ public final class TestBugs {
|
|||
* Bug 42484: NullPointerException from ShapeGroup.getAnchor()
|
||||
*/
|
||||
@Test
|
||||
public void bug42484 () throws IOException {
|
||||
void bug42484 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42485.ppt")) {
|
||||
for (HSLFShape shape : ppt.getSlides().get(0).getShapes()) {
|
||||
if (shape instanceof HSLFGroupShape) {
|
||||
|
@ -206,7 +206,7 @@ public final class TestBugs {
|
|||
* Bug 41381: Exception from Slide.getMasterSheet() on a seemingly valid PPT file
|
||||
*/
|
||||
@Test
|
||||
public void bug41381() throws IOException {
|
||||
void bug41381() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("alterman_security.ppt")) {
|
||||
assertEquals(1, ppt.getSlideMasters().size());
|
||||
assertEquals(1, ppt.getTitleMasters().size());
|
||||
|
@ -225,7 +225,7 @@ public final class TestBugs {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void bug42486 () throws IOException {
|
||||
void bug42486 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42486.ppt")) {
|
||||
for (HSLFSlide slide : ppt.getSlides()) {
|
||||
List<HSLFShape> shape = slide.getShapes();
|
||||
|
@ -237,7 +237,7 @@ public final class TestBugs {
|
|||
* Bug 42524: NPE in Shape.getShapeType()
|
||||
*/
|
||||
@Test
|
||||
public void bug42524 () throws IOException {
|
||||
void bug42524 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42486.ppt")) {
|
||||
//walk down the tree and see if there were no errors while reading
|
||||
for (HSLFSlide slide : ppt.getSlides()) {
|
||||
|
@ -259,7 +259,7 @@ public final class TestBugs {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void bug42520 () throws IOException {
|
||||
void bug42520 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("42520.ppt")) {
|
||||
|
||||
//test case from the bug report
|
||||
|
@ -288,7 +288,7 @@ public final class TestBugs {
|
|||
* ( also fixed followup: getTextRuns() returns no text )
|
||||
*/
|
||||
@Test
|
||||
public void bug38256 () throws IOException {
|
||||
void bug38256 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("38256.ppt")) {
|
||||
List<HSLFSlide> slide = ppt.getSlides();
|
||||
assertEquals(1, slide.size());
|
||||
|
@ -313,7 +313,7 @@ public final class TestBugs {
|
|||
* ( also fixed followup: getTextRuns() returns no text )
|
||||
*/
|
||||
@Test
|
||||
public void bug43781() throws IOException {
|
||||
void bug43781() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("43781.ppt")) {
|
||||
// Check the first slide
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
|
@ -348,7 +348,7 @@ public final class TestBugs {
|
|||
* Bug 44296: HSLF Not Extracting Slide Background Image
|
||||
*/
|
||||
@Test
|
||||
public void bug44296 () throws IOException {
|
||||
void bug44296 () throws IOException {
|
||||
try (HSLFSlideShow ppt = open("44296.ppt")) {
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
|
||||
|
@ -368,7 +368,7 @@ public final class TestBugs {
|
|||
* type with id 1036 on class class org.apache.poi.hslf.record.PPDrawing
|
||||
*/
|
||||
@Test
|
||||
public void bug44770() throws IOException {
|
||||
void bug44770() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("44770.ppt")) {
|
||||
assertNotNull(ppt.getSlides().get(0));
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ public final class TestBugs {
|
|||
* Bug 41071: Will not extract text from Powerpoint TextBoxes
|
||||
*/
|
||||
@Test
|
||||
public void bug41071() throws IOException {
|
||||
void bug41071() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("41071.ppt")) {
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
List<HSLFShape> sh = slide.getShapes();
|
||||
|
@ -397,7 +397,7 @@ public final class TestBugs {
|
|||
* PowerPoint 95 files should throw a more helpful exception
|
||||
*/
|
||||
@Test
|
||||
public void bug41711() throws IOException {
|
||||
void bug41711() throws IOException {
|
||||
// New file is fine
|
||||
open("SampleShow.ppt").close();
|
||||
|
||||
|
@ -409,7 +409,7 @@ public final class TestBugs {
|
|||
* Changing text from Ascii to Unicode
|
||||
*/
|
||||
@Test
|
||||
public void bug49648() throws IOException {
|
||||
void bug49648() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("49648.ppt")) {
|
||||
for (HSLFSlide slide : ppt.getSlides()) {
|
||||
for (List<HSLFTextParagraph> run : slide.getTextParagraphs()) {
|
||||
|
@ -425,7 +425,7 @@ public final class TestBugs {
|
|||
* Bug 41246: AIOOB with illegal note references
|
||||
*/
|
||||
@Test
|
||||
public void bug41246a() throws IOException {
|
||||
void bug41246a() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("41246-1.ppt")) {
|
||||
try (HSLFSlideShow ppt2 = writeOutAndReadBack(ppt)) {
|
||||
assertNotNull(ppt2.getSlides().get(0));
|
||||
|
@ -434,7 +434,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug41246b() throws IOException {
|
||||
void bug41246b() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("41246-2.ppt")) {
|
||||
try (HSLFSlideShow ppt2 = writeOutAndReadBack(ppt)) {
|
||||
assertNotNull(ppt2.getSlides().get(0));
|
||||
|
@ -446,7 +446,7 @@ public final class TestBugs {
|
|||
* Bug 45776: Fix corrupt file problem using TextRun.setText
|
||||
*/
|
||||
@Test
|
||||
public void bug45776() throws IOException {
|
||||
void bug45776() throws IOException {
|
||||
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ROOT);
|
||||
try (HSLFSlideShow ppt = open("45776.ppt")) {
|
||||
|
||||
|
@ -476,7 +476,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug55732() throws IOException {
|
||||
void bug55732() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug55732.ppt")) {
|
||||
/* Iterate over slides and extract text */
|
||||
for (HSLFSlide slide : ppt.getSlides()) {
|
||||
|
@ -487,7 +487,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug56260() throws IOException {
|
||||
void bug56260() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("56260.ppt")) {
|
||||
List<HSLFSlide> _slides = ppt.getSlides();
|
||||
assertEquals(13, _slides.size());
|
||||
|
@ -524,7 +524,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug37625() throws IOException {
|
||||
void bug37625() throws IOException {
|
||||
try (HSLFSlideShow ppt1 = open("37625.ppt");
|
||||
HSLFSlideShow ppt2 = writeOutAndReadBack(ppt1)) {
|
||||
assertEquals(29, ppt1.getSlides().size());
|
||||
|
@ -534,7 +534,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug57272() throws IOException {
|
||||
void bug57272() throws IOException {
|
||||
try (HSLFSlideShow ppt1 = open("57272_corrupted_usereditatom.ppt");
|
||||
HSLFSlideShow ppt2 = writeOutAndReadBack(ppt1)) {
|
||||
assertEquals(6, ppt1.getSlides().size());
|
||||
|
@ -544,7 +544,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug49541() throws IOException {
|
||||
void bug49541() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("49541_symbol_map.ppt")) {
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
HSLFGroupShape sg = (HSLFGroupShape) slide.getShapes().get(0);
|
||||
|
@ -555,7 +555,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug47261() throws IOException {
|
||||
void bug47261() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug47261.ppt")) {
|
||||
ppt.removeSlide(0);
|
||||
ppt.createSlide();
|
||||
|
@ -564,7 +564,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug56240() throws IOException {
|
||||
void bug56240() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug56240.ppt")) {
|
||||
int slideCnt = ppt.getSlides().size();
|
||||
assertEquals(105, slideCnt);
|
||||
|
@ -573,7 +573,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug46441() throws IOException {
|
||||
void bug46441() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug46441.ppt")) {
|
||||
HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(0).getShapes().get(0);
|
||||
AbstractEscherOptRecord opt = as.getEscherOptRecord();
|
||||
|
@ -601,12 +601,12 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug58516() throws IOException {
|
||||
void bug58516() throws IOException {
|
||||
open("bug58516.ppt").close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug45124() throws IOException {
|
||||
void bug45124() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug45124.ppt")) {
|
||||
Slide<?, ?> slide1 = ppt.getSlides().get(1);
|
||||
|
||||
|
@ -638,7 +638,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug45088() throws IOException {
|
||||
void bug45088() throws IOException {
|
||||
String template = "[SYSDATE]";
|
||||
String textExp = "REPLACED_DATE_WITH_A_LONG_ONE";
|
||||
|
||||
|
@ -667,7 +667,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug45908() throws IOException {
|
||||
void bug45908() throws IOException {
|
||||
try (HSLFSlideShow ppt1 = open("bug45908.ppt")) {
|
||||
|
||||
HSLFSlide slide = ppt1.getSlides().get(0);
|
||||
|
@ -740,7 +740,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug47904() throws IOException {
|
||||
void bug47904() throws IOException {
|
||||
try (HSLFSlideShow ppt1 = new HSLFSlideShow()) {
|
||||
HSLFSlideMaster sm = ppt1.getSlideMasters().get(0);
|
||||
HSLFAutoShape as = (HSLFAutoShape) sm.getPlaceholder(Placeholder.TITLE);
|
||||
|
@ -772,7 +772,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug58718() throws IOException {
|
||||
void bug58718() throws IOException {
|
||||
String[] files = {"bug58718_008524.ppt", "bug58718_008558.ppt", "bug58718_349008.ppt", "bug58718_008495.ppt",};
|
||||
for (String f : files) {
|
||||
File sample = HSLFTestDataSamples.getSampleFile(f);
|
||||
|
@ -783,7 +783,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug58733() throws IOException {
|
||||
void bug58733() throws IOException {
|
||||
File sample = HSLFTestDataSamples.getSampleFile("bug58733_671884.ppt");
|
||||
try (SlideShowExtractor<?,?> ex = new SlideShowExtractor<>(SlideShowFactory.create(sample))) {
|
||||
assertNotNull(ex.getText());
|
||||
|
@ -791,7 +791,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug58159() throws IOException {
|
||||
void bug58159() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug58159_headers-and-footers.ppt")) {
|
||||
HeadersFooters hf = ppt.getSlideHeadersFooters();
|
||||
assertNull(hf.getHeaderText());
|
||||
|
@ -816,7 +816,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug55030() throws IOException {
|
||||
void bug55030() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("bug55030.ppt")) {
|
||||
String expFamily = "\u96b6\u4e66";
|
||||
|
||||
|
@ -833,7 +833,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug59056() throws IOException {
|
||||
void bug59056() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("54541_cropped_bitmap.ppt")) {
|
||||
for (HSLFShape shape : ppt.getSlides().get(0).getShapes()) {
|
||||
BufferedImage img = new BufferedImage(500, 300, BufferedImage.TYPE_INT_ARGB);
|
||||
|
@ -857,7 +857,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug55983() throws IOException {
|
||||
void bug55983() throws IOException {
|
||||
try (HSLFSlideShow ppt1 = new HSLFSlideShow()) {
|
||||
HSLFSlide sl = ppt1.createSlide();
|
||||
assertNotNull(sl.getBackground());
|
||||
|
@ -894,7 +894,7 @@ public final class TestBugs {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug59302() throws IOException {
|
||||
void bug59302() throws IOException {
|
||||
//add extraction from PPT
|
||||
Map<String, String> macros = getMacrosFromHSLF("59302.ppt");
|
||||
assertNotNull(macros, "couldn't find macros");
|
||||
|
@ -939,7 +939,7 @@ public final class TestBugs {
|
|||
* Bug 60294: Add "unknown" ShapeType for 4095
|
||||
*/
|
||||
@Test
|
||||
public void bug60294() throws IOException {
|
||||
void bug60294() throws IOException {
|
||||
try (HSLFSlideShow ppt = open("60294.ppt")) {
|
||||
List<HSLFShape> shList = ppt.getSlides().get(0).getShapes();
|
||||
assertEquals(ShapeType.NOT_PRIMITIVE, shList.get(2).getShapeType());
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TestFontRendering {
|
|||
|
||||
// @Disabled2("This fails on some systems because fonts are rendered slightly different")
|
||||
@Test
|
||||
public void bug55902mixedFontWithChineseCharacters() throws IOException, FontFormatException {
|
||||
void bug55902mixedFontWithChineseCharacters() throws IOException, FontFormatException {
|
||||
// font files need to be downloaded first via
|
||||
// ant test-scratchpad-download-resources
|
||||
String[][] fontFiles = {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class TestHSLFSlideShow extends BaseTestSlideShow<HSLFShape, HSLFTextPara
|
|||
|
||||
// make sure junit4 executes this test class
|
||||
@Test
|
||||
public void dummy() {
|
||||
void dummy() {
|
||||
assertNotNull(createSlideShow());
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public final class TestMostRecentRecords {
|
|||
private HSLFSlideShow ss;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
void setup() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShow(hss);
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class TestNotesText {
|
|||
private HSLFSlideShow ss;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
void setup() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShow(hss);
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class TestPicture {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
public void multiplePictures() throws IOException {
|
||||
void multiplePictures() throws IOException {
|
||||
try (HSLFSlideShow ppt = new HSLFSlideShow()) {
|
||||
HSLFSlide s = ppt.createSlide();
|
||||
HSLFSlide s2 = ppt.createSlide();
|
||||
|
@ -91,7 +91,7 @@ public final class TestPicture {
|
|||
* was not found. The correct behaviour is to return null.
|
||||
*/
|
||||
@Test
|
||||
public void bug46122() throws IOException {
|
||||
void bug46122() throws IOException {
|
||||
try (HSLFSlideShow ppt = new HSLFSlideShow()) {
|
||||
HSLFSlide slide = ppt.createSlide();
|
||||
HSLFPictureData pd = HSLFPictureData.create(PictureType.PNG);
|
||||
|
@ -109,7 +109,7 @@ public final class TestPicture {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void macImages() throws IOException {
|
||||
void macImages() throws IOException {
|
||||
try (InputStream is = _slTests.openResourceAsStream("53446.ppt");
|
||||
HSLFSlideShowImpl hss = new HSLFSlideShowImpl(is)) {
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class TestReOrderingSlides {
|
|||
* Create/open the slideshows
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
|
||||
hss_one = new HSLFSlideShowImpl(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class TestRecordSetup {
|
|||
private HSLFSlideShowImpl hss;
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws Exception {
|
||||
void init() throws Exception {
|
||||
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
|
||||
hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
|
||||
ss = new HSLFSlideShow(hss);
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class TestRichTextRun {
|
|||
private static String filenameC;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
// Basic (non rich) test file
|
||||
ss = HSLFTestDataSamples.getSlideShow("basic_test_ppt_file.ppt");
|
||||
|
||||
|
@ -74,7 +74,7 @@ public final class TestRichTextRun {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
ss.close();
|
||||
ssRichA.close();
|
||||
ssRichB.close();
|
||||
|
|
|
@ -35,12 +35,12 @@ public final class TestSheetText {
|
|||
private HSLFSlideShow ss;
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws IOException {
|
||||
void init() throws IOException {
|
||||
ss = HSLFTestDataSamples.getSlideShow("basic_test_ppt_file.ppt");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
ss.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@ public final class TestSlideOrdering {
|
|||
private HSLFSlideShow ssB;
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws IOException {
|
||||
void init() throws IOException {
|
||||
ssA = HSLFTestDataSamples.getSlideShow("basic_test_ppt_file.ppt");
|
||||
ssB = HSLFTestDataSamples.getSlideShow("incorrect_slide_order.ppt");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
ssA.close();
|
||||
ssB.close();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.junit.jupiter.api.Test;
|
|||
*/
|
||||
public class TestTable {
|
||||
@Test
|
||||
public void moveTable() throws IOException {
|
||||
void moveTable() throws IOException {
|
||||
HSLFSlideShow ppt = new HSLFSlideShow();
|
||||
HSLFSlide slide = ppt.createSlide();
|
||||
int rows = 3, cols = 5;
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class TestTextRun {
|
|||
private HSLFSlideShow ssRich;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
// Basic (non rich) test file
|
||||
ss = HSLFTestDataSamples.getSlideShow("basic_test_ppt_file.ppt");
|
||||
|
||||
|
@ -57,7 +57,7 @@ public final class TestTextRun {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
ssRich.close();
|
||||
ss.close();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
|
|||
*/
|
||||
public final class TestTextShape {
|
||||
@Test
|
||||
public void createAutoShape(){
|
||||
void createAutoShape(){
|
||||
HSLFTextShape shape = new HSLFAutoShape(ShapeType.TRAPEZOID);
|
||||
assertNull(shape.getEscherTextboxWrapper());
|
||||
assertNotNull(shape.getTextParagraphs());
|
||||
|
@ -51,7 +51,7 @@ public final class TestTextShape {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void createTextBox(){
|
||||
void createTextBox(){
|
||||
HSLFTextShape shape = new HSLFTextBox();
|
||||
List<HSLFTextParagraph> paras = shape.getTextParagraphs();
|
||||
assertNotNull(paras);
|
||||
|
@ -71,7 +71,7 @@ public final class TestTextShape {
|
|||
* - text in auto-shapes
|
||||
*/
|
||||
@Test
|
||||
public void read() throws IOException {
|
||||
void read() throws IOException {
|
||||
HSLFSlideShow ppt = HSLFTestDataSamples.getSlideShow("text_shapes.ppt");
|
||||
|
||||
List<String> lst1 = new ArrayList<>();
|
||||
|
@ -122,7 +122,7 @@ public final class TestTextShape {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readWrite() throws IOException {
|
||||
void readWrite() throws IOException {
|
||||
HSLFSlideShow ppt = new HSLFSlideShow();
|
||||
HSLFSlide slide = ppt.createSlide();
|
||||
|
||||
|
@ -158,7 +158,7 @@ public final class TestTextShape {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void margins() throws IOException {
|
||||
void margins() throws IOException {
|
||||
HSLFSlideShow ppt = HSLFTestDataSamples.getSlideShow("text-margins.ppt");
|
||||
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
|
@ -201,7 +201,7 @@ public final class TestTextShape {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bug52599() throws IOException {
|
||||
void bug52599() throws IOException {
|
||||
HSLFSlideShow ppt = HSLFTestDataSamples.getSlideShow("52599.ppt");
|
||||
|
||||
HSLFSlide slide = ppt.getSlides().get(0);
|
||||
|
|
|
@ -41,7 +41,7 @@ public final class Test7BitCodepage {
|
|||
* Initialize this test, load up the messages.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
ascii_cp1251_lcid1049 = new MAPIMessage(samples.openResourceAsStream("ASCII_CP1251_LCID1049.msg"));
|
||||
ascii_utf_8_cp1252_lcid1031 = new MAPIMessage(samples.openResourceAsStream("ASCII_UTF-8_CP1252_LCID1031.msg"));
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class TestBasics {
|
|||
* Initialize this test, load up the blank.msg mapi message.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
simple = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
|
||||
quick = new MAPIMessage(samples.openResourceAsStream("quick.msg"));
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class TestBlankFileRead {
|
|||
* Initialize this test, load up the blank.msg mapi message.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
mapiMessage = new MAPIMessage(samples.openResourceAsStream("blank.msg"));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class TestMessageSubmissionChunk {
|
|||
* Initialise this test, load up the test messages.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
this.mapiMessageExtraHyphenSubmissionChunk = new MAPIMessage(samples.openResourceAsStream("message_extra_hyphen_submission_chunk.msg"));
|
||||
this.mapiMessageNormalSubmissionChunk = new MAPIMessage(samples.openResourceAsStream("message_normal_submission_chunk.msg"));
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class TestMessageSubmissionChunkY2KRead {
|
|||
* Initialise this test, load up the three test messages.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
mapiMessage1979 = new MAPIMessage(samples.openResourceAsStream("message_1979.msg"));
|
||||
mapiMessage1980 = new MAPIMessage(samples.openResourceAsStream("message_1980.msg"));
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class TestOutlook30FileRead {
|
|||
* Initialize this test, load up the blank.msg mapi message.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
void setup() throws IOException {
|
||||
POIDataSamples samples = POIDataSamples.getHSMFInstance();
|
||||
this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class TestHwmfParsing {
|
|||
/* Bug 65063 */
|
||||
"empty-polygon-close.wmf, 272"
|
||||
})
|
||||
public void parse(String file, int recordCnt) throws IOException {
|
||||
void parse(String file, int recordCnt) throws IOException {
|
||||
try (InputStream fis = samples.openResourceAsStream(file)) {
|
||||
HwmfPicture wmf = new HwmfPicture(fis);
|
||||
List<HwmfRecord> records = wmf.getRecords();
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
public class TestRasterOp {
|
||||
@Test
|
||||
public void checkTertiaryCalcCmd() {
|
||||
void checkTertiaryCalcCmd() {
|
||||
for (HwmfTernaryRasterOp op : HwmfTernaryRasterOp.values()) {
|
||||
String cmd = op.calcCmd();
|
||||
if (HwmfTernaryRasterOp.SSPXDSXOXN == op) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.io.IOException;
|
|||
public final class HWPFDocFixture
|
||||
{
|
||||
public static final String DEFAULT_TEST_FILE = "test.doc";
|
||||
|
||||
|
||||
public byte[] _tableStream;
|
||||
public byte[] _mainStream;
|
||||
public FileInformationBlock _fib;
|
||||
|
|
|
@ -28,7 +28,7 @@ public abstract class HWPFTestCase {
|
|||
protected HWPFDocFixture _hWPFDocFixture;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
/** @todo verify the constructors */
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, getTestFile());
|
||||
|
||||
|
@ -40,7 +40,7 @@ public abstract class HWPFTestCase {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
if (_hWPFDocFixture != null) {
|
||||
_hWPFDocFixture.tearDown();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class TestHWPFPictures {
|
|||
private String imgDFile;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
docAFile = "testPictures.doc";
|
||||
docBFile = "two_images.doc";
|
||||
docCFile = "vector_image.doc";
|
||||
|
|
|
@ -95,7 +95,7 @@ public final class TestHWPFRangeParts {
|
|||
private HWPFDocument docUnicode;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
docUnicode = HWPFTestDataSamples.openSampleFile("HeaderFooterUnicode.doc");
|
||||
docAscii = HWPFTestDataSamples.openSampleFile("ThreeColHeadFoot.doc");
|
||||
}
|
||||
|
|
|
@ -41,20 +41,20 @@ public class TestHWPFLister {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
void tearDown() {
|
||||
// the main-method sets these properties, we need to revert them here to not affect other tests
|
||||
System.clearProperty("org.apache.poi.hwpf.preserveBinTables");
|
||||
System.clearProperty("org.apache.poi.hwpf.preserveTextTable");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void main() throws Exception {
|
||||
void main() throws Exception {
|
||||
File file = POIDataSamples.getDocumentInstance().getFile("SampleDoc.doc");
|
||||
HWPFLister.main(new String[] { file.getAbsolutePath() });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mainAll() throws Exception {
|
||||
void mainAll() throws Exception {
|
||||
File file = POIDataSamples.getDocumentInstance().getFile("SampleDoc.doc");
|
||||
HWPFLister.main(new String[] {
|
||||
file.getAbsolutePath(),
|
||||
|
|
|
@ -57,12 +57,12 @@ public final class TestDifferentRoutes {
|
|||
private HWPFDocument doc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
doc = HWPFTestDataSamples.openSampleFile("test2.doc");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
doc.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,14 +74,14 @@ public final class TestCHPBinTable {
|
|||
|
||||
}
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
|
||||
_hWPFDocFixture.setUp();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
_cHPBinTable = null;
|
||||
_hWPFDocFixture.tearDown();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class TestDocumentProperties {
|
|||
private HWPFDocFixture _hWPFDocFixture;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
// TODO verify the constructors
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
_hWPFDocFixture.setUp();
|
||||
|
@ -40,7 +40,7 @@ public final class TestDocumentProperties {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() {
|
||||
_documentProperties = null;
|
||||
_hWPFDocFixture.tearDown();
|
||||
_hWPFDocFixture = null;
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class TestFileInformationBlock {
|
|||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
/** @todo verify the constructors */
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
_hWPFDocFixture.setUp();
|
||||
|
@ -52,7 +52,7 @@ public final class TestFileInformationBlock {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
_fileInformationBlock = null;
|
||||
_hWPFDocFixture.tearDown();
|
||||
_hWPFDocFixture = null;
|
||||
|
|
|
@ -58,13 +58,13 @@ public final class TestFontTable {
|
|||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
_hWPFDocFixture.setUp();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
void tearDown() throws IOException {
|
||||
_hWPFDocFixture.tearDown();
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class TestPlexOfCps {
|
|||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
/**@todo verify the constructors*/
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
|
||||
|
@ -68,7 +68,7 @@ public final class TestPlexOfCps {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
_plexOfCps = null;
|
||||
_hWPFDocFixture.tearDown();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public final class TestSectionTable {
|
|||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
/*@todo verify the constructors*/
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
|
||||
|
@ -94,7 +94,7 @@ public final class TestSectionTable {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
void tearDown() {
|
||||
_hWPFDocFixture.tearDown();
|
||||
|
||||
_hWPFDocFixture = null;
|
||||
|
|
|
@ -65,7 +65,7 @@ public final class TestStyleSheet {
|
|||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
/**@todo verify the constructors*/
|
||||
_hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE);
|
||||
_hWPFDocFixture.setUp();
|
||||
|
@ -78,7 +78,7 @@ public final class TestStyleSheet {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
_styleSheet = null;
|
||||
_hWPFDocFixture.tearDown();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class TestTextPieceTable {
|
|||
private HWPFDocFixture _hWPFDocFixture;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
void setUp() throws Exception {
|
||||
System.setProperty("org.apache.poi.hwpf.preserveTextTable",
|
||||
Boolean.TRUE.toString());
|
||||
|
||||
|
@ -48,7 +48,7 @@ public final class TestTextPieceTable {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
void tearDown() throws Exception {
|
||||
_hWPFDocFixture.tearDown();
|
||||
_hWPFDocFixture = null;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public final class TestHeaderStories {
|
|||
private HWPFDocument withFields;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
none = openSampleFile("NoHeadFoot.doc");
|
||||
header = openSampleFile("ThreeColHead.doc");
|
||||
|
|
|
@ -69,7 +69,7 @@ public final class TestRangeProperties {
|
|||
private HWPFDocument a;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
u = HWPFTestDataSamples.openSampleFile("HeaderFooterUnicode.doc");
|
||||
a = HWPFTestDataSamples.openSampleFile("SampleDoc.doc");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue