shlwapi: Added more UrlCanonicalizeA tests.

This commit is contained in:
Piotr Caban 2010-05-08 18:01:02 +02:00 committed by Alexandre Julliard
parent 40119690b8
commit ee2abe7f82
1 changed files with 20 additions and 1 deletions

View File

@ -793,7 +793,8 @@ static void test_UrlEscape(void)
static void test_UrlCanonicalizeA(void)
{
unsigned int i;
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
CHAR szReturnUrl[4*INTERNET_MAX_URL_LENGTH];
CHAR longurl[4*INTERNET_MAX_URL_LENGTH];
DWORD dwSize;
DWORD urllen;
HRESULT hr;
@ -845,6 +846,24 @@ static void test_UrlCanonicalizeA(void)
"got 0x%x with %u and size %u for '%s' and %u (expected 'S_OK' and size %u)\n",
hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen);
/* length is set to 0 */
dwSize=0;
memset(szReturnUrl, '#', urllen+4);
szReturnUrl[urllen+4] = '\0';
SetLastError(0xdeadbeef);
hr = pUrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
ok( (hr == E_INVALIDARG) && (dwSize == 0),
"got 0x%x with %u and size %u for '%s' and %u (expected 'E_INVALIDARG' and size %u)\n",
hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), 0);
/* url length > INTERNET_MAX_URL_SIZE */
dwSize=sizeof(szReturnUrl);
memset(longurl, 'a', sizeof(longurl));
memcpy(longurl, winehqA, sizeof(winehqA)-1);
longurl[sizeof(longurl)-1] = '\0';
hr = pUrlCanonicalizeA(longurl, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
ok(hr == S_OK, "hr = %x\n", hr);
test_url_canonicalize(-1, "", 0, S_OK, S_FALSE /* Vista/win2k8 */, "", FALSE);
/* test url-modification */