mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 12:30:44 +02:00
- Add metadata descriptor to template page
- Add png export tests.
This commit is contained in:
parent
d2c287684f
commit
0d8b6b210e
@ -11,6 +11,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<base href="${requestScope['site.baseurl']}/">
|
||||
|
||||
<meta name="author" content="WiseMapping">
|
||||
<meta name="publisher" content="WiseMapping Open Source">
|
||||
<meta name="keywords" content="mindmap,mind map,mind maps,mindmaps,ideas,brainstorming,organize,thoughts,structure,collaboration,free,fast,simple,online,tool,knowledge,share,sharing,publish">
|
||||
<meta name="description" content="WiseMapping is a free, fast and simple online mind mapping editor for individuals and business. Sign up to start organizing and sharing your ideas and thoughts.">
|
||||
<meta property="og:title" content="WiseMapping" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="http://www.wisemapping.com" />
|
||||
<meta property="og:image" content="http://www.wisemapping.com/images/logo.png" />
|
||||
<meta property="og:site_name" content="WiseMapping.com" />
|
||||
|
||||
<title>
|
||||
<spring:message code="SITE.TITLE"/>-
|
||||
<c:choose>
|
||||
|
@ -24,10 +24,15 @@ public class ExportTest {
|
||||
private static final String DATA_DIR_PATH = "src/test/resources/data/svg/";
|
||||
|
||||
@Test(dataProvider = "Data-Provider-Function")
|
||||
public void exportSvgTest(@NotNull final File svgFile, @NotNull final File pngFile) throws ImporterException, IOException, ExportException, TransformerException, XMLStreamException, JAXBException, SAXException, TranscoderException, ParserConfigurationException {
|
||||
public void exportSvgTest(@NotNull final File svgFile, @NotNull final File pngFile, @NotNull final File pdfFile) throws ImporterException, IOException, ExportException, TransformerException, XMLStreamException, JAXBException, SAXException, TranscoderException, ParserConfigurationException {
|
||||
|
||||
String svgXml = FileUtils.readFileToString(svgFile, "UTF-8");
|
||||
|
||||
exportPng(svgFile, pngFile, svgXml);
|
||||
exportPdf(svgFile, pdfFile, svgXml);
|
||||
}
|
||||
|
||||
private void exportPng(File svgFile, File pngFile, String svgXml) throws ParserConfigurationException, TranscoderException, IOException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
||||
final ExportFormat format = ExportFormat.PNG;
|
||||
final ExportProperties properties = ExportProperties.create(format);
|
||||
final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
|
||||
@ -47,6 +52,24 @@ public class ExportTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void exportPdf(File svgFile, File pdfFile, String svgXml) throws ParserConfigurationException, TranscoderException, IOException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
||||
final ExportFormat format = ExportFormat.PDF;
|
||||
final ExportProperties properties = ExportProperties.create(format);
|
||||
|
||||
String baseUrl = svgFile.getParentFile().getAbsolutePath() + "/../../../../../../wise-editor/src/main/webapp";
|
||||
ExporterFactory factory = new ExporterFactory(new File(baseUrl));
|
||||
// Write content ...
|
||||
if (pdfFile.exists()) {
|
||||
// Export mile content ...
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
factory.export(properties, null, bos, svgXml);
|
||||
} else {
|
||||
OutputStream outputStream = new FileOutputStream(pdfFile, false);
|
||||
factory.export(properties, null, outputStream, svgXml);
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
//This function will provide the parameter data
|
||||
@DataProvider(name = "Data-Provider-Function")
|
||||
public Object[][] parameterIntTestProvider() {
|
||||
@ -59,11 +82,11 @@ public class ExportTest {
|
||||
}
|
||||
});
|
||||
|
||||
final Object[][] result = new Object[svgFile.length][2];
|
||||
final Object[][] result = new Object[svgFile.length][3];
|
||||
for (int i = 0; i < svgFile.length; i++) {
|
||||
File freeMindFile = svgFile[i];
|
||||
final String name = freeMindFile.getName();
|
||||
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".png")};
|
||||
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".png"),new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".pdf")};
|
||||
}
|
||||
|
||||
return result;
|
||||
|
BIN
wise-webapp/src/test/resources/data/svg/bug-nbsp.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/bug-nbsp.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/bug1.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/bug1.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/bug2.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/bug2.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/bug3.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/bug3.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/bug3.png
Normal file
BIN
wise-webapp/src/test/resources/data/svg/bug3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 216 KiB |
7536
wise-webapp/src/test/resources/data/svg/bug3.svg
Normal file
7536
wise-webapp/src/test/resources/data/svg/bug3.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 564 KiB |
BIN
wise-webapp/src/test/resources/data/svg/map-3.0.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map-3.0.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map1.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map1.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map2.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map2.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map3.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map3.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map4.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map4.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map5.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map5.pdf
Normal file
Binary file not shown.
BIN
wise-webapp/src/test/resources/data/svg/map6.pdf
Normal file
BIN
wise-webapp/src/test/resources/data/svg/map6.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user