shlwapi/tests: Remove workarounds from url.c for no longer supported Windows versions.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-10 23:36:38 -06:00 committed by Alexandre Julliard
parent 164539e8d2
commit c4b0c64c8d
1 changed files with 19 additions and 47 deletions

View File

@ -295,7 +295,6 @@ typedef struct _TEST_URL_ESCAPEW {
DWORD flags; DWORD flags;
const WCHAR expecturl[INTERNET_MAX_URL_LENGTH]; const WCHAR expecturl[INTERNET_MAX_URL_LENGTH];
const WCHAR win7url[INTERNET_MAX_URL_LENGTH]; /* <= Win7 */ const WCHAR win7url[INTERNET_MAX_URL_LENGTH]; /* <= Win7 */
const WCHAR vistaurl[INTERNET_MAX_URL_LENGTH]; /* <= Vista/2k8 */
} TEST_URL_ESCAPEW; } TEST_URL_ESCAPEW;
static const TEST_URL_ESCAPEW TEST_ESCAPEW[] = { static const TEST_URL_ESCAPEW TEST_ESCAPEW[] = {
@ -311,12 +310,10 @@ static const TEST_URL_ESCAPEW TEST_ESCAPEW[] = {
{'M','a','%','D','F',0}}, {'M','a','%','D','F',0}},
/* 0x2070E */ /* 0x2070E */
{{0xd841,0xdf0e,0}, URL_ESCAPE_AS_UTF8, {'%','F','0','%','A','0','%','9','C','%','8','E',0}, {{0xd841,0xdf0e,0}, URL_ESCAPE_AS_UTF8, {'%','F','0','%','A','0','%','9','C','%','8','E',0},
{'%','E','F','%','B','F','%','B','D','%','E','F','%','B','F','%','B','D',0}, {'%','E','F','%','B','F','%','B','D','%','E','F','%','B','F','%','B','D',0}},
{0xd841,0xdf0e,0}},
/* 0x27A3E */ /* 0x27A3E */
{{0xd85e,0xde3e,0}, URL_ESCAPE_AS_UTF8, {'%','F','0','%','A','7','%','A','8','%','B','E',0}, {{0xd85e,0xde3e,0}, URL_ESCAPE_AS_UTF8, {'%','F','0','%','A','7','%','A','8','%','B','E',0},
{'%','E','F','%','B','F','%','B','D','%','E','F','%','B','F','%','B','D',0}, {'%','E','F','%','B','F','%','B','D','%','E','F','%','B','F','%','B','D',0}},
{0xd85e,0xde3e,0}},
{{0xd85e,0}, URL_ESCAPE_AS_UTF8, {'%','E','F','%','B','F','%','B','D',0}, {{0xd85e,0}, URL_ESCAPE_AS_UTF8, {'%','E','F','%','B','F','%','B','D',0},
{0xd85e,0}}, {0xd85e,0}},
@ -414,12 +411,7 @@ static const struct {
{"c:\\foo/b a%r", "file:///c:/foo/b%20a%25r", S_OK}, {"c:\\foo/b a%r", "file:///c:/foo/b%20a%25r", S_OK},
{"c:\\foo\\foo bar", "file:///c:/foo/foo%20bar", S_OK}, {"c:\\foo\\foo bar", "file:///c:/foo/foo%20bar", S_OK},
{"file:///c:/foo/bar", "file:///c:/foo/bar", S_FALSE}, {"file:///c:/foo/bar", "file:///c:/foo/bar", S_FALSE},
#if 0
/* The following test fails on native shlwapi as distributed with Win95/98.
* Wine matches the behaviour of later versions.
*/
{"xx:c:\\foo\\bar", "xx:c:\\foo\\bar", S_FALSE} {"xx:c:\\foo\\bar", "xx:c:\\foo\\bar", S_FALSE}
#endif
}; };
/* ################ */ /* ################ */
@ -614,8 +606,8 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
dwSize = 1; dwSize = 1;
res = UrlGetPartA(szUrl, szPart, &dwSize, dwPart, dwFlags); res = UrlGetPartA(szUrl, szPart, &dwSize, dwPart, dwFlags);
ok(res == E_POINTER, "UrlGetPart for \"%s\" gave: 0x%08x\n", szUrl, res); ok(res == E_POINTER, "UrlGetPart for \"%s\" gave: 0x%08x\n", szUrl, res);
ok(dwSize == strlen(szExpected)+1 || todo_wine_if (dwPart == URL_PART_QUERY)
(*szExpected == '?' && dwSize == strlen(szExpected)), ok(dwSize == strlen(szExpected) + 1,
"UrlGetPart for \"%s\" gave size: %u\n", szUrl, dwSize); "UrlGetPart for \"%s\" gave size: %u\n", szUrl, dwSize);
dwSize = INTERNET_MAX_URL_LENGTH; dwSize = INTERNET_MAX_URL_LENGTH;
@ -638,9 +630,8 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
FreeWideString(wszConvertedPart); FreeWideString(wszConvertedPart);
FreeWideString(wszUrl); FreeWideString(wszUrl);
/* Note that v6.0 and later don't return '?' with the query */ todo_wine_if (dwPart == URL_PART_QUERY)
ok(strcmp(szPart,szExpected)==0 || ok(!strcmp(szPart,szExpected),
(*szExpected=='?' && !strcmp(szPart,szExpected+1)),
"Expected %s, but got %s\n", szExpected, szPart); "Expected %s, but got %s\n", szExpected, szPart);
} }
@ -707,7 +698,7 @@ static void test_UrlGetPart(void)
test_url_part(TEST_URL_3, URL_PART_USERNAME, 0, "foo"); test_url_part(TEST_URL_3, URL_PART_USERNAME, 0, "foo");
test_url_part(TEST_URL_3, URL_PART_PASSWORD, 0, "bar"); test_url_part(TEST_URL_3, URL_PART_PASSWORD, 0, "bar");
test_url_part(TEST_URL_3, URL_PART_SCHEME, 0, "http"); test_url_part(TEST_URL_3, URL_PART_SCHEME, 0, "http");
test_url_part(TEST_URL_3, URL_PART_QUERY, 0, "?query=x&return=y"); test_url_part(TEST_URL_3, URL_PART_QUERY, 0, "query=x&return=y");
test_url_part(TEST_URL_4, URL_PART_HOSTNAME, 0, "google.*.com"); test_url_part(TEST_URL_4, URL_PART_HOSTNAME, 0, "google.*.com");
@ -855,10 +846,8 @@ static void test_UrlEscapeA(void)
size = 1; size = 1;
empty_string[0] = 127; empty_string[0] = 127;
ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_AS_UTF8); ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_AS_UTF8);
ok(ret == E_NOTIMPL || broken(ret == E_POINTER), /* < Win7/Win2k8 */ ok(ret == E_NOTIMPL, "Got unexpected hr %#x.\n", ret);
"got %x, expected %x\n", ret, E_NOTIMPL); ok(size == 1, "Got unexpected size %u.\n", size);
ok(size == 1 || broken(size == 34), /* < Win7/Win2k8 */
"got %d, expected %d\n", size, 1);
ok(empty_string[0] == 127, "String has changed, empty_string[0] = %d\n", empty_string[0]); ok(empty_string[0] == 127, "String has changed, empty_string[0] = %d\n", empty_string[0]);
for (i = 0; i < ARRAY_SIZE(TEST_ESCAPE); i++) { for (i = 0; i < ARRAY_SIZE(TEST_ESCAPE); i++) {
@ -962,12 +951,10 @@ static void test_UrlEscapeW(void)
size = INTERNET_MAX_URL_LENGTH; size = INTERNET_MAX_URL_LENGTH;
ret = UrlEscapeW(TEST_ESCAPEW[i].url, ret_url, &size, TEST_ESCAPEW[i].flags); ret = UrlEscapeW(TEST_ESCAPEW[i].url, ret_url, &size, TEST_ESCAPEW[i].flags);
ok(ret == S_OK, "Got unexpected hr %#x for %s.\n", ret, debugstr_w(TEST_ESCAPEW[i].url)); ok(ret == S_OK, "Got unexpected hr %#x for %s.\n", ret, debugstr_w(TEST_ESCAPEW[i].url));
ok(!lstrcmpW(ret_url, TEST_ESCAPEW[i].expecturl) || ok(!wcscmp(ret_url, TEST_ESCAPEW[i].expecturl)
broken(!lstrcmpW(ret_url, TEST_ESCAPEW[i].vistaurl)) || || broken(!wcscmp(ret_url, TEST_ESCAPEW[i].win7url)),
broken(!lstrcmpW(ret_url, TEST_ESCAPEW[i].win7url)), "Expected %s, but got %s for %s.\n", debugstr_w(TEST_ESCAPEW[i].expecturl),
"Expected \"%s\" or \"%s\" or \"%s\", but got \"%s\" for \"%s\"\n", debugstr_w(ret_url), debugstr_w(TEST_ESCAPEW[i].url));
wine_dbgstr_w(TEST_ESCAPEW[i].expecturl), wine_dbgstr_w(TEST_ESCAPEW[i].vistaurl),
wine_dbgstr_w(TEST_ESCAPEW[i].win7url), wine_dbgstr_w(ret_url), wine_dbgstr_w(TEST_ESCAPEW[i].url));
} }
} }
@ -1484,36 +1471,27 @@ static void test_HashData(void)
/* Test hashing with identically sized input/output buffers. */ /* Test hashing with identically sized input/output buffers. */
res = HashData(input, 16, output, 16); res = HashData(input, 16, output, 16);
ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res); ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
if(res == S_OK) ok(!memcmp(output, expected, sizeof(expected)), "data didn't match\n");
ok(!memcmp(output, expected, sizeof(expected)),
"Output buffer did not match expected contents\n");
/* Test hashing with larger output buffer. */ /* Test hashing with larger output buffer. */
res = HashData(input, 16, output, 32); res = HashData(input, 16, output, 32);
ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res); ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
if(res == S_OK) ok(!memcmp(output, expected2, sizeof(expected2)), "data didn't match\n");
ok(!memcmp(output, expected2, sizeof(expected2)),
"Output buffer did not match expected contents\n");
/* Test hashing with smaller input buffer. */ /* Test hashing with smaller input buffer. */
res = HashData(input, 8, output, 16); res = HashData(input, 8, output, 16);
ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res); ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
if(res == S_OK) ok(!memcmp(output, expected3, sizeof(expected3)), "data didn't match\n");
ok(!memcmp(output, expected3, sizeof(expected3)),
"Output buffer did not match expected contents\n");
/* Test passing NULL pointers for input/output parameters. */ /* Test passing NULL pointers for input/output parameters. */
res = HashData(NULL, 0, NULL, 0); res = HashData(NULL, 0, NULL, 0);
ok(res == E_INVALIDARG || broken(res == S_OK), /* Windows 2000 */ ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
"Expected HashData to return E_INVALIDARG, got 0x%08x\n", res);
res = HashData(input, 0, NULL, 0); res = HashData(input, 0, NULL, 0);
ok(res == E_INVALIDARG || broken(res == S_OK), /* Windows 2000 */ ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
"Expected HashData to return E_INVALIDARG, got 0x%08x\n", res);
res = HashData(NULL, 0, output, 0); res = HashData(NULL, 0, output, 0);
ok(res == E_INVALIDARG || broken(res == S_OK), /* Windows 2000 */ ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
"Expected HashData to return E_INVALIDARG, got 0x%08x\n", res);
/* Test passing valid pointers with sizes of zero. */ /* Test passing valid pointers with sizes of zero. */
for (i = 0; i < ARRAY_SIZE(input); i++) for (i = 0; i < ARRAY_SIZE(input); i++)
@ -1527,16 +1505,10 @@ static void test_HashData(void)
/* The buffers should be unchanged. */ /* The buffers should be unchanged. */
for (i = 0; i < ARRAY_SIZE(input); i++) for (i = 0; i < ARRAY_SIZE(input); i++)
{
ok(input[i] == 0x00, "Expected the input buffer to be unchanged\n"); ok(input[i] == 0x00, "Expected the input buffer to be unchanged\n");
if(input[i] != 0x00) break;
}
for (i = 0; i < ARRAY_SIZE(output); i++) for (i = 0; i < ARRAY_SIZE(output); i++)
{
ok(output[i] == 0xFF, "Expected the output buffer to be unchanged\n"); ok(output[i] == 0xFF, "Expected the output buffer to be unchanged\n");
if(output[i] != 0xFF) break;
}
/* Input/output parameters are not validated. */ /* Input/output parameters are not validated. */
res = HashData((BYTE *)0xdeadbeef, 0, (BYTE *)0xdeadbeef, 0); res = HashData((BYTE *)0xdeadbeef, 0, (BYTE *)0xdeadbeef, 0);