- Add metadata descriptor to template page

- Add png export tests.
This commit is contained in:
Paulo Gustavo Veiga 2012-12-01 19:09:31 -03:00
parent d2c287684f
commit 0d8b6b210e
15 changed files with 7573 additions and 3 deletions

View File

@ -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>

View File

@ -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;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.