kernel32/tests: Don't test functions directly when reporting GetLastError().

Signed-off-by: André Zwing <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
André Zwing 2021-12-28 20:09:48 +01:00 committed by Alexandre Julliard
parent a225ca161b
commit a6bf1a5ffb
1 changed files with 28 additions and 40 deletions

View File

@ -7048,22 +7048,19 @@ static BOOL CALLBACK calinfo_procA(LPSTR calinfo)
static void test_EnumCalendarInfoA(void)
{
BOOL ret;
INT i;
ok( EnumCalendarInfoA( calinfo_procA,
LOCALE_USER_DEFAULT,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ),
"EnumCalendarInfoA for user default locale failed: %u\n", GetLastError() );
ret = EnumCalendarInfoA( calinfo_procA, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret, "EnumCalendarInfoA for user default locale failed: %u\n", GetLastError() );
for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++)
{
LCID lcid = locales_with_optional_calendars[i];
ok( EnumCalendarInfoA( calinfo_procA,
lcid,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) ||
broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
ret = EnumCalendarInfoA( calinfo_procA, lcid, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
"EnumCalendarInfoA for LCID %#06x failed: %u\n", lcid, GetLastError() );
}
}
@ -7076,22 +7073,19 @@ static BOOL CALLBACK calinfo_procW(LPWSTR calinfo)
static void test_EnumCalendarInfoW(void)
{
BOOL ret;
INT i;
ok( EnumCalendarInfoW( calinfo_procW,
LOCALE_USER_DEFAULT,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ),
"EnumCalendarInfoW for user default locale failed: %u\n", GetLastError() );
ret = EnumCalendarInfoW( calinfo_procW, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret, "EnumCalendarInfoW for user default locale failed: %u\n", GetLastError() );
for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++)
{
LCID lcid = locales_with_optional_calendars[i];
ok( EnumCalendarInfoW( calinfo_procW,
lcid,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) ||
broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
ret = EnumCalendarInfoW( calinfo_procW, lcid, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
"EnumCalendarInfoW for LCID %#06x failed: %u\n", lcid, GetLastError() );
}
}
@ -7105,22 +7099,19 @@ static BOOL CALLBACK calinfoex_procA(LPSTR calinfo, LCID calid)
static void test_EnumCalendarInfoExA(void)
{
BOOL ret;
INT i;
ok( EnumCalendarInfoExA( calinfoex_procA,
LOCALE_USER_DEFAULT,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ),
"EnumCalendarInfoExA for user default locale failed: %u\n", GetLastError() );
ret = EnumCalendarInfoExA( calinfoex_procA, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret, "EnumCalendarInfoExA for user default locale failed: %u\n", GetLastError() );
for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++)
{
LCID lcid = locales_with_optional_calendars[i];
ok( EnumCalendarInfoExA( calinfoex_procA,
lcid,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) ||
broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
ret = EnumCalendarInfoExA( calinfoex_procA, lcid, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
"EnumCalendarInfoExA for LCID %#06x failed: %u\n", lcid, GetLastError() );
}
}
@ -7134,22 +7125,19 @@ static BOOL CALLBACK calinfoex_procW(LPWSTR calinfo, LCID calid)
static void test_EnumCalendarInfoExW(void)
{
BOOL ret;
INT i;
ok( EnumCalendarInfoExW( calinfoex_procW,
LOCALE_USER_DEFAULT,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ),
"EnumCalendarInfoExW for user default locale failed: %u\n", GetLastError() );
ret = EnumCalendarInfoExW( calinfoex_procW, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret, "EnumCalendarInfoExW for user default locale failed: %u\n", GetLastError() );
for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++)
{
LCID lcid = locales_with_optional_calendars[i];
ok( EnumCalendarInfoExW( calinfoex_procW,
lcid,
ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) ||
broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
ret = EnumCalendarInfoExW( calinfoex_procW, lcid, ENUM_ALL_CALENDARS,
CAL_RETURN_NUMBER | CAL_ICALINTVALUE );
ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */,
"EnumCalendarInfoExW for LCID %#06x failed: %u\n", lcid, GetLastError() );
}
}