You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/09/11 21:24:08 UTC

svn commit: r1866808 [7/7] - in /poi: site/src/documentation/content/xdocs/ trunk/src/java/org/apache/poi/common/usermodel/ trunk/src/java/org/apache/poi/common/usermodel/fonts/ trunk/src/java/org/apache/poi/ddf/ trunk/src/java/org/apache/poi/hssf/user...

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java Wed Sep 11 21:24:06 2019
@@ -17,28 +17,31 @@
 
 package org.apache.poi.hwmf.record;
 
-import static org.apache.poi.hwmf.record.HwmfDraw.boundsToString;
-import static org.apache.poi.hwmf.record.HwmfDraw.pointToString;
 import static org.apache.poi.hwmf.record.HwmfDraw.readPointS;
 import static org.apache.poi.hwmf.record.HwmfDraw.readRectS;
+import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
 
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
 
-import org.apache.commons.codec.Charsets;
+import org.apache.poi.common.usermodel.GenericRecord;
 import org.apache.poi.hwmf.draw.HwmfDrawProperties;
 import org.apache.poi.hwmf.draw.HwmfGraphics;
 import org.apache.poi.hwmf.record.HwmfMisc.WmfSetMapMode;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.GenericRecordJsonWriter;
+import org.apache.poi.util.GenericRecordUtil;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LittleEndianConsts;
 import org.apache.poi.util.LittleEndianInputStream;
-import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
@@ -76,6 +79,11 @@ public class HwmfText {
         public void draw(HwmfGraphics ctx) {
 
         }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("charExtra", () -> charExtra);
+        }
     }
     
     /**
@@ -102,7 +110,16 @@ public class HwmfText {
 
         @Override
         public String toString() {
-            return "{ colorRef: "+colorRef+" }";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public HwmfColorRef getColorRef() {
+            return colorRef;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("colorRef", this::getColorRef);
         }
     }
     
@@ -141,6 +158,14 @@ public class HwmfText {
         public void draw(HwmfGraphics ctx) {
 
         }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "breakCount", () -> breakCount,
+                "breakExtra", () -> breakExtra
+            );
+        }
     }
     
     /**
@@ -204,9 +229,14 @@ public class HwmfText {
             System.arraycopy(rawTextBytes, 0, ret, 0, stringLength);
             return ret;
         }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("text", () -> getText(StandardCharsets.US_ASCII));
+        }
     }
 
-    public static class WmfExtTextOutOptions {
+    public static class WmfExtTextOutOptions implements GenericRecord {
         /**
          * Indicates that the background color that is defined in the playback device context
          * SHOULD be used to fill the rectangle.
@@ -272,23 +302,37 @@ public class HwmfText {
         /** This bit is reserved and SHOULD NOT be used. */
         private static final BitField ETO_REVERSE_INDEX_MAP = BitFieldFactory.getInstance(0x10000);
 
-        protected int flag;
+        private static final int[] FLAGS_MASKS = {
+            0x0002, 0x0004, 0x0010, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x10000
+        };
+
+        private static final String[] FLAGS_NAMES = {
+            "OPAQUE", "CLIPPED", "GLYPH_INDEX", "RTLREADING", "NO_RECT", "SMALL_CHARS", "NUMERICSLOCAL",
+            "NUMERICSLATIN", "IGNORELANGUAGE", "PDY", "REVERSE_INDEX_MAP"
+        };
+
+        protected int flags;
 
         public int init(LittleEndianInputStream leis) {
-            flag = leis.readUShort();
+            flags = leis.readUShort();
             return LittleEndianConsts.SHORT_SIZE;
         }
 
         public boolean isOpaque() {
-            return ETO_OPAQUE.isSet(flag);
+            return ETO_OPAQUE.isSet(flags);
         }
 
         public boolean isClipped() {
-            return ETO_CLIPPED.isSet(flag);
+            return ETO_CLIPPED.isSet(flags);
         }
 
         public boolean isYDisplaced() {
-            return ETO_PDY.isSet(flag);
+            return ETO_PDY.isSet(flags);
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("flags", getBitsAsString(() -> flags, FLAGS_MASKS, FLAGS_NAMES));
         }
     }
 
@@ -417,17 +461,24 @@ public class HwmfText {
 
         @Override
         public String toString() {
-            String text = "";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        private String getGenericText() {
             try {
-                text = getText(isUnicode() ? Charsets.UTF_16LE : LocaleUtil.CHARSET_1252);
-            } catch (IOException ignored) {
+                return getText(isUnicode() ? StandardCharsets.UTF_16LE : StandardCharsets.US_ASCII);
+            } catch (IOException e) {
+                return "";
             }
+        }
 
-            return
-                "{ reference: " + pointToString(reference) +
-                ", bounds: " + boundsToString(bounds) +
-                ", text: '"+text.replaceAll("\\p{Cntrl}",".")+"'"+
-                "}";
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "reference", this::getReference,
+                "bounds", this::getBounds,
+                "text", this::getGenericText
+            );
         }
     }
     
