Various test fixes for XP/msvc.

This commit is contained in:
Jon Griffiths 2003-09-25 20:29:40 +00:00 committed by Alexandre Julliard
parent 5e46d9f9d7
commit 90535ce905
10 changed files with 95 additions and 81 deletions

View File

@ -96,8 +96,11 @@ static void test_enum_value(void)
ok( val_count == 2 || val_count == 3, "val_count set to %ld", val_count ); ok( val_count == 2 || val_count == 3, "val_count set to %ld", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ", type );
#if 0
/* v5.1.2600.0 (XP Home) does not touch value or data in this case */
ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'", value ); ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'", value );
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data ); ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data );
#endif
/* overflow empty name */ /* overflow empty name */
val_count = 0; val_count = 0;
@ -111,7 +114,10 @@ static void test_enum_value(void)
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value ); ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value );
#if 0
/* v5.1.2600.0 (XP Home) does not touch data in this case */
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data ); ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data );
#endif
/* overflow data */ /* overflow data */
val_count = 20; val_count = 20;

View File

@ -72,6 +72,7 @@ static void testCursor(HANDLE hCon, COORD sbSize)
{ {
COORD c; COORD c;
c.X = c.Y = 0;
ok(SetConsoleCursorPosition(0, c) == 0, "No handle"); ok(SetConsoleCursorPosition(0, c) == 0, "No handle");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu",
ERROR_INVALID_HANDLE, GetLastError()); ERROR_INVALID_HANDLE, GetLastError());
@ -115,7 +116,7 @@ static void testWriteSimple(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
DWORD len; DWORD len;
const char* mytest = "abcdefg"; const char* mytest = "abcdefg";
const size_t mylen = strlen(mytest); const int mylen = strlen(mytest);
/* single line write */ /* single line write */
c.X = c.Y = 0; c.X = c.Y = 0;
@ -137,7 +138,7 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
DWORD len, mode; DWORD len, mode;
const char* mytest = "abcd\nf\tg"; const char* mytest = "abcd\nf\tg";
const size_t mylen = strlen(mytest); const int mylen = strlen(mytest);
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)),
@ -187,8 +188,8 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
DWORD len, mode; DWORD len, mode;
const char* mytest = "abcd\nf\tg"; const char* mytest = "abcd\nf\tg";
const size_t mylen = strlen(mytest); const int mylen = strlen(mytest);
const size_t mylen2 = strchr(mytest, '\n') - mytest; const int mylen2 = strchr(mytest, '\n') - mytest;
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT),
@ -263,7 +264,7 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
DWORD len, mode; DWORD len, mode;
const char* mytest = "abcd\nf\tg"; const char* mytest = "abcd\nf\tg";
const size_t mylen = strlen(mytest); const int mylen = strlen(mytest);
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)),
@ -314,7 +315,7 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
DWORD len, mode; DWORD len, mode;
const char* mytest = "abcd\nf\tg"; const char* mytest = "abcd\nf\tg";
const size_t mylen = strlen(mytest); const int mylen = strlen(mytest);
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)),

View File

@ -902,11 +902,6 @@ void test_FindFirstFileA()
WIN32_FIND_DATAA search_results; WIN32_FIND_DATAA search_results;
int err; int err;
handle = FindFirstFileA("C:",&search_results);
err = GetLastError();
ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
if (handle == INVALID_HANDLE_VALUE)
ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number\n");
handle = FindFirstFileA("C:\\",&search_results); handle = FindFirstFileA("C:\\",&search_results);
err = GetLastError(); err = GetLastError();
ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail"); ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");

View File

@ -27,7 +27,7 @@ static void test_sscanf( void )
char buffer[100], buffer1[100]; char buffer[100], buffer1[100];
char format[20]; char format[20];
int result, ret; int result, ret;
float res1= -82.6267, res2= 27.76, res11, res12; float res1= -82.6267f, res2= 27.76f, res11, res12;
char pname[]=" St. Petersburg, Florida\n"; char pname[]=" St. Petersburg, Florida\n";

View File

