Writing tests

Walt Ogburn reuben at ugcs.caltech.edu
Wed Oct 27 22:15:40 CDT 2004


Hi folks,

I have a question about dependencies when writing tests.  Some tests use
LoadLibraryA and GetProcessAddress to get access to Windows / Wine APIs,
and other tests just include the appropriate header files and link to the
DLLs.  One example of the first type is dlls/oleaut32/olefont.c:

================ <snip> ==============================================
static HMODULE hOleaut32;

static HRESULT (WINAPI
*pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*);

START_TEST(olefont)
{
        LPVOID pvObj = NULL;
        HRESULT hres;
        IFont*  font = NULL;

        hOleaut32 = LoadLibraryA("oleaut32.dll");
        pOleCreateFontIndirect = (void*)GetProcAddress(hOleaut32, "OleCreateFontIndirect");
        if (!pOleCreateFontIndirect)
            return;
=====================================================================

What is the reason for this difference?  Which example should new tests
follow?  My guess is that LoadLibraryA and GetProcAddress are used if the
headers, DLLs, and APIs might not be present on some Windows machines, so
that the tests don't fail.  If that's correct, is there a list somewhere
of which ones are safe and which ones should be handled like in the
olefont test?

Thanks,
Walter



More information about the wine-devel mailing list