On Sun, Sep 14, 2008 at 11:32:31PM +0900, Dmitry Timoshkov wrote:
"Marcus Meissner" marcus@jet.franken.de wrote:
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index f792da2..a49953b 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -1268,7 +1268,7 @@ static void test_LCMapStringW(void) /* otherwise src == dst should fail */ SetLastError(0xdeadbeef); ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | LCMAP_UPPERCASE,
buf, 10, buf, sizeof(buf));
ok(GetLastError() == ERROR_INVALID_FLAGS /* NT */ || GetLastError() == ERROR_INVALID_PARAMETER /* Win9x */, "unexpected error code %d\n", GetLastError());buf, 10, buf, sizeof(buf)/sizeof(WCHAR));
@@ -1276,40 +1276,40 @@ static void test_LCMapStringW(void)
/* test whether '\0' is always appended */ ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,
upper_case, -1, buf, sizeof(buf));
ok(ret, "LCMapStringW must succeed\n"); ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
upper_case, lstrlenW(upper_case), buf2, sizeof(buf2));
upper_case, lstrlenW(upper_case), buf2, sizeof(buf2)/sizeof(WCHAR));
ok(ret, "LCMapStringW must succeed\n"); ok(ret == ret2, "lengths of sort keys must be equal\n"); ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n");
/* test LCMAP_SORTKEY | NORM_IGNORECASE */ ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORECASE,
upper_case, -1, buf, sizeof(buf));
ok(ret, "LCMapStringW must succeed\n"); ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
lower_case, -1, buf2, sizeof(buf2));
lower_case, -1, buf2, sizeof(buf2)/sizeof(WCHAR));
ok(ret2, "LCMapStringW must succeed\n"); ok(ret == ret2, "lengths of sort keys must be equal\n"); ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n");
/* test LCMAP_SORTKEY | NORM_IGNORENONSPACE */ ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORENONSPACE,
lower_case, -1, buf, sizeof(buf));
ok(ret, "LCMapStringW must succeed\n"); ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
lower_case, -1, buf2, sizeof(buf2));
lower_case, -1, buf2, sizeof(buf2)/sizeof(WCHAR));
ok(ret2, "LCMapStringW must succeed\n"); ok(ret == ret2, "lengths of sort keys must be equal\n"); ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n");
/* test LCMAP_SORTKEY | NORM_IGNORESYMBOLS */ ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORESYMBOLS,
lower_case, -1, buf, sizeof(buf));
ok(ret, "LCMapStringW must succeed\n"); ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
symbols_stripped, -1, buf2, sizeof(buf2));
ok(ret2, "LCMapStringW must succeed\n"); ok(ret == ret2, "lengths of sort keys must be equal\n"); ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n");symbols_stripped, -1, buf2, sizeof(buf2)/sizeof(WCHAR));
LCMAP_SORTKEY takes the target buffer size in bytes in both A and W versions.
Thats a bad API then :(
@@ -1332,7 +1332,7 @@ static void test_LCMapStringW(void)
/* test srclen = 0 */ SetLastError(0xdeadbeef);
- ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf));
- ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf)/sizeof(WCHAR)); ok(!ret, "LCMapStringW should fail with srclen = 0\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "unexpected error code %d\n", GetLastError());
The size of the target buffer doesn't matter at all in this case, since the API is supposed to fail due to source length being 0.
Hmm.
Have to adjust my tests then.
Ciao, Marcus