@ -107,7 +107,8 @@ void run_usergetinfo_tests(void)
todo_wine { todo_wine {
/* FIXME - Currently Wine can't verify whether the network path is good or bad */ /* FIXME - Currently Wine can't verify whether the network path is good or bad */
rc=pNetUserGetInfo(sBadNetPath, sAdminUserName, 0, (LPBYTE *)&ui0); rc=pNetUserGetInfo(sBadNetPath, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_BAD_NETPATH,"Bad Network Path: rc=%ld",rc); ok(rc == ERROR_BAD_NETPATH || rc == ERROR_NETWORK_UNREACHABLE,
"Bad Network Path: rc=%ld",rc);
} }
rc=pNetUserGetInfo(sEmptyStr, sAdminUserName, 0, (LPBYTE *)&ui0); rc=pNetUserGetInfo(sEmptyStr, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_BAD_NETPATH,"Bad Network Path: rc=%ld",rc); ok(rc == ERROR_BAD_NETPATH,"Bad Network Path: rc=%ld",rc);

View File

@ -25,7 +25,6 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winnls.h" #include "winnls.h"
#include "ntstatus.h"
#include "winresrc.h" /* Ensure we use Unicode defns with native headers */ #include "winresrc.h" /* Ensure we use Unicode defns with native headers */
#include "nb30.h" #include "nb30.h"
#include "lmcons.h" #include "lmcons.h"
@ -136,7 +135,8 @@ static void run_wkstatransportenum_tests(void)
/* 1st check: is param 2 (level) correct? (only if param 5 passed?) */ /* 1st check: is param 2 (level) correct? (only if param 5 passed?) */
apiReturn = pNetWkstaTransportEnum(NULL, 1, NULL, MAX_PREFERRED_LENGTH, apiReturn = pNetWkstaTransportEnum(NULL, 1, NULL, MAX_PREFERRED_LENGTH,
NULL, &totalEntries, NULL); NULL, &totalEntries, NULL);
ok(apiReturn == ERROR_INVALID_LEVEL, "Invalid level"); ok(apiReturn == ERROR_INVALID_LEVEL || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
/* 2nd check: is param 5 passed? (only if level passes?) */ /* 2nd check: is param 5 passed? (only if level passes?) */
apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH, apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH,
@ -146,12 +146,14 @@ static void run_wkstatransportenum_tests(void)
if (apiReturn == ERROR_NETWORK_UNREACHABLE) if (apiReturn == ERROR_NETWORK_UNREACHABLE)
return; return;
ok(apiReturn == STATUS_ACCESS_VIOLATION, "access violation"); ok(apiReturn == STATUS_ACCESS_VIOLATION || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
/* 3rd check: is param 3 passed? */ /* 3rd check: is param 3 passed? */
apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH, apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH,
NULL, NULL, NULL); NULL, NULL, NULL);
ok(apiReturn == STATUS_ACCESS_VIOLATION, "STATUS_ACCESS_VIOLATION"); ok(apiReturn == STATUS_ACCESS_VIOLATION || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
/* 4th check: is param 6 passed? */ /* 4th check: is param 6 passed? */
apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH, apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH,
@ -161,7 +163,8 @@ static void run_wkstatransportenum_tests(void)
/* final check: valid return, actually get data back */ /* final check: valid return, actually get data back */
apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH, apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH,
&entriesRead, &totalEntries, NULL); &entriesRead, &totalEntries, NULL);
ok(apiReturn == NERR_Success, "NetWkstaTransportEnum is successful"); ok(apiReturn == NERR_Success || apiReturn == ERROR_NETWORK_UNREACHABLE,
"NetWkstaTransportEnum returned %ld", apiReturn);
if (apiReturn == NERR_Success) { if (apiReturn == NERR_Success) {
/* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */ /* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */

View File

@ -434,7 +434,7 @@ static void test_RtlDuplicateUnicodeString(void)
dest_ansi_str.Length = dest_str.Length / sizeof(WCHAR); dest_ansi_str.Length = dest_str.Length / sizeof(WCHAR);
dest_ansi_str.MaximumLength = dest_ansi_str.Length + 1; dest_ansi_str.MaximumLength = dest_ansi_str.Length + 1;
for (pos = 0; pos < dest_ansi_str.Length; pos++) { for (pos = 0; pos < dest_ansi_str.Length; pos++) {
dest_ansi_buf[pos] = dest_buf[pos]; dest_ansi_buf[pos] = (char)dest_buf[pos];
} /* for */ } /* for */
dest_ansi_buf[dest_ansi_str.Length] = '\0'; dest_ansi_buf[dest_ansi_str.Length] = '\0';
dest_ansi_str.Buffer = dest_ansi_buf; dest_ansi_str.Buffer = dest_ansi_buf;
@ -1286,7 +1286,7 @@ static const str2int_t str2int[] = {
{ 0, "-xFEDCBA00", 0, STATUS_SUCCESS}, /* Negative Hexadecimal (x-notation) */ { 0, "-xFEDCBA00", 0, STATUS_SUCCESS}, /* Negative Hexadecimal (x-notation) */
{ 0, "0x89abcdef", 0x89abcdef, STATUS_SUCCESS}, /* Hex with lower case digits a-f (0x-notation) */ { 0, "0x89abcdef", 0x89abcdef, STATUS_SUCCESS}, /* Hex with lower case digits a-f (0x-notation) */
{ 0, "0xFEDCBA00", 0xFEDCBA00, STATUS_SUCCESS}, /* Hex with upper case digits A-F (0x-notation) */ { 0, "0xFEDCBA00", 0xFEDCBA00, STATUS_SUCCESS}, /* Hex with upper case digits A-F (0x-notation) */
{ 0, "-0xFEDCBA00", -0xFEDCBA00, STATUS_SUCCESS}, /* Negative Hexadecimal (0x-notation) */ { 0, "-0xFEDCBA00", 19088896, STATUS_SUCCESS}, /* Negative Hexadecimal (0x-notation) */
{ 0, "0xabcdefgh", 0xabcdef, STATUS_SUCCESS}, /* Hex with illegal lower case digits (g-z) */ { 0, "0xabcdefgh", 0xabcdef, STATUS_SUCCESS}, /* Hex with illegal lower case digits (g-z) */
{ 0, "0xABCDEFGH", 0xABCDEF, STATUS_SUCCESS}, /* Hex with illegal upper case digits (G-Z) */ { 0, "0xABCDEFGH", 0xABCDEF, STATUS_SUCCESS}, /* Hex with illegal upper case digits (G-Z) */
{ 0, "0xF", 0xf, STATUS_SUCCESS}, /* one digit hexadecimal */ { 0, "0xF", 0xf, STATUS_SUCCESS}, /* one digit hexadecimal */

View File

@ -299,13 +299,13 @@ static void test_CList(void)
inserted = pSHLWAPI_22(list, item->ulId); inserted = pSHLWAPI_22(list, item->ulId);
ok(inserted != NULL, "lost after adding"); ok(inserted != NULL, "lost after adding");
ok(!inserted || inserted->ulId != -1, "find returned a container"); ok(!inserted || inserted->ulId != ~0UL, "find returned a container");
/* Check size */ /* Check size */
if (inserted && inserted->ulSize & 0x3) if (inserted && inserted->ulSize & 0x3)
{ {
/* Contained */ /* Contained */
ok(inserted[-1].ulId == -1, "invalid size is not countained"); ok(inserted[-1].ulId == ~0UL, "invalid size is not countained");
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST), ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
"container too small"); "container too small");
} }
@ -374,7 +374,7 @@ static void test_CList(void)
inserted = (LPSHLWAPI_CLIST)buff; inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = 44; inserted->ulSize = 44;
inserted->ulId = -1; inserted->ulId = ~0UL;
hRet = pSHLWAPI_20(&list, inserted); hRet = pSHLWAPI_20(&list, inserted);
/* The call succeeds but the item is not inserted */ /* The call succeeds but the item is not inserted */
ok(hRet == S_OK, "failed adding a container"); ok(hRet == S_OK, "failed adding a container");
@ -419,13 +419,13 @@ static void test_CList(void)
inserted = pSHLWAPI_22(list, item->ulId); inserted = pSHLWAPI_22(list, item->ulId);
ok(inserted != NULL, "lost after adding"); ok(inserted != NULL, "lost after adding");
ok(!inserted || inserted->ulId != -1, "find returned a container"); ok(!inserted || inserted->ulId != ~0UL, "find returned a container");
/* Check size */ /* Check size */
if (inserted && inserted->ulSize & 0x3) if (inserted && inserted->ulSize & 0x3)
{ {
/* Contained */ /* Contained */
ok(inserted[-1].ulId == -1, "invalid size is not countained"); ok(inserted[-1].ulId == ~0UL, "invalid size is not countained");
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST), ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
"container too small"); "container too small");
} }

