mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 18:37:18 +00:00
winspool/tests: Add tests for ClosePrinter.
Signed-off-by: Detlef Riekenberg <wine.dev@web.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b611acc736
commit
4814aad7fe
|
@ -672,6 +672,50 @@ static void test_ConfigurePort(void)
|
|||
|
||||
/* ########################### */
|
||||
|
||||
static void test_ClosePrinter(void)
|
||||
{
|
||||
HANDLE printer = 0;
|
||||
BOOL res;
|
||||
|
||||
/* NULL is handled */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = ClosePrinter(NULL);
|
||||
ok(!res && (GetLastError() == ERROR_INVALID_HANDLE),
|
||||
"got %d with %d (expected FALSE with ERROR_INVALID_HANDLE)\n",
|
||||
res, GetLastError());
|
||||
|
||||
/* A random value as HANDLE is handled */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = ClosePrinter( (void *) -1);
|
||||
if (is_spooler_deactivated(res, GetLastError())) return;
|
||||
ok(!res && (GetLastError() == ERROR_INVALID_HANDLE),
|
||||
"got %d with %d (expected FALSE with ERROR_INVALID_HANDLE)\n",
|
||||
res, GetLastError());
|
||||
|
||||
|
||||
/* Normal use (The Spooler service is needed) */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = OpenPrinterA(default_printer, &printer, NULL);
|
||||
if (is_spooler_deactivated(res, GetLastError())) return;
|
||||
if (res)
|
||||
{
|
||||
SetLastError(0xdeadbeef);
|
||||
res = ClosePrinter(printer);
|
||||
ok(res, "got %d with %d (expected TRUE)\n", res, GetLastError());
|
||||
|
||||
|
||||
/* double free is handled */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = ClosePrinter(printer);
|
||||
ok(!res && (GetLastError() == ERROR_INVALID_HANDLE),
|
||||
"got %d with %d (expected FALSE with ERROR_INVALID_HANDLE)\n",
|
||||
res, GetLastError());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
||||
static void test_DeleteMonitor(void)
|
||||
{
|
||||
MONITOR_INFO_2A mi2a;
|
||||
|
@ -3023,6 +3067,7 @@ START_TEST(info)
|
|||
test_AddPort();
|
||||
test_AddPortEx();
|
||||
test_ConfigurePort();
|
||||
test_ClosePrinter();
|
||||
test_DeleteMonitor();
|
||||
test_DeletePort();
|
||||
test_DeviceCapabilities();
|
||||
|
@ -3037,7 +3082,9 @@ START_TEST(info)
|
|||
test_GetDefaultPrinter();
|
||||
test_GetPrinterDriverDirectory();
|
||||
test_GetPrintProcessorDirectory();
|
||||
test_IsValidDevmodeW();
|
||||
test_OpenPrinter();
|
||||
test_OpenPrinter_defaults();
|
||||
test_GetPrinter();
|
||||
test_GetPrinterData();
|
||||
test_GetPrinterDataEx();
|
||||
|
@ -3045,8 +3092,6 @@ START_TEST(info)
|
|||
test_SetDefaultPrinter();
|
||||
test_XcvDataW_MonitorUI();
|
||||
test_XcvDataW_PortIsValid();
|
||||
test_IsValidDevmodeW();
|
||||
test_OpenPrinter_defaults();
|
||||
|
||||
/* Cleanup our temporary file */
|
||||
DeleteFileA(tempfileA);
|
||||
|
|
Loading…
Reference in a new issue