Commit 9e96be87 authored by Felix Nawothnig's avatar Felix Nawothnig Committed by Alexandre Julliard

Fix the EnumEnhMetaFile tests.

parent 183fcb5c
...@@ -443,43 +443,39 @@ static void test_mf_PatternBrush(void) ...@@ -443,43 +443,39 @@ static void test_mf_PatternBrush(void)
HeapFree (GetProcessHeap(), 0, orig_lb); HeapFree (GetProcessHeap(), 0, orig_lb);
} }
static INT CALLBACK EmfMmTextEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData) static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)
{ {
LPMETAFILEPICT lpMFP = (LPMETAFILEPICT)lpData;
POINT mapping[2] = { { 0, 0 }, { 10, 10 } }; POINT mapping[2] = { { 0, 0 }, { 10, 10 } };
LPtoDP(hdc, mapping, 2); /* When using MM_TEXT Win9x does not update the mapping mode
trace("Meta record: iType = %ld, (%ld,%ld)-(%ld,%ld)\n", lpEMFR->iType, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y); * until a record is played which actually outputs something */
if (lpEMFR->iType == EMR_LINETO)
{
INT x0 = 0;
INT y0 = 0;
INT x1 = (INT)floor(10 * 100.0 / LINE_X + 0.5);
INT y1 = (INT)floor(10 * 100.0 / LINE_Y + 0.5);
ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1,
"(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n",
mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y,
x0, y0, x1, y1);
}
PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj); PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj);
return TRUE;
}
static INT CALLBACK EmfMmAnisotropicEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)
{
POINT mapping[2] = { { 0, 0 }, { 10, 10 } };
LPtoDP(hdc, mapping, 2); LPtoDP(hdc, mapping, 2);
trace("Meta record: iType = %ld, (%ld,%ld)-(%ld,%ld)\n", lpEMFR->iType, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y); trace("Meta record: iType = %ld, (%ld,%ld)-(%ld,%ld)\n", lpEMFR->iType, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y);
if (lpEMFR->iType == EMR_LINETO) if (lpEMFR->iType == EMR_LINETO)
{ {
INT x0 = MulDiv(0, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES)); INT x0, y0, x1, y1;
INT y0 = MulDiv(0, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES)); if (!lpMFP || lpMFP->mm == MM_TEXT)
INT x1 = MulDiv(10, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES)); {
INT y1 = MulDiv(10, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES)); x0 = 0;
y0 = 0;
x1 = (INT)floor(10 * 100.0 / LINE_X + 0.5);
y1 = (INT)floor(10 * 100.0 / LINE_Y + 0.5);
}
else
{
ok(lpMFP->mm == MM_ANISOTROPIC, "mm=%ld\n", lpMFP->mm);
x0 = MulDiv(0, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES));
y0 = MulDiv(0, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES));
x1 = MulDiv(10, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES));
y1 = MulDiv(10, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES));
}
ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1, ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1,
"(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n", "(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n",
mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y,
x0, y0, x1, y1); x0, y0, x1, y1);
} }
PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj);
return TRUE; return TRUE;
} }
...@@ -518,7 +514,7 @@ static void test_mf_conversions(void) ...@@ -518,7 +514,7 @@ static void test_mf_conversions(void)
mfp.yExt = 100; mfp.yExt = 100;
mfp.hMF = NULL; mfp.hMF = NULL;
hemf = create_converted_emf(&mfp); hemf = create_converted_emf(&mfp);
EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmAnisotropicEnumProc, NULL, &rect); EnumEnhMetaFile(hdcOffscreen, hemf, EmfEnumProc, &mfp, &rect);
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);
DeleteDC(hdcOffscreen); DeleteDC(hdcOffscreen);
} }
...@@ -534,7 +530,7 @@ static void test_mf_conversions(void) ...@@ -534,7 +530,7 @@ static void test_mf_conversions(void)
mfp.yExt = 0; mfp.yExt = 0;
mfp.hMF = NULL; mfp.hMF = NULL;
hemf = create_converted_emf(&mfp); hemf = create_converted_emf(&mfp);
EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmTextEnumProc, NULL, &rect); EnumEnhMetaFile(hdcOffscreen, hemf, EmfEnumProc, &mfp, &rect);
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);
DeleteDC(hdcOffscreen); DeleteDC(hdcOffscreen);
} }
...@@ -545,7 +541,7 @@ static void test_mf_conversions(void) ...@@ -545,7 +541,7 @@ static void test_mf_conversions(void)
HENHMETAFILE hemf; HENHMETAFILE hemf;
RECT rect = { 0, 0, 100, 100 }; RECT rect = { 0, 0, 100, 100 };
hemf = create_converted_emf(NULL); hemf = create_converted_emf(NULL);
EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmTextEnumProc, NULL, &rect); EnumEnhMetaFile(hdcOffscreen, hemf, EmfEnumProc, NULL, &rect);
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);
DeleteDC(hdcOffscreen); DeleteDC(hdcOffscreen);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment