mirror of
https://github.com/apache/poi.git
synced 2025-02-11 12:34:51 +00:00
test also render to SVG, PDF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883130 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b27bb4f413
commit
9e5790d004
@ -23,6 +23,7 @@ import static java.util.Arrays.asList;
|
|||||||
import static org.junit.Assume.assumeFalse;
|
import static org.junit.Assume.assumeFalse;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -54,6 +55,12 @@ public class TestPPTX2PNG {
|
|||||||
"customGeo.pptx, customGeo.ppt, wrench.emf, santa.wmf, missing-moveto.ppt, " +
|
"customGeo.pptx, customGeo.ppt, wrench.emf, santa.wmf, missing-moveto.ppt, " +
|
||||||
"64716_image1.wmf, 64716_image2.wmf, 64716_image3.wmf";
|
"64716_image1.wmf, 64716_image2.wmf, 64716_image3.wmf";
|
||||||
|
|
||||||
|
private static final String svgFiles =
|
||||||
|
"bug64693.pptx";
|
||||||
|
|
||||||
|
private static final String pdfFiles =
|
||||||
|
"alterman_security.ppt";
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void checkHslf() {
|
public static void checkHslf() {
|
||||||
try {
|
try {
|
||||||
@ -78,17 +85,26 @@ public class TestPPTX2PNG {
|
|||||||
@Test
|
@Test
|
||||||
public void render() throws Exception {
|
public void render() throws Exception {
|
||||||
assumeFalse("ignore HSLF (.ppt) / HEMF (.emf) / HWMF (.wmf) files in no-scratchpad run", xslfOnly && pptFile.matches(".*\\.(ppt|emf|wmf)$"));
|
assumeFalse("ignore HSLF (.ppt) / HEMF (.emf) / HWMF (.wmf) files in no-scratchpad run", xslfOnly && pptFile.matches(".*\\.(ppt|emf|wmf)$"));
|
||||||
|
PPTX2PNG.main(getArgs("null"));
|
||||||
|
if (svgFiles.contains(pptFile)) {
|
||||||
|
PPTX2PNG.main(getArgs("svg"));
|
||||||
|
}
|
||||||
|
if (pdfFiles.contains(pptFile)) {
|
||||||
|
PPTX2PNG.main(getArgs("pdf"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bug64693.pptx
|
private String[] getArgs(String format) throws IOException {
|
||||||
|
|
||||||
final List<String> args = new ArrayList<>(asList(
|
final List<String> args = new ArrayList<>(asList(
|
||||||
"-format", "null", // png,gif,jpg,svg or null for test
|
"-format", format, // png,gif,jpg,svg,pdf or null for test
|
||||||
"-slide", "-1", // -1 for all
|
"-slide", "-1", // -1 for all
|
||||||
"-outdir", new File("build/tmp/").getCanonicalPath(),
|
"-outdir", new File("build/tmp/").getCanonicalPath(),
|
||||||
"-outpat", "${basename}-${slideno}-${ext}.${format}",
|
"-outpat", "${basename}-${slideno}-${ext}.${format}",
|
||||||
// "-dump", new File("build/tmp/", pptFile+".json").getCanonicalPath(),
|
// "-dump", new File("build/tmp/", pptFile+".json").getCanonicalPath(),
|
||||||
"-dump", "null",
|
"-dump", "null",
|
||||||
"-quiet",
|
"-quiet",
|
||||||
|
// "-charset", "GBK",
|
||||||
|
// "-emfHeaderBounds",
|
||||||
"-fixside", "long",
|
"-fixside", "long",
|
||||||
"-scale", "800"
|
"-scale", "800"
|
||||||
));
|
));
|
||||||
@ -101,6 +117,6 @@ public class TestPPTX2PNG {
|
|||||||
|
|
||||||
args.add((basedir == null ? samples.getFile(pptFile) : new File(basedir, pptFile)).getAbsolutePath());
|
args.add((basedir == null ? samples.getFile(pptFile) : new File(basedir, pptFile)).getAbsolutePath());
|
||||||
|
|
||||||
PPTX2PNG.main(args.toArray(new String[0]));
|
return args.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user