Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d0e93cd3
Commit
d0e93cd3
authored
Jun 15, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jun 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi/tests: Add simple enumeration tests for SetupIterateCabinetA.
parent
abf63710
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
setupcab.c
dlls/setupapi/tests/setupcab.c
+59
-0
No files found.
dlls/setupapi/tests/setupcab.c
View file @
d0e93cd3
...
...
@@ -316,6 +316,63 @@ static void test_invalid_callbackW(void)
DeleteFileW
(
source
);
}
static
const
char
*
expected_files
[]
=
{
"tristram"
,
"wine"
,
"shandy"
};
static
UINT
CALLBACK
simple_callbackA
(
PVOID
Context
,
UINT
Notification
,
UINT_PTR
Param1
,
UINT_PTR
Param2
)
{
static
int
index
;
int
*
file_count
=
Context
;
switch
(
Notification
)
{
case
SPFILENOTIFY_CABINETINFO
:
index
=
0
;
return
NO_ERROR
;
case
SPFILENOTIFY_FILEINCABINET
:
{
FILE_IN_CABINET_INFO_A
*
info
=
(
FILE_IN_CABINET_INFO_A
*
)
Param1
;
(
*
file_count
)
++
;
if
(
index
<
sizeof
(
expected_files
)
/
sizeof
(
char
*
))
{
ok
(
!
strcmp
(
expected_files
[
index
],
info
->
NameInCabinet
),
"[%d] Expected file
\"
%s
\"
, got
\"
%s
\"\n
"
,
index
,
expected_files
[
index
],
info
->
NameInCabinet
);
index
++
;
return
FILEOP_SKIP
;
}
else
{
ok
(
0
,
"Unexpectedly enumerated more than number of files in cabinet, index = %d
\n
"
,
index
);
return
FILEOP_ABORT
;
}
}
default:
return
NO_ERROR
;
}
}
static
void
test_simple_enumerationA
(
void
)
{
BOOL
ret
;
char
source
[
MAX_PATH
],
temp
[
MAX_PATH
];
int
enum_count
=
0
;
GetTempPathA
(
sizeof
(
temp
),
temp
);
GetTempFileNameA
(
temp
,
"doc"
,
0
,
source
);
create_source_fileA
(
source
,
comp_cab_zip_multi
,
sizeof
(
comp_cab_zip_multi
));
ret
=
SetupIterateCabinetA
(
source
,
0
,
simple_callbackA
,
&
enum_count
);
ok
(
ret
==
1
,
"Expected SetupIterateCabinetA to return 1, got %d
\n
"
,
ret
);
ok
(
enum_count
==
sizeof
(
expected_files
)
/
sizeof
(
char
*
),
"Unexpectedly enumerated %d files
\n
"
,
enum_count
);
DeleteFileA
(
source
);
}
START_TEST
(
setupcab
)
{
test_invalid_parametersA
();
...
...
@@ -327,4 +384,6 @@ START_TEST(setupcab)
test_invalid_callbackA
();
test_invalid_callbackW
();
}
test_simple_enumerationA
();
}
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