]> source.dussan.org Git - poi.git/commitdiff
rename emf_2003_image.doc to Bug41898.doc and move test to TestBugs class
authorSergey Vladimirov <sergey@apache.org>
Tue, 9 Aug 2011 12:50:15 +0000 (12:50 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 9 Aug 2011 12:50:15 +0000 (12:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1155339 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
test-data/document/Bug41898.doc [new file with mode: 0644]
test-data/document/emf_2003_image.doc [deleted file]

index 820d7ba239f262274503608145ff8e3434d86d5b..7a6db7f2e7ccbbb68c5e6098241aaa24c7d10239 100644 (file)
@@ -21,6 +21,8 @@ import java.io.InputStream;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.poi.util.LittleEndian;
+
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 import org.apache.commons.codec.digest.DigestUtils;
@@ -149,6 +151,38 @@ public class TestBugs extends TestCase
         extractor.getText();
     }
 
+    /**
+     * [FAILING] 41898 - Word 2003 pictures cannot be extracted
+     */
+    public void Bug41898()
+    {
+        /*
+         * Commenting out this test case temporarily. The file emf_2003_image
+         * does not contain any pictures. Instead it has an office drawing
+         * object. Need to rewrite this test after revisiting the implementation
+         * of office drawing objects. -- (nick?)
+         */
+        HWPFDocument doc = HWPFTestDataSamples.openSampleFile( "Bug41898.doc" );
+        List<Picture> pics = doc.getPicturesTable().getAllPictures();
+
+        assertNotNull( pics );
+        assertEquals( 1, pics.size() );
+
+        Picture pic = pics.get( 0 );
+        assertNotNull( pic.suggestFileExtension() );
+        assertNotNull( pic.suggestFullFileName() );
+
+        // This one's tricky
+        // TODO: Fix once we've sorted bug #41898
+        assertNotNull( pic.getContent() );
+        assertNotNull( pic.getRawContent() );
+
+        // These are probably some sort of offset, need to figure them out
+        assertEquals( 4, pic.getSize() );
+        assertEquals( 0x80000000l, LittleEndian.getUInt( pic.getContent() ) );
+        assertEquals( 0x80000000l, LittleEndian.getUInt( pic.getRawContent() ) );
+    }
+
     /**
      * Bug 34898 - WordExtractor doesn't read the whole string from the file
      */
index 938b77a01853b743207be1a4622d0d1dbc205945..d23a898d2a3a2bf353be9bb9622fbe4691786734 100644 (file)
@@ -108,36 +108,6 @@ public final class TestPictures extends TestCase {
                }
        }
 
-       /**
-        * emf image, with a crazy offset
-        */
-       public void disabled_testEmfComplexImage() {
-
-               // Commenting out this test case temporarily. The file emf_2003_image does not contain any
-               // pictures. Instead it has an office drawing object. Need to rewrite this test after
-               // revisiting the implementation of office drawing objects.
-
-               HWPFDocument doc = HWPFTestDataSamples.openSampleFile("emf_2003_image.doc");
-               List<Picture> pics = doc.getPicturesTable().getAllPictures();
-
-               assertNotNull(pics);
-               assertEquals(1, pics.size());
-
-               Picture pic = pics.get(0);
-               assertNotNull(pic.suggestFileExtension());
-               assertNotNull(pic.suggestFullFileName());
-
-               // This one's tricky
-               // TODO: Fix once we've sorted bug #41898
-               assertNotNull(pic.getContent());
-               assertNotNull(pic.getRawContent());
-
-               // These are probably some sort of offset, need to figure them out
-               assertEquals(4, pic.getSize());
-               assertEquals(0x80000000l, LittleEndian.getUInt(pic.getContent()));
-               assertEquals(0x80000000l, LittleEndian.getUInt(pic.getRawContent()));
-       }
-
        public void testPicturesWithTable() {
                HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug44603.doc");
 
diff --git a/test-data/document/Bug41898.doc b/test-data/document/Bug41898.doc
new file mode 100644 (file)
index 0000000..a475813
Binary files /dev/null and b/test-data/document/Bug41898.doc differ
diff --git a/test-data/document/emf_2003_image.doc b/test-data/document/emf_2003_image.doc
deleted file mode 100644 (file)
index a475813..0000000
Binary files a/test-data/document/emf_2003_image.doc and /dev/null differ