aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad/testcases/org/apache/poi/hemf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2018-09-24 23:55:52 +0000
committerAndreas Beeker <kiwiwings@apache.org>2018-09-24 23:55:52 +0000
commitb3fc9f49572cb79ffa25f82d45987adb33b09e93 (patch)
tree0f1686a9903852e887395a5aad32e077be7c46cf /src/scratchpad/testcases/org/apache/poi/hemf
parent5073f22fce96dcc74529baaa8ee6e7e3c732ee56 (diff)
downloadpoi-b3fc9f49572cb79ffa25f82d45987adb33b09e93.tar.gz
poi-b3fc9f49572cb79ffa25f82d45987adb33b09e93.zip
#60656 - Support export file that contains emf and render it correctly
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/hemf@1841897 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hemf')
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java b/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
index 8d360d9aef..6e88853e16 100644
--- a/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
+++ b/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
@@ -32,6 +32,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
@@ -63,7 +64,7 @@ public class HemfPictureTest {
@Test
@Ignore("Only for manual tests")
public void paint() throws IOException {
- File f = sl_samples.getFile("wrench.emf");
+ File f = new File("picture_14.emf"); // sl_samples.getFile("wrench.emf");
try (FileInputStream fis = new FileInputStream(f)) {
HemfPicture emf = new HemfPicture(fis);
@@ -84,6 +85,14 @@ public class HemfPictureTest {
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ FileWriter fw = new FileWriter("record-list.txt");
+ int i=0;
+ for (HemfRecord r : emf.getRecords()) {
+ fw.write(i + " "+r.getEmfRecordType()+" "+r.toString()+"\n");
+ i++;
+ }
+ fw.close();
+
emf.draw(g, new Rectangle2D.Double(0,0,width,height));
g.dispose();
@@ -160,7 +169,7 @@ public class HemfPictureTest {
StringBuilder sb = new StringBuilder();
for (HemfRecord record : pic) {
if (record.getEmfRecordType().equals(HemfRecordType.exttextoutw)) {
- HemfText.ExtTextOutW extTextOutW = (HemfText.ExtTextOutW) record;
+ HemfText.EmfExtTextOutW extTextOutW = (HemfText.EmfExtTextOutW) record;
Point2D reference = extTextOutW.getTextObject().getReference();
if (lastY > -1 && lastY != reference.getY()) {
sb.append("\n");
@@ -194,7 +203,7 @@ public class HemfPictureTest {
int foundExpected = 0;
for (HemfRecord record : pic) {
if (record.getEmfRecordType().equals(HemfRecordType.exttextoutw)) {
- HemfText.ExtTextOutW extTextOutW = (HemfText.ExtTextOutW) record;
+ HemfText.EmfExtTextOutW extTextOutW = (HemfText.EmfExtTextOutW) record;
Point2D reference = extTextOutW.getTextObject().getReference();
if (lastY > -1 && lastY != reference.getY()) {
sb.append("\n");