Aric Stewart : kernel32/tests: Add test for CT_TYPE1 of GetStringTypeW.
Alexandre Julliard
julliard at winehq.org
Thu Jul 22 12:09:30 CDT 2010
Module: wine
Branch: master
Commit: 6c970e7e665745c587b5f9afb72435f21d3c0c86
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6c970e7e665745c587b5f9afb72435f21d3c0c86
Author: Aric Stewart <aric at codeweavers.com>
Date: Mon Jul 19 13:52:57 2010 -0500
kernel32/tests: Add test for CT_TYPE1 of GetStringTypeW.
---
dlls/kernel32/tests/locale.c | 126 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 126 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index f37d503..9d6f7e4 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -2656,6 +2656,131 @@ static void test_GetCPInfo(void)
}
}
+/*
+ * The CT_TYPE1 has varied over windows version.
+ * The current target for correct behavior is windows 7.
+ * There was a big shift between windows 2000 (first introduced) and windows Xp
+ * Most of the old values below are from windows 2000.
+ * A smaller subset of changes happened between windows Xp and Window vista/7
+ */
+static void test_GetStringTypeW(void)
+{
+ static const WCHAR blanks[] = {0x9, 0x20, 0xa0, 0x3000, 0xfeff};
+ static const WORD blanks_new[] = {C1_SPACE | C1_CNTRL | C1_BLANK | C1_DEFINED,
+ C1_SPACE | C1_BLANK | C1_DEFINED,
+ C1_SPACE | C1_BLANK | C1_DEFINED,
+ C1_SPACE | C1_BLANK | C1_DEFINED,
+ C1_CNTRL | C1_BLANK | C1_DEFINED};
+ static const WORD blanks_old[] ={C1_SPACE | C1_CNTRL | C1_BLANK,
+ C1_SPACE | C1_BLANK,
+ C1_SPACE | C1_BLANK,
+ C1_SPACE | C1_BLANK,
+ C1_SPACE | C1_BLANK};
+
+ static const WCHAR undefined[] = {0x378, 0x379, 0x65f, 0xfff8, 0xfffe};
+
+ /* Lu, Ll, Lt */
+ static const WCHAR alpha[] = {0x47, 0x67, 0x1c5};
+ static const WORD alpha_old[] = {C1_UPPER | C1_ALPHA,
+ C1_LOWER | C1_ALPHA,
+ C1_UPPER | C1_LOWER | C1_ALPHA,
+ C1_ALPHA};
+
+ /* Sk, Sk, Mn, So, Me */
+ static const WCHAR oldpunc[] = { 0x2c2, 0x2e5, 0x322, 0x482, 0x6de,
+ /* Sc, Sm, No,*/
+ 0xffe0, 0xffe9, 0x2153};
+
+ /* Lm, Nl, Cf, 0xad(Cf), 0x1f88 (Lt), Lo, Mc */
+ static const WCHAR changed[] = {0x2b0, 0x2160, 0x600, 0xad, 0x1f88, 0x294, 0x903};
+ static const WORD changed_old[] = { C1_PUNCT, C1_PUNCT, 0, C1_PUNCT, C1_UPPER | C1_ALPHA, C1_ALPHA, C1_PUNCT };
+ static const WORD changed_xp[] = {C1_ALPHA | C1_DEFINED,
+ C1_ALPHA | C1_DEFINED,
+ C1_CNTRL | C1_DEFINED,
+ C1_PUNCT | C1_DEFINED,
+ C1_UPPER | C1_LOWER | C1_ALPHA | C1_DEFINED,
+ C1_ALPHA | C1_LOWER | C1_DEFINED,
+ C1_ALPHA | C1_DEFINED };
+ static const WORD changed_new[] = { C1_ALPHA | C1_DEFINED,
+ C1_ALPHA | C1_DEFINED,
+ C1_CNTRL | C1_DEFINED,
+ C1_PUNCT | C1_CNTRL | C1_DEFINED,
+ C1_UPPER | C1_LOWER | C1_ALPHA | C1_DEFINED,
+ C1_ALPHA | C1_DEFINED,
+ C1_DEFINED
+ };
+ /* Pc, Pd, Ps, Pe, Pi, Pf, Po*/
+ static const WCHAR punct[] = { 0x5f, 0x2d, 0x28, 0x29, 0xab, 0xbb, 0x21 };
+
+ static const WCHAR punct_special[] = {0x24, 0x2b, 0x3c, 0x3e, 0x5e, 0x60,
+ 0x7c, 0x7e, 0xa2, 0xbe, 0xd7, 0xf7};
+ static const WCHAR digit_special[] = {0xb2, 0xb3, 0xb9};
+ static const WCHAR lower_special[] = {0x2071, 0x207f};
+ static const WCHAR cntrl_special[] = {0x070f, 0x200c, 0x200d,
+ 0x200e, 0x200f, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e,
+ 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0xfeff,
+ 0xfff9, 0xfffa, 0xfffb};
+ static const WCHAR space_special[] = {0x09, 0x0d, 0x85};
+
+ WORD types[20];
+ int i;
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, blanks, 5, types);
+ for (i = 0; i < 5; i++)
+ ok(types[i] == blanks_new[i] || broken(types[i] == blanks_old[i] || broken(types[i] == 0)), "incorrect type1 returned for %x -> (%x != %x)\n",blanks[i],types[i],blanks_new[i]);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, alpha, 3, types);
+ for (i = 0; i < 3; i++)
+ ok(types[i] == (C1_DEFINED | alpha_old[i]) || broken(types[i] == alpha_old[i]) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",alpha[i], types[i],(C1_DEFINED | alpha_old[i]));
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, undefined, 5, types);
+ for (i = 0; i < 5; i++)
+ ok(types[i] == 0, "incorrect types returned for %x -> (%x != 0)\n",undefined[i], types[i]);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, oldpunc, 8, types);
+ for (i = 0; i < 8; i++)
+ ok(types[i] == C1_DEFINED || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",oldpunc[i], types[i], C1_DEFINED);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, changed, 7, types);
+ for (i = 0; i < 7; i++)
+ ok(types[i] == changed_new[i] || broken(types[i] == changed_old[i]) || broken(types[i] == changed_xp[i]) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",changed[i], types[i], changed_new[i]);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, punct, 7, types);
+ for (i = 0; i < 7; i++)
+ ok(types[i] == (C1_PUNCT | C1_DEFINED) || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",punct[i], types[i], (C1_PUNCT | C1_DEFINED));
+
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, punct_special, 12, types);
+ for (i = 0; i < 12; i++)
+ ok(types[i] & C1_PUNCT || broken(types[i] == 0), "incorrect types returned for %x -> (%x doest not have %x)\n",punct_special[i], types[i], C1_PUNCT);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, digit_special, 3, types);
+ for (i = 0; i < 3; i++)
+ ok(types[i] & C1_DIGIT || broken(types[i] == 0), "incorrect types returned for %x -> (%x doest not have = %x)\n",digit_special[i], types[i], C1_DIGIT);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, lower_special, 2, types);
+ for (i = 0; i < 2; i++)
+ ok(types[i] & C1_LOWER || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",lower_special[i], types[i], C1_LOWER);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, cntrl_special, 20, types);
+ for (i = 0; i < 20; i++)
+ ok(types[i] & C1_CNTRL || broken(types[i] == (C1_BLANK|C1_SPACE)) || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",cntrl_special[i], types[i], C1_CNTRL);
+
+ memset(types,0,sizeof(types));
+ GetStringTypeW(CT_CTYPE1, space_special, 3, types);
+ for (i = 0; i < 3; i++)
+ ok(types[i] & C1_SPACE || broken(types[i] == C1_CNTRL) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",space_special[i], types[i], C1_SPACE );
+}
+
START_TEST(locale)
{
InitFunctionPointers();
@@ -2680,6 +2805,7 @@ START_TEST(locale)
test_SetLocaleInfoA();
test_EnumUILanguageA();
test_GetCPInfo();
+ test_GetStringTypeW();
/* this requires collation table patch to make it MS compatible */
if (0) test_sorting();
}
More information about the wine-cvs
mailing list