Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4DD731094C for ; Thu, 20 Feb 2014 00:07:18 +0000 (UTC) Received: (qmail 24844 invoked by uid 500); 20 Feb 2014 00:07:01 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 24825 invoked by uid 500); 20 Feb 2014 00:06:59 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 24784 invoked by uid 99); 20 Feb 2014 00:06:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Feb 2014 00:06:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Feb 2014 00:06:55 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F200B2388994; Thu, 20 Feb 2014 00:06:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1570002 - in /poi/trunk: src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java test-data/openxml4j/ContentTypeHasEntities.ooxml Date: Thu, 20 Feb 2014 00:06:34 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140220000634.F200B2388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nick Date: Thu Feb 20 00:06:34 2014 New Revision: 1570002 URL: http://svn.apache.org/r1570002 Log: Another content types test, for #55026 Added: poi/trunk/test-data/openxml4j/ContentTypeHasEntities.ooxml (with props) Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java?rev=1570002&r1=1570001&r2=1570002&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java Thu Feb 20 00:06:34 2014 @@ -107,6 +107,12 @@ public final class XWPFRelation extends "/word/footer#.xml", XWPFFooter.class ); + public static final XWPFRelation THEME = new XWPFRelation( + "application/vnd.openxmlformats-officedocument.theme+xml", + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", + "/word/theme/theme#.xml", + null + ); public static final XWPFRelation HYPERLINK = new XWPFRelation( null, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java?rev=1570002&r1=1570001&r2=1570002&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestContentType.java Thu Feb 20 00:06:34 2014 @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.apache.poi.openxml4j.OpenXML4JTestDataSamples; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.internal.ContentType; +import org.apache.poi.xwpf.usermodel.XWPFRelation; /** * Tests for content type (ContentType class). @@ -142,8 +143,29 @@ public final class TestContentType exten * OOXML content types don't need entities, but we shouldn't * barf if we get one from a third party system that added them */ - public void testFileWithContentTypeEntities() { - // TODO + public void testFileWithContentTypeEntities() throws Exception { + InputStream is = OpenXML4JTestDataSamples.openSampleStream("ContentTypeHasEntities.ooxml"); + OPCPackage p = OPCPackage.open(is); + + // Check we found the contents of it + boolean foundCoreProps = false, foundDocument = false, foundTheme1 = false; + for (PackagePart part : p.getParts()) { + if (part.getPartName().toString().equals("/docProps/core.xml")) { + assertEquals(ContentTypes.CORE_PROPERTIES_PART, part.getContentType()); + foundCoreProps = true; + } + if (part.getPartName().toString().equals("/word/document.xml")) { + assertEquals(XWPFRelation.DOCUMENT.getContentType(), part.getContentType()); + foundDocument = true; + } + if (part.getPartName().toString().equals("/word/theme/theme1.xml")) { + assertEquals(XWPFRelation.THEME.getContentType(), part.getContentType()); + foundTheme1 = true; + } + } + assertTrue("Core not found in " + p.getParts(), foundCoreProps); + assertTrue("Document not found in " + p.getParts(), foundDocument); + assertTrue("Theme1 not found in " + p.getParts(), foundTheme1); } /** Added: poi/trunk/test-data/openxml4j/ContentTypeHasEntities.ooxml URL: http://svn.apache.org/viewvc/poi/trunk/test-data/openxml4j/ContentTypeHasEntities.ooxml?rev=1570002&view=auto ============================================================================== Binary file - no diff available. Propchange: poi/trunk/test-data/openxml4j/ContentTypeHasEntities.ooxml ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org