[PATCH] mlang/tests: Fix failures with IE 5.5 and below

Detlef Riekenberg wine.dev at web.de
Thu Jun 4 22:25:36 CDT 2009


---
 dlls/mlang/tests/mlang.c |   45 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c
index d646d39..aaa9b72 100644
--- a/dlls/mlang/tests/mlang.c
+++ b/dlls/mlang/tests/mlang.c
@@ -53,6 +53,8 @@ typedef struct lcid_tag_table {
     LPCSTR rfc1766;
     LCID lcid;
     HRESULT hr;
+    LCID alternate_lcid;
+    LPCSTR broken_rfc;
 } lcid_table_entry;
 
 /* en, ar and zh use SUBLANG_NEUTRAL for the rfc1766 name without the country
@@ -86,7 +88,7 @@ static const lcid_table_entry  lcid_table[] = {
     {"fr-ca", 0x0c0c,   S_OK},
     {"fr-ch", 0x100c,   S_OK},
     {"fr-lu", 0x140c,   S_OK},
-    {"fr-mc", 0x180c,   S_OK},
+    {"fr-mc", 0x180c,   S_OK, 0x040c},
 
     {"it",    0x0410,   S_OK},
     {"it-ch", 0x0810,   S_OK},
@@ -96,7 +98,7 @@ static const lcid_table_entry  lcid_table[] = {
     {"pl",    0x0415,   S_OK},
     {"ru",    0x0419,   S_OK},
 
-    {"kok",   0x0457,   S_OK}
+    {"kok",   0x0457,   S_OK, 0x0412, "x-kok"}
 
 };
 
@@ -901,10 +903,18 @@ static void test_GetLcidFromRfc1766(IMultiLanguage2 *iML2)
         MultiByteToWideChar(CP_ACP, 0, lcid_table[i].rfc1766, -1, rfc1766W, MAX_RFC1766_NAME);
         ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, &lcid, rfc1766W);
 
-        ok(ret == lcid_table[i].hr,
-            "#%02d: HRESULT 0x%x (expected 0x%x)\n", i, ret, lcid_table[i].hr);
+        /* IE <6.0 guess 0x412 (ko) from "kok" */
+        if (lcid_table[i].alternate_lcid && (lcid_table[i].lcid != -1)) {
+            ok(ret == S_OK || ret == S_FALSE,
+                "#%02d: HRESULT 0x%x (expected S_OK or S_FALSE)\n", i, ret);
 
-        ok(lcid == lcid_table[i].lcid,
+
+        }
+        else
+            ok(ret == lcid_table[i].hr,
+                "#%02d: HRESULT 0x%x (expected 0x%x)\n", i, ret, lcid_table[i].hr);
+        ok((lcid == lcid_table[i].lcid) ||
+            broken(lcid == lcid_table[i].alternate_lcid),   /* IE <6.0 */
             "#%02d: got LCID 0x%x (expected 0x%x)\n", i, lcid, lcid_table[i].lcid);
     }
 
@@ -951,11 +961,18 @@ static void test_Rfc1766ToLcid(void)
         lcid = -1;
         ret = Rfc1766ToLcidA(&lcid, lcid_table[i].rfc1766);
 
-        ok(ret == lcid_table[i].hr,
-            "#%02d: HRESULT 0x%x (expected 0x%x)\n", i, ret, lcid_table[i].hr);
+        /* IE <6.0 guess 0x412 (ko) from "kok" */
+        if (lcid_table[i].alternate_lcid) {
+            ok(ret == S_OK || ret == S_FALSE,
+                "#%02d: HRESULT 0x%x (expected S_OK or S_FALSE)\n", i, ret);
 
+        }
+        else
+            ok(ret == lcid_table[i].hr,
+                "#%02d: HRESULT 0x%x (expected 0x%x)\n", i, ret, lcid_table[i].hr);
 
-        ok(lcid == lcid_table[i].lcid,
+        ok( (lcid == lcid_table[i].lcid) ||
+            (lcid == lcid_table[i].alternate_lcid),   /* IE <6.0 or guessed lcid */
             "#%02d: got LCID 0x%x (expected 0x%x)\n", i, lcid, lcid_table[i].lcid);
 
     }
@@ -992,7 +1009,9 @@ static void test_GetRfc1766FromLcid(IMultiLanguage2 *iML2)
         LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, lcid_table[i].rfc1766,
                     lstrlenA(lcid_table[i].rfc1766) + 1, expected, MAX_RFC1766_NAME);
 
-        ok(!lstrcmpA(buffer, expected),
+        /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
+        ok((!lstrcmpA(buffer, expected)) ||
+            broken(!lstrcmpA(buffer, lcid_table[i].broken_rfc)),
             "#%02d: got '%s' (expected '%s')\n", i, buffer, expected);
 
         SysFreeString(rfcstr);
@@ -1016,7 +1035,9 @@ static void test_LcidToRfc1766(void)
 
         hr = LcidToRfc1766A(lcid_table[i].lcid, buffer, MAX_RFC1766_NAME);
 
-        ok(hr == lcid_table[i].hr,
+        /* IE <5.0 does not recognize 0x180c (fr-mc) and 0x457 (kok) */
+        ok((hr == lcid_table[i].hr) ||
+            broken(lcid_table[i].broken_rfc && (hr == E_FAIL)),
             "#%02d: HRESULT 0x%x (expected 0x%x)\n", i, hr, lcid_table[i].hr);
 
         if (hr != S_OK)
@@ -1025,7 +1046,9 @@ static void test_LcidToRfc1766(void)
         LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, lcid_table[i].rfc1766,
                     lstrlenA(lcid_table[i].rfc1766) + 1, expected, MAX_RFC1766_NAME);
 
-        ok(!lstrcmpA(buffer, expected),
+        /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
+        ok((!lstrcmpA(buffer, expected)) ||
+            broken(!lstrcmpA(buffer, lcid_table[i].broken_rfc)),
             "#%02d: got '%s' (expected '%s')\n", i, buffer, expected);
 
     }
-- 
1.5.4.3


--=-KTIPG30lnGGcFWKQGgoC--




More information about the wine-patches mailing list