Vincent Povirk wrote:
You still have the loop comparing to 0xff, and the test won't pass on windows with the if(0).
Whoops, that must have been an old version of the patch. I fixed the first one, and the second one should be fixed, too. Now the BitBlt(...,WHITENESS) call executes on Windows, but not on Wine. (There should be a function in wine/test.h for doing this.) Patch attached.
On Tue, Nov 17, 2009 at 6:09 PM, Charles Davis cdavis@mymail.mines.edu wrote:
All right, this should be the last one. The tests pass on Wine, and should pass on Windows if you un-if(0) the call to BitBlt(..., WHITENESS). I still don't have any results for the many other Windows versions (95, 98, ME, NT4, 2000, Vista, Win7), so I'm going to wait for results from these other platforms before I send this to wine-patches.
Chip
From 2d5aa7c607496c1b05a7a08adfee09db446754cb Mon Sep 17 00:00:00 2001 From: Charles Davis cdavis@mymail.mines.edu Date: Tue, 17 Nov 2009 11:10:50 -0700 Subject: [PATCH] gdi32/tests: Test BitBlt() to a metafile. To: wine-patches wine-patches@winehq.org Reply-To: wine-devel wine-devel@winehq.org
dlls/gdi32/tests/metafile.c | 83 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index b559901..19401ed 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -665,6 +665,88 @@ static void test_SaveDC(void) DestroyWindow(hwnd); }
+static int CALLBACK test_BitBlt_record(HDC hdc, HANDLETABLE *table, const ENHMETARECORD *emfr, int nobj, LPARAM data) +{
- UINT *pi = (UINT *)data;
- EMRBITBLT *emrbb;
- if(emfr->iType != EMR_BITBLT) return 1;
- emrbb = (EMRBITBLT *)emfr;
- (*pi)++;
- if(*pi > 2) return 1;
- ok( emrbb->xDest == 0, "wrong xDest for BitBlt record: got %d, expected 0\n", emrbb->xDest );
- ok( emrbb->yDest == 0, "wrong yDest for BitBlt record: got %d, expected 0\n", emrbb->yDest );
- ok( emrbb->xSrc == 0, "wrong xSrc for BitBlt record: got %d, expected 0\n", emrbb->xSrc );
- ok( emrbb->ySrc == 0, "wrong ySrc for BitBlt record: got %d, expected 0\n", emrbb->ySrc );
- ok( emrbb->cxDest == GetSystemMetrics(SM_CXSCREEN), "wrong cxDest for BitBlt record: got %d\n", emrbb->cxDest );
- ok( emrbb->cyDest == GetSystemMetrics(SM_CYSCREEN), "wrong cyDest for BitBlt record: got %d\n", emrbb->cyDest );
- if(*pi == 1) /* First BitBlt */
- {
ok( emrbb->dwRop == SRCCOPY, "wrong ROP for BitBlt record: got %x, expected SRCCOPY\n", emrbb->dwRop );
- }
- else
- {
todo_wine ok( emrbb->dwRop == WHITENESS, "wrong ROP for BitBlt record: got %x, expected WHITENESS\n", emrbb->dwRop );
- }
- return 1;
+}
+static void test_emf_BitBlt(void) +{
- HDC hdcDisplay, hdcMetafile, hdcBitmap;
- HBITMAP hBitmap, hOldBitmap;
- HENHMETAFILE hMetafile;
- ENHMETAHEADER emh;
- BYTE *bits;
- BOOL ret;
- UINT i;
- hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
- ok( hdcDisplay != 0, "CreateDCA error %d\n", GetLastError() );
- hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
- ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
- hdcBitmap = CreateCompatibleDC(hdcDisplay);
- ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" );
- hBitmap = CreateCompatibleBitmap(hdcDisplay, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
- ok( hBitmap != 0, "CreateCompatibleBitmap failed\n" );
- hOldBitmap = SelectObject(hdcBitmap, hBitmap);
- ret = BitBlt(hdcMetafile, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hdcBitmap, 0, 0, SRCCOPY);
- ok( ret, "BitBlt failed\n" );
- if(0) /* Crashes on wine */
- {
ret = BitBlt(hdcMetafile, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0, 0, 0, WHITENESS);
ok( ret, "BitBlt failed\n" );
- }
- hMetafile = CloseEnhMetaFile(hdcMetafile);
- ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
- ret = GetEnhMetaFileHeader( hMetafile, sizeof(emh), &emh );
- ok( ret != 0, "GetEnhMetaFileHeader failed\n" );
- ok( emh.dSignature == ENHMETA_SIGNATURE, "bad metafile signature %x\n", emh.dSignature );
- bits = HeapAlloc( GetProcessHeap(), 0, emh.nBytes );
- if(!bits)
- {
skip( "not enough memory for EMF bits\n" );
return;
- }
- ret = GetEnhMetaFileBits( hMetafile, emh.nBytes, bits );
- ok( ret != 0, "GetEnhMetaFileBits error %d\n", GetLastError() );
- for(i = 0; i < emh.nBytes; i++)
todo_wine ok( bits[i] == 0xff, "unexpected EMF bits: got %02x, expected 0xff\n", bits[i] );
- EnumEnhMetaFile(0, hMetafile, test_BitBlt_record, &i, NULL);
- todo_wine ok( i == 2, "too many/not enough BitBlt records: got %d, expected 2\n", i );
- SelectObject(hdcBitmap, hOldBitmap);
- DeleteObject(hBitmap);
- DeleteDC(hdcBitmap);
+}
static void test_mf_SaveDC(void) { HDC hdcMetafile; @@ -2628,6 +2710,7 @@ START_TEST(metafile) /* For enhanced metafiles (enhmfdrv) */ test_ExtTextOut(); test_SaveDC();
test_emf_BitBlt();
/* For win-format metafiles (mfdrv) */ test_mf_SaveDC();
-- 1.6.5.2
Chip
From 990018e6e74279c3243d2c3b48472e94d8839c8c Mon Sep 17 00:00:00 2001
From: Charles Davis cdavis@mymail.mines.edu Date: Tue, 17 Nov 2009 11:10:50 -0700 Subject: [PATCH] gdi32/tests: Test BitBlt() to a metafile. To: wine-patches wine-patches@winehq.org Reply-To: wine-devel wine-devel@winehq.org
--- dlls/gdi32/tests/metafile.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index b559901..dbeff43 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -665,6 +665,72 @@ static void test_SaveDC(void) DestroyWindow(hwnd); }
+static int CALLBACK test_BitBlt_record(HDC hdc, HANDLETABLE *table, const ENHMETARECORD *emfr, int nobj, LPARAM data) +{ + UINT *pi = (UINT *)data; + EMRBITBLT *emrbb; + + if(emfr->iType != EMR_BITBLT) return 1; + emrbb = (EMRBITBLT *)emfr; + + (*pi)++; + if(*pi > 2) return 1; + ok( emrbb->xDest == 0, "wrong xDest for BitBlt record: got %d, expected 0\n", emrbb->xDest ); + ok( emrbb->yDest == 0, "wrong yDest for BitBlt record: got %d, expected 0\n", emrbb->yDest ); + ok( emrbb->xSrc == 0, "wrong xSrc for BitBlt record: got %d, expected 0\n", emrbb->xSrc ); + ok( emrbb->ySrc == 0, "wrong ySrc for BitBlt record: got %d, expected 0\n", emrbb->ySrc ); + ok( emrbb->cxDest == GetSystemMetrics(SM_CXSCREEN), "wrong cxDest for BitBlt record: got %d\n", emrbb->cxDest ); + ok( emrbb->cyDest == GetSystemMetrics(SM_CYSCREEN), "wrong cyDest for BitBlt record: got %d\n", emrbb->cyDest ); + if(*pi == 1) /* First BitBlt */ + { + ok( emrbb->dwRop == SRCCOPY, "wrong ROP for BitBlt record: got %x, expected SRCCOPY\n", emrbb->dwRop ); + } + else + { + todo_wine ok( emrbb->dwRop == WHITENESS, "wrong ROP for BitBlt record: got %x, expected WHITENESS\n", emrbb->dwRop ); + } + return 1; +} + +static void test_emf_BitBlt(void) +{ + HDC hdcDisplay, hdcMetafile, hdcBitmap; + HBITMAP hBitmap, hOldBitmap; + HENHMETAFILE hMetafile; + BOOL ret; + UINT i; + + hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL); + ok( hdcDisplay != 0, "CreateDCA error %d\n", GetLastError() ); + hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL); + ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" ); + + hdcBitmap = CreateCompatibleDC(hdcDisplay); + ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" ); + hBitmap = CreateCompatibleBitmap(hdcDisplay, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + ok( hBitmap != 0, "CreateCompatibleBitmap failed\n" ); + hOldBitmap = SelectObject(hdcBitmap, hBitmap); + + ret = BitBlt(hdcMetafile, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hdcBitmap, 0, 0, SRCCOPY); + ok( ret, "BitBlt failed\n" ); + if(0) /* Crashes on wine */ + { + ret = BitBlt(hdcMetafile, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0, 0, 0, WHITENESS); + ok( ret, "BitBlt failed\n" ); + } + + hMetafile = CloseEnhMetaFile(hdcMetafile); + ok( hMetafile != 0, "CloseEnhMetaFile failed\n" ); + + i = 0; + EnumEnhMetaFile(0, hMetafile, test_BitBlt_record, &i, NULL); + todo_wine ok( i == 2, "too many/not enough BitBlt records: got %d, expected 2\n", i ); + + SelectObject(hdcBitmap, hOldBitmap); + DeleteObject(hBitmap); + DeleteDC(hdcBitmap); +} + static void test_mf_SaveDC(void) { HDC hdcMetafile; @@ -2628,6 +2694,7 @@ START_TEST(metafile) /* For enhanced metafiles (enhmfdrv) */ test_ExtTextOut(); test_SaveDC(); + test_emf_BitBlt();
/* For win-format metafiles (mfdrv) */ test_mf_SaveDC();