Better test for visible desktop, should be working on all platforms.
Jakob Eriksson
jakov at vmlinux.org
Sat Mar 5 04:43:18 CST 2005
I took this test from the gdi32 conformance tests, since it fails
reliably when run under a non visible desktop, regardless of platform.
It's not pretty, but I don't have an NT4 to test with, so I didn't want
to change
anything. Later I can refactor it into exactly the failing part.
regards,
Jakob Eriksson
-------------- next part --------------
Index: programs/winetest/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/winetest/Makefile.in,v
retrieving revision 1.34
diff -u -r1.34 Makefile.in
--- programs/winetest/Makefile.in 21 Jan 2005 10:15:04 -0000 1.34
+++ programs/winetest/Makefile.in 5 Mar 2005 09:31:34 -0000
@@ -4,7 +4,7 @@
VPATH = @srcdir@
MODULE = winetest.exe
APPMODE = -mconsole
-IMPORTS = comctl32 user32 wsock32
+IMPORTS = comctl32 user32 wsock32 gdi32
C_SRCS = \
gui.c \
Index: programs/winetest/main.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/main.c,v
retrieving revision 1.26
diff -u -r1.26 main.c
--- programs/winetest/main.c 3 Mar 2005 13:49:47 -0000 1.26
+++ programs/winetest/main.c 5 Mar 2005 09:31:34 -0000
@@ -1,6 +1,7 @@
/*
* Wine Conformance Test EXE
*
+ * Copyright 2005 Jakob Eriksson
* Copyright 2003, 2004 Jakob Eriksson (for Solid Form Sweden AB)
* Copyright 2003 Dimitrie O. Paun
* Copyright 2003 Ferenc Wagner
@@ -66,9 +67,74 @@
return (GetProcAddress(module, "wine_server_call") != NULL);
}
+static int emr_processed = 0;
+
+static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
+ const ENHMETARECORD *emr, int n_objs, LPARAM param)
+{
+ PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
+
+ if (EMR_EXTTEXTOUTA == emr->iType || EMR_EXTTEXTOUTW == emr->iType)
+ emr_processed = 1;
+
+ return 1;
+}
+
static int running_on_visible_desktop ()
{
- return IsWindowVisible( GetDesktopWindow() );
+ HWND hwnd;
+ HDC hdcDisplay, hdcMetafile;
+ HENHMETAFILE hMetafile;
+ HFONT hFont;
+ static const char text[] = "Simple text to test ExtTextOut on metafiles";
+ INT i, len, dx[256];
+ static const RECT rc = { 0, 0, 100, 100 };
+ BOOL ret;
+ LOGFONTA orig_lf;
+
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
+ 0, 0, 200, 200, 0, 0, 0, NULL);
+
+ hdcDisplay = GetDC(hwnd);
+
+ SetMapMode(hdcDisplay, MM_TEXT);
+
+ memset(&orig_lf, 0, sizeof(orig_lf));
+
+ orig_lf.lfCharSet = ANSI_CHARSET;
+ orig_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ orig_lf.lfWeight = FW_DONTCARE;
+ orig_lf.lfHeight = 7;
+ orig_lf.lfQuality = DEFAULT_QUALITY;
+ lstrcpyA(orig_lf.lfFaceName, "Arial");
+ hFont = CreateFontIndirectA(&orig_lf);
+
+ hFont = SelectObject(hdcDisplay, hFont);
+
+ len = lstrlenA(text);
+ for (i = 0; i < len; i++)
+ ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]);
+
+ hFont = SelectObject(hdcDisplay, hFont);
+
+ hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
+
+ hFont = SelectObject(hdcMetafile, hFont);
+
+ ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL);
+
+ ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
+
+ hFont = SelectObject(hdcMetafile, hFont);
+ ret = DeleteObject(hFont);
+
+ hMetafile = CloseEnhMetaFile(hdcMetafile);
+
+ ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc);
+
+ ret = EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc);
+
+ return emr_processed;
}
void print_version ()
More information about the wine-patches
mailing list