[PATCH] gdi32/tests: CloseMetaFile() no longer destroys the metafile hdc.
Francois Gouget
fgouget at free.fr
Thu Nov 21 09:08:46 CST 2019
Windows 10 1507 still deleted it but 1607 no longer does.
Signed-off-by: Francois Gouget <fgouget at free.fr>
---
Even calling GetObjectType() after calling DeleteMetaFile() still
returns OBJ_METADC so I don't know when Windows actually destroys the
metafile hdc. Maybe it does destroy it but GetObjectType() does not
notice until the corresponding memory area is reused for something else?
>From time to time there is a run with only two failures which I
think gives credit to the above theory:
https://test.winehq.org/data/aa3d01e65019fb2f135f74cf26cfa1661ca09325/index_Win10.html#kernel32:codepage
In any case this behavior seems broken so I'm marking it as such in the
test.
dlls/gdi32/tests/metafile.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index f1978f7bdfd..6adafa37b82 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -2082,7 +2082,9 @@ static void test_mf_Blank(void)
ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
type = GetObjectType(hMetafile);
ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
- ok(!GetObjectType(hdcMetafile), "CloseMetaFile has to destroy metafile hdc\n");
+ type = GetObjectType(hdcMetafile);
+ ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
+ "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
if (compare_mf_bits (hMetafile, MF_BLANK_BITS, sizeof(MF_BLANK_BITS),
"mf_blank") != 0)
@@ -2249,6 +2251,7 @@ static void test_mf_Graphics(void)
HDC hdcMetafile;
HMETAFILE hMetafile;
POINT oldpoint;
+ INT type;
BOOL ret;
hdcMetafile = CreateMetaFileA(NULL);
@@ -2275,7 +2278,9 @@ static void test_mf_Graphics(void)
hMetafile = CloseMetaFile(hdcMetafile);
ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
- ok(!GetObjectType(hdcMetafile), "CloseMetaFile has to destroy metafile hdc\n");
+ type = GetObjectType(hdcMetafile);
+ ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
+ "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
if (compare_mf_bits (hMetafile, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS),
"mf_Graphics") != 0)
@@ -2296,6 +2301,7 @@ static void test_mf_PatternBrush(void)
LOGBRUSH *orig_lb;
HBRUSH hBrush;
BOOL ret;
+ INT type;
orig_lb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGBRUSH));
@@ -2316,7 +2322,9 @@ static void test_mf_PatternBrush(void)
hMetafile = CloseMetaFile(hdcMetafile);
ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
- ok(!GetObjectType(hdcMetafile), "CloseMetaFile has to destroy metafile hdc\n");
+ type = GetObjectType(hdcMetafile);
+ ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
+ "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
if (compare_mf_bits (hMetafile, MF_PATTERN_BRUSH_BITS, sizeof(MF_PATTERN_BRUSH_BITS),
"mf_Pattern_Brush") != 0)
--
2.20.1
More information about the wine-devel
mailing list