setupapi/tests: Fix the SetupGetIntField test to load the correct key.

This commit is contained in:
Alexandre Julliard 2009-10-08 21:50:09 +02:00
parent 42c5215133
commit f901f63bc6
1 changed files with 10 additions and 15 deletions

View File

@ -602,14 +602,14 @@ static void test_SetupGetIntField(void)
} keys[] =
{
/* key fields index expected int errorcode */
{ "Key=", "48", 1, 48, ERROR_SUCCESS },
{ "Key=", "48", 0, -1, ERROR_INVALID_DATA },
{ "123=", "48", 0, 123, ERROR_SUCCESS },
{ "Key=", "0x4", 1, 4, ERROR_SUCCESS },
{ "Key=", "Field1", 1, -1, ERROR_INVALID_DATA },
{ "Key=", "Field1,34", 2, 34, ERROR_SUCCESS },
{ "Key=", "Field1,,Field3", 2, 0, ERROR_SUCCESS },
{ "Key=", "Field1,", 2, 0, ERROR_SUCCESS }
{ "Key", "48", 1, 48, ERROR_SUCCESS },
{ "Key", "48", 0, -1, ERROR_INVALID_DATA },
{ "123", "48", 0, 123, ERROR_SUCCESS },
{ "Key", "0x4", 1, 4, ERROR_SUCCESS },
{ "Key", "Field1", 1, -1, ERROR_INVALID_DATA },
{ "Key", "Field1,34", 2, 34, ERROR_SUCCESS },
{ "Key", "Field1,,Field3", 2, 0, ERROR_SUCCESS },
{ "Key", "Field1,", 2, 0, ERROR_SUCCESS }
};
unsigned int i;
@ -624,22 +624,17 @@ static void test_SetupGetIntField(void)
strcpy( buffer, STD_HEADER "[TestSection]\n" );
strcat( buffer, keys[i].key );
strcat( buffer, "=" );
strcat( buffer, keys[i].fields );
hinf = test_file_contents( buffer, &err);
ok( hinf != NULL, "Expected valid INF file\n" );
SetupFindFirstLineA( hinf, "TestSection", "Key", &context );
SetupFindFirstLineA( hinf, "TestSection", keys[i].key, &context );
SetLastError( 0xdeadbeef );
intfield = -1;
retb = SetupGetIntField( &context, keys[i].index, &intfield );
if ( keys[i].err == ERROR_SUCCESS )
{
if ( !retb && !lstrcmpA( keys[i].key, "123=" ) )
{
win_skip( "results differ on Win9x\n" );
SetupCloseInfFile( hinf );
continue;
}
ok( retb, "%u: Expected success\n", i );
ok( GetLastError() == ERROR_SUCCESS ||
GetLastError() == 0xdeadbeef /* win9x, NT4 */,