GDI/tests: link to {G|S}etRelAbs() during runtime [#3]
Saulius Krasuckas
saulius2 at ar.fi.lt
Fri Oct 21 06:54:33 CDT 2005
* On Fri, 21 Oct 2005, Huw Davies wrote:
> * On Fri, Oct 21, 2005 at 01:06:48PM +0300, Saulius Krasuckas wrote:
> > + hGDI = LoadLibraryA("gdi.dll");
>
> You mean "gdi32.dll"
Yes, I see my nightwork isn't much worth of doing it. ;-)
Lets see if I did some more mistakes.
Log message:
Saulius Krasuckas <saulius.krasuckas at ieee.org>
Link to {G|S}etRelAbs() during runtime as Win9x OSes miss them.
Index: dlls/gdi/tests/metafile.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/tests/metafile.c,v
retrieving revision 1.17
diff -p -u -r1.17 metafile.c
--- dlls/gdi/tests/metafile.c 19 Oct 2005 18:28:14 -0000 1.17
+++ dlls/gdi/tests/metafile.c 21 Oct 2005 11:56:52 -0000
@@ -35,6 +35,30 @@ static BOOL emr_processed = FALSE;
#define LINE_X 55.0f
#define LINE_Y 15.0f
+static HMODULE hGDI;
+static INT (WINAPI * pGetRelAbs)(HDC, DWORD);
+static INT (WINAPI * pSetRelAbs)(HDC, INT);
+
+#define GDI_GET_PROC(func) \
+ p ## func = (void *)GetProcAddress(hGDI, #func); \
+ if(!p ## func) \
+ trace("GetProcAddress(hGDI, \"%s\") failed\n", #func); \
+
+static void init_function_pointers(void)
+{
+ pGetRelAbs = NULL;
+ pSetRelAbs = NULL;
+
+ hGDI = LoadLibraryA("gdi32.dll");
+ if(!hGDI) {
+ trace("Could not load gdi32.dll\n");
+ return;
+ }
+
+ GDI_GET_PROC(GetRelAbs);
+ GDI_GET_PROC(SetRelAbs);
+}
+
static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
const ENHMETARECORD *emr, int n_objs, LPARAM param)
{
@@ -65,7 +89,8 @@ static int CALLBACK emf_enum_proc(HDC hd
/* GetBkMode, GetRelAbs do not get reset to the default value */
ok(GetBkMode(hdc) == OPAQUE, "bk mode %d\n", GetBkMode(hdc));
- ok(GetRelAbs(hdc, 0) == RELATIVE, "relabs %d\n", GetRelAbs(hdc, 0));
+ if(pSetRelAbs && pGetRelAbs)
+ ok(pGetRelAbs(hdc, 0) == RELATIVE, "relabs %d\n", pGetRelAbs(hdc, 0));
n_record = 0;
break;
@@ -209,7 +234,7 @@ static void test_ExtTextOut(void)
SetPolyFillMode(hdcDisplay, WINDING);
SetStretchBltMode(hdcDisplay, HALFTONE);
- SetRelAbs(hdcDisplay, RELATIVE);
+ if(pSetRelAbs) pSetRelAbs(hdcDisplay, RELATIVE);
SetBkMode(hdcDisplay, OPAQUE);
ret = EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc);
@@ -787,6 +812,8 @@ static void test_gdiis(void)
START_TEST(metafile)
{
+ init_function_pointers();
+
/* For enhanced metafiles (enhmfdrv) */
test_ExtTextOut();
@@ -801,4 +828,6 @@ START_TEST(metafile)
test_mf_conversions();
test_gdiis();
+
+ FreeLibrary(hGDI);
}
More information about the wine-patches
mailing list