@@ -555,12 +606,17 @@ public class HwmfText {
 
         @Override
         public String toString() {
-            return
-                "{ align: '"+ getAlignLatin() + "'" +
-                ", valign: '"+ getVAlignLatin() + "'" +
-                ", alignAsian: '"+ getAlignAsian() + "'" +
-                ", valignAsian: '"+ getVAlignAsian() + "'" +
-                "}";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "align", this::getAlignLatin,
+                "valign", this::getVAlignLatin,
+                "alignAsian", this::getAlignAsian,
+                "valignAsian", this::getVAlignAsian
+            );
         }
 
         private HwmfTextAlignment getAlignLatin() {
@@ -649,7 +705,12 @@ public class HwmfText {
 
         @Override
         public String toString() {
-            return "{ font: "+font+" } ";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("font", this::getFont);
         }
     }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfWindowing.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfWindowing.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfWindowing.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfWindowing.java Wed Sep 11 21:24:06 2019
@@ -17,10 +17,7 @@
 
 package org.apache.poi.hwmf.record;
 
-import static org.apache.poi.hwmf.record.HwmfDraw.boundsToString;
-import static org.apache.poi.hwmf.record.HwmfDraw.dimToString;
 import static org.apache.poi.hwmf.record.HwmfDraw.normalizeBounds;
-import static org.apache.poi.hwmf.record.HwmfDraw.pointToString;
 import static org.apache.poi.hwmf.record.HwmfDraw.readBounds;
 import static org.apache.poi.hwmf.record.HwmfDraw.readPointS;
 
@@ -31,10 +28,18 @@ import java.awt.geom.Dimension2D;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.Supplier;
 
+import org.apache.poi.common.usermodel.GenericRecord;
 import org.apache.poi.hwmf.draw.HwmfDrawProperties;
 import org.apache.poi.hwmf.draw.HwmfGraphics;
 import org.apache.poi.util.Dimension2DDouble;
+import org.apache.poi.util.GenericRecordJsonWriter;
+import org.apache.poi.util.GenericRecordUtil;
 import org.apache.poi.util.LittleEndianConsts;
 import org.apache.poi.util.LittleEndianInputStream;
 
@@ -71,7 +76,16 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return pointToString(origin);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Point2D getOrigin() {
+            return origin;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("origin", this::getOrigin);
         }
     }
 
@@ -112,7 +126,16 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return dimToString(extents);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Dimension2D getExtents() {
+            return extents;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("extents", this::getExtents);
         }
     }
 
@@ -148,7 +171,16 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return pointToString(offset);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Point2D getOffset() {
+            return offset;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("offset", this::getOffset);
         }
     }
 
@@ -189,8 +221,18 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return pointToString(origin);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Point2D getOrigin() {
+            return origin;
         }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("origin", this::getOrigin);
+        }
+
     }
 
     /**
@@ -234,7 +276,12 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return dimToString(size);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("size", this::getSize);
         }
     }
 
@@ -268,7 +315,16 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return pointToString(offset);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Point2D getOffset() {
+            return offset;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("offset", this::getOffset);
         }
     }
 
@@ -319,8 +375,18 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return "{ scaleX: "+scale.getWidth()+", scaleY: "+scale.getHeight()+" }";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Dimension2D getScale() {
+            return scale;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("scale", this::getScale);
         }
+
     }
 
 
@@ -373,7 +439,16 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return "{ scaleX: "+scale.getWidth()+", scaleY: "+scale.getHeight()+" }";
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Dimension2D getScale() {
+            return scale;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("scale", this::getScale);
         }
     }
 
@@ -409,8 +484,18 @@ public class HwmfWindowing {
 
         @Override
         public String toString() {
-            return pointToString(offset);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Point2D getOffset() {
+            return offset;
         }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("offset", this::getOffset);
+        }
+
     }
 
     /**
@@ -439,7 +524,16 @@ public class HwmfWindowing {
         
         @Override
         public String toString() {
-            return boundsToString(bounds);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Rectangle2D getBounds() {
+            return bounds;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("bounds", this::getBounds);
         }
     }
 
@@ -470,7 +564,16 @@ public class HwmfWindowing {
         
         @Override
         public String toString() {
-            return boundsToString(bounds);
+            return GenericRecordJsonWriter.marshal(this);
+        }
+
+        public Rectangle2D getBounds() {
+            return bounds;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("bounds", this::getBounds);
         }
     }
 
@@ -500,9 +603,18 @@ public class HwmfWindowing {
         public void draw(HwmfGraphics ctx) {
 
         }
+
+        public int getRegion() {
+            return region;
+        }
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties("region", this::getRegion);
+        }
     }
 
-    public static class WmfScanObject {
+    public static class WmfScanObject implements GenericRecord {
         /**
          * A 16-bit unsigned integer that specifies the number of horizontal (x-axis)
          * coordinates in the ScanLines array. This value MUST be a multiple of 2, since left and right
@@ -549,6 +661,19 @@ public class HwmfWindowing {
             size += LittleEndianConsts.SHORT_SIZE;
             return size;
         }
+
+        @SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            return GenericRecordUtil.getGenericProperties(
+                "count", () -> count,
+                "top", () -> top,
+                "bottom", () -> bottom,
+                "left_scanline", () -> Arrays.asList(left_scanline),
+                "right_scanline", () -> Arrays.asList(right_scanline),
+                "count2", () -> count2
+            );
+        }
     }
 
     public static class WmfCreateRegion implements HwmfRecord, HwmfObjectTableEntry {
@@ -578,7 +703,7 @@ public class HwmfWindowing {
          */
         private int maxScan;
 
