Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4814aad7
Commit
4814aad7
authored
Nov 01, 2016
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool/tests: Add tests for ClosePrinter.
Signed-off-by:
Detlef Riekenberg
<
wine.dev@web.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b611acc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
2 deletions
+47
-2
info.c
dlls/winspool.drv/tests/info.c
+47
-2
No files found.
dlls/winspool.drv/tests/info.c
View file @
4814aad7
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment