]> source.dussan.org Git - poi.git/commitdiff
I know POI developers are supposed to like working with binary data,
authorAvik Sengupta <avik@apache.org>
Sun, 25 Jan 2004 16:05:02 +0000 (16:05 +0000)
committerAvik Sengupta <avik@apache.org>
Sun, 25 Jan 2004 16:05:02 +0000 (16:05 +0000)
but going thru source code with a hex editor to figure out characters
isnt my idea of fun :))
Anyways, hpsf.basic.TestWrite now runs, on both UTF-8 and US-ASCII
environments.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353488 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hpsf/basic/TestWrite.java

index 094817ddfa80c97c8a2588c8fc6dd0e41fa8e894..57c56bec39dbdd9efe061b862be68deb4b783e20 100644 (file)
@@ -66,6 +66,7 @@ import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -420,21 +421,21 @@ public class TestWrite extends TestCase
             check(Variant.VT_I4, new Long(28), codepage);
             check(Variant.VT_FILETIME, new Date(), codepage);
             check(Variant.VT_LPSTR, "", codepage);
-            check(Variant.VT_LPSTR, "ä", codepage);
-            check(Variant.VT_LPSTR, "äö", codepage);
-            check(Variant.VT_LPSTR, "äöü", codepage);
-            check(Variant.VT_LPSTR, "äöüÄ", codepage);
-            check(Variant.VT_LPSTR, "äöüÄÖ", codepage);
-            check(Variant.VT_LPSTR, "äöüÄÖÜ", codepage);
-            check(Variant.VT_LPSTR, "äöüÄÖÜß", codepage);
+            check(Variant.VT_LPSTR, "\u00e4", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc", codepage);
+            check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df", codepage);
             check(Variant.VT_LPWSTR, "", codepage);
-            check(Variant.VT_LPWSTR, "ä", codepage);
-            check(Variant.VT_LPWSTR, "äö", codepage);
-            check(Variant.VT_LPWSTR, "äöü", codepage);
-            check(Variant.VT_LPWSTR, "äöüÄ", codepage);
-            check(Variant.VT_LPWSTR, "äöüÄÖ", codepage);
-            check(Variant.VT_LPWSTR, "äöüÄÖÜ", codepage);
-            check(Variant.VT_LPWSTR, "äöüÄÖÜß", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6\u00fc", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6\u00fc\u00c4", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc", codepage);
+            check(Variant.VT_LPWSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df", codepage);
         }
         catch (Exception ex)
         {
@@ -465,13 +466,13 @@ public class TestWrite extends TestCase
             try
             {
                 check(Variant.VT_LPSTR, "", codepage);
-                check(Variant.VT_LPSTR, "ä", codepage);
-                check(Variant.VT_LPSTR, "äö", codepage);
-                check(Variant.VT_LPSTR, "äöü", codepage);
-                check(Variant.VT_LPSTR, "äöüÄ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖÜ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖÜß", codepage);
+                check(Variant.VT_LPSTR, "\u00e4", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df", codepage);
                 if (codepage == 1200 || codepage == 65001)
                     check(Variant.VT_LPSTR, "\u79D1\u5B78", codepage);
             }
@@ -495,13 +496,13 @@ public class TestWrite extends TestCase
             try
             {
                 check(Variant.VT_LPSTR, "", codepage);
-                check(Variant.VT_LPSTR, "ä", codepage);
-                check(Variant.VT_LPSTR, "äö", codepage);
-                check(Variant.VT_LPSTR, "äöü", codepage);
-                check(Variant.VT_LPSTR, "äöüÄ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖÜ", codepage);
-                check(Variant.VT_LPSTR, "äöüÄÖÜß", codepage);
+                check(Variant.VT_LPSTR, "\u00e4", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc", codepage);
+                check(Variant.VT_LPSTR, "\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df", codepage);
                 fail("UnsupportedEncodingException for codepage " + codepage +
                      " expected.");
             }
@@ -602,11 +603,23 @@ public class TestWrite extends TestCase
     {
         final File dataDir =
             new File(System.getProperty("HPSF.testdata.path"));
+        String[] filesToTest = new String[]{
+                       "Test0313rur.adm",
+                       "TestChineseProperties.doc",
+                       "TestCorel.shw",
+                       "TestEditTime.doc",
+                       "TestGermanWord90.doc",
+                       "TestMickey.doc",
+                       "TestSectionDictionary.doc",
+                       "TestUnicode.xls"
+
+        };
+        final java.util.List listFilesToTest = Arrays.asList(filesToTest);
         final File[] fileList = dataDir.listFiles(new FileFilter()
             {
                 public boolean accept(final File f)
                 {
-                    return f.isFile();
+                    return listFilesToTest.contains(f.getName());
                 }
             });
         for (int i = 0; i < fileList.length; i++)
@@ -666,7 +679,7 @@ public class TestWrite extends TestCase
             
                 /* Compare the property set stream with the corresponding one
                  * from the origin file and check whether they are equal. */
-                assertEquals(ps1, ps2);
+                assertEquals("Equality for file "+f.getName(),ps1, ps2);
             }
         }
         catch (Exception ex)