-        private Rectangle2D bounds = new Rectangle2D.Double();
+        private final Rectangle2D bounds = new Rectangle2D.Double();
 
         /**
          * An array of Scan objects that define the scanlines in the region.
@@ -651,5 +776,20 @@ public class HwmfWindowing {
 
             ctx.getProperties().setRegion(region);
         }
+
+
+        @Override
+        public Map<String, Supplier<?>> getGenericProperties() {
+            final Map<String,Supplier<?>> m = new LinkedHashMap<>();
+            m.put("nextInChain", () -> nextInChain);
+            m.put("objectType", () -> objectType);
+            m.put("objectCount", () -> objectCount);
+            m.put("regionSize", () -> regionSize);
+            m.put("scanCount", () -> scanCount);
+            m.put("maxScan", () -> maxScan);
+            m.put("bounds", () -> bounds);
+            m.put("scanObjects", () -> Arrays.asList(scanObjects));
+            return Collections.unmodifiableMap(m);
+        }
     }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java Wed Sep 11 21:24:06 2019
@@ -26,9 +26,14 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.Supplier;
 
+import org.apache.poi.common.usermodel.GenericRecord;
 import org.apache.poi.hwmf.draw.HwmfDrawProperties;
 import org.apache.poi.hwmf.draw.HwmfGraphics;
 import org.apache.poi.hwmf.record.HwmfHeader;
@@ -45,7 +50,7 @@ import org.apache.poi.util.POILogger;
 import org.apache.poi.util.RecordFormatException;
 import org.apache.poi.util.Units;
 
-public class HwmfPicture {
+public class HwmfPicture implements Iterable<HwmfRecord>, GenericRecord {
     /** Max. record length - processing longer records will throw an exception */
     public static final int MAX_RECORD_LENGTH = 50_000_000;
 
