You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ni...@apache.org on 2017/10/07 05:04:52 UTC

[tika] branch master updated: TIKA-2473 PCX and DCX mime magic and detection unit tests

This is an automated email from the ASF dual-hosted git repository.

nick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/master by this push:
     new 450ab4b  TIKA-2473 PCX and DCX mime magic and detection unit tests
450ab4b is described below

commit 450ab4bee5b91663c8d524ad1f6357147c6cd40f
Author: Nick Burch <ni...@apache.org>
AuthorDate: Sat Oct 7 06:04:29 2017 +0100

    TIKA-2473 PCX and DCX mime magic and detection unit tests
---
 .../org/apache/tika/mime/tika-mimetypes.xml        | 30 +++++++++++++++++++---
 .../java/org/apache/tika/TikaDetectionTest.java    |  4 ++-
 .../java/org/apache/tika/mime/TestMimeTypes.java   | 13 ++++++++++
 3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
index da67270..dd5d066 100644
--- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
+++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
@@ -5247,6 +5247,33 @@
     <glob pattern="*.wbmp"/>
   </mime-type>
 
+  <mime-type type="image/vnd.zbrush.dcx">
+    <acronym>DCX</acronym>
+    <_comment>ZSoft Multi-Page Paintbrush</_comment>
+    <alias type="image/x-dcx"/>
+    <magic priority="50">
+      <match value="0xB168DE3A" type="string" offset="0"/>
+    </magic>
+    <glob pattern="*.dcx"/>
+  </mime-type>
+
+  <mime-type type="image/vnd.zbrush.pcx">
+    <acronym>PCX</acronym>
+    <_comment>ZSoft Paintbrush PiCture eXchange</_comment>
+    <alias type="image/x-pcx"/>
+    <alias type="image/x-pc-paintbrush"/>
+    <magic priority="40">
+      <match value="0x0A" type="string" offset="0">
+        <match value="0x00" type="string" offset="1"/>
+        <match value="0x02" type="string" offset="1"/>
+        <match value="0x03" type="string" offset="1"/>
+        <match value="0x04" type="string" offset="1"/>
+        <match value="0x05" type="string" offset="1"/>
+      </match>
+    </magic>
+    <glob pattern="*.pcx"/>
+  </mime-type>
+
   <mime-type type="image/webp">
     <acronym>WEBP</acronym>
     <tika:link>http://en.wikipedia.org/wiki/WebP</tika:link>
@@ -5347,9 +5374,6 @@
     </magic>
   </mime-type>
 
-  <mime-type type="image/x-pcx">
-    <glob pattern="*.pcx"/>
-  </mime-type>
   <mime-type type="image/x-pict">
     <_comment>Apple Macintosh QuickDraw/PICT Format</_comment>
     <magic priority="50">
diff --git a/tika-core/src/test/java/org/apache/tika/TikaDetectionTest.java b/tika-core/src/test/java/org/apache/tika/TikaDetectionTest.java
index 42f1234..a642b47 100644
--- a/tika-core/src/test/java/org/apache/tika/TikaDetectionTest.java
+++ b/tika-core/src/test/java/org/apache/tika/TikaDetectionTest.java
@@ -727,7 +727,9 @@ public class TikaDetectionTest {
         // Differ from httpd - An official mimetype has subsequently been issued
         //  favicon.ico +friends should now be image/vnd.microsoft.icon
         //assertEquals("image/x-icon", tika.detect("x.ico"));
-        assertEquals("image/x-pcx", tika.detect("x.pcx"));
+        // Differ from httpd - An official mimetype has subsequently been issued
+        //  pcx PiCture eXchange files should now be image/vnd.zbrush.pcx
+        //assertEquals("image/x-pcx", tika.detect("x.pcx"));
         assertEquals("image/x-pict", tika.detect("x.pic"));
         assertEquals("image/x-pict", tika.detect("x.pct"));
         assertEquals("image/x-portable-anymap", tika.detect("x.pnm"));
diff --git a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
index cc2f1bf..058035c 100644
--- a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
+++ b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
@@ -507,6 +507,19 @@ public class TestMimeTypes {
     }
 
     @Test
+    public void testPcxDetection() throws Exception {
+        // Single PCX file
+        assertType("image/vnd.zbrush.pcx", "testPCX.pcx");
+        assertTypeByData("image/vnd.zbrush.pcx", "testPCX.pcx");
+        assertTypeByName("image/vnd.zbrush.pcx", "x.pcx");
+
+        // Multi-Page PCX = DCX
+        assertType("image/vnd.zbrush.dcx", "testDCX.dcx");
+        assertTypeByData("image/vnd.zbrush.dcx", "testDCX.dcx");
+        assertTypeByName("image/vnd.zbrush.dcx", "x.dcx");
+    }
+
+    @Test
     public void testCgmDetection() throws Exception {
         // TODO: Need a test image file
         assertTypeByName("image/cgm", "x.cgm");

-- 
To stop receiving notification emails like this one, please contact
['"commits@tika.apache.org" <co...@tika.apache.org>'].