Module: wine Branch: master Commit: 9f92437e291d45ba7800b72f9512a12b3f7b6adf URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f92437e291d45ba7800b72f95... Author: Paul Vriens <paul.vriens.wine(a)gmail.com> Date: Sun Mar 4 11:44:34 2007 +0100 mapi32/tests: Don't run tests if functions are not implemented. --- dlls/mapi32/tests/imalloc.c | 18 +++++++++++++++++- dlls/mapi32/tests/prop.c | 14 +++++++++++++- dlls/mapi32/tests/util.c | 19 ++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/dlls/mapi32/tests/imalloc.c b/dlls/mapi32/tests/imalloc.c index f882a20..63c66f2 100644 --- a/dlls/mapi32/tests/imalloc.c +++ b/dlls/mapi32/tests/imalloc.c @@ -87,12 +87,28 @@ static void test_IMalloc(void) START_TEST(imalloc) { + SCODE ret; + hMapi32 = LoadLibraryA("mapi32.dll"); pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil(a)4"); if (!pScInitMapiUtil) + { + skip("ScInitMapiUtil is not available\n"); + FreeLibrary(hMapi32); + return; + } + + SetLastError(0xdeadbeef); + ret = pScInitMapiUtil(0); + if ((ret != S_OK) && (GetLastError() == ERROR_PROC_NOT_FOUND)) + { + skip("ScInitMapiUtil is not implemented\n"); + FreeLibrary(hMapi32); return; - pScInitMapiUtil(0); + } test_IMalloc(); + + FreeLibrary(hMapi32); } diff --git a/dlls/mapi32/tests/prop.c b/dlls/mapi32/tests/prop.c index ac397ff..d78eb36 100644 --- a/dlls/mapi32/tests/prop.c +++ b/dlls/mapi32/tests/prop.c @@ -1342,10 +1342,22 @@ static void test_IProp(void) START_TEST(prop) { + SCODE ret; + if(!InitFuncPtrs()) + { + skip("Needed functions are not available\n"); 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_PropCopyMore(); test_UlPropSize(); diff --git a/dlls/mapi32/tests/util.c b/dlls/mapi32/tests/util.c index b2d156b..2ae42f1 100644 --- a/dlls/mapi32/tests/util.c +++ b/dlls/mapi32/tests/util.c @@ -169,12 +169,27 @@ static void test_IsBadBoundedStringPtr(void) START_TEST(util) { + SCODE ret; + hMapi32 = LoadLibraryA("mapi32.dll"); pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil(a)4"); + if (!pScInitMapiUtil) + { + skip("ScInitMapiUtil is not available\n"); + FreeLibrary(hMapi32); 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_SwapPlong(); @@ -183,4 +198,6 @@ START_TEST(util) test_UlFromSzHex(); test_CbOfEncoded(); test_IsBadBoundedStringPtr(); + + FreeLibrary(hMapi32); }