mapi32/tests: Don't run tests if functions are not implemented.

This commit is contained in:
Paul Vriens 2007-03-04 11:44:34 +01:00 committed by Alexandre Julliard
parent 17ac48b6a4
commit 9f92437e29
3 changed files with 50 additions and 5 deletions

View File

@ -87,12 +87,28 @@ static void test_IMalloc(void)
START_TEST(imalloc) START_TEST(imalloc)
{ {
SCODE ret;
hMapi32 = LoadLibraryA("mapi32.dll"); hMapi32 = LoadLibraryA("mapi32.dll");
pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4"); pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
if (!pScInitMapiUtil) if (!pScInitMapiUtil)
{
skip("ScInitMapiUtil is not available\n");
FreeLibrary(hMapi32);
return; return;
pScInitMapiUtil(0); }
SetLastError(0xdeadbeef);
ret = pScInitMapiUtil(0);
if ((ret != S_OK) && (GetLastError() == ERROR_PROC_NOT_FOUND))
{
skip("ScInitMapiUtil is not implemented\n");
FreeLibrary(hMapi32);
return;
}
test_IMalloc(); test_IMalloc();
FreeLibrary(hMapi32);
} }

View File

@ -1342,10 +1342,22 @@ static void test_IProp(void)
START_TEST(prop) START_TEST(prop)
{ {
if(!InitFuncPtrs()) SCODE ret;
return;
pScInitMapiUtil(0); if(!InitFuncPtrs())
{
skip("Needed functions are not available\n");
return;
}
SetLastError(0xdeadbeef);
ret = pScInitMapiUtil(0);
if ((ret != S_OK) && (GetLastError() == ERROR_PROC_NOT_FOUND))
{
skip("ScInitMapiUtil is not implemented\n");
FreeLibrary(hMapi32);
return;
}
test_PropCopyMore(); test_PropCopyMore();
test_UlPropSize(); test_UlPropSize();

View File

@ -169,12 +169,27 @@ static void test_IsBadBoundedStringPtr(void)
START_TEST(util) START_TEST(util)
{ {
SCODE ret;
hMapi32 = LoadLibraryA("mapi32.dll"); hMapi32 = LoadLibraryA("mapi32.dll");
pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4"); pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
if (!pScInitMapiUtil) if (!pScInitMapiUtil)
{
skip("ScInitMapiUtil is not available\n");
FreeLibrary(hMapi32);
return; return;
pScInitMapiUtil(0); }
SetLastError(0xdeadbeef);
ret = pScInitMapiUtil(0);
if ((ret != S_OK) && (GetLastError() == ERROR_PROC_NOT_FOUND))
{
skip("ScInitMapiUtil is not implemented\n");
FreeLibrary(hMapi32);
return;
}
test_SwapPword(); test_SwapPword();
test_SwapPlong(); test_SwapPlong();
@ -183,4 +198,6 @@ START_TEST(util)
test_UlFromSzHex(); test_UlFromSzHex();
test_CbOfEncoded(); test_CbOfEncoded();
test_IsBadBoundedStringPtr(); test_IsBadBoundedStringPtr();
FreeLibrary(hMapi32);
} }