@@ -227,4 +232,24 @@ public class HwmfPicture {
     public Iterable<HwmfEmbedded> getEmbeddings() {
         return () -> new HwmfEmbeddedIterator(HwmfPicture.this);
     }
+
+    @Override
+    public Iterator<HwmfRecord> iterator() {
+        return getRecords().iterator();
+    }
+
+    @Override
+    public Spliterator<HwmfRecord> spliterator() {
+        return getRecords().spliterator();
+    }
+
+    @Override
+    public Map<String, Supplier<?>> getGenericProperties() {
+        return null;
+    }
+
+    @Override
+    public List<? extends GenericRecord> getGenericChildren() {
+        return getRecords();
+    }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Wed Sep 11 21:24:06 2019
@@ -17,11 +17,12 @@
 
 package org.apache.poi.hslf.model;
 
-import static org.apache.poi.hslf.record.TextHeaderAtom.BODY_TYPE;
-import static org.apache.poi.hslf.record.TextHeaderAtom.CENTER_TITLE_TYPE;
-import static org.apache.poi.hslf.record.TextHeaderAtom.CENTRE_BODY_TYPE;
-import static org.apache.poi.hslf.record.TextHeaderAtom.TITLE_TYPE;
+import static org.apache.poi.sl.usermodel.TextShape.TextPlaceholder.BODY;
+import static org.apache.poi.sl.usermodel.TextShape.TextPlaceholder.CENTER_BODY;
+import static org.apache.poi.sl.usermodel.TextShape.TextPlaceholder.CENTER_TITLE;
+import static org.apache.poi.sl.usermodel.TextShape.TextPlaceholder.TITLE;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
@@ -33,7 +34,6 @@ import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
 import org.apache.poi.hslf.model.textproperties.TextProp;
 import org.apache.poi.hslf.record.Environment;
-import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.usermodel.HSLFMasterSheet;
 import org.apache.poi.hslf.usermodel.HSLFSlide;
 import org.apache.poi.hslf.usermodel.HSLFSlideMaster;
@@ -42,6 +42,7 @@ import org.apache.poi.hslf.usermodel.HSL
 import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
 import org.apache.poi.hslf.usermodel.HSLFTextRun;
 import org.apache.poi.hslf.usermodel.HSLFTitleMaster;
+import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
 import org.junit.Test;
 
 /**
@@ -63,30 +64,30 @@ public final class TestSlideMaster {
         assertEquals(2, ppt.getSlideMasters().size());
 
         //character attributes
-        assertEquals(40, getMasterVal(ppt, 0, TITLE_TYPE, "font.size", true));
-        assertEquals(48, getMasterVal(ppt, 1, TITLE_TYPE, "font.size", true));
+        assertEquals(40, getMasterVal(ppt, 0, TITLE, "font.size", true));
+        assertEquals(48, getMasterVal(ppt, 1, TITLE, "font.size", true));
 
-        int font1 = getMasterVal(ppt, 0, TITLE_TYPE, "font.index", true);
-        int font2 = getMasterVal(ppt, 1, TITLE_TYPE, "font.index", true);
+        int font1 = getMasterVal(ppt, 0, TITLE, "font.index", true);
+        int font2 = getMasterVal(ppt, 1, TITLE, "font.index", true);
         assertEquals("Arial", env.getFontCollection().getFontInfo(font1).getTypeface());
         assertEquals("Georgia", env.getFontCollection().getFontInfo(font2).getTypeface());
 
-        CharFlagsTextProp prop1 = getMasterProp(ppt, 0, TITLE_TYPE, "char_flags", true);
-        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
-
-        CharFlagsTextProp prop2 = getMasterProp(ppt, 1, TITLE_TYPE, "char_flags", true);
-        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        CharFlagsTextProp prop1 = getMasterProp(ppt, 0, TITLE, "char_flags", true);
+        assertFalse(prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertFalse(prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertTrue(prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+
+        CharFlagsTextProp prop2 = getMasterProp(ppt, 1, TITLE, "char_flags", true);
+        assertFalse(prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertTrue(prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         //now paragraph attributes
-        assertEquals(0x266B, getMasterVal(ppt, 0, BODY_TYPE, "bullet.char", false));
-        assertEquals(0x2022, getMasterVal(ppt, 1, BODY_TYPE, "bullet.char", false));
+        assertEquals(0x266B, getMasterVal(ppt, 0, BODY, "bullet.char", false));
+        assertEquals(0x2022, getMasterVal(ppt, 1, BODY, "bullet.char", false));
 
-        int b1 = getMasterVal(ppt, 0, BODY_TYPE, "bullet.font", false);
-        int b2 = getMasterVal(ppt, 1, BODY_TYPE, "bullet.font", false);
+        int b1 = getMasterVal(ppt, 0, BODY, "bullet.font", false);
+        int b2 = getMasterVal(ppt, 1, BODY, "bullet.font", false);
         assertEquals("Arial", env.getFontCollection().getFontInfo(b1).getTypeface());
         assertEquals("Georgia", env.getFontCollection().getFontInfo(b2).getTypeface());
 
@@ -94,11 +95,11 @@ public final class TestSlideMaster {
     }
 
     @SuppressWarnings("unchecked")
-    private static <T extends TextProp> T getMasterProp(HSLFSlideShow ppt, int masterIdx, int txtype, String propName, boolean isCharacter) {
-        return (T)ppt.getSlideMasters().get(masterIdx).getPropCollection(txtype, 0, propName, isCharacter).findByName(propName);
+    private static <T extends TextProp> T getMasterProp(HSLFSlideShow ppt, int masterIdx, TextPlaceholder txtype, String propName, boolean isCharacter) {
+        return (T)ppt.getSlideMasters().get(masterIdx).getPropCollection(txtype.nativeId, 0, propName, isCharacter).findByName(propName);
     }
 
-    private static int getMasterVal(HSLFSlideShow ppt, int masterIdx, int txtype, String propName, boolean isCharacter) {
+    private static int getMasterVal(HSLFSlideShow ppt, int masterIdx, TextPlaceholder txtype, String propName, boolean isCharacter) {
         return getMasterProp(ppt, masterIdx, txtype, propName, isCharacter).getValue();
     }
 
@@ -111,17 +112,17 @@ public final class TestSlideMaster {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         assertEquals(1, ppt.getTitleMasters().size());
 
-        assertEquals(40, getMasterVal(ppt, 0, CENTER_TITLE_TYPE, "font.size", true));
-        CharFlagsTextProp prop1 = getMasterProp(ppt, 0, CENTER_TITLE_TYPE, "char_flags", true);
-        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
-
-        assertEquals(32, getMasterVal(ppt, 0, CENTRE_BODY_TYPE, "font.size", true));
-        CharFlagsTextProp prop2 = getMasterProp(ppt, 0, CENTRE_BODY_TYPE, "char_flags", true);
-        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        assertEquals(40, getMasterVal(ppt, 0, CENTER_TITLE, "font.size", true));
+        CharFlagsTextProp prop1 = getMasterProp(ppt, 0, CENTER_TITLE, "char_flags", true);
+        assertFalse(prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertFalse(prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertTrue(prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+
+        assertEquals(32, getMasterVal(ppt, 0, CENTER_BODY, "font.size", true));
+        CharFlagsTextProp prop2 = getMasterProp(ppt, 0, CENTER_BODY, "char_flags", true);
+        assertFalse(prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertFalse(prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         ppt.close();
     }
@@ -138,18 +139,18 @@ public final class TestSlideMaster {
 
         for (List<HSLFTextParagraph> txt : slide.getTextParagraphs()) {
             HSLFTextRun rt = txt.get(0).getTextRuns().get(0);
-            switch(txt.get(0).getRunType()){
-                case TextHeaderAtom.CENTER_TITLE_TYPE:
+            switch(TextPlaceholder.fromNativeId(txt.get(0).getRunType())){
+                case CENTER_TITLE:
                     assertEquals("Arial", rt.getFontFamily());
                     assertEquals(32, rt.getFontSize(), 0);
-                    assertEquals(true, rt.isBold());
-                    assertEquals(true, rt.isUnderlined());
+                    assertTrue(rt.isBold());
+                    assertTrue(rt.isUnderlined());
                     break;
-                case TextHeaderAtom.CENTRE_BODY_TYPE:
+                case CENTER_BODY:
                     assertEquals("Courier New", rt.getFontFamily());
                     assertEquals(20, rt.getFontSize(), 0);
-                    assertEquals(true, rt.isBold());
-                    assertEquals(false, rt.isUnderlined());
+                    assertTrue(rt.isBold());
+                    assertFalse(rt.isUnderlined());
                     break;
             }
 
@@ -167,12 +168,12 @@ public final class TestSlideMaster {
         assertEquals(3, slide.size());
         for (List<HSLFTextParagraph> tparas : slide.get(0).getTextParagraphs()) {
             HSLFTextParagraph tpara = tparas.get(0);
-            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+            if (tpara.getRunType() == TITLE.nativeId){
                 HSLFTextRun rt = tpara.getTextRuns().get(0);
                 assertEquals(40, rt.getFontSize(), 0);
-                assertEquals(true, rt.isUnderlined());
+                assertTrue(rt.isUnderlined());
                 assertEquals("Arial", rt.getFontFamily());
-            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+            } else if (tpara.getRunType() == BODY.nativeId){
                 HSLFTextRun rt = tpara.getTextRuns().get(0);
                 assertEquals(0, tpara.getIndentLevel());
                 assertEquals(32, rt.getFontSize(), 0);
@@ -189,12 +190,12 @@ public final class TestSlideMaster {
 
         for (List<HSLFTextParagraph> tparas : slide.get(1).getTextParagraphs()) {
             HSLFTextParagraph tpara = tparas.get(0);
-            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+            if (tpara.getRunType() == TITLE.nativeId){
                 HSLFTextRun rt = tpara.getTextRuns().get(0);
                 assertEquals(48, rt.getFontSize(), 0);
-                assertEquals(true, rt.isItalic());
+                assertTrue(rt.isItalic());
                 assertEquals("Georgia", rt.getFontFamily());
-            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+            } else if (tpara.getRunType() == BODY.nativeId){
                 HSLFTextRun rt;
                 rt = tpara.getTextRuns().get(0);
                 assertEquals(0, tpara.getIndentLevel());
@@ -253,12 +254,12 @@ public final class TestSlideMaster {
 
         for (List<HSLFTextParagraph> tparas : slide.getTextParagraphs()) {
             HSLFTextParagraph tpara = tparas.get(0);
-            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+            if (tpara.getRunType() == TITLE.nativeId){
                 HSLFTextRun rt = tpara.getTextRuns().get(0);
                 assertEquals(40, rt.getFontSize(), 0);
-                assertEquals(true, rt.isUnderlined());
+                assertTrue(rt.isUnderlined());
                 assertEquals("Arial", rt.getFontFamily());
-            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+            } else if (tpara.getRunType() == BODY.nativeId){
                 int[] indents = {32, 28, 24};
                 for (HSLFTextRun rt : tpara.getTextRuns()) {
                     int indent = tpara.getIndentLevel();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Wed Sep 11 21:24:06 2019
@@ -29,7 +29,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.usermodel.HSLFShape;
 import org.apache.poi.hslf.usermodel.HSLFSlide;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
@@ -39,6 +38,7 @@ import org.apache.poi.sl.usermodel.Shape
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.sl.usermodel.SlideShow;
 import org.apache.poi.sl.usermodel.TableShape;
+import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
 import org.junit.Test;
 
 /**
@@ -60,7 +60,7 @@ public final class TestTable {
 
         HSLFTableCell cell = tbl.getCell(0, 0);
         //table cells have type=TextHeaderAtom.OTHER_TYPE, see bug #46033
-        assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextParagraphs().get(0).getRunType());
+        assertEquals(TextPlaceholder.OTHER.nativeId, cell.getTextParagraphs().get(0).getRunType());
 
         HSLFShape tblSh = slide.getShapes().get(0);
         assertTrue(tblSh instanceof HSLFTable);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java Wed Sep 11 21:24:06 2019
@@ -18,10 +18,11 @@
 package org.apache.poi.hslf.record;
 
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
 
+import org.apache.poi.ddf.EscherRecordTypes;
+import org.junit.Test;
+
 /**
  * Tests that RecordTypes returns the right records and classes when asked
  */
@@ -35,9 +36,9 @@ public final class TestRecordTypes {
 
     @Test
 	public void testEscherNameLookups() {
-		assertEquals("EscherDggContainer", RecordTypes.EscherDggContainer.name());
-		assertEquals("EscherClientTextbox", RecordTypes.EscherClientTextbox.name());
-		assertEquals("EscherSelection", RecordTypes.EscherSelection.name());
+		assertEquals("DGG_CONTAINER", EscherRecordTypes.DGG_CONTAINER.name());
+		assertEquals("CLIENT_TEXTBOX", EscherRecordTypes.CLIENT_TEXTBOX.name());
+		assertEquals("SELECTION", EscherRecordTypes.SELECTION.name());
 	}
 
     @Test
@@ -46,11 +47,4 @@ public final class TestRecordTypes {
 		// This is checking the "unhandled default" stuff works
 		assertEquals(RecordTypes.UnknownRecordPlaceholder, RecordTypes.forTypeID(-10));
 	}
-
-    @Test
-    public void testEscherClassLookups() {
-		// Should all come back with null, as DDF handles them
-		assertEquals(null, RecordTypes.EscherDggContainer.recordConstructor);
-		assertEquals(null, RecordTypes.EscherBStoreContainer.recordConstructor);
-	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextHeaderAtom.java Wed Sep 11 21:24:06 2019
@@ -18,9 +18,11 @@
 package org.apache.poi.hslf.record;
 
 
-import junit.framework.TestCase;
 import java.io.ByteArrayOutputStream;
 
+import junit.framework.TestCase;
+import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
+
 /**
  * Tests that TextHeaderAtom works properly
  *
@@ -40,9 +42,9 @@ public final class TestTextHeaderAtom ex
 		TextHeaderAtom n_tha = new TextHeaderAtom(notes_data,0,12);
 		TextHeaderAtom t_tha = new TextHeaderAtom(title_data,0,12);
 		TextHeaderAtom b_tha = new TextHeaderAtom(body_data,0,12);
-		assertEquals(TextHeaderAtom.NOTES_TYPE, n_tha.getTextType());
-		assertEquals(TextHeaderAtom.TITLE_TYPE, t_tha.getTextType());
-		assertEquals(TextHeaderAtom.BODY_TYPE, b_tha.getTextType());
+		assertEquals(TextPlaceholder.NOTES.nativeId, n_tha.getTextType());
+		assertEquals(TextPlaceholder.TITLE.nativeId, t_tha.getTextType());
+		assertEquals(TextPlaceholder.BODY.nativeId, b_tha.getTextType());
 	}
 
 	public void testWrite() throws Exception {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java Wed Sep 11 21:24:06 2019
@@ -22,10 +22,10 @@ import java.util.List;
 
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
-
 import org.apache.poi.hslf.model.textproperties.TextProp;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
 
 
 /**
@@ -47,26 +47,26 @@ public final class TestTxMasterStyleAtom
         TxMasterStyleAtom[] txmaster = getMasterStyles();
         for (final TxMasterStyleAtom atom : txmaster) {
             final int txtype = atom.getTextType();
-            switch (txtype){
-                case TextHeaderAtom.TITLE_TYPE:
+            switch (TextPlaceholder.fromNativeId(txtype)){
+                case TITLE:
                     checkTitleType(atom);
                     break;
-                case TextHeaderAtom.BODY_TYPE:
+                case BODY:
                     checkBodyType(atom);
                     break;
-                case TextHeaderAtom.NOTES_TYPE:
+                case NOTES:
                     checkNotesType(atom);
                     break;
-                case TextHeaderAtom.OTHER_TYPE:
+                case OTHER:
                     checkOtherType(atom);
                     break;
-                case TextHeaderAtom.CENTRE_BODY_TYPE:
+                case CENTER_BODY:
                     break;
-                case TextHeaderAtom.CENTER_TITLE_TYPE:
+                case CENTER_TITLE:
                     break;
-                case TextHeaderAtom.HALF_BODY_TYPE:
+                case HALF_BODY:
                     break;
-                case TextHeaderAtom.QUARTER_BODY_TYPE:
+                case QUARTER_BODY:
                     break;
                 default:
                     fail("Unknown text type: " + txtype);
@@ -230,7 +230,7 @@ public final class TestTxMasterStyleAtom
                 }
 
                 assertEquals("Document.Environment must contain TxMasterStyleAtom  with type=TextHeaderAtom.OTHER_TYPE",
-                        TextHeaderAtom.OTHER_TYPE, txstyle.getTextType());
+                        TextPlaceholder.OTHER.nativeId, txstyle.getTextType());
                 lst.add(txstyle);
             }
         }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java Wed Sep 11 21:24:06 2019
@@ -32,8 +32,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.poi.hslf.HSLFTestDataSamples;
-import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.sl.usermodel.ShapeType;
+import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
 import org.junit.Test;
 
 /**
@@ -90,9 +90,9 @@ public final class TestTextShape {
                     assertEquals("Text in a TextBox", rawText);
                     break;
                 case RECT:
-                    if(runType == TextHeaderAtom.OTHER_TYPE) {
+                    if(runType == TextPlaceholder.OTHER.nativeId) {
                         assertEquals("Rectangle", rawText);
-                    } else if(runType == TextHeaderAtom.TITLE_TYPE) {
+                    } else if(runType == TextPlaceholder.TITLE.nativeId) {
                         assertEquals("Title Placeholder", rawText);
                     }
                     break;

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwmf/TestHwmfParsing.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwmf/TestHwmfParsing.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwmf/TestHwmfParsing.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwmf/TestHwmfParsing.java Wed Sep 11 21:24:06 2019
@@ -20,44 +20,22 @@ package org.apache.poi.hwmf;
 import static org.apache.poi.POITestCase.assertContains;
 import static org.junit.Assert.assertEquals;
 
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Dimension2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
 import java.io.File;
-import java.io.FileFilter;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
-import java.util.Locale;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.imageio.ImageIO;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hwmf.record.HwmfFill.HwmfImageRecord;
 import org.apache.poi.hwmf.record.HwmfFont;
 import org.apache.poi.hwmf.record.HwmfRecord;
 import org.apache.poi.hwmf.record.HwmfRecordType;
 import org.apache.poi.hwmf.record.HwmfText;
-import org.apache.poi.hwmf.usermodel.HwmfEmbedded;
 import org.apache.poi.hwmf.usermodel.HwmfPicture;
-import org.apache.poi.sl.usermodel.PictureData;
-import org.apache.poi.sl.usermodel.PictureData.PictureType;
-import org.apache.poi.sl.usermodel.SlideShow;
-import org.apache.poi.sl.usermodel.SlideShowFactory;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.RecordFormatException;
-import org.apache.poi.util.Units;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -65,6 +43,9 @@ public class TestHwmfParsing {
 
     private static final POIDataSamples samples = POIDataSamples.getSlideShowInstance();
 
+    // ******************************************************************************
+    // for manual mass parsing and rendering tests of .wmfs use HemfPictureTest.paint() !
+    // ******************************************************************************
 
     @Test
     public void parse() throws IOException {
@@ -82,158 +63,6 @@ public class TestHwmfParsing {
         }
     }
 
-    @Test
-    @Ignore("This is work-in-progress and not a real unit test ...")
-    public void paint() throws IOException {
-        boolean dumpEmbedded = true;
-        boolean dumpRecords = false;
-
-        File f = new File("testme.wmf");
-        FileInputStream fis = new FileInputStream(f);
-        HwmfPicture wmf = new HwmfPicture(fis);
-        fis.close();
-        
-        Dimension2D dim = wmf.getSize();
-        double width = Units.pointsToPixel(dim.getWidth());
-        // keep aspect ratio for height
-        double height = Units.pointsToPixel(dim.getHeight());
-        double scale = (width > height) ? 1500 / width : 1500 / width;
-        width = Math.abs(width * scale);
-        height = Math.abs(height * scale);
-
-        BufferedImage bufImg = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_INT_ARGB);
-        Graphics2D g = bufImg.createGraphics();
-        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
-        g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
-        
-        wmf.draw(g, new Rectangle2D.Double(0,0,width,height));
-
-        g.dispose();
-        
-        ImageIO.write(bufImg, "PNG", new File("bla.png"));
-
-        if (dumpEmbedded) {
-            int embIdx = 0;
-            for (HwmfEmbedded emb : wmf.getEmbeddings()) {
-                final File embName = new File("build/tmp", "emb_"+embIdx + emb.getEmbeddedType().extension);
-                try (FileOutputStream fos = new FileOutputStream(embName)) {
-                    fos.write(emb.getRawData());
-                }
-                embIdx++;
-            }
-        }
-
-        if (dumpRecords) {
-            try (FileWriter fw = new FileWriter("wmf-records.log")) {
-                for (HwmfRecord r : wmf.getRecords()) {
-                    fw.write(r.getWmfRecordType().name());
-                    fw.write(":");
-                    fw.write(r.toString());
-                    fw.write("\n");
-                }
-            }
-        }
-    }
-
-    @Test
-    @Ignore("This is work-in-progress and not a real unit test ...")
-    public void fetchWmfFromGovdocs() throws IOException {
-        URL url = new URL("http://digitalcorpora.org/corpora/files/govdocs1/by_type/ppt.zip");
-        File outdir = new File("build/ppt");
-        outdir.mkdirs();
-        ZipInputStream zis = new ZipInputStream(url.openStream());
-        ZipEntry ze;
-        while ((ze = zis.getNextEntry()) != null) {
-            String basename = ze.getName().replaceAll(".*?([^/]+)\\.wmf", "$1");
-            FilterInputStream fis = new FilterInputStream(zis){
-                @Override
-                public void close() throws IOException {}
-            };
-            try {
-                SlideShow<?,?> ss = SlideShowFactory.create(fis);
-                int wmfIdx = 1;
-                for (PictureData pd : ss.getPictureData()) {
-                    if (pd.getType() != PictureType.WMF) {
-                        continue;
-                    }
-                    byte[] wmfData = pd.getData();
-                    String filename = String.format(Locale.ROOT, "%s-%04d.wmf", basename, wmfIdx);
-                    FileOutputStream fos = new FileOutputStream(new File(outdir, filename));
-                    fos.write(wmfData);
-                    fos.close();
-                    wmfIdx++;
-                }
-                ss.close();
-            } catch (Exception e) {
-                System.out.println(ze.getName()+" ignored.");
-            }
-        }
-    }
-
-    @Test
-    @Ignore("This is work-in-progress and not a real unit test ...")
-    public void parseWmfs() throws IOException {
-        // parse and render the extracted wmfs from the fetchWmfFromGovdocs step
-        boolean outputFiles = false;
-        boolean renderWmf = true;
-        File indir = new File("E:\\project\\poi\\misc\\govdocs-ppt");
-        File outdir = new File("build/wmf");
-        outdir.mkdirs();
-        final String startFile = "";
-        File[] files = indir.listFiles(new FileFilter() {
-            boolean foundStartFile;
-
-            @Override
-            public boolean accept(File pathname) {
-                foundStartFile |= startFile.isEmpty() || pathname.getName().contains(startFile);
-                return foundStartFile && pathname.getName().matches("(?i).*\\.wmf?$");
-            }
-        });
-        for (File f : files) {
-            try {
-                String basename = f.getName().replaceAll(".*?([^/]+)\\.wmf", "$1");
-                FileInputStream fis = new FileInputStream(f);
-                HwmfPicture wmf = new HwmfPicture(fis);
-                fis.close();
-                
-                int bmpIndex = 1;
-                for (HwmfRecord r : wmf.getRecords()) {
-                    if (r instanceof HwmfImageRecord) {
-                        BufferedImage bi = ((HwmfImageRecord)r).getImage();
-                        if (bi != null && outputFiles) {
-                            String filename = String.format(Locale.ROOT, "%s-%04d.png", basename, bmpIndex);
-                            ImageIO.write(bi, "PNG", new File(outdir, filename));
-                        }
-                        bmpIndex++;
-                    }
-                }
-
-                if (renderWmf) {
-                    Dimension2D dim = wmf.getSize();
-                    int width = Units.pointsToPixel(dim.getWidth());
-                    // keep aspect ratio for height
-                    int height = Units.pointsToPixel(dim.getHeight());
-
-                    BufferedImage bufImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
-                    Graphics2D g = bufImg.createGraphics();
-                    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-                    g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-                    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
-                    g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
-                    
-                    wmf.draw(g);
-
-                    g.dispose();
-                    
-                    ImageIO.write(bufImg, "PNG", new File(outdir, basename+".png"));
-                }
-            } catch (Exception e) {
-                System.out.println(f.getName()+" ignored.");                
-            }
-        }
-    }
 
     @Test
     @Ignore("If we decide we can use common crawl file specified, we can turn this back on")

Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java?rev=1866808&r1=1866807&r2=1866808&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java Wed Sep 11 21:24:06 2019
@@ -161,6 +161,8 @@ public final class TestEscherContainerRe
         public String getRecordName() { return ""; }
         @Override
 		protected Object[][] getAttributeMap() { return null; }
+		@Override
+		public Enum getGenericRecordType() { return EscherRecordTypes.UNKNOWN; }
 	}
 
     @Test



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org