From: Nick Burch Date: Sat, 8 Nov 2014 12:21:27 +0000 (+0000) Subject: Test from Tim to include PropertyList in poi-ooxml-schemas X-Git-Tag: REL_3_11_BETA3~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=06376b13d644c47ad503095ee97ded6ef5961954;p=poi.git Test from Tim to include PropertyList in poi-ooxml-schemas git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637548 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java index 1db28cb297..0cf3efa53c 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java @@ -29,6 +29,7 @@ import java.util.TimeZone; import junit.framework.TestCase; +import org.apache.poi.POIDataSamples; import org.apache.poi.openxml4j.OpenXML4JTestDataSamples; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; @@ -36,6 +37,8 @@ import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart; import org.apache.poi.openxml4j.util.Nullable; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty; public final class TestPackageCoreProperties extends TestCase { private static final POILogger logger = POILogFactory.getLogger(TestPackageCoreProperties.class); @@ -226,4 +229,20 @@ public final class TestPackageCoreProperties extends TestCase { // Check assertEquals("Stefan Kopf", props.getCreatorProperty().getValue()); } + + public void testListOfCustomProperties() throws Exception { + File inp = POIDataSamples.getSpreadSheetInstance().getFile("ExcelWithAttachments.xlsm"); + OPCPackage pkg = OPCPackage.open(inp, PackageAccess.READ); + XSSFWorkbook wb = new XSSFWorkbook(pkg); + + assertNotNull(wb.getProperties()); + assertNotNull(wb.getProperties().getCustomProperties()); + + for (CTProperty prop : wb.getProperties().getCustomProperties().getUnderlyingProperties().getPropertyList()) { + assertNotNull(prop); + } + + wb.close(); + pkg.close(); + } }