Commit c9663015 authored by Marcel Partap's avatar Marcel Partap Committed by Alexandre Julliard

winspool.drv/tests: Add dumping of FORM_INFO_1/2 in test_EnumForms.

parent 3252ddc0
...@@ -768,7 +768,12 @@ static void test_EnumForms(LPSTR pName) ...@@ -768,7 +768,12 @@ static void test_EnumForms(LPSTR pName)
DWORD pcbNeeded; DWORD pcbNeeded;
DWORD pcReturned; DWORD pcReturned;
DWORD level; DWORD level;
INT i;
const char *formtype;
static const char * const formtypes[] = { "FORM_USER", "FORM_BUILTIN", "FORM_PRINTER", "FORM_flag_unknown" };
#define FORMTYPE_MAX 2
PFORM_INFO_1A pFI_1a;
PFORM_INFO_2A pFI_2a;
res = OpenPrinter(pName, &hprinter, NULL); res = OpenPrinter(pName, &hprinter, NULL);
RETURN_ON_DEACTIVATED_SPOOLER(res) RETURN_ON_DEACTIVATED_SPOOLER(res)
...@@ -785,7 +790,7 @@ static void test_EnumForms(LPSTR pName) ...@@ -785,7 +790,7 @@ static void test_EnumForms(LPSTR pName)
pcReturned = 0xdeadbeef; pcReturned = 0xdeadbeef;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = EnumFormsA(hprinter, level, NULL, 0, &cbBuf, &pcReturned); res = EnumFormsA(hprinter, level, NULL, 0, &cbBuf, &pcReturned);
/* EnumForms is not implemented in win9x */ /* EnumForms is not implemented in win9x */
if (!res && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) continue; if (!res && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) continue;
...@@ -803,7 +808,7 @@ static void test_EnumForms(LPSTR pName) ...@@ -803,7 +808,7 @@ static void test_EnumForms(LPSTR pName)
"ERROR_INVALID_LEVEL or '!=0' and 0x0)\n", "ERROR_INVALID_LEVEL or '!=0' and 0x0)\n",
level, res, GetLastError(), pcReturned); level, res, GetLastError(), pcReturned);
continue; continue;
} }
ok((!res) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER), ok((!res) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
"(%d) returned %d with %d (expected '0' with " "(%d) returned %d with %d (expected '0' with "
...@@ -816,8 +821,31 @@ static void test_EnumForms(LPSTR pName) ...@@ -816,8 +821,31 @@ static void test_EnumForms(LPSTR pName)
res = EnumFormsA(hprinter, level, buffer, cbBuf, &pcbNeeded, &pcReturned); res = EnumFormsA(hprinter, level, buffer, cbBuf, &pcbNeeded, &pcReturned);
ok(res, "(%d) returned %d with %d (expected '!=0')\n", ok(res, "(%d) returned %d with %d (expected '!=0')\n",
level, res, GetLastError()); level, res, GetLastError());
/* We can dump the returned Data here */
if (winetest_debug > 1) {
trace("dumping %d forms level %d\n", pcReturned, level);
pFI_1a = (PFORM_INFO_1A)buffer;
pFI_2a = (PFORM_INFO_2A)buffer;
for (i = 0; i < pcReturned; i++)
{
/* first part is same in FORM_INFO_1 and FORM_INFO_2 */
formtype = (pFI_1a->Flags <= FORMTYPE_MAX) ? formtypes[pFI_1a->Flags] : formtypes[3];
trace("%u (%s): %.03fmm x %.03fmm, %s\n", i, pFI_1a->pName,
(float)pFI_1a->Size.cx/1000, (float)pFI_1a->Size.cy/1000, formtype);
if (level == 1) pFI_1a ++;
else {
/* output additional FORM_INFO_2 fields */
trace("\tkeyword=%s strtype=%u muidll=%s resid=%u dispname=%s langid=%u\n",
pFI_2a->pKeyword, pFI_2a->StringType, pFI_2a->pMuiDll,
pFI_2a->dwResourceId, pFI_2a->pDisplayName, pFI_2a->wLangId);
/* offset pointer pFI_1a by 1*sizeof(FORM_INFO_2A) Bytes */
pFI_2a ++;
pFI_1a = (PFORM_INFO_1A)pFI_2a;
}
}
}
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = EnumFormsA(hprinter, level, buffer, cbBuf+1, &pcbNeeded, &pcReturned); res = EnumFormsA(hprinter, level, buffer, cbBuf+1, &pcbNeeded, &pcReturned);
......
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