View File

@ -92,7 +92,10 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, char*
FreeWideString(wszUrl); FreeWideString(wszUrl);
FreeWideString(wszConvertedPart); FreeWideString(wszConvertedPart);
ok(strcmp(szPart,szExpected)==0, "Expected %s, but got %s", szExpected, szPart); /* Note that v6.0 and later don't return '?' with the query */
ok(strcmp(szPart,szExpected)==0 ||
(*szExpected=='?' && !strcmp(szPart,szExpected+1)),
"Expected %s, but got %s", szExpected, szPart);
} }
static void test_UrlGetPart(void) static void test_UrlGetPart(void)

View File

@ -125,12 +125,14 @@ void winapi_test(int flags)
if (hor == 0x0) goto abort; if (hor == 0x0) goto abort;
trace("HttpSendRequestA -->\n"); trace("HttpSendRequestA -->\n");
SetLastError(0);
rc = HttpSendRequestA(hor, "", 0xffffffff,0x0,0x0); rc = HttpSendRequestA(hor, "", 0xffffffff,0x0,0x0);
if (flags) if (flags)
ok(((rc == 0)&&(GetLastError()==997)), ok(((rc == 0)&&(GetLastError()==997)),
"Asyncronous HttpSendRequest NOT returning 0 with error 997"); "Asyncronous HttpSendRequest NOT returning 0 with error 997");
else else
ok((rc != 0), "Syncronous HttpSendRequest returning 0"); ok((rc != 0) || GetLastError() == 12007, /* 12007 == XP */
"Syncronous HttpSendRequest returning 0, error %ld", GetLastError());
trace("HttpSendRequestA <--\n"); trace("HttpSendRequestA <--\n");
while ((flags)&&(!goon)) while ((flags)&&(!goon))
@ -233,8 +235,11 @@ void InternetOpenUrlA_test(void)
urlComponents.dwExtraInfoLength = 1024; urlComponents.dwExtraInfoLength = 1024;
ok((InternetCrackUrl("http://LTspice.linear-tech.com/fieldsync2/release.log.gz", 0,0,&urlComponents)), ok((InternetCrackUrl("http://LTspice.linear-tech.com/fieldsync2/release.log.gz", 0,0,&urlComponents)),
"InternetCrackUrl failed, error %lx\n",GetLastError()); "InternetCrackUrl failed, error %lx\n",GetLastError());
SetLastError(0);
myhttp = InternetOpenUrl(myhinternet, "http://LTspice.linear-tech.com/fieldsync2/release.log.gz", 0, 0, myhttp = InternetOpenUrl(myhinternet, "http://LTspice.linear-tech.com/fieldsync2/release.log.gz", 0, 0,
INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0); INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
if (GetLastError() == 12007)
return; /* WinXP returns this when not connected to the net */
ok((myhttp != 0),"InternetOpenUrl failed, error %lx\n",GetLastError()); ok((myhttp != 0),"InternetOpenUrl failed, error %lx\n",GetLastError());
ok(InternetReadFile(myhttp, buffer,0x400,&readbytes), "InternetReadFile failed, error %lx\n",GetLastError()); ok(InternetReadFile(myhttp, buffer,0x400,&readbytes), "InternetReadFile failed, error %lx\n",GetLastError());
totalbytes += readbytes; totalbytes += readbytes;