Charles Davis : gdi32/tests: Test BitBlt() to an enhanced metafile.
Alexandre Julliard
julliard at winehq.org
Mon Nov 23 08:49:55 CST 2009
Module: wine
Branch: master
Commit: 3f1281cc449a9a9c92b1fe1f0064c35a8a103f55
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f1281cc449a9a9c92b1fe1f0064c35a8a103f55
Author: Charles Davis <cdavis at mymail.mines.edu>
Date: Sun Nov 22 13:25:42 2009 -0700
gdi32/tests: Test BitBlt() to an enhanced metafile.
---
dlls/gdi32/tests/metafile.c | 122 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 122 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index b559901..9ce3ece 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -1030,6 +1030,63 @@ static const unsigned char EMF_LINETO_MM_TEXT_BITS[] = {
0x14, 0x00, 0x00, 0x00
};
+static const unsigned char EMF_BITBLT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xa0, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x23, 0x04, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00,
+ 0x75, 0x01, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0xb1, 0x05, 0x00,
+ 0x28, 0x11, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0xcc, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x8c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
+
/* For debugging or dumping the raw metafiles produced by
* new test functions.
*/
@@ -1382,6 +1439,70 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits,
return 0;
}
+
+/* tests blitting to an EMF */
+static void test_emf_BitBlt(void)
+{
+ HDC hdcDisplay, hdcMetafile, hdcBitmap;
+ HBITMAP hBitmap, hOldBitmap;
+ HENHMETAFILE hMetafile;
+#define BMP_DIM 4
+ BITMAPINFOHEADER bmih =
+ {
+ sizeof(BITMAPINFOHEADER),
+ BMP_DIM,/* biWidth */
+ BMP_DIM,/* biHeight */
+ 1, /* biPlanes */
+ 24, /* biBitCount */
+ BI_RGB, /* biCompression */
+ 0, /* biXPelsPerMeter */
+ 0, /* biYPelsPerMeter */
+ 0, /* biClrUsed */
+ 0, /* biClrImportant */
+ };
+ void *bits;
+ BOOL ret;
+
+ hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
+ ok( hdcDisplay != 0, "CreateDCA error %d\n", GetLastError() );
+
+ hdcBitmap = CreateCompatibleDC(hdcDisplay);
+ ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" );
+ bmih.biXPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSX), 100, 3937);
+ bmih.biYPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSY), 100, 3937);
+ hBitmap = CreateDIBSection(hdcDisplay, (const BITMAPINFO *)&bmih,
+ DIB_RGB_COLORS, &bits, NULL, 0);
+ hOldBitmap = SelectObject(hdcBitmap, hBitmap);
+
+ hdcMetafile = CreateEnhMetaFileA(hdcBitmap, NULL, NULL, NULL);
+ ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
+
+ /* First fill the bitmap DC with something recognizable, like BLACKNESS */
+ ret = BitBlt(hdcBitmap, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, BLACKNESS);
+ ok( ret, "BitBlt(BLACKNESS) failed\n" );
+
+ ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, hdcBitmap, 0, 0, SRCCOPY);
+ ok( ret, "BitBlt(SRCCOPY) failed\n" );
+ ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, WHITENESS);
+ ok( ret, "BitBlt(WHITENESS) failed\n" );
+
+ hMetafile = CloseEnhMetaFile(hdcMetafile);
+ ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
+
+ if(compare_emf_bits(hMetafile, EMF_BITBLT, sizeof(EMF_BITBLT),
+ "emf_BitBlt", FALSE) != 0)
+ {
+ dump_emf_bits(hMetafile, "emf_BitBlt");
+ dump_emf_records(hMetafile, "emf_BitBlt");
+ }
+
+ SelectObject(hdcBitmap, hOldBitmap);
+ DeleteObject(hBitmap);
+ DeleteDC(hdcBitmap);
+ DeleteDC(hdcDisplay);
+#undef BMP_DIM
+}
+
/* Test a blank metafile. May be used as a template for new tests. */
static void test_mf_Blank(void)
@@ -2628,6 +2749,7 @@ START_TEST(metafile)
/* For enhanced metafiles (enhmfdrv) */
test_ExtTextOut();
test_SaveDC();
+ test_emf_BitBlt();
/* For win-format metafiles (mfdrv) */
test_mf_SaveDC();
More information about the wine-cvs